|
|||||||||
| Home >> All >> com >> techtrader >> modules >> tools >> [ bytecode overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.techtrader.modules.tools.bytecode
Class ConvertInstruction

java.lang.Objectcom.techtrader.modules.tools.bytecode.Instruction
com.techtrader.modules.tools.bytecode.ConvertInstruction
- All Implemented Interfaces:
- Constants, com.techtrader.modules.tools.bytecode.visitor.VisitAcceptor
- public class ConvertInstruction
- extends Instruction
Represents one of the conversion opcodes defined in the Constants interface for converting between primitive types. Changing the types of the instruction will automatically update the underlying opcode. If converting from one type to the same type will result in a NOP. Note that the result of conversions not supported directly by the JVM (i.e. char to double) is undefined.
| Field Summary | |
private java.lang.Class |
_fromType
|
private java.lang.Class |
_toType
|
private static java.util.Map |
_typeNames
|
| Fields inherited from class com.techtrader.modules.tools.bytecode.Instruction |
_byteIndex, _opcode, _opcodeTypes, _owner |
| Constructor Summary | |
protected |
ConvertInstruction(Code owner)
|
protected |
ConvertInstruction(Code owner,
int opcode,
java.lang.Class from,
java.lang.Class to)
|
| Method Summary | |
void |
acceptVisit(com.techtrader.modules.tools.bytecode.visitor.BCVisitor visit)
Accept a visit from a BCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this object. |
private void |
calculateOpCode()
Helper method to calculate the correct opcode for this conversion. |
protected void |
copy(Instruction orig)
|
boolean |
equals(java.lang.Object other)
ConvertInstructions are equal if they convert between the same types, or the types of either is unset. |
java.lang.Class |
getFromType()
Get the type of being converted from; will be one of: int, float, double, long. |
java.lang.String |
getFromTypeName()
Get the type of being converted from; will be one of: int, float, double, long. |
int |
getStackChange()
Return the number of stack positions this instruction pushes or pops during its execution. |
java.lang.Class |
getToType()
Get the type being converted to; will be one of: int, float, double, long, byte, char, short. |
java.lang.String |
getToTypeName()
Get the type being converted to; will be one of: int, float, double, long, byte, char, short. |
ConvertInstruction |
setFromType(java.lang.Class type)
Set the type to convert from. |
ConvertInstruction |
setFromTypeName(java.lang.String name)
Set the type to convert from by name. |
ConvertInstruction |
setToType(java.lang.Class type)
Set the type to convert to. |
ConvertInstruction |
setToTypeName(java.lang.String name)
Set the type to convert to by name. |
| Methods inherited from class com.techtrader.modules.tools.bytecode.Instruction |
getByteIndex, getLength, getName, getOpCode, getOwner, invalidate, readData, setByteIndex, setOpCode, writeData |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
_typeNames
private static final java.util.Map _typeNames
_fromType
private java.lang.Class _fromType
_toType
private java.lang.Class _toType
| Constructor Detail |
ConvertInstruction
protected ConvertInstruction(Code owner)
ConvertInstruction
protected ConvertInstruction(Code owner, int opcode, java.lang.Class from, java.lang.Class to)
| Method Detail |
getFromType
public java.lang.Class getFromType()
- Get the type of being converted from; will be one of:
int, float, double, long.
If the type has not been set, this method will return null.
getFromTypeName
public java.lang.String getFromTypeName()
- Get the type of being converted from; will be one of:
int, float, double, long.
If the type has not been set, this method will return null.
setFromType
public ConvertInstruction setFromType(java.lang.Class type)
- Set the type to convert from. Types without direct support are
demoted to int.class.
setFromTypeName
public ConvertInstruction setFromTypeName(java.lang.String name)
- Set the type to convert from by name.
getToType
public java.lang.Class getToType()
- Get the type being converted to; will be one of:
int, float, double, long, byte, char, short.
If the type has not been set, this method will return null.
getToTypeName
public java.lang.String getToTypeName()
- Get the type being converted to; will be one of:
int, float, double, long, byte, char, short.
If the type has not been set, this method will return null.
setToType
public ConvertInstruction setToType(java.lang.Class type)
- Set the type to convert to. Types without direct support are
demoted to int.class.
setToTypeName
public ConvertInstruction setToTypeName(java.lang.String name)
- Set the type to convert to by name.
equals
public boolean equals(java.lang.Object other)
- ConvertInstructions are equal if they convert between the same types,
or the types of either is unset.
- Overrides:
equalsin classInstruction
getStackChange
public int getStackChange()
- Description copied from class:
Instruction - Return the number of stack positions this instruction pushes
or pops during its execution.
- Overrides:
getStackChangein classInstruction
copy
protected void copy(Instruction orig)
- Overrides:
copyin classInstruction
calculateOpCode
private void calculateOpCode()
- Helper method to calculate the correct opcode for this conversion.
acceptVisit
public void acceptVisit(com.techtrader.modules.tools.bytecode.visitor.BCVisitor visit)
- Description copied from interface:
com.techtrader.modules.tools.bytecode.visitor.VisitAcceptor - Accept a visit from a BCVisitor, calling the appropriate methods
to notify the visitor that it has entered this entity, and
to provide it with the proper callbacks for each sub-entity owned
by this object.
- Specified by:
acceptVisitin interfacecom.techtrader.modules.tools.bytecode.visitor.VisitAcceptor- Overrides:
acceptVisitin classInstruction
|
|||||||||
| Home >> All >> com >> techtrader >> modules >> tools >> [ bytecode overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC