Package com.offbynull.coroutines.user
Class SerializedState.Frame
- java.lang.Object
-
- com.offbynull.coroutines.user.SerializedState.Frame
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- SerializedState
public static final class SerializedState.Frame extends java.lang.Object implements java.io.Serializable
MethodState
's andLockState
's state translated for serialization.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
className
private int
continuationPointId
private int
methodId
private java.lang.Object[]
monitors
private SerializedState.Data
operands
private static long
serialVersionUID
private SerializedState.Data
variables
-
Constructor Summary
Constructors Constructor Description Frame(java.lang.String className, int methodId, int continuationPointId, java.lang.Object[] monitors, SerializedState.Data variables, SerializedState.Data operands)
Constructs aSerializedState.Frame
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getClassName()
Get class name.int
getContinuationPointId()
Get continuation point id.int
getMethodId()
Get method ID.java.lang.Object[]
getMonitors()
Get monitor locks.SerializedState.Data
getOperands()
Get operands.SerializedState.Data
getVariables()
Get variables.(package private) void
validateState()
SerializedState.Frame
withClassname(java.lang.String className)
Helper to copy this frame but with a new method ID.SerializedState.Frame
withContinuationIndexOperands(int[] continuationIndexes)
Helper to copy this frame but with new variable continuation indexes.SerializedState.Frame
withContinuationIndexVariables(int[] continuationIndexes)
Helper to copy this frame but with new variable continuation indexes.SerializedState.Frame
withContinuationPointId(int continuationPointId)
Helper to copy this frame but with a new continuation point ID.SerializedState.Frame
withDoubleOperands(double[] doubles)
Helper to copy this frame but with new double operands.SerializedState.Frame
withDoubleVariables(double[] doubles)
Helper to copy this frame but with new double variables.SerializedState.Frame
withFloatOperands(float[] floats)
Helper to copy this frame but with new float operands.SerializedState.Frame
withFloatVariables(float[] floats)
Helper to copy this frame but with new float variables.SerializedState.Frame
withIntOperands(int[] ints)
Helper to copy this frame but with new int operands.SerializedState.Frame
withIntVariables(int[] ints)
Helper to copy this frame but with new int variables.SerializedState.Frame
withKey(java.lang.String className, java.lang.Integer methodId, java.lang.Integer continuationPointId)
Helper to copy this frame but with a potentially new new class name / method ID / continuation point ID.SerializedState.Frame
withLongOperands(long[] longs)
Helper to copy this frame but with new long operands.SerializedState.Frame
withLongVariables(long[] longs)
Helper to copy this frame but with new long variables.SerializedState.Frame
withMethodId(int methodId)
Helper to copy this frame but with a new method ID.SerializedState.Frame
withObjectOperands(java.lang.Object[] objects)
Helper to copy this frame but with new object operands.SerializedState.Frame
withObjectVariables(java.lang.Object[] objects)
Helper to copy this frame but with new object variables.SerializedState.Frame
withOperands(int[] ints, float[] floats, long[] longs, double[] doubles, java.lang.Object[] objects, int[] continuationIndexes)
Helper to copy this frame but with potentially new operands.SerializedState.Frame
withVariables(int[] ints, float[] floats, long[] longs, double[] doubles, java.lang.Object[] objects, int[] continuationIndexes)
Helper to copy this frame but with potentially new variables.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
className
private final java.lang.String className
-
methodId
private final int methodId
-
continuationPointId
private final int continuationPointId
-
monitors
private final java.lang.Object[] monitors
-
variables
private final SerializedState.Data variables
-
operands
private final SerializedState.Data operands
-
-
Constructor Detail
-
Frame
public Frame(java.lang.String className, int methodId, int continuationPointId, java.lang.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:
java.lang.NullPointerException
- if any argument isnull
java.lang.IllegalArgumentException
- if any elements inmonitors
arenull
or if eithervariables
oroperands
are in an invalid state
-
-
Method Detail
-
getClassName
public java.lang.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 java.lang.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, java.lang.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:
java.lang.IllegalArgumentException
- ifcontinuationIndexes
points to out of bounds indexes withinobjects
or if ifcontinuationIndexes
points to non-null indexes withinobjects
-
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:
java.lang.NullPointerException
- if any argument isnull
-
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:
java.lang.NullPointerException
- if any argument isnull
-
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:
java.lang.NullPointerException
- if any argument isnull
-
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:
java.lang.NullPointerException
- if any argument isnull
-
withObjectVariables
public SerializedState.Frame withObjectVariables(java.lang.Object[] objects)
Helper to copy this frame but with new object variables.- Parameters:
objects
- new objects- Returns:
- new frame
- Throws:
java.lang.NullPointerException
- if any argument isnull
-
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:
java.lang.NullPointerException
- if any argument isnull
java.lang.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, java.lang.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:
java.lang.IllegalArgumentException
- ifcontinuationIndexes
points to out of bounds indexes withinobjects
or if ifcontinuationIndexes
points to non-null indexes withinobjects
-
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:
java.lang.NullPointerException
- if any argument isnull
-
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:
java.lang.NullPointerException
- if any argument isnull
-
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:
java.lang.NullPointerException
- if any argument isnull
-
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:
java.lang.NullPointerException
- if any argument isnull
-
withObjectOperands
public SerializedState.Frame withObjectOperands(java.lang.Object[] objects)
Helper to copy this frame but with new object operands.- Parameters:
objects
- new objects- Returns:
- new frame
- Throws:
java.lang.NullPointerException
- if any argument isnull
-
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:
java.lang.NullPointerException
- if any argument isnull
java.lang.IllegalArgumentException
- ifcontinuationIndexes
points to out of bounds indexes withinobjects
or if ifcontinuationIndexes
points to non-null indexes withinobjects
-
withKey
public SerializedState.Frame withKey(java.lang.String className, java.lang.Integer methodId, java.lang.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:
java.lang.IllegalArgumentException
- ifcontinuationPointId < 0
-
withClassname
public SerializedState.Frame withClassname(java.lang.String className)
Helper to copy this frame but with a new method ID.- Parameters:
className
- new class name- Returns:
- new frame
- Throws:
java.lang.NullPointerException
- if any argument isnull
-
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:
java.lang.IllegalArgumentException
- ifcontinuationPointId < 0
-
validateState
void validateState()
-
-