Package com.offbynull.coroutines.user
Class SerializedState.Frame
java.lang.Object
com.offbynull.coroutines.user.SerializedState.Frame
- All Implemented Interfaces:
Serializable
- Enclosing class:
SerializedState
MethodState
's and LockState
's state translated for serialization.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
private final int
private final int
private final Object[]
private final SerializedState.Data
private static final long
private final SerializedState.Data
-
Constructor Summary
ConstructorsConstructorDescriptionFrame
(String className, int methodId, int continuationPointId, Object[] monitors, SerializedState.Data variables, SerializedState.Data operands) Constructs aSerializedState.Frame
object. -
Method Summary
Modifier and TypeMethodDescriptionGet class name.int
Get continuation point id.int
Get method ID.Object[]
Get monitor locks.Get operands.Get variables.(package private) void
withClassname
(String className) Helper to copy this frame but with a new method ID.withContinuationIndexOperands
(int[] continuationIndexes) Helper to copy this frame but with new variable continuation indexes.withContinuationIndexVariables
(int[] continuationIndexes) Helper to copy this frame but with new variable continuation indexes.withContinuationPointId
(int continuationPointId) Helper to copy this frame but with a new continuation point ID.withDoubleOperands
(double[] doubles) Helper to copy this frame but with new double operands.withDoubleVariables
(double[] doubles) Helper to copy this frame but with new double variables.withFloatOperands
(float[] floats) Helper to copy this frame but with new float operands.withFloatVariables
(float[] floats) Helper to copy this frame but with new float variables.withIntOperands
(int[] ints) Helper to copy this frame but with new int operands.withIntVariables
(int[] ints) Helper to copy this frame but with new int variables.Helper to copy this frame but with a potentially new new class name / method ID / continuation point ID.withLongOperands
(long[] longs) Helper to copy this frame but with new long operands.withLongVariables
(long[] longs) Helper to copy this frame but with new long variables.withMethodId
(int methodId) Helper to copy this frame but with a new method ID.withObjectOperands
(Object[] objects) Helper to copy this frame but with new object operands.withObjectVariables
(Object[] objects) Helper to copy this frame but with new object variables.withOperands
(int[] ints, float[] floats, long[] longs, double[] doubles, Object[] objects, int[] continuationIndexes) Helper to copy this frame but with potentially new operands.withVariables
(int[] ints, float[] floats, long[] longs, double[] doubles, Object[] objects, int[] continuationIndexes) Helper to copy this frame but with potentially new variables.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
className
-
methodId
private final int methodId -
continuationPointId
private final int continuationPointId -
monitors
-
variables
-
operands
-
-
Constructor Details
-
Frame
public Frame(String className, int methodId, int continuationPointId, Object[] monitors, SerializedState.Data variables, SerializedState.Data operands) Constructs aSerializedState.Frame
object.- Parameters:
className
- class namemethodId
- method idcontinuationPointId
- continuation point idmonitors
- monitor locksvariables
- lock variable table valuesoperands
- operand stack values- Throws:
NullPointerException
- if any argument isnull
IllegalArgumentException
- if any elements inmonitors
arenull
or if eithervariables
oroperands
are in an invalid state
-
-
Method Details
-
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
Get monitor locks.- Returns:
- monitor locks
-
getVariables
Get variables.- Returns:
- variables
-
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 (ornull
if should be kept the same)floats
- new floats (ornull
if should be kept the same)longs
- new longs (ornull
if should be kept the same)doubles
- new doubles (ornull
if should be kept the same)objects
- new objects (ornull
if should be kept the same)continuationIndexes
- new continuation indexes (ornull
if should be kept the same)- Returns:
- new frame
- Throws:
IllegalArgumentException
- ifcontinuationIndexes
points to out of bounds indexes withinobjects
or if ifcontinuationIndexes
points to non-null indexes withinobjects
-
withIntVariables
Helper to copy this frame but with new int variables.- Parameters:
ints
- new ints- Returns:
- new frame
- Throws:
NullPointerException
- if any argument isnull
-
withFloatVariables
Helper to copy this frame but with new float variables.- Parameters:
floats
- new floats- Returns:
- new frame
- Throws:
NullPointerException
- if any argument isnull
-
withLongVariables
Helper to copy this frame but with new long variables.- Parameters:
longs
- new longs- Returns:
- new frame
- Throws:
NullPointerException
- if any argument isnull
-
withDoubleVariables
Helper to copy this frame but with new double variables.- Parameters:
doubles
- new doubles- Returns:
- new frame
- Throws:
NullPointerException
- if any argument isnull
-
withObjectVariables
Helper to copy this frame but with new object variables.- Parameters:
objects
- new objects- Returns:
- new frame
- Throws:
NullPointerException
- if any argument isnull
-
withContinuationIndexVariables
Helper to copy this frame but with new variable continuation indexes.- Parameters:
continuationIndexes
- new continuation indexes- Returns:
- new frame
- Throws:
NullPointerException
- if any argument isnull
IllegalArgumentException
- ifcontinuationIndexes
points to out of bounds indexes withinobjects
or if ifcontinuationIndexes
points to non-null indexes withinobjects
-
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 (ornull
if should be kept the same)floats
- new floats (ornull
if should be kept the same)longs
- new longs (ornull
if should be kept the same)doubles
- new doubles (ornull
if should be kept the same)objects
- new objects (ornull
if should be kept the same)continuationIndexes
- new continuation indexes (ornull
if should be kept the same)- Returns:
- new frame
- Throws:
IllegalArgumentException
- ifcontinuationIndexes
points to out of bounds indexes withinobjects
or if ifcontinuationIndexes
points to non-null indexes withinobjects
-
withIntOperands
Helper to copy this frame but with new int operands.- Parameters:
ints
- new ints- Returns:
- new frame
- Throws:
NullPointerException
- if any argument isnull
-
withFloatOperands
Helper to copy this frame but with new float operands.- Parameters:
floats
- new floats- Returns:
- new frame
- Throws:
NullPointerException
- if any argument isnull
-
withLongOperands
Helper to copy this frame but with new long operands.- Parameters:
longs
- new longs- Returns:
- new frame
- Throws:
NullPointerException
- if any argument isnull
-
withDoubleOperands
Helper to copy this frame but with new double operands.- Parameters:
doubles
- new doubles- Returns:
- new frame
- Throws:
NullPointerException
- if any argument isnull
-
withObjectOperands
Helper to copy this frame but with new object operands.- Parameters:
objects
- new objects- Returns:
- new frame
- Throws:
NullPointerException
- if any argument isnull
-
withContinuationIndexOperands
Helper to copy this frame but with new variable continuation indexes.- Parameters:
continuationIndexes
- new continuation indexes- Returns:
- new frame
- Throws:
NullPointerException
- if any argument isnull
IllegalArgumentException
- ifcontinuationIndexes
points to out of bounds indexes withinobjects
or if ifcontinuationIndexes
points to non-null indexes withinobjects
-
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 (ornull
if should be kept the same)methodId
- new method ID (ornull
if should be kept the same)continuationPointId
- new continuation point ID (ornull
if should be kept the same)- Returns:
- new frame
- Throws:
IllegalArgumentException
- ifcontinuationPointId < 0
-
withClassname
Helper to copy this frame but with a new method ID.- Parameters:
className
- new class name- Returns:
- new frame
- Throws:
NullPointerException
- if any argument isnull
-
withMethodId
Helper to copy this frame but with a new method ID.- Parameters:
methodId
- new method ID- Returns:
- new frame
-
withContinuationPointId
Helper to copy this frame but with a new continuation point ID.- Parameters:
continuationPointId
- new continuation point ID- Returns:
- new frame
- Throws:
IllegalArgumentException
- ifcontinuationPointId < 0
-
validateState
void validateState()
-