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 TypeMethodDescriptionbooleanDetermine whether this operation can be mirrored.booleanDetermine whether this operation can be logically reversed.default booleancheckOperatorType(JavaOperatorType optype) Determine whether this operation uses a specific operator type.Duplicate this element.intRetrieve the operand count.getLeft()Get the left member sub-expression.Get the expression's operator.default JavaOperatorTypeRetrieve the operation's operator type.getRight()Get the right sub-expression.booleanMirror the operation order, whenever possible.booleanLogical negation of the operation, whenever possible.voidsetLeft(IJavaExpression left) Set the left member sub-expression.voidsetOperator(IJavaOperator operator) Set the operator for the expression.voidsetRight(IJavaExpression right) Set the right member sub-expression.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
Retrieve the operation's operator type.- Returns:
- operator type
-
checkOperatorType
Determine whether this operation uses a specific operator type.- Parameters:
optype- operator type- Returns:
- true if this operation uses the provided operator type
-
getCountOfOperands
int getCountOfOperands()Retrieve the operand count.- Returns:
- operand count
-
getLeft
IJavaExpression getLeft()Get the left member sub-expression.- Returns:
- the left expression, null if none
-
setLeft
Set the left member sub-expression.- Parameters:
left- left expression, or null for unary operators
-
getRight
IJavaExpression getRight()Get the right sub-expression.- Returns:
- the right expression
-
setRight
Set the right member sub-expression.- Parameters:
right- right expression
-
canReverse
boolean canReverse()Determine whether this operation can be logically reversed.- Returns:
- true if
reverse(IJavaOperatorFactory)may succeed
-
reverse
Logical negation of the operation, whenever possible. The object is modified.- Parameters:
of- operator factory- Returns:
- true if reversing was possible, false otherwise
-
canMirror
boolean canMirror()Determine whether this operation can be mirrored.- Returns:
- true if
mirror(IJavaOperatorFactory)may succeed
-
mirror
Mirror the operation order, whenever possible. The object is modified.- Parameters:
of- operator factory- Returns:
- true if mirroring was possible, false otherwise
-
duplicate
IJavaOperation duplicate()Description copied from interface:IJavaElementDuplicate this element.- Specified by:
duplicatein interfaceIJavaElement- Specified by:
duplicatein interfaceIJavaExpression- Returns:
- a (possibly) duplicated object of the same type
-