java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.Vector
java.util.Stack
jreversepro.runtime.JOperandStack
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Collection, java.lang.Iterable, jreversepro.common.KeyWords, java.util.List, OperandConstants, java.util.RandomAccess, java.io.Serializable
- public class JOperandStack
- extends java.util.Stack
- implements jreversepro.common.KeyWords, OperandConstants
Operand Stack is the abstraction of the Java Method Operand Stack.
The variables are pushed to and popped from, this stack.
| Fields inherited from class java.util.Stack |
|
| Fields inherited from interface jreversepro.common.KeyWords |
ANY, BOOLEAN, BREAK, BYTE, CASE, CHAR, CLASS, CLASS_STRING, CLINIT, CLOSE_BRACKET, COND_AND, COND_NOT, COND_OR, CONTINUE, DEFAULT, DEFAULT_PACKAGE, DOUBLE, EQUALTO, FALSE, FLOAT, FOREIGN_CLASS, FOREIGN_OBJ, GOTO, INIT, INSTANCEOF, INT, INTERFACE, JVM_BOOLEAN, JVM_CHAR, JVM_VOID, LANG_OBJECT, LENGTH, LONG, NEW, NULL, OPEN_BRACKET, OPR_EQ, OPR_GE, OPR_GT, OPR_LE, OPR_LT, OPR_NE, OPR_NOT, REFERENCE, RET_ADDR, RETURN, SHORT, SPACE, STATIC, SUPER, SWITCH, THIS, THISCLASS, THROW, TRUE, VOID |
| Fields inherited from interface jreversepro.runtime.OperandConstants |
L_ADD, L_BITAND, L_BITOR, L_BITXOR, L_CAST, L_COMMA, L_DIV, L_EVAL, L_INDEX, L_LOGAND, L_LOGEQ, L_LOGIOF, L_LOGNEQ, L_LOGOR, L_LOGREL, L_MOD, L_MUL, L_REF, L_SHIFT, L_SUB, L_TERN, L_UNARY, VALUE |
| Methods inherited from class java.util.Vector |
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize |
constants
java.util.Vector constants
- A Vector of constants. The individual members of this
vector are 'String'. They are primarily used in the following
case. Lets say - we have a code called .
String [] args = { "run", "args", "args1" };
In this case all the individual members of the array
namely args come into the constants.
JOperandStack
public JOperandStack()
- Empty constructor
addConstant
public void addConstant(java.lang.String constant)
- Adds a new constant.
removeAllConstants
public void removeAllConstants()
- Deletes all the constants that were stored in the
vector already.
getConstants
public java.util.List getConstants()
getConstantValues
public java.lang.String getConstantValues()
- Returns the values of the constants serialized such
that it corresponds to java syntax code too.
push
public void push(java.lang.String value,
java.lang.String datatype,
int precedence)
push
public void push(int value,
java.lang.String datatype,
int precedence)
topDatatype
public java.lang.String topDatatype()
isTopDatatypeForeign
public boolean isTopDatatypeForeign()
- Lets us know if the top data type is foreign. Mainly this method
is necessary when we have a operand loaded onto the stack from
outside. ( Eg: an argument to the exception handler of the
exception type ).
mergeTopTwo
public void mergeTopTwo()
throws jreversepro.revengine.RevEngineException
- Merges the top two contents of the operand stack.
Eg, if the stack contents are
ab String
cd String ( in reverse order - stack top first ).,
On merging it becomes
abcd String ( in reverse order - stack top first ).,
The precondition is that the datatypes of first top two elements
ought to be the same. Then only this is valid.