Class EmptyMemory
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.process.computer.util.EmptyMemory
-
- All Implemented Interfaces:
Memory
,Memory.Admin
public final class EmptyMemory extends Object implements Memory.Admin
- Author:
- Marko A. Rodriguez (http://markorodriguez.com)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.computer.Memory
Memory.Admin, Memory.Exceptions
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(String key, Object value)
Set the value of the provided key.Memory
asImmutable()
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 theGraphComputer
has been executing thus far.static EmptyMemory
instance()
Set<String>
keys()
The set of keys currently associated with this memory.void
set(String key, Object value)
void
setIteration(int iteration)
void
setRuntime(long runtime)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.tinkerpop.gremlin.process.computer.Memory
asMap, isInitialIteration
-
Methods inherited from interface org.apache.tinkerpop.gremlin.process.computer.Memory.Admin
incrIteration
-
-
-
-
Method Detail
-
instance
public static EmptyMemory instance()
-
setIteration
public void setIteration(int iteration)
- Specified by:
setIteration
in interfaceMemory.Admin
-
setRuntime
public void setRuntime(long runtime)
- Specified by:
setRuntime
in interfaceMemory.Admin
-
asImmutable
public Memory asImmutable()
- Specified by:
asImmutable
in interfaceMemory.Admin
-
keys
public Set<String> keys()
Description copied from interface:Memory
The set of keys currently associated with this memory.
-
get
public <R> R get(String key) throws IllegalArgumentException
Description copied from interface:Memory
Get the value associated with the provided key.- Specified by:
get
in interfaceMemory
- Type Parameters:
R
- the type of the value- Parameters:
key
- the key of the value- Returns:
- the value
- Throws:
IllegalArgumentException
- is thrown if the key does not exist
-
set
public void set(String key, Object value) throws IllegalArgumentException, IllegalStateException
- Specified by:
set
in interfaceMemory
- Throws:
IllegalArgumentException
IllegalStateException
-
add
public void add(String key, Object value) throws IllegalArgumentException, IllegalStateException
Description copied from interface:Memory
Set the value of the provided key. This is typically called in setup() and/or terminate() of theVertexProgram
. If this is called during execute(), there is no guarantee as to the ultimately stored value as call order is indeterminate. It is up to the implementation to determine the states in which this method can be called.- Specified by:
add
in interfaceMemory
- Parameters:
key
- they key to set a value forvalue
- the value to set for the key- Throws:
IllegalArgumentException
IllegalStateException
-
getIteration
public int getIteration()
Description copied from interface:Memory
Get the current iteration number.- Specified by:
getIteration
in interfaceMemory
- Returns:
- the current iteration
-
getRuntime
public long getRuntime()
Description copied from interface:Memory
Get the amount of milliseconds theGraphComputer
has been executing thus far.- Specified by:
getRuntime
in interfaceMemory
- Returns:
- the total time in milliseconds
-
-