Interface Memory

  • All Known Subinterfaces:
    Memory.Admin
    All Known Implementing Classes:
    EmptyMemory, ImmutableMemory, MapMemory, TinkerMemory, TinkerWorkerMemory

    public interface Memory
    The Memory of a 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.
    Author:
    Marko A. Rodriguez (http://markorodriguez.com)
    • Method Detail

      • exists

        default boolean exists​(String key)
        Whether the key exists in the memory.
        Parameters:
        key - key to search the memory for.
        Returns:
        whether the key exists
      • keys

        Set<String> keys()
        The set of keys currently associated with this memory.
        Returns:
        the memory's key set.
      • get

        <R> R get​(String key)
           throws IllegalArgumentException
        Get the value associated with the provided key.
        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
      • asMap

        default Map<String,​Object> asMap()
        A helper method that generates a Map of the memory key/values.
        Returns:
        the map representation of the memory key/values
      • getIteration

        int getIteration()
        Get the current iteration number.
        Returns:
        the current iteration
      • getRuntime

        long getRuntime()
        Get the amount of milliseconds the GraphComputer has been executing thus far.
        Returns:
        the total time in milliseconds
      • isInitialIteration

        default boolean isInitialIteration()
        A helper method that states whether the current iteration is 0.
        Returns:
        whether this is the first iteration