|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gnu.jel.TypesStack
Organizes stack of types, supports type identification and automatically calculates the maximum occupation. Efficiently supports primitive types identification.
Field Summary | |
protected int |
currWords
|
static char[] |
primitiveCodes
Java codes for primitive types. |
static java.lang.String[] |
primitiveTypeNames
Names of the primitive types by ID in readable form. |
static java.lang.Class[] |
primitiveTypes
Classes of the primitive types by ID. |
protected static byte[] |
stkoccup
|
protected static java.lang.Class |
string_class
|
protected static java.lang.Class |
tsb_class
|
Constructor Summary | |
TypesStack()
Constructs a new empty TypesStack. |
Method Summary | |
java.lang.Object |
clone()
Makes a clone of this object. |
int |
getMaxOccupation()
Used to get a maximum number of Java words needed to store the stack. |
static boolean |
isString(java.lang.Class c)
Used to find out if the given class represents a Java string. |
static boolean |
isTSB(java.lang.Class c)
Used to find out if the given class represents a temporary sttring buffer. |
static boolean |
isWidening(java.lang.Class t1,
java.lang.Class t2)
Used to find out if the conversion t1->t2 is widening. |
static boolean |
isWidening(int it1,
int it2)
Used to find out if the conversion t1->t2 is widening. |
static void |
main(java.lang.String[] args)
Performs unitary test of this class. |
protected static java.lang.Object |
narrow(java.lang.Number val,
int clsID)
|
java.lang.Class |
peek()
Peeks the class on top of the stack without removing it. |
java.lang.Class |
peek(int i)
Peeks the class from the body of the stack. |
int |
peekID()
Peeks the ID of the class on top of the stack without removing it. |
int |
peekID(int i)
Peeks the ID of the class from the body of the stack. |
java.lang.Class |
pop()
Pops the top class from the stack. |
static int |
primitiveID(java.lang.Class c)
Identifies the primitive type of the given class. |
static int |
primitiveID(java.lang.Object o)
Identify the primitive type corresponding to the given reflection object. |
void |
push(java.lang.Class c)
Pushes a given class into stack. |
void |
push(java.lang.Class cls,
int i)
Adds a new element to the stack at a given position from top of it. |
void |
pushID(int id)
Pushes the class representing the primitive type into stack. |
void |
pushID(int id,
java.lang.Class c)
Pushes the class representing the primitive type into stack. |
void |
pushID(int id,
int i)
Adds a new element to the stack at a given position from top of it. |
void |
resetStats()
Used to adjust maximum stack occupation by a given amount. |
int |
size()
Used to determine the number of elements in this stack. |
void |
tempExcessWords(int nw)
Used to adjust maximum stack occupation by a given amount. |
static void |
test(Tester t)
Performs unitary test of this class. |
protected static java.lang.Number |
widen(java.lang.Object o,
int clsID)
|
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static java.lang.Class tsb_class
protected static java.lang.Class string_class
public static final java.lang.Class[] primitiveTypes
public static final char[] primitiveCodes
public static final java.lang.String[] primitiveTypeNames
protected static final byte[] stkoccup
protected int currWords
Constructor Detail |
public TypesStack()
Method Detail |
public static final int primitiveID(java.lang.Class c)
c
- class to identify.public static final int primitiveID(java.lang.Object o)
o
- object to identify.public java.lang.Object clone()
clone
in class java.lang.Object
public final java.lang.Class peek()
public final int peekID()
public final java.lang.Class peek(int i)
i
- number of the class to peek (0 means the top of the stack)public final int peekID(int i)
i
- number of the class to peek (0-peek)public final java.lang.Class pop()
public final void pushID(int id, java.lang.Class c)
public final void pushID(int id)
public final void push(java.lang.Class c)
public final void push(java.lang.Class cls, int i)
cls
- class to addi
- position of new element from the top of the stack (0 -- push)public final void pushID(int id, int i)
id
- ID of the class to addi
- position of new element from the top of the stack (0 -- push)public final int size()
public final void resetStats()
This method is called when there were data pushed on top of Java stack bypassing this class.
public final void tempExcessWords(int nw)
This method is called when there were data pushed on top of Java stack bypassing this class.
public final int getMaxOccupation()
public static boolean isWidening(java.lang.Class t1, java.lang.Class t2)
t1
- type to convert fromt2
- type to convert topublic static boolean isWidening(int it1, int it2)
it1
- type ID to convert fromit2
- type ID to convert topublic static boolean isString(java.lang.Class c)
c
- class to checkpublic static boolean isTSB(java.lang.Class c)
c
- class to checkprotected static java.lang.Number widen(java.lang.Object o, int clsID)
protected static java.lang.Object narrow(java.lang.Number val, int clsID)
public static void main(java.lang.String[] args)
args
- ignored.public static void test(Tester t)
Used if all package is being tested and not just codegen.
t
- Tester to report test results.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |