All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tinkerpop.blueprints.util.wrappers.WrapperVertexQuery Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
package com.tinkerpop.blueprints.util.wrappers;

import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.VertexQuery;
import com.tinkerpop.blueprints.Vertex;

/**
 * A WrapperQuery is useful for wrapping the construction and results of a Vertex.query().
 * Any necessary Iterable wrapping must occur when Vertex.vertices() or Vertex.edges() is called.
 *
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
public abstract class WrapperVertexQuery implements VertexQuery {

    protected VertexQuery query;

    public WrapperVertexQuery(final VertexQuery query) {
        this.query = query;
    }

    public VertexQuery has(final String key, final Object value) {
        this.query = this.query.has(key, value);
        return this;
    }

    public > VertexQuery has(final String key, final T value, final Compare compare) {
        this.query = this.query.has(key, value, compare);
        return this;
    }

    public > VertexQuery interval(final String key, final T startValue, final T endValue) {
        this.query = this.query.interval(key, startValue, endValue);
        return this;
    }

    public VertexQuery direction(final Direction direction) {
        this.query = this.query.direction(direction);
        return this;
    }

    public VertexQuery limit(final long limit) {
        this.query = this.query.limit(limit);
        return this;
    }

    public VertexQuery labels(final String... labels) {
        this.query = this.query.labels(labels);
        return this;
    }

    public long count() {
        return this.query.count();
    }

    public Object vertexIds() {
        return this.query.vertexIds();
    }

    public abstract Iterable edges();

    public abstract Iterable vertices();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy