Search in sources :

Example 1 with IndexDefinition

use of com.thinkaurelius.titan.graphdb.types.IndexDefinition in project titan by thinkaurelius.

the class TitanKeyVertex method getIndexList.

private List<IndexDefinition> getIndexList(Class<? extends Element> type) {
    Preconditions.checkArgument(type == Vertex.class || type == Edge.class, "Expected Vertex or Edge class as argument");
    List<IndexDefinition> result = type == Vertex.class ? vertexIndexes : edgeIndexes;
    if (result == null) {
        // Build it
        ImmutableList.Builder b = new ImmutableList.Builder();
        for (IndexDefinition it : getIndexes()) if (type.isAssignableFrom(it.getElementType()))
            b.add(it);
        result = b.build();
        if (type == Vertex.class)
            vertexIndexes = result;
        else if (type == Edge.class)
            edgeIndexes = result;
    }
    return result;
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) IndexDefinition(com.thinkaurelius.titan.graphdb.types.IndexDefinition) ImmutableList(com.google.common.collect.ImmutableList) Edge(com.tinkerpop.blueprints.Edge)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 IndexDefinition (com.thinkaurelius.titan.graphdb.types.IndexDefinition)1 Edge (com.tinkerpop.blueprints.Edge)1 Vertex (com.tinkerpop.blueprints.Vertex)1