Class InMemoryEvaluationStore

All Implemented Interfaces:
Closeable, AutoCloseable, CommandReceivingComponent, Component, ExpectedResponseReceivingComponent, PlatformConnector, ResponseReceivingComponent

public class InMemoryEvaluationStore extends AbstractEvaluationStorage
Simple in-memory implementation of an evaluation storage that can be used for testing purposes.
Author:
Michael Röder (roeder@informatik.uni-leipzig.de)
  • Field Details

    • results

      private Map<String,ResultPair> results
      Map containing a mapping from task Ids to result pairs.
  • Constructor Details

    • InMemoryEvaluationStore

      public InMemoryEvaluationStore()
      Constructor.
    • InMemoryEvaluationStore

      public InMemoryEvaluationStore(HobbitConfiguration configuration)
      Constructor to assign configuration object.
  • Method Details

    • receiveResponseData

      public void receiveResponseData(String taskId, long timestamp, byte[] data)
      Description copied from interface: ResponseReceivingComponent
      This method is called if a response is received from the system.
      Parameters:
      taskId - the id of the task
      timestamp - the time at which the response has been received from the system
      data - the data received from a data generator
    • receiveExpectedResponseData

      public void receiveExpectedResponseData(String taskId, long timestamp, byte[] data)
      Description copied from interface: ExpectedResponseReceivingComponent
      This method is called if an expected response is received from a task generator component.
      Parameters:
      taskId - the id of the task
      timestamp - the time at which the task has been sent to the system
      data - the data received from a task generator
    • putResult

      public void putResult(boolean isExpectedResult, String taskId, long timestamp, byte[] data)
      Adds the given result to the map of results.
      Parameters:
      isExpectedResult - true if the result has been received from a task generator, i.e., is the expected result for a task
      taskId - id of the task
      timestamp - time stamp for the task result
      data - the result
    • createIterator

      protected Iterator<ResultPair> createIterator()
      Description copied from class: AbstractEvaluationStorage
      Creates a new iterator that iterates over the response pairs.
      Specified by:
      createIterator in class AbstractEvaluationStorage
      Returns:
      a new iterator or null if an error occurred