public interface Memory
GraphComputer
is a global data structure where by vertices can communicate information with one another.
Moreover, it also contains global information about the state of the computation such as runtime and the current iteration.
The Memory data is logically updated in parallel using associative/commutative methods which have embarrassingly parallel implementations.Modifier and Type | Interface and Description |
---|---|
static interface |
Memory.Admin
The Admin interface is used by the
GraphComputer to update the Memory. |
static class |
Memory.Exceptions |
Modifier and Type | Method and Description |
---|---|
void |
and(String key,
boolean bool)
Logically AND the provided boolean value with the boolean value currently stored at the key.
|
default Map<String,Object> |
asMap()
A helper method that generates a
Map of the memory key/values. |
default boolean |
exists(String key)
Whether the key exists in the memory.
|
<R> R |
get(String key)
Get the value associated with the provided key.
|
int |
getIteration()
Get the current iteration number.
|
long |
getRuntime()
Get the amount of milliseconds the
GraphComputer has been executing thus far. |
void |
incr(String key,
long delta)
Add the provided delta value to the long value currently stored at the key.
|
default boolean |
isInitialIteration()
A helper method that states whether the current iteration is 0.
|
Set<String> |
keys()
The set of keys currently associated with this memory.
|
void |
or(String key,
boolean bool)
Logically OR the provided boolean value with the boolean value currently stored at the key.
|
void |
set(String key,
Object value)
Set the value of the provided key.
|
default boolean exists(String key)
key
- key to search the memory for.Set<String> keys()
<R> R get(String key) throws IllegalArgumentException
R
- the type of the valuekey
- the key of the valueIllegalArgumentException
- is thrown if the key does not existvoid set(String key, Object value)
VertexProgram
.
If this is called during execute(), there is no guarantee as to the ultimately stored value as call order is indeterminate.key
- they key to set a value forvalue
- the value to set for the keydefault Map<String,Object> asMap()
Map
of the memory key/values.int getIteration()
long getRuntime()
GraphComputer
has been executing thus far.void incr(String key, long delta)
key
- the key of the long valuedelta
- the adjusting amount (can be negative for decrement)void and(String key, boolean bool)
key
- the key of the boolean valuebool
- the boolean to ANDvoid or(String key, boolean bool)
key
- the key of the boolean valuebool
- the boolean to ORdefault boolean isInitialIteration()
Copyright © 2013–2016 Apache Software Foundation. All rights reserved.