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
Modifier and TypeFieldDescriptionstatic final Node.NType
static final Node.NType.Field
double
static final Node.NType.Field
int
static final Expression[]
static final I18NBundle
long
static final Node.NType.Field
static final int
static final int
static final Node.NType.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, MAX_RESOLUTION, MIME_TYPE, MIN_RESOLUTION, MIN_UNUSED_SPECIAL_OF_SOURCE, MIN_UNUSED_SPECIAL_OF_TARGET, name$FIELD, RESOLUTION_BIT, RESOLUTION_MASK, resolution$FIELD
Fields inherited from interface de.grogra.util.Map
DEFAULT_VALUE, EMPTY_MAP
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(Expression expr) boolean
allowsIteration
(int index) final void
checkExpressionCount
(int count) protected void
checkSetType
(Type type) clone()
compile
(Scope scope, Expression e) compile
(Scope scope, Expression e1, Expression e2) static final Expression
createConst
(Type type, Object value) createExpression
(Scope scope, antlr.collections.AST ast) static final Expression
createMaxConst
(int typeId) static final Expression
createMinConst
(int typeId) boolean
discards
(int index) final Object
final void
final boolean
final boolean
protected boolean
final byte
final byte
protected byte
final char
final char
protected char
final double
final double
protected double
final float
final float
protected float
final int
final int
protected int
final long
final long
protected long
final Object
final Object
protected Object
final short
final short
protected short
boolean
protected void
protected void
getExpression
(int index) final Expression
getExpression
(int index, int typeId, boolean checkTypes) final Expression
getExpression
(int index, Class cls) int
getLeastCommonAncestor
(Expression other) protected Node.NType
This method returns theNode.NType
which describes the managed fields of the class of this node.final Expression
getObjectExpression
(int index, Type type, boolean checkTypes) final Expression
getObjectExpression
(int index, Class type, boolean checkTypes) int
getPromotedType
(Expression expr1, Expression expr2) Determines the type id (seeTypeId
) of the binarily promoted type of the operandsexpr1
andexpr2
(binary promotion is defined by the Java Language Specification, it includes unboxing).int
getSupportedTypes
(int arg) getType()
boolean
boolean
implicitConversion
(Scope scope, Type type) boolean
boolean
boolean
isRequired
(int index) void
link
(boolean checkTypes) final void
linkGraph
(boolean checkTypes) boolean
protected Node
This method returns a new instance of the class of this node.int
opcode
(int[] opcodes) static int
opcode
(int typeId, int[] opcodes) protected String
Computes 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 void
receiveChildren
(Expression source) setNextSibling
(Expression expr) substitute
(Expression prev) toConst()
protected Expression
toString()
If this expression is a boxed value, return its unboxed expression.final void
void
valueChanged
(Expression expr, int index, Transaction t) final void
write
(BytecodeWriter writer, boolean discard) void
writeChildren
(BytecodeWriter writer) protected void
writeConditional
(BytecodeWriter writer, boolean discard) int
writeConditional
(BytecodeWriter writer, org.objectweb.asm.Label falseLabel, org.objectweb.asm.Label trueLabel) void
writeFinally
(BytecodeWriter writer, int label, ControlTransfer cause) protected void
writeImpl
(BytecodeWriter writer, boolean discard) protected void
writeOperator
(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, writeReplace
Methods inherited from class de.grogra.graph.impl.Edge
addEdgeBits, getBitMark, getEdgeBits, getEdgeKeys, 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 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:Node
This method returns theNode.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 classNode
- Returns:
- type describing the managed fields of the class of this 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 classNode
- Returns:
- new instance of class of this node
-
getType
- Specified by:
getType
in interfaceExpressionFactory
-
createExpression
- Specified by:
createExpression
in 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:
valueChanged
in 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 operandsexpr1
andexpr2
(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:Node
Computes 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:
paramString
in 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
-