Class ProposerContext

Object
ProposerContext

public final class ProposerContext extends Object
Context for proposing operations in the MPP framework.

This class encapsulates various components needed for proposing operations, including random number generation, energy stack, region map, and error handling.

  • Constructor Details

    • ProposerContext

      public ProposerContext(RandomNumberGenerator randomNumberGenerator, EnergyStack energyStack, RegionMap regionMap, OperationContext operationContext, ErrorNode errorNode)
      Creates a new ProposerContext instance.
      Parameters:
      randomNumberGenerator - Random number generator for sampling operations.
      energyStack - Energy stack for the current context.
      regionMap - Region map for the current context.
      operationContext - Operation context for the current operation.
      errorNode - Error node for tracking and managing errors.
  • Method Details

    • replaceError

      public ProposerContext replaceError(ErrorNode errorNode)
      Creates a new ProposerContext with a replaced error node.
      Parameters:
      errorNode - The new error node to use
      Returns:
      A new ProposerContext with the updated error node
    • addErrorLevel

      public ProposerContext addErrorLevel(String errorMessage)
      Creates a new ProposerContext with an additional error level.
      Parameters:
      errorMessage - The error message to add
      Returns:
      A new ProposerContext with the added error level
    • sampleInteger

      public int sampleInteger(int maxValExclusive)
      Samples an integer uniformly between [0..maxValExclusive).
      Parameters:
      maxValExclusive - The exclusive upper bound for the sampled integer
      Returns:
      A randomly sampled integer
    • dimensions

      public Dimensions dimensions()
      Gets the dimensions of the energy stack.
      Returns:
      The dimensions of the energy stack
    • create

      public VoxelizedMarkMemo create(Mark mark)
      Creates a VoxelizedMarkMemo for the given mark.
      Parameters:
      mark - The mark to create a VoxelizedMarkMemo for
      Returns:
      A new VoxelizedMarkMemo
    • getRandomNumberGenerator

      public RandomNumberGenerator getRandomNumberGenerator()
      Random number generator for sampling operations.
    • getEnergyStack

      public EnergyStack getEnergyStack()
      Energy stack for the current context.
    • getRegionMap

      public RegionMap getRegionMap()
      Region map for the current context.
    • getOperationContext

      public OperationContext getOperationContext()
      Operation context for the current operation.
    • getErrorNode

      public ErrorNode getErrorNode()
      Error node for tracking and managing errors.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object