Class ComparisonOperation
- java.lang.Object
-
- org.benf.cfr.reader.bytecode.analysis.parse.expression.AbstractExpression
-
- org.benf.cfr.reader.bytecode.analysis.parse.expression.ComparisonOperation
-
- All Implemented Interfaces:
HasByteCodeLoc
,Expression
,ConditionalExpression
,BoxingProcessor
,DeepCloneable<Expression>
,ComparableUnderEC
,Dumpable
,DumpableWithPrecedence
,TypeUsageCollectable
public class ComparisonOperation extends AbstractExpression implements ConditionalExpression, BoxingProcessor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ComparisonOperation.BooleanComparisonType
-
Field Summary
Fields Modifier and Type Field Description private boolean
canNegate
private Expression
lhs
private CompOp
op
private Expression
rhs
-
Constructor Summary
Constructors Constructor Description ComparisonOperation(BytecodeLoc loc, Expression lhs, Expression rhs, CompOp op)
ComparisonOperation(BytecodeLoc loc, Expression lhs, Expression rhs, CompOp op, boolean canNegate)
-
Method Summary
-
Methods inherited from class org.benf.cfr.reader.bytecode.analysis.parse.expression.AbstractExpression
addLoc, canPushDownInto, dump, dumpWithOuterPrecedence, getInferredJavaType, getLoc, isSimple, isValidStatement, outerDeepClone, pushDown, toString, visit
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.benf.cfr.reader.bytecode.analysis.parse.rewriters.DeepCloneable
outerDeepClone
-
Methods inherited from interface org.benf.cfr.reader.util.output.DumpableWithPrecedence
dumpWithOuterPrecedence
-
Methods inherited from interface org.benf.cfr.reader.bytecode.analysis.parse.Expression
canPushDownInto, dump, getInferredJavaType, isSimple, isValidStatement, pushDown, visit
-
Methods inherited from interface org.benf.cfr.reader.bytecode.analysis.loc.HasByteCodeLoc
addLoc, getLoc
-
-
-
-
Field Detail
-
lhs
private Expression lhs
-
rhs
private Expression rhs
-
op
private final CompOp op
-
canNegate
private final boolean canNegate
-
-
Constructor Detail
-
ComparisonOperation
public ComparisonOperation(BytecodeLoc loc, Expression lhs, Expression rhs, CompOp op)
-
ComparisonOperation
public ComparisonOperation(BytecodeLoc loc, Expression lhs, Expression rhs, CompOp op, boolean canNegate)
-
-
Method Detail
-
deepClone
public Expression deepClone(CloneHelper cloneHelper)
- Specified by:
deepClone
in interfaceDeepCloneable<Expression>
-
getCombinedLoc
public BytecodeLoc getCombinedLoc()
- Specified by:
getCombinedLoc
in interfaceHasByteCodeLoc
-
collectTypeUsages
public void collectTypeUsages(TypeUsageCollector collector)
- Specified by:
collectTypeUsages
in interfaceTypeUsageCollectable
- Overrides:
collectTypeUsages
in classAbstractExpression
-
getSize
public int getSize(Precedence outerPrecedence)
- Specified by:
getSize
in interfaceConditionalExpression
-
getPrecedence
public Precedence getPrecedence()
- Specified by:
getPrecedence
in interfaceDumpableWithPrecedence
- Specified by:
getPrecedence
in classAbstractExpression
-
dumpInner
public Dumper dumpInner(Dumper d)
- Specified by:
dumpInner
in classAbstractExpression
-
replaceSingleUsageLValues
public Expression replaceSingleUsageLValues(LValueRewriter lValueRewriter, SSAIdentifiers ssaIdentifiers, StatementContainer statementContainer)
- Specified by:
replaceSingleUsageLValues
in interfaceExpression
-
applyExpressionRewriter
public Expression applyExpressionRewriter(ExpressionRewriter expressionRewriter, SSAIdentifiers ssaIdentifiers, StatementContainer statementContainer, ExpressionRewriterFlags flags)
- Specified by:
applyExpressionRewriter
in interfaceExpression
-
applyReverseExpressionRewriter
public Expression applyReverseExpressionRewriter(ExpressionRewriter expressionRewriter, SSAIdentifiers ssaIdentifiers, StatementContainer statementContainer, ExpressionRewriterFlags flags)
- Specified by:
applyReverseExpressionRewriter
in interfaceExpression
-
getNegated
public ConditionalExpression getNegated()
- Specified by:
getNegated
in interfaceConditionalExpression
-
getOp
public CompOp getOp()
-
getDemorganApplied
public ConditionalExpression getDemorganApplied(boolean amNegating)
- Specified by:
getDemorganApplied
in interfaceConditionalExpression
-
getRightDeep
public ConditionalExpression getRightDeep()
- Specified by:
getRightDeep
in interfaceConditionalExpression
-
addIfLValue
private void addIfLValue(Expression expression, java.util.Set<LValue> res)
-
getLoopLValues
public java.util.Set<LValue> getLoopLValues()
- Specified by:
getLoopLValues
in interfaceConditionalExpression
-
collectUsedLValues
public void collectUsedLValues(LValueUsageCollector lValueUsageCollector)
- Specified by:
collectUsedLValues
in interfaceExpression
-
isBooleanComparison
private static ComparisonOperation.BooleanComparisonType isBooleanComparison(Expression a, Expression b, CompOp op)
-
getConditionalExpression
private ConditionalExpression getConditionalExpression(Expression booleanExpression, ComparisonOperation.BooleanComparisonType booleanComparisonType)
-
optimiseForType
public ConditionalExpression optimiseForType()
- Specified by:
optimiseForType
in interfaceConditionalExpression
-
getLhs
public Expression getLhs()
-
getRhs
public Expression getRhs()
-
simplify
public ConditionalExpression simplify()
- Specified by:
simplify
in interfaceConditionalExpression
-
rewriteBoxing
public boolean rewriteBoxing(PrimitiveBoxingRewriter boxingRewriter)
- Specified by:
rewriteBoxing
in interfaceBoxingProcessor
-
applyNonArgExpressionRewriter
public void applyNonArgExpressionRewriter(ExpressionRewriter expressionRewriter, SSAIdentifiers ssaIdentifiers, StatementContainer statementContainer, ExpressionRewriterFlags flags)
- Specified by:
applyNonArgExpressionRewriter
in interfaceBoxingProcessor
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in classAbstractExpression
-
canThrow
public boolean canThrow(ExceptionCheck caught)
- Specified by:
canThrow
in interfaceExpression
- Overrides:
canThrow
in classAbstractExpression
-
equivalentUnder
public final boolean equivalentUnder(java.lang.Object o, EquivalenceConstraint constraint)
- Specified by:
equivalentUnder
in interfaceComparableUnderEC
- Specified by:
equivalentUnder
in interfaceExpression
-
getComputedLiteral
public Literal getComputedLiteral(java.util.Map<LValue,Literal> display)
- Specified by:
getComputedLiteral
in interfaceExpression
- Overrides:
getComputedLiteral
in classAbstractExpression
-
-