Class CommandResult

java.lang.Object
org.sensorhub.api.command.CommandResult
All Implemented Interfaces:
ICommandResult

public class CommandResult extends Object implements ICommandResult

Immutable class used to describe the result of a command

  • Field Details

  • Constructor Details

    • CommandResult

      protected CommandResult()
  • Method Details

    • withEntireDatastream

      public static ICommandResult withEntireDatastream(BigId dataStreamID)
      Declare an entire datastream as result
      Parameters:
      dataStreamID - The ID of the datastream that contains the result
      Returns:
      The result object
    • withObsInDatastream

      public static ICommandResult withObsInDatastream(BigId dataStreamID, Collection<BigId> obsIDs)
      Declare certain obs from an existing datastream as result
      Parameters:
      dataStreamID - The ID of the datastream that contains the result
      obsIDs - IDs of observations that constitute the result
      Returns:
      The result object
    • withObs

      public static ICommandResult withObs(Collection<IObsData> obsList)
      Add observations to a command result
      Parameters:
      obsList - List of observations to be added to the datastream of the result
      Returns:
      The result object
    • withSingleObs

      public static ICommandResult withSingleObs(IObsData obs)
      Add observations to a command result
      Parameters:
      obs - A single observation to return as the result
      Returns:
      The result object
    • withData

      public static ICommandResult withData(DataBlock data)
      Add data to a command result
      Parameters:
      data - A single observation result to return as the command result
      Returns:
      The result object
    • getObservations

      public Collection<IObsData> getObservations()
      Specified by:
      getObservations in interface ICommandResult
      Returns:
      inline result data, as a list of observations matching the result schema defined by ICommandStreamInfo
    • getObservationRefs

      public Collection<BigId> getObservationRefs()
      Specified by:
      getObservationRefs in interface ICommandResult
      Returns:
      reference to observations (when not provided inline) generated during the execution of the command and added to one or more existing datastream(s).
    • getDataStreamID

      public BigId getDataStreamID()
      Specified by:
      getDataStreamID in interface ICommandResult
      Returns:
      reference to an entire datastream that contains one or more observations (but usually many) generated during the execution of the command.
    • toString

      public String toString()
      Overrides:
      toString in class Object