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

com.tinkerpop.blueprints.impls.neo4j2.batch.Neo4j2BatchEdgeIterable Maven / Gradle / Ivy

The newest version!
package com.tinkerpop.blueprints.impls.neo4j2.batch;

import com.tinkerpop.blueprints.CloseableIterable;
import com.tinkerpop.blueprints.Edge;
import org.neo4j.graphdb.index.IndexHits;

import java.util.Iterator;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
class Neo4j2BatchEdgeIterable implements CloseableIterable {

    private final IndexHits hits;
    private final Neo4j2BatchGraph graph;

    public Neo4j2BatchEdgeIterable(final Neo4j2BatchGraph graph, final IndexHits hits) {
        this.hits = hits;
        this.graph = graph;
    }

    public Iterator iterator() {
        return new Iterator() {
            private final Iterator itty = hits.iterator();

            public void remove() {
                itty.remove();
            }

            public boolean hasNext() {
                return hits.hasNext();
            }

            public Edge next() {
                return new Neo4j2BatchEdge(graph, itty.next(), null);
            }
        };
    }


    public void close() {
        hits.close();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy