Class SerializedState.Frame

java.lang.Object
com.offbynull.coroutines.user.SerializedState.Frame
All Implemented Interfaces:
Serializable
Enclosing class:
SerializedState

public static final class SerializedState.Frame extends Object implements Serializable
MethodState's and LockState's state translated for serialization.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • className

      private final String className
    • methodId

      private final int methodId
    • continuationPointId

      private final int continuationPointId
    • monitors

      private final Object[] monitors
    • variables

      private final SerializedState.Data variables
    • operands

      private final SerializedState.Data operands
  • Constructor Details

  • Method Details

    • getClassName

      public String getClassName()
      Get class name.
      Returns:
      class name
    • getMethodId

      public int getMethodId()
      Get method ID.
      Returns:
      method ID
    • getContinuationPointId

      public int getContinuationPointId()
      Get continuation point id.
      Returns:
      continuation point id
    • getMonitors

      public Object[] getMonitors()
      Get monitor locks.
      Returns:
      monitor locks
    • getVariables

      public SerializedState.Data getVariables()
      Get variables.
      Returns:
      variables
    • getOperands

      public SerializedState.Data getOperands()
      Get operands.
      Returns:
      operands
    • withVariables

      public SerializedState.Frame withVariables(int[] ints, float[] floats, long[] longs, double[] doubles, Object[] objects, int[] continuationIndexes)
      Helper to copy this frame but with potentially new variables.
      Parameters:
      ints - new ints (or null if should be kept the same)
      floats - new floats (or null if should be kept the same)
      longs - new longs (or null if should be kept the same)
      doubles - new doubles (or null if should be kept the same)
      objects - new objects (or null if should be kept the same)
      continuationIndexes - new continuation indexes (or null if should be kept the same)
      Returns:
      new frame
      Throws:
      IllegalArgumentException - if continuationIndexes points to out of bounds indexes within objects or if if continuationIndexes points to non-null indexes within objects
    • withIntVariables

      public SerializedState.Frame withIntVariables(int[] ints)
      Helper to copy this frame but with new int variables.
      Parameters:
      ints - new ints
      Returns:
      new frame
      Throws:
      NullPointerException - if any argument is null
    • withFloatVariables

      public SerializedState.Frame withFloatVariables(float[] floats)
      Helper to copy this frame but with new float variables.
      Parameters:
      floats - new floats
      Returns:
      new frame
      Throws:
      NullPointerException - if any argument is null
    • withLongVariables

      public SerializedState.Frame withLongVariables(long[] longs)
      Helper to copy this frame but with new long variables.
      Parameters:
      longs - new longs
      Returns:
      new frame
      Throws:
      NullPointerException - if any argument is null
    • withDoubleVariables

      public SerializedState.Frame withDoubleVariables(double[] doubles)
      Helper to copy this frame but with new double variables.
      Parameters:
      doubles - new doubles
      Returns:
      new frame
      Throws:
      NullPointerException - if any argument is null
    • withObjectVariables

      public SerializedState.Frame withObjectVariables(Object[] objects)
      Helper to copy this frame but with new object variables.
      Parameters:
      objects - new objects
      Returns:
      new frame
      Throws:
      NullPointerException - if any argument is null
    • withContinuationIndexVariables

      public SerializedState.Frame withContinuationIndexVariables(int[] continuationIndexes)
      Helper to copy this frame but with new variable continuation indexes.
      Parameters:
      continuationIndexes - new continuation indexes
      Returns:
      new frame
      Throws:
      NullPointerException - if any argument is null
      IllegalArgumentException - if continuationIndexes points to out of bounds indexes within objects or if if continuationIndexes points to non-null indexes within objects
    • withOperands

      public SerializedState.Frame withOperands(int[] ints, float[] floats, long[] longs, double[] doubles, Object[] objects, int[] continuationIndexes)
      Helper to copy this frame but with potentially new operands.
      Parameters:
      ints - new ints (or null if should be kept the same)
      floats - new floats (or null if should be kept the same)
      longs - new longs (or null if should be kept the same)
      doubles - new doubles (or null if should be kept the same)
      objects - new objects (or null if should be kept the same)
      continuationIndexes - new continuation indexes (or null if should be kept the same)
      Returns:
      new frame
      Throws:
      IllegalArgumentException - if continuationIndexes points to out of bounds indexes within objects or if if continuationIndexes points to non-null indexes within objects
    • withIntOperands

      public SerializedState.Frame withIntOperands(int[] ints)
      Helper to copy this frame but with new int operands.
      Parameters:
      ints - new ints
      Returns:
      new frame
      Throws:
      NullPointerException - if any argument is null
    • withFloatOperands

      public SerializedState.Frame withFloatOperands(float[] floats)
      Helper to copy this frame but with new float operands.
      Parameters:
      floats - new floats
      Returns:
      new frame
      Throws:
      NullPointerException - if any argument is null
    • withLongOperands

      public SerializedState.Frame withLongOperands(long[] longs)
      Helper to copy this frame but with new long operands.
      Parameters:
      longs - new longs
      Returns:
      new frame
      Throws:
      NullPointerException - if any argument is null
    • withDoubleOperands

      public SerializedState.Frame withDoubleOperands(double[] doubles)
      Helper to copy this frame but with new double operands.
      Parameters:
      doubles - new doubles
      Returns:
      new frame
      Throws:
      NullPointerException - if any argument is null
    • withObjectOperands

      public SerializedState.Frame withObjectOperands(Object[] objects)
      Helper to copy this frame but with new object operands.
      Parameters:
      objects - new objects
      Returns:
      new frame
      Throws:
      NullPointerException - if any argument is null
    • withContinuationIndexOperands

      public SerializedState.Frame withContinuationIndexOperands(int[] continuationIndexes)
      Helper to copy this frame but with new variable continuation indexes.
      Parameters:
      continuationIndexes - new continuation indexes
      Returns:
      new frame
      Throws:
      NullPointerException - if any argument is null
      IllegalArgumentException - if continuationIndexes points to out of bounds indexes within objects or if if continuationIndexes points to non-null indexes within objects
    • withKey

      public SerializedState.Frame withKey(String className, Integer methodId, Integer continuationPointId)
      Helper to copy this frame but with a potentially new new class name / method ID / continuation point ID.
      Parameters:
      className - new class name (or null if should be kept the same)
      methodId - new method ID (or null if should be kept the same)
      continuationPointId - new continuation point ID (or null if should be kept the same)
      Returns:
      new frame
      Throws:
      IllegalArgumentException - if continuationPointId < 0
    • withClassname

      public SerializedState.Frame withClassname(String className)
      Helper to copy this frame but with a new method ID.
      Parameters:
      className - new class name
      Returns:
      new frame
      Throws:
      NullPointerException - if any argument is null
    • withMethodId

      public SerializedState.Frame withMethodId(int methodId)
      Helper to copy this frame but with a new method ID.
      Parameters:
      methodId - new method ID
      Returns:
      new frame
    • withContinuationPointId

      public SerializedState.Frame withContinuationPointId(int continuationPointId)
      Helper to copy this frame but with a new continuation point ID.
      Parameters:
      continuationPointId - new continuation point ID
      Returns:
      new frame
      Throws:
      IllegalArgumentException - if continuationPointId < 0
    • validateState

      void validateState()