|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.voytechs.jnetstream.npl.Node
com.voytechs.jnetstream.npl.NodeList
com.voytechs.jnetstream.npl.ArrayDimensionNode
public class ArrayDimensionNode
Support class that allows muti-dimensional array manipulation. Since array references can have dynamic code associated with array lookup, a number of convenience functions are performed by the class. 1) Bounds checking for MAX and MIN bounds for all dimensions. 2) Node traversal for each dimension 3) Scalar array size computation which also needs to be done at run time because of dynamic code.
| Field Summary |
|---|
| Fields inherited from class com.voytechs.jnetstream.npl.Node |
|---|
parent, token |
| Constructor Summary | |
|---|---|
ArrayDimensionNode()
|
|
| Method Summary | |
|---|---|
int |
calculateArraySize()
|
protected static int |
calculateArraySize(ArrayDimensionNode max,
int level)
|
int |
calculateScalarSize(ArrayDimensionNode dim)
Calculates the scalar dimension of the entire array. |
protected static int |
calculateScalarSize(ArrayDimensionNode max,
ArrayDimensionNode dim)
|
boolean |
checkBoundary(ArrayDimensionNode dim)
Checks that "dim" is within allocated limits of the array dimension. |
java.lang.String |
createLabel(int scalar)
|
ArrayDimensionNode |
evaluateToStatic()
This method evaluates the code to its NodeInt equivelent and creates a new Dimension object with static values. |
static void |
main(java.lang.String[] args)
Test function for ArrayDimensionNode |
int |
toScalar()
|
int |
toScalar(ArrayDimensionNode dim)
Returns the scalar equivelent value of the entire array. |
| Methods inherited from class com.voytechs.jnetstream.npl.NodeList |
|---|
add, add, addFirst, addLast, canOptimize, clear, contains, empty, get, getBoolean, getFirst, getInt, getLast, getLong, getString, indexOf, merge, optimize, remove, remove, size, toString, visit |
| Methods inherited from class com.voytechs.jnetstream.npl.Node |
|---|
getParent, getToken, setParent, setToken |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ArrayDimensionNode()
-
| Method Detail |
|---|
public int toScalar(ArrayDimensionNode dim)
throws NodeException
NodeException
public int toScalar()
throws NodeException
NodeException
public int calculateScalarSize(ArrayDimensionNode dim)
throws NodeException
max - Maximim multidimensional boundaries of the array.dim - the value to convert to scalar based on max as the array sizes.
NodeException
protected static int calculateScalarSize(ArrayDimensionNode max,
ArrayDimensionNode dim)
throws NodeException
NodeException
public int calculateArraySize()
throws NodeException
NodeException
protected static int calculateArraySize(ArrayDimensionNode max,
int level)
throws NodeException
NodeException
public java.lang.String createLabel(int scalar)
throws NodeException
NodeException
public boolean checkBoundary(ArrayDimensionNode dim)
throws NodeException
NodeException - since we are also excecuting dynamic expression code.
public ArrayDimensionNode evaluateToStatic()
throws NodeException
NodeException - if reference(s) can not be derefereced to a primitive. Becarefull when
evaluating in linkers and such where the dynamic runtime structures aren't ready yet. Can use the
canOptimize() function. If top level node can be optimized, this usually means that there are no
references in the code to be evaluated.public static void main(java.lang.String[] args)
args - command line arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||