Interface IJavaOperation
- All Superinterfaces:
IJavaElement
,IJavaExpression
- All Known Subinterfaces:
IJavaPredicate_LEGACY
Java AST interface to represent arithmetic and logical expressions.
An expression consists of one or two members (the left and right members) and an operator. The left member is optional, and should be null for unary operators.
Examples:
a + 1 a * ((int)b - foo()) !x x ^ y | z
-
Field Summary
Fields inherited from interface com.pnfsoftware.jeb.core.units.code.java.IJavaElement
FLAG_BUILT, FLAG_FIELD_REFERENCES_OUTERCLASS, FLAG_LAMBDA_CLASS, FLAG_LAMBDA_IMPL, FLAG_OPTIONAL_RENDERING, FLAG_SECOND_PARAMETER_IS_OUTER_REF, FLAG_STICKY
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
default boolean
checkOperatorType
(JavaOperatorType optype) Duplicate this element.int
getLeft()
Get the left member sub-expression.Get the expression's operator.default JavaOperatorType
getRight()
Get the right sub-expression.boolean
Mirror the operation order, whenever possible.boolean
Logical negation of the operation, whenever possible.void
setLeft
(IJavaExpression left) void
setOperator
(IJavaOperator operator) Set the operator for the expression.void
setRight
(IJavaExpression right) Methods inherited from interface com.pnfsoftware.jeb.core.units.code.java.IJavaElement
addFlags, addTag, canCauseException, collectAllPhysicalOffsets, generate, getData, getElementType, getFlags, getOrigin, getPhysicalMethodIndex, getPhysicalOffset, getReconAnon, getReconEnum, getReconEnummap, getReconLambda, getSubElements, getTags, hasFlags, hasPhysicalMethodIndex, hasPhysicalOffset, isReconArtifact, removeFlags, removeTag, replaceSubElement, setData, setFlags, setLambdaRecon, setOrigin, setPhysicalMethodIndex, setPhysicalOffset, setReconAnon, setReconEnum, setReconEnummap, toShortString, visitDepthPost, visitDepthPost, visitDepthPost, visitDepthPost, visitDepthPre, visitDepthPre, visitDepthPre
-
Method Details
-
getOperator
IJavaOperator getOperator()Get the expression's operator.- Returns:
- the operator
-
setOperator
Set the operator for the expression. Dangerous method! the operator type is not checked, it is the caller's responsibility to do so.- Parameters:
operator
- operator, cannot be null
-
getOperatorType
-
checkOperatorType
-
getCountOfOperands
int getCountOfOperands() -
getLeft
IJavaExpression getLeft()Get the left member sub-expression.- Returns:
- the left expression, null if none
-
setLeft
-
getRight
IJavaExpression getRight()Get the right sub-expression.- Returns:
- the right expression
-
setRight
-
canReverse
boolean canReverse() -
reverse
Logical negation of the operation, whenever possible. The object is modified.- Parameters:
of
-- Returns:
- true if reversing was possible, false otherwise
-
canMirror
boolean canMirror() -
mirror
Mirror the operation order, whenever possible. The object is modified.- Parameters:
of
-- Returns:
- true if mirroring was possible, false otherwise
-
duplicate
IJavaOperation duplicate()Description copied from interface:IJavaElement
Duplicate this element.- Specified by:
duplicate
in interfaceIJavaElement
- Specified by:
duplicate
in interfaceIJavaExpression
- Returns:
- a (possibly) duplicated object of the same type
-