Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.grogra.xl.expr
Class Expression

    java.lang.Object
      de.grogra.graph.impl.Edge
          de.grogra.graph.impl.Node
              de.grogra.xl.expr.Expression

All Implemented Interfaces:
  Manageable, PersistenceCapable, Shareable, TypeId, UserFields, XObject, Map, ExpressionFactory, ValueObserver, java.io.Serializable, java.lang.Cloneable

Direct Known Subclasses:
  Assignment, EvalExpression, FieldObserver, FilterGuard, FinishIteratorGenerator, Guard, IterableGenerator, ModelExpression, Pop, Production, Root, VoidExpression

    public class Expression

extends Node
implements TypeId, ValueObserver, java.lang.Cloneable, ExpressionFactory

`Expression` is the base class for the internal representation of compiled expression trees. These are used by the XL compiler as an intermediate step in the creation of byte-code. However, they are evaluatable on their own (though this is not as performant as byte-code). Expression trees are used for both expressions and statements.

Author:
  Ole Kniemeyer
See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class de.grogra.graph.impl.Node
`Node.AccessorBridge, Node.FieldAttributeAccessor, Node.NType`

Nested classes/interfaces inherited from interface de.grogra.util.Map
`Map.Chain`

Field Summary
`static Node.NType` | `$TYPE`
`java.lang.Object` | `aval`
`static Node.NType.Field` | `aval$FIELD`
`double` | `dval`
`static Node.NType.Field` | `dval$FIELD`
`int` | `etype`
`static Expression[]` | `EXPR_0`
`static I18NBundle` | `I18N`
`long` | `lval`
`static Node.NType.Field` | `lval$FIELD`
`static int` | `USED_BITS`
`static int` | `VALID`
`static Node.NType.Field` | `valid$FIELD`

Fields inherited from class de.grogra.graph.impl.Node
`ADDITIONAL_FIELDS, bits, DELETED, EXTENT_BIT, EXTENT_MASK, extentIndex$FIELD, extentTail$FIELD, HAS_OBSERVERS, IS_INTERPRETIVE, isInterpretive$FIELD, LAST_EXTENT_INDEX, layer$FIELD, MARK, mark$FIELD, MIME_TYPE, MIN_UNUSED_SPECIAL_OF_SOURCE, MIN_UNUSED_SPECIAL_OF_TARGET, name$FIELD`

Fields inherited from interface de.grogra.reflect.TypeId
`A_VALUE, ABSTRACT_PRIMITIVE, BOOLEAN, BOOLEAN_MASK, BYTE, BYTE_MASK, CHAR, CHAR_MASK, D_VALUE, DOUBLE, DOUBLE_MASK, F_VALUE, FLOAT, FLOAT_MASK, FLOATING_POINT_MASK, I_VALUE, INT, INT_ASSIGNABLE, INT_MASK, INTEGRAL_MASK, L_VALUE, LONG, LONG_MASK, MAX_PRIMITIVE, MIN_PRIMITIVE, NUMERIC_MASK, NUMERIC_NONCHAR_MASK, OBJECT, OBJECT_MASK, PRIMITIVE_MASK, SHORT, SHORT_MASK, TYPE_COUNT, VOID, VOID_MASK`

Fields inherited from interface de.grogra.util.Map
`DEFAULT_VALUE, EMPTY_MAP`

Constructor Summary
`Expression()`
`Expression(Type type)`

Method Summary
`Expression` | `add(Expression expr)`
`boolean` | `allowsIteration(int index)`
`Expression` | `cast(Type type)`
`void` | `checkExpressionCount(int count)`
`protected void` | `checkSetType(Type type)`
`java.lang.Object` | `clone()`
`Expression` | `compile(de.grogra.xl.compiler.scope.Scope scope, Expression e)`
`Expression` | `compile(de.grogra.xl.compiler.scope.Scope scope, Expression e1, Expression e2)`
`static Expression` | `createConst(Type type, java.lang.Object value)`
`Expression` | `createExpression(de.grogra.xl.compiler.scope.Scope scope, antlr.collections.AST ast)`
`static Expression` | `createMaxConst(int typeId)`
`static Expression` | `createMinConst(int typeId)`
`boolean` | `discards(int index)`
`java.lang.Object` | `evaluateAsObject(VMXState t)`
`void` | `evaluateAsVoid(VMXState t)`
`boolean` | `evaluateBoolean()`
`boolean` | `evaluateBoolean(VMXState t)`
`protected boolean` | `evaluateBooleanImpl(VMXState t)`
`byte` | `evaluateByte()`
`byte` | `evaluateByte(VMXState t)`
`protected byte` | `evaluateByteImpl(VMXState t)`
`char` | `evaluateChar()`
`char` | `evaluateChar(VMXState t)`
`protected char` | `evaluateCharImpl(VMXState t)`
`double` | `evaluateDouble()`
`double` | `evaluateDouble(VMXState t)`
`protected double` | `evaluateDoubleImpl(VMXState t)`
`float` | `evaluateFloat()`
`float` | `evaluateFloat(VMXState t)`
`protected float` | `evaluateFloatImpl(VMXState t)`
`int` | `evaluateInt()`
`int` | `evaluateInt(VMXState t)`
`protected int` | `evaluateIntImpl(VMXState t)`
`long` | `evaluateLong()`
`long` | `evaluateLong(VMXState t)`
`protected long` | `evaluateLongImpl(VMXState t)`
`java.lang.Object` | `evaluateObject()`
`java.lang.Object` | `evaluateObject(VMXState t)`
`protected java.lang.Object` | `evaluateObjectImpl(VMXState t)`
`AbruptCompletion.Return` | `evaluateRet(VMXState t)`
`short` | `evaluateShort()`
`short` | `evaluateShort(VMXState t)`
`protected short` | `evaluateShortImpl(VMXState t)`
`boolean` | `evaluatesWithoutSideeffect()`
`protected void` | `evaluateVoidImpl(VMXState t)`
`protected void` | `fireValueChanged(Transaction t)`
`Expression` | `getExpression(int index)`
`Expression` | `getExpression(int index, java.lang.Class cls)`
`Expression` | `getExpression(int index, int typeId, boolean checkTypes)`
`int` | `getExpressionCount()`
`Expression` | `getFirstExpression()`
`Expression` | `getLastExpression()`
`Expression` | `getLeastCommonAncestor(Expression other)`
`Expression` | `getNextExpression()`
`protected Node.NType` | `getNTypeImpl()` This method returns the `Node.NType` which describes the managed fields of the class of this node.
`Expression` | `getObjectExpression(int index, java.lang.Class type, boolean checkTypes)`
`Expression` | `getObjectExpression(int index, Type type, boolean checkTypes)`
`int` | `getPromotedType(Expression expr1, Expression expr2)` Determines the type id (see `TypeId`) of the binarily promoted type of the operands `expr1` and `expr2` (binary promotion is defined by the Java Language Specification, it includes unboxing).
`int` | `getSupportedTypes(int arg)`
`Type` | `getType()`
`TypeLoader` | `getTypeLoader()`
`boolean` | `hasType(java.lang.Class type)`
`boolean` | `hasType(Type type)`
`Expression` | `implicitConversion(de.grogra.xl.compiler.scope.Scope scope, Type type)`
`boolean` | `isConditional()`
`boolean` | `isPrimitiveOrStringConstant()`
`boolean` | `isRequired(int index)`
`void` | `link(boolean checkTypes)`
`void` | `linkGraph(boolean checkTypes)`
`boolean` | `needsEmptyOperandStackForFinally()`
`protected Node` | `newInstance()` This method returns a new instance of the class of this node.
`int` | `opcode(int[] opcodes)`
`static int` | `opcode(int typeId, int[] opcodes)`
`protected java.lang.String` | `paramString()` Computes the class-specific part of the string returned by `Node.toString()` which shall be enclosed in brackets.
`Expression` | `promote(de.grogra.xl.compiler.scope.Scope scope, int supportedTypes)` Converts this expression by unary promotion to one of the types whose mask (see `TypeId`) is present in `supportedTypes`.
`void` | `push(VMXState t)`
`Expression` | `receiveChildren(Expression source)`
`Expression` | `setNextSibling(Expression expr)`
`Expression` | `setType(Type type)`
`Expression` | `substitute(Expression prev)`
`Expression` | `toConst()`
`protected Expression` | `toConstImpl()`
`java.lang.String` | `toString()`
`Expression` | `unboxingConversion()` If this expression is a boxed value, return its unboxed expression.
`void` | `unlinkTree()`
`void` | `valueChanged(Expression expr, int index, Transaction t)`
`void` | `write(de.grogra.xl.compiler.BytecodeWriter writer, boolean discard)`
`void` | `writeChildren(de.grogra.xl.compiler.BytecodeWriter writer)`
`protected void` | `writeConditional(de.grogra.xl.compiler.BytecodeWriter writer, boolean discard)`
`int` | `writeConditional(de.grogra.xl.compiler.BytecodeWriter writer, org.objectweb.asm.Label falseLabel, org.objectweb.asm.Label trueLabel)`
`void` | `writeFinally(de.grogra.xl.compiler.BytecodeWriter writer, int label, ControlTransfer cause)`
`protected void` | `writeImpl(de.grogra.xl.compiler.BytecodeWriter writer, boolean discard)`
`protected void` | `writeOperator(de.grogra.xl.compiler.BytecodeWriter writer)`

Methods inherited from class de.grogra.graph.impl.Node
`addEdgeBitsTo, addReference, appendBranchNode, appendBranchNode, appendReferencesTo, clone, cloneGraph, dump, dumpTree, dup, dupUnmanagedFields, edgeChanged, fieldModified, findAdjacent, get, getAccessor, getAccessor, getAttributes, getAxisParent, getBoolean, getBranch, getBranchLength, getBranchNode, getBranchTail, getByte, getChar, getCommonAncestor, getCurrentGraphState, getDirectChildCount, getDouble, getEdgeAttributeAccessor, getEdgeAttributes, getEdgeBitsTo, getEdgeTo, getExtentIndex, getFirst, getFirstEdge, getFloat, getGraph, getId, getIndex, getInstantiator, getInt, getLayer, getLong, getManageableType, getName, getNeighbor, getNext, getNType, getObject, getOrCreateEdgeTo, getOrNull, getPersistenceManager, getPredecessor, getProvider, getShort, getSource, getStamp, getSuccessor, getSymbol, getSymbolColor, getTarget, getTransaction, getUserField, getUserFieldCount, getXClass, getXData, hasName, initProvider, initXClass, insertBranchNode, insertBranchNode, instantiateGraph, isAncestorOf, isDirection, isManagingInstance, isMarked, isRoot, isSource, isTarget, manageableReadResolve, manageableWriteReplace, removeAll, removeEdgeBitsTo, removeFromChain, removeFromChain, removeReference, setBranch, setBranch, setExtentIndex, setGraphForDeserialization, setLayer, setMark, setName, setSuccessor, setSuccessor, specialEdgeAdded, specialEdgeRefModified, specialEdgeRemoved, writeReplace`

Methods inherited from class de.grogra.graph.impl.Edge
`addEdgeBits, getBitMark, getEdgeBits, getObjectMark, getSpecialEdgeDescriptor, parseEdgeKeys, remove, removeEdgeBits, setBitMark, setEdgeBits, setObjectMark, testEdgeBits`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface de.grogra.persistence.PersistenceCapable
`getBitMark, getObjectMark, setBitMark, setObjectMark`

Field Detail

### $TYPE

    public static final Node.NType $TYPE

### aval

    public java.lang.Object aval

### aval$FIELD

    public static final Node.NType.Field aval$FIELD

### dval

    public double dval

### dval$FIELD

    public static final Node.NType.Field dval$FIELD

### etype

    public int etype

### EXPR_0

    public static final Expression[] EXPR_0

### I18N

    public static final I18NBundle I18N

### lval

    public long lval

### lval$FIELD

    public static final Node.NType.Field lval$FIELD

### USED_BITS

    public static final int USED_BITS

See Also:
  Constant Field Values

### VALID

    public static final int VALID

See Also:
  Constant Field Values

### valid$FIELD

    public static final Node.NType.Field valid$FIELD

Constructor Detail

### Expression

    public Expression()

### Expression

    public Expression(Type type)

Method Detail

### add

    public Expression add(Expression expr)

### allowsIteration

    public boolean allowsIteration(int index)

### cast

    public Expression cast(Type type)

### checkExpressionCount

    public final void checkExpressionCount(int count)

### checkSetType

    protected void checkSetType(Type type)

### clone

    public java.lang.Object clone()

  Overrides:
    `clone` in class `Node`

### compile

    public Expression compile(de.grogra.xl.compiler.scope.Scope scope,
                              Expression e)

### compile

    public Expression compile(de.grogra.xl.compiler.scope.Scope scope,
                              Expression e1,
                              Expression e2)

### createConst

    public static final Expression createConst(Type type,
                                               java.lang.Object value)

### createExpression

    public Expression createExpression(de.grogra.xl.compiler.scope.Scope scope,
                                       antlr.collections.AST ast)

  Specified by:
    `createExpression` in interface `ExpressionFactory`

### createMaxConst

    public static final Expression createMaxConst(int typeId)

### createMinConst

    public static final Expression createMinConst(int typeId)

### discards

    public boolean discards(int index)

### evaluateAsObject

    public final java.lang.Object evaluateAsObject(VMXState t)

### evaluateAsVoid

    public final void evaluateAsVoid(VMXState t)

### evaluateBoolean

    public final boolean evaluateBoolean()

### evaluateBoolean

    public final boolean evaluateBoolean(VMXState t)

### evaluateBooleanImpl

    protected boolean evaluateBooleanImpl(VMXState t)

### evaluateByte

    public final byte evaluateByte()

### evaluateByte

    public final byte evaluateByte(VMXState t)

### evaluateByteImpl

    protected byte evaluateByteImpl(VMXState t)

### evaluateChar

    public final char evaluateChar()

### evaluateChar

    public final char evaluateChar(VMXState t)

### evaluateCharImpl

    protected char evaluateCharImpl(VMXState t)

### evaluateDouble

    public final double evaluateDouble()

### evaluateDouble

    public final double evaluateDouble(VMXState t)

### evaluateDoubleImpl

    protected double evaluateDoubleImpl(VMXState t)

### evaluateFloat

    public final float evaluateFloat()

### evaluateFloat

    public final float evaluateFloat(VMXState t)

### evaluateFloatImpl

    protected float evaluateFloatImpl(VMXState t)

### evaluateInt

    public final int evaluateInt()

### evaluateInt

    public final int evaluateInt(VMXState t)

### evaluateIntImpl

    protected int evaluateIntImpl(VMXState t)

### evaluateLong

    public final long evaluateLong()

### evaluateLong

    public final long evaluateLong(VMXState t)

### evaluateLongImpl

    protected long evaluateLongImpl(VMXState t)

### evaluateObject

    public final java.lang.Object evaluateObject()

### evaluateObject

    public final java.lang.Object evaluateObject(VMXState t)

### evaluateObjectImpl

    protected java.lang.Object evaluateObjectImpl(VMXState t)

### evaluateRet

    public AbruptCompletion.Return evaluateRet(VMXState t)

### evaluateShort

    public final short evaluateShort()

### evaluateShort

    public final short evaluateShort(VMXState t)

### evaluateShortImpl

    protected short evaluateShortImpl(VMXState t)

### evaluatesWithoutSideeffect

    public boolean evaluatesWithoutSideeffect()

### evaluateVoidImpl

    protected void evaluateVoidImpl(VMXState t)

### fireValueChanged

    protected void fireValueChanged(Transaction t)

### getExpression

    public Expression getExpression(int index)

### getExpression

    public final Expression getExpression(int index,
                                          java.lang.Class cls)

### getExpression

    public final Expression getExpression(int index,
                                          int typeId,
                                          boolean checkTypes)

### getExpressionCount

    public int getExpressionCount()

### getFirstExpression

    public Expression getFirstExpression()

### getLastExpression

    public Expression getLastExpression()

### getLeastCommonAncestor

    public Expression getLeastCommonAncestor(Expression other)

### getNextExpression

    public Expression getNextExpression()

### getNTypeImpl

    protected Node.NType getNTypeImpl()

  Description copied from class: `Node`
  This method returns the `Node.NType` which describes the managed fields of the class of this node. This method has to be implemented in every concrete subclass.

  Overrides:
    `getNTypeImpl` in class `Node`
  Returns:
    type describing the managed fields of the class of this node

### getObjectExpression

    public final Expression getObjectExpression(int index,
                                                java.lang.Class type,
                                                boolean checkTypes)

### getObjectExpression

    public final Expression getObjectExpression(int index,
                                                Type type,
                                                boolean checkTypes)

### getPromotedType

    public int getPromotedType(Expression expr1,
                               Expression expr2)

  Determines the type id (see `TypeId`) of the binarily promoted type of the operands `expr1` and `expr2` (binary promotion is defined by the Java Language Specification, it includes unboxing).

  Parameters:
    `expr1` - first operand
    `expr2` - second operand
  Returns:
    type id of promoted type

### getSupportedTypes

    public int getSupportedTypes(int arg)

### getType

    public Type getType()

  Specified by:
    `getType` in interface `ExpressionFactory`

### getTypeLoader

    public TypeLoader getTypeLoader()

### hasType

    public boolean hasType(java.lang.Class type)

### hasType

    public boolean hasType(Type type)

### implicitConversion

    public Expression implicitConversion(de.grogra.xl.compiler.scope.Scope scope,
                                         Type type)

### isConditional

    public boolean isConditional()

### isPrimitiveOrStringConstant

    public boolean isPrimitiveOrStringConstant()

### isRequired

    public boolean isRequired(int index)

### link

    public void link(boolean checkTypes)

### linkGraph

    public final void linkGraph(boolean checkTypes)

### needsEmptyOperandStackForFinally

    public boolean needsEmptyOperandStackForFinally()

### newInstance

    protected Node newInstance()

  Description copied from class: `Node`
  This method returns a new instance of the class of this node. This method has to be implemented in every concrete subclass.

  Overrides:
    `newInstance` in class `Node`
  Returns:
    new instance of class of this node

### opcode

    public int opcode(int[] opcodes)

### opcode

    public static int opcode(int typeId,
                             int[] opcodes)

### paramString

    protected java.lang.String paramString()

  Description copied from class: `Node`
  Computes the class-specific part of the string returned by `Node.toString()` which shall be enclosed in brackets. This should be used to show important properties of this node.

  Overrides:
    `paramString` in class `Node`
  Returns:
    string describing some important properties of this node

### promote

    public Expression promote(de.grogra.xl.compiler.scope.Scope scope,
                              int supportedTypes)

  Converts this expression by unary promotion to one of the types whose mask (see `TypeId`) is present in `supportedTypes`. The most specific type is chosen, i.e. the type which is a subtype of all other possible, supported types.

  Parameters:
    `scope` - TODO
    `supportedTypes` - union of allowed type masks for the promoted expression
  Returns:
    promoted expression, its type being one of the supported types
  Throws:
    `IllegalOperandTypeException` - if promotion cannot be performed

### push

    public final void push(VMXState t)

### receiveChildren

    public Expression receiveChildren(Expression source)

### setNextSibling

    public Expression setNextSibling(Expression expr)

### setType

    public Expression setType(Type type)

### substitute

    public Expression substitute(Expression prev)

### toConst

    public Expression toConst()

### toConstImpl

    protected Expression toConstImpl()

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `Node`

### unboxingConversion

    public Expression unboxingConversion()

  If this expression is a boxed value, return its unboxed expression. Otherwise return this expression itself.

  Returns:

### unlinkTree

    public final void unlinkTree()

### valueChanged

    public void valueChanged(Expression expr,
                             int index,
                             Transaction t)

  Specified by:
    `valueChanged` in interface `ValueObserver`

### write

    public final void write(de.grogra.xl.compiler.BytecodeWriter writer,
                            boolean discard)

### writeChildren

    public void writeChildren(de.grogra.xl.compiler.BytecodeWriter writer)

### writeConditional

    protected void writeConditional(de.grogra.xl.compiler.BytecodeWriter writer,
                                    boolean discard)

### writeConditional

    public int writeConditional(de.grogra.xl.compiler.BytecodeWriter writer,
                                org.objectweb.asm.Label falseLabel,
                                org.objectweb.asm.Label trueLabel)

### writeFinally

    public void writeFinally(de.grogra.xl.compiler.BytecodeWriter writer,
                             int label,
                             ControlTransfer cause)

### writeImpl

    protected void writeImpl(de.grogra.xl.compiler.BytecodeWriter writer,
                             boolean discard)

### writeOperator

    protected void writeOperator(de.grogra.xl.compiler.BytecodeWriter writer)

Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD