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,Serializable,Cloneable
- Direct Known Subclasses:
Assignment,EvalExpression,FieldObserver,FilterGuard,FinishIteratorGenerator,Guard,IterableGenerator,ModelExpression,OpenArgument,Pop,Production,Root,VoidExpression
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.grogra.graph.impl.Node
Node.AccessorBridge, Node.FieldAttributeAccessor, Node.NType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Node.NTypestatic final Node.NType.Fielddoublestatic final Node.NType.Fieldintstatic final Expression[]static final I18NBundlelongstatic final Node.NType.Fieldstatic final intstatic final intstatic final Node.NType.FieldFields 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, MAX_RESOLUTION, MIME_TYPE, MIN_RESOLUTION, MIN_UNUSED_SPECIAL_OF_SOURCE, MIN_UNUSED_SPECIAL_OF_TARGET, name$FIELD, RESOLUTION_BIT, RESOLUTION_MASK, resolution$FIELDFields inherited from interface de.grogra.util.Map
DEFAULT_VALUE, EMPTY_MAPFields 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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(Expression expr) booleanallowsIteration(int index) final voidcheckExpressionCount(int count) protected voidcheckSetType(Type type) clone()compile(Scope scope, Expression e) compile(Scope scope, Expression e1, Expression e2) static final ExpressioncreateConst(Type type, Object value) createExpression(Scope scope, antlr.collections.AST ast) static final ExpressioncreateMaxConst(int typeId) static final ExpressioncreateMinConst(int typeId) booleandiscards(int index) final Objectfinal voidfinal booleanfinal booleanprotected booleanfinal bytefinal byteprotected bytefinal charfinal charprotected charfinal doublefinal doubleprotected doublefinal floatfinal floatprotected floatfinal intfinal intprotected intfinal longfinal longprotected longfinal Objectfinal Objectprotected Objectfinal shortfinal shortprotected shortbooleanprotected voidprotected voidgetExpression(int index) final ExpressiongetExpression(int index, int typeId, boolean checkTypes) final ExpressiongetExpression(int index, Class cls) intgetLeastCommonAncestor(Expression other) protected Node.NTypeThis method returns theNode.NTypewhich describes the managed fields of the class of this node.final ExpressiongetObjectExpression(int index, Type type, boolean checkTypes) final ExpressiongetObjectExpression(int index, Class type, boolean checkTypes) intgetPromotedType(Expression expr1, Expression expr2) Determines the type id (seeTypeId) of the binarily promoted type of the operandsexpr1andexpr2(binary promotion is defined by the Java Language Specification, it includes unboxing).intgetSupportedTypes(int arg) getType()booleanbooleanimplicitConversion(Scope scope, Type type) booleanbooleanbooleanisRequired(int index) voidlink(boolean checkTypes) final voidlinkGraph(boolean checkTypes) booleanprotected NodeThis method returns a new instance of the class of this node.intopcode(int[] opcodes) static intopcode(int typeId, int[] opcodes) protected StringComputes the class-specific part of the string returned byNode.toString()which shall be enclosed in brackets.Converts this expression by unary promotion to one of the types whose mask (seeTypeId) is present insupportedTypes.final voidreceiveChildren(Expression source) setNextSibling(Expression expr) substitute(Expression prev) toConst()protected ExpressiontoString()If this expression is a boxed value, return its unboxed expression.final voidvoidvalueChanged(Expression expr, int index, Transaction t) final voidwrite(BytecodeWriter writer, boolean discard) voidwriteChildren(BytecodeWriter writer) protected voidwriteConditional(BytecodeWriter writer, boolean discard) intwriteConditional(BytecodeWriter writer, org.objectweb.asm.Label falseLabel, org.objectweb.asm.Label trueLabel) voidwriteFinally(BytecodeWriter writer, int label, ControlTransfer cause) protected voidwriteImpl(BytecodeWriter writer, boolean discard) protected voidwriteOperator(BytecodeWriter writer) Methods inherited from class de.grogra.graph.impl.Node
addEdgeBitsTo, addReference, appendBranchNode, appendBranchNode, appendReferencesTo, clone, cloneGraph, dump, dumpTree, dup, dupFrom, dupnew, dupUnmanagedFields, edgeChanged, fieldModified, findAdjacent, findRefinementType, 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, getIgnored, getIndex, getInstantiator, getInt, getLayer, getLong, getManageableType, getName, getNeighbor, getNext, getNType, getObject, getOrCreateEdgeTo, getOrNull, getPersistenceManager, getPredecessor, getProvider, getResolution, getShort, getSource, getStamp, getSuccessor, getSymbol, getSymbolColor, getTarget, getTransaction, getUserField, getUserFieldCount, getXClass, getXData, hasName, initProvider, initXClass, insertBranchNode, insertBranchNode, instantiateGraph, isAncestorOf, isDirection, isEncoarseOf, isManagingInstance, isMarked, isRoot, isSource, isTarget, manageableReadResolve, manageableWriteReplace, removeAll, removeEdgeBitsTo, removeFromChain, removeFromChain, removeReference, setBranch, setBranch, setExtentIndex, setGraphForDeserialization, setIgnored, setLayer, setMark, setName, setResolution, setSuccessor, setSuccessor, specialEdgeAdded, specialEdgeRefModified, specialEdgeRemoved, writeReplaceMethods inherited from class de.grogra.graph.impl.Edge
addEdgeBits, getBitMark, getEdgeBits, getEdgeKeys, getObjectMark, getSpecialEdgeDescriptor, parseEdgeKeys, remove, removeEdgeBits, setBitMark, setEdgeBits, setObjectMark, testEdgeBitsMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface de.grogra.persistence.PersistenceCapable
getBitMark, getObjectMark, setBitMark, setObjectMark
-
Field Details
-
I18N
-
EXPR_0
-
etype
public int etype -
VALID
public static final int VALID- See Also:
-
USED_BITS
public static final int USED_BITS- See Also:
-
lval
public long lval -
dval
public double dval -
aval
-
$TYPE
-
lval$FIELD
-
dval$FIELD
-
aval$FIELD
-
valid$FIELD
-
-
Constructor Details
-
Expression
public Expression() -
Expression
-
-
Method Details
-
getNTypeImpl
Description copied from class:NodeThis method returns theNode.NTypewhich describes the managed fields of the class of this node. This method has to be implemented in every concrete subclass.- Overrides:
getNTypeImplin classNode- Returns:
- type describing the managed fields of the class of this node
-
newInstance
Description copied from class:NodeThis method returns a new instance of the class of this node. This method has to be implemented in every concrete subclass.- Overrides:
newInstancein classNode- Returns:
- new instance of class of this node
-
getType
- Specified by:
getTypein interfaceExpressionFactory
-
createExpression
- Specified by:
createExpressionin interfaceExpressionFactory
-
clone
-
hasType
-
hasType
-
isPrimitiveOrStringConstant
public boolean isPrimitiveOrStringConstant() -
setType
-
checkSetType
-
isRequired
public boolean isRequired(int index) -
discards
public boolean discards(int index) -
needsEmptyOperandStackForFinally
public boolean needsEmptyOperandStackForFinally() -
allowsIteration
public boolean allowsIteration(int index) -
getTypeLoader
-
link
public void link(boolean checkTypes) -
linkGraph
public final void linkGraph(boolean checkTypes) -
unlinkTree
public final void unlinkTree() -
getSupportedTypes
public int getSupportedTypes(int arg) -
fireValueChanged
-
valueChanged
- Specified by:
valueChangedin interfaceValueObserver
-
evaluateRet
-
evaluateAsVoid
-
evaluateAsObject
-
evaluateBoolean
public final boolean evaluateBoolean() -
evaluateBoolean
-
evaluateBooleanImpl
-
evaluateByte
public final byte evaluateByte() -
evaluateByte
-
evaluateByteImpl
-
evaluateShort
public final short evaluateShort() -
evaluateShort
-
evaluateShortImpl
-
evaluateChar
public final char evaluateChar() -
evaluateChar
-
evaluateCharImpl
-
evaluateInt
public final int evaluateInt() -
evaluateInt
-
evaluateIntImpl
-
evaluateLong
public final long evaluateLong() -
evaluateLong
-
evaluateLongImpl
-
evaluateFloat
public final float evaluateFloat() -
evaluateFloat
-
evaluateFloatImpl
-
evaluateDouble
public final double evaluateDouble() -
evaluateDouble
-
evaluateDoubleImpl
-
evaluateObject
-
evaluateObject
-
evaluateObjectImpl
-
evaluateVoidImpl
-
toConst
-
toConstImpl
-
push
-
add
-
setNextSibling
-
receiveChildren
-
substitute
-
getFirstExpression
-
getNextExpression
-
getLastExpression
-
getExpressionCount
public int getExpressionCount() -
getExpression
-
getLeastCommonAncestor
-
getPromotedType
Determines the type id (seeTypeId) of the binarily promoted type of the operandsexpr1andexpr2(binary promotion is defined by the Java Language Specification, it includes unboxing).- Parameters:
expr1- first operandexpr2- second operand- Returns:
- type id of promoted type
-
promote
Converts this expression by unary promotion to one of the types whose mask (seeTypeId) is present insupportedTypes. The most specific type is chosen, i.e. the type which is a subtype of all other possible, supported types.- Parameters:
scope- TODOsupportedTypes- 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
-
compile
-
compile
-
implicitConversion
-
unboxingConversion
If this expression is a boxed value, return its unboxed expression. Otherwise return this expression itself.- Returns:
-
cast
-
checkExpressionCount
public final void checkExpressionCount(int count) -
getExpression
-
getExpression
-
getObjectExpression
-
getObjectExpression
-
createConst
-
createMinConst
-
createMaxConst
-
evaluatesWithoutSideeffect
public boolean evaluatesWithoutSideeffect() -
toString
-
paramString
Description copied from class:NodeComputes the class-specific part of the string returned byNode.toString()which shall be enclosed in brackets. This should be used to show important properties of this node.- Overrides:
paramStringin classNode- Returns:
- string describing some important properties of this node
-
opcode
public static int opcode(int typeId, int[] opcodes) -
opcode
public int opcode(int[] opcodes) -
writeChildren
-
write
-
writeImpl
-
isConditional
public boolean isConditional() -
writeConditional
public int writeConditional(BytecodeWriter writer, org.objectweb.asm.Label falseLabel, org.objectweb.asm.Label trueLabel) -
writeConditional
-
writeFinally
-
writeOperator
-