Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jreversepro.runtime
Class JOperandStack  view JOperandStack download JOperandStack.java

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.Vector
              extended byjava.util.Stack
                  extended byjreversepro.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.


Nested Class Summary
 
Nested classes inherited from class java.util.AbstractList
 
Field Summary
(package private)  java.util.Vector constants
          A Vector of constants.
 
Fields inherited from class java.util.Stack
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
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
 
Constructor Summary
JOperandStack()
          Empty constructor
 
Method Summary
 void addConstant(java.lang.String constant)
          Adds a new constant.
 java.util.List getConstants()
           
 java.lang.String getConstantValues()
          Returns the values of the constants serialized such that it corresponds to java syntax code too.
 boolean isTopDatatypeForeign()
          Lets us know if the top data type is foreign.
 void mergeTopTwo()
          Merges the top two contents of the operand stack.
 void push(int value, java.lang.String datatype, int precedence)
           
 void push(java.lang.String value, java.lang.String datatype, int precedence)
           
 void removeAllConstants()
          Deletes all the constants that were stored in the vector already.
 java.lang.String topDatatype()
           
 
Methods inherited from class java.util.Stack
empty, peek, pop, push, search
 
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
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.util.AbstractCollection
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Field Detail

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.

Constructor Detail

JOperandStack

public JOperandStack()
Empty constructor

Method Detail

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.