Interface IIndex
-
- All Known Implementing Classes:
DefaultIndex
public interface IIndex
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default INodeItem
get(INodeItem item, DynamicContext dynamicContext)
Retrieve the item from the index that matches the key generated by evaluating the index's default key field components against the provided item.INodeItem
get(List<String> key)
Retrieve the item from the index that matches the provided key.List<IKeyField>
getKeyFields()
Retrieve the key field components used to generate a key for this index.static boolean
isAllNulls(Iterable<String> key)
Check if a key contains information other thannull
Strings.static IIndex
newInstance(List<? extends IKeyField> keyFields)
Construct a new index using the provided key field components to generate keys.default INodeItem
put(INodeItem item, DynamicContext dynamicContext)
Store the provided item in the index using the index's key field components to generate the key.INodeItem
put(INodeItem item, List<String> key)
Store the provided item using the provided key.static List<String>
toKey(INodeItem item, List<? extends IKeyField> keyFields, DynamicContext dynamicContext)
Construct a key by evaluating the provided key field components against the provided item.
-
-
-
Method Detail
-
newInstance
@NonNull static IIndex newInstance(@NonNull List<? extends IKeyField> keyFields)
Construct a new index using the provided key field components to generate keys.- Parameters:
keyFields
- the key field components to use to generate keys by default- Returns:
- the new index
-
isAllNulls
static boolean isAllNulls(@NonNull Iterable<String> key)
Check if a key contains information other thannull
Strings.- Parameters:
key
- the key to check- Returns:
true
if the series of key values contains onlynull
values, orfalse
otherwise
-
getKeyFields
@NonNull List<IKeyField> getKeyFields()
Retrieve the key field components used to generate a key for this index.- Returns:
- the key field components
-
put
@Nullable default INodeItem put(@NonNull INodeItem item, @NonNull DynamicContext dynamicContext)
Store the provided item in the index using the index's key field components to generate the key.- Parameters:
item
- the item to store in the indexdynamicContext
- the Metapath evaluation context- Returns:
- the previous item stored in the index, or
null
otherwise
-
put
@Nullable INodeItem put(@NonNull INodeItem item, @NonNull List<String> key)
Store the provided item using the provided key.- Parameters:
item
- the item to storekey
- the key to store the item with- Returns:
- the previous item stored in the index using the key, or
null
otherwise
-
get
@Nullable default INodeItem get(@NonNull INodeItem item, @NonNull DynamicContext dynamicContext)
Retrieve the item from the index that matches the key generated by evaluating the index's default key field components against the provided item.- Parameters:
item
- the item to store in the indexdynamicContext
- the Metapath evaluation context- Returns:
- the previous item stored in the index, or
null
otherwise
-
get
INodeItem get(List<String> key)
Retrieve the item from the index that matches the provided key.- Parameters:
key
- the key to use for lookup- Returns:
- the item with the matching key or
null
if no matching item was found
-
toKey
@NonNull static List<String> toKey(@NonNull INodeItem item, @NonNull List<? extends IKeyField> keyFields, @NonNull DynamicContext dynamicContext)
Construct a key by evaluating the provided key field components against the provided item.- Parameters:
item
- the item to generate the key fromkeyFields
- the key field components used to generate the keydynamicContext
- the Metapath evaluation context- Returns:
- a new key
-
-