Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.tinkerpop.blueprints.impls.neo4j2.batch;
 
 

Author(s):
Marko A. Rodriguez (http://markorodriguez.com)
class Neo4j2BatchIndex<T extends Elementimplements Index<T> {
    private final Neo4j2BatchGraph graph;
    protected final BatchInserterIndex rawIndex;
    private final String name;
    private final Class<T> indexClass;
    public Neo4j2BatchIndex(final Neo4j2BatchGraph graphfinal BatchInserterIndex indexfinal String namefinal Class<T> indexClass) {
        this. = graph;
        this. = index;
        this. = name;
        this. = indexClass;
    }
    public void put(final String keyfinal Object valuefinal T element) {
        final Map<StringObjectmap = new HashMap<StringObject>();
        map.put(keyvalue);
        this..add((Longelement.getId(), map);
    }
    public CloseableIterable<T> get(final String keyfinal Object value) {
        if (Vertex.class.isAssignableFrom(this.))
            return (CloseableIterable<T>) new Neo4j2BatchVertexIterable(this.this..get(keyvalue));
        else
            return (CloseableIterable<T>) new Neo4j2BatchEdgeIterable(this.this..get(keyvalue));
    }
    public CloseableIterable<T> query(final String keyfinal Object query) {
        if (Vertex.class.isAssignableFrom(this.))
            return (CloseableIterable<T>) new Neo4j2BatchVertexIterable(this.this..query(keyquery));
        else
            return (CloseableIterable<T>) new Neo4j2BatchEdgeIterable(this.this..query(keyquery));
    }
    public long count(final String keyfinal Object value) {
        long count = 0;
        for (final T t : this.get(keyvalue)) {
            count++;
        }
        return count;
    }

    
    public void remove(final String keyfinal Object valuefinal T elementthrows UnsupportedOperationException {
    }
    public Class<T> getIndexClass() {
        return this.;
    }
    public String getIndexName() {
        return this.;
    }

    
This is required before querying the index for data. This method is not a standard Index API method and thus, be sure to typecast the index to Neo4j2BatchIndex.
    public void flush() {
        this..flush();
    }
    public String toString() {
        return StringFactory.indexString(this);
    }
New to GrepCode? Check out our FAQ X