public interface TraversalSideEffects extends Cloneable, Serializable
Modifier and Type | Interface and Description |
---|---|
static class |
TraversalSideEffects.Exceptions |
Modifier and Type | Field and Description |
---|---|
static String |
SIDE_EFFECTS |
Modifier and Type | Method and Description |
---|---|
TraversalSideEffects |
clone()
Cloning is used to duplicate the sideEffects typically in OLAP environments.
|
default boolean |
exists(String key)
Determines if the
TraversalSideEffects contains the respective key. |
default <V> void |
forEach(BiConsumer<String,V> biConsumer) |
<V> V |
get(String key)
Get the sideEffect associated with the provided key.
|
default <V> V |
getOrCreate(String key,
Supplier<V> orCreate)
If the sideEffect contains an object associated with the key, return it.
|
<V> Optional<Supplier<V>> |
getRegisteredSupplier(String key)
Get the registered
Supplier associated with the specified key. |
<S> Optional<Supplier<S>> |
getSackInitialValue() |
<S> Optional<UnaryOperator<S>> |
getSackSplitOperator() |
default <V> void |
ifPresent(String key,
Consumer<V> consumer)
If a value or registered
Supplier exists for the provided key, consume it with the provided consumer. |
Set<String> |
keys()
The keys of the sideEffect which includes registered
Supplier keys. |
void |
mergeInto(TraversalSideEffects sideEffects)
Add the current
TraversalSideEffects data and suppliers to the provided TraversalSideEffects . |
default <V> V |
orElse(String key,
V otherValue)
Return the value associated with the key or return the provided otherValue.
|
void |
registerSupplier(String key,
Supplier supplier)
Register a
Supplier with the provided key. |
default void |
registerSupplierIfAbsent(String key,
Supplier supplier)
A helper method to register a
Supplier if it has not already been registered. |
void |
remove(String key)
Remove both the value and registered
Supplier associated with provided key. |
void |
set(String key,
Object value)
Set the specified key to the specified value.
|
void |
setLocalVertex(Vertex vertex)
In a distributed
GraphComputer traversal, the sideEffects of the traversal are not a single object within a single JVM. |
<S> void |
setSack(Supplier<S> initialValue,
Optional<UnaryOperator<S>> splitOperator) |
static final String SIDE_EFFECTS
default boolean exists(String key)
TraversalSideEffects
contains the respective key.
If the key references a stored Supplier
, then it should return true as it will be dynamically created on get().key
- the key to check forvoid set(String key, Object value)
Supplier
is provided, it is NOT assumed to be a supplier as set by registerSupplier().key
- the keyvalue
- the value<V> V get(String key) throws IllegalArgumentException
Supplier
for that key, generate the object, store the object in the sideEffects, and return it.V
- the type of the value to retrievekey
- the key to get the value forIllegalArgumentException
- if the key does not reference an object or a registered supplier.default <V> V orElse(String key, V otherValue)
V
- the type of the value to getkey
- the key to get the value forotherValue
- if not value is associated with key, return the other value.default <V> void ifPresent(String key, Consumer<V> consumer)
Supplier
exists for the provided key, consume it with the provided consumer.V
- the type of the value to consumekey
- the key to the valueconsumer
- the consumer to process the valuevoid remove(String key)
Supplier
associated with provided key.key
- the key of the value and registered supplier to removeSet<String> keys()
Supplier
keys.
In essence, that which is possible to get().void registerSupplier(String key, Supplier supplier)
Supplier
with the provided key.
When sideEffects get() are called, if no object exists and there exists a registered supplier for the key, the object is generated.
Registered suppliers are used for the lazy generation of sideEffect data.key
- the key to register the supplier withsupplier
- the supplier that will generate an object when get() is called if it hasn't already been created<V> Optional<Supplier<V>> getRegisteredSupplier(String key)
Supplier
associated with the specified key.V
- The object type of the supplierkey
- the key associated with the supplierdefault void registerSupplierIfAbsent(String key, Supplier supplier)
Supplier
if it has not already been registered.key
- the key of the supplier to registersupplier
- the supplier to register if the key has not already been registered<S> void setSack(Supplier<S> initialValue, Optional<UnaryOperator<S>> splitOperator)
<S> Optional<UnaryOperator<S>> getSackSplitOperator()
default <V> V getOrCreate(String key, Supplier<V> orCreate)
Supplier
.V
- the return type of the objectkey
- the key of the object to getorCreate
- if the object doesn't exist as an object or suppliable object, then generate it with the specified supplierdefault <V> void forEach(BiConsumer<String,V> biConsumer)
void setLocalVertex(Vertex vertex)
GraphComputer
traversal, the sideEffects of the traversal are not a single object within a single JVM.
Instead, the sideEffects are distributed across the graph and the pieces are stored on the computing vertices.
This method is necessary to call when the Traversal
is processing the Traverser
s at a particular Vertex
.vertex
- the vertex where the traversal is currently executing.TraversalSideEffects clone()
void mergeInto(TraversalSideEffects sideEffects)
TraversalSideEffects
data and suppliers to the provided TraversalSideEffects
.sideEffects
- the sideEffects to add this traversal's sideEffect data to.Copyright © 2013–2015 Apache Software Foundation. All rights reserved.