Skip to content

Instantly share code, notes, and snippets.

Created May 14, 2012
What would you like to do?
package com.tinkerpop.gremlin.pipes.filter;
import com.tinkerpop.blueprints.Element;
import com.tinkerpop.pipes.AbstractPipe;
import com.tinkerpop.pipes.filter.FilterPipe;
import com.tinkerpop.pipes.util.PipeHelper;
* @author Marko A. Rodriguez (
public class IntervalFilterPipe<T extends Element> extends AbstractPipe<T, T> implements FilterPipe<T> {
private final String key;
private final Object startValue;
private final Object endValue;
public IntervalFilterPipe(final String key, final Object startValue, final Object endValue) {
this.key = key;
this.startValue = startValue;
this.endValue = endValue;
public T processNextStart() {
while (true) {
final T t =;
final Object value = t.getProperty(key);
if (null == value)
else {
if (PipeHelper.compareObjects(Filter.GREATER_THAN, value, this.startValue) && PipeHelper.compareObjects(Filter.LESS_THAN_EQUAL, value, this.endValue))
return t;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment