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.SerializableMethodState's andLockState's state translated for serialization.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringclassNameprivate intcontinuationPointIdprivate intmethodIdprivate java.lang.Object[]monitorsprivate SerializedState.Dataoperandsprivate static longserialVersionUIDprivate SerializedState.Datavariables
-
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.Frameobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetClassName()Get class name.intgetContinuationPointId()Get continuation point id.intgetMethodId()Get method ID.java.lang.Object[]getMonitors()Get monitor locks.SerializedState.DatagetOperands()Get operands.SerializedState.DatagetVariables()Get variables.(package private) voidvalidateState()SerializedState.FramewithClassname(java.lang.String className)Helper to copy this frame but with a new method ID.SerializedState.FramewithContinuationIndexOperands(int[] continuationIndexes)Helper to copy this frame but with new variable continuation indexes.SerializedState.FramewithContinuationIndexVariables(int[] continuationIndexes)Helper to copy this frame but with new variable continuation indexes.SerializedState.FramewithContinuationPointId(int continuationPointId)Helper to copy this frame but with a new continuation point ID.SerializedState.FramewithDoubleOperands(double[] doubles)Helper to copy this frame but with new double operands.SerializedState.FramewithDoubleVariables(double[] doubles)Helper to copy this frame but with new double variables.SerializedState.FramewithFloatOperands(float[] floats)Helper to copy this frame but with new float operands.SerializedState.FramewithFloatVariables(float[] floats)Helper to copy this frame but with new float variables.SerializedState.FramewithIntOperands(int[] ints)Helper to copy this frame but with new int operands.SerializedState.FramewithIntVariables(int[] ints)Helper to copy this frame but with new int variables.SerializedState.FramewithKey(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.FramewithLongOperands(long[] longs)Helper to copy this frame but with new long operands.SerializedState.FramewithLongVariables(long[] longs)Helper to copy this frame but with new long variables.SerializedState.FramewithMethodId(int methodId)Helper to copy this frame but with a new method ID.SerializedState.FramewithObjectOperands(java.lang.Object[] objects)Helper to copy this frame but with new object operands.SerializedState.FramewithObjectVariables(java.lang.Object[] objects)Helper to copy this frame but with new object variables.SerializedState.FramewithOperands(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.FramewithVariables(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.Frameobject.- 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 isnulljava.lang.IllegalArgumentException- if any elements inmonitorsarenullor if eithervariablesoroperandsare 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 (ornullif should be kept the same)floats- new floats (ornullif should be kept the same)longs- new longs (ornullif should be kept the same)doubles- new doubles (ornullif should be kept the same)objects- new objects (ornullif should be kept the same)continuationIndexes- new continuation indexes (ornullif should be kept the same)- Returns:
- new frame
- Throws:
java.lang.IllegalArgumentException- ifcontinuationIndexespoints to out of bounds indexes withinobjectsor if ifcontinuationIndexespoints 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 isnulljava.lang.IllegalArgumentException- ifcontinuationIndexespoints to out of bounds indexes withinobjectsor if ifcontinuationIndexespoints 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 (ornullif should be kept the same)floats- new floats (ornullif should be kept the same)longs- new longs (ornullif should be kept the same)doubles- new doubles (ornullif should be kept the same)objects- new objects (ornullif should be kept the same)continuationIndexes- new continuation indexes (ornullif should be kept the same)- Returns:
- new frame
- Throws:
java.lang.IllegalArgumentException- ifcontinuationIndexespoints to out of bounds indexes withinobjectsor if ifcontinuationIndexespoints 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 isnulljava.lang.IllegalArgumentException- ifcontinuationIndexespoints to out of bounds indexes withinobjectsor if ifcontinuationIndexespoints 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 (ornullif should be kept the same)methodId- new method ID (ornullif should be kept the same)continuationPointId- new continuation point ID (ornullif 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()
-
-