Class AbstractTinkerIndex<T extends Element>
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.tinkergraph.structure.AbstractTinkerIndex<T>
-
- Type Parameters:
T
- type ofElement
to be indexed
public abstract class AbstractTinkerIndex<T extends Element> extends Object
Storage for indexes that can be used by different implementations ofAbstractTinkerGraph
.- Author:
- Valentyn Kahamlyk
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractTinkerIndex.IndexedNull
-
Field Summary
Fields Modifier and Type Field Description protected AbstractTinkerGraph
graph
protected Class<T>
indexClass
protected Set<String>
indexedKeys
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractTinkerIndex(AbstractTinkerGraph graph, Class<T> indexClass)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
autoUpdate(String key, Object newValue, Object oldValue, T element)
Update index for single property of element.abstract long
count(String key, Object value)
Get count of elements which have a property with the desired value.abstract void
createKeyIndex(String key)
Create new indexabstract void
dropKeyIndex(String key)
Drop indexabstract List<T>
get(String key, Object value)
Get list of elements which have a property with the desired value.Set<String>
getIndexedKeys()
Get all index keys for Graphstatic Object
indexable(Object obj)
Provides a way for an index to have anull
value asConcurrentHashMap
will not allow anull
key.abstract void
remove(String key, Object value, T element)
Remove elements with some property from index.abstract void
removeElement(T element)
Remove elements from all indexes.
-
-
-
Constructor Detail
-
AbstractTinkerIndex
protected AbstractTinkerIndex(AbstractTinkerGraph graph, Class<T> indexClass)
-
-
Method Detail
-
get
public abstract List<T> get(String key, Object value)
Get list of elements which have a property with the desired value.- Parameters:
key
- property keyvalue
- property value- Returns:
- list of elements
-
count
public abstract long count(String key, Object value)
Get count of elements which have a property with the desired value.- Parameters:
key
- property keyvalue
- property value- Returns:
- count of elements
-
remove
public abstract void remove(String key, Object value, T element)
Remove elements with some property from index. Convenient to use when removed only one property of an element.- Parameters:
key
- property keyvalue
- property valueelement
- changed element
-
removeElement
public abstract void removeElement(T element)
Remove elements from all indexes. Can be used when element was deleted or has changed more than 1 property.- Parameters:
element
- changed element
-
autoUpdate
public abstract void autoUpdate(String key, Object newValue, Object oldValue, T element)
Update index for single property of element.- Parameters:
key
- property keynewValue
- updated value of propertyoldValue
- optional value of property before updateelement
- changed element
-
createKeyIndex
public abstract void createKeyIndex(String key)
Create new index- Parameters:
key
- property key
-
dropKeyIndex
public abstract void dropKeyIndex(String key)
Drop index- Parameters:
key
- property key
-
getIndexedKeys
public Set<String> getIndexedKeys()
Get all index keys for Graph- Returns:
- set of index keys
-
-