@Override public TypedValue staticMethodCallValue(MethodCallValue.StaticMethodCallValue val, I in) { // TODO: This changes the semantics of things a little bit MethodSignature sig = val.getSignature(); if (additionalStaticComparisonMethods.containsKey(sig)) { return new TypedValue.ComparisonValue(additionalStaticComparisonMethods.get(sig), val.args.get(0), val.args.get(1)); } return super.staticMethodCallValue(val, in); }
@Override public TypedValue virtualMethodCallValue(MethodCallValue.VirtualMethodCallValue val, I in) { // TODO: This changes the semantics of things a little bit MethodSignature sig = val.getSignature(); if (comparisonMethods.containsKey(sig)) { return new TypedValue.ComparisonValue(comparisonMethods.get(sig), val.base, val.args.get(0)); } if (additionalComparisonMethods.containsKey(sig)) { return new TypedValue.ComparisonValue(additionalComparisonMethods.get(sig), val.base, val.args.get(0)); } if (mathMethods.containsKey(sig)) { if (mathMethodsType.containsKey(sig)) return new TypedValue.MathOpValue(mathMethods.get(sig), mathMethodsType.get(sig), val.base, val.args.get(0)); else return new TypedValue.MathOpValue(mathMethods.get(sig), val.base, val.args.get(0)); } if (convertAllEquals && "equals".equals(sig.name) && "(Ljava/lang/Object;)Z".equals(sig.desc)) { return new TypedValue.ComparisonValue(ComparisonOp.eq, val.base, val.args.get(0)); } return methodCallValue(val, in); }
new TypedValue.ComparisonValue(op, (TypedValue)value1, (TypedValue)value2);
return new TypedValue.ComparisonValue(op, newLeft, newRight);
public ComparisonValue inverseValue() { ComparisonOp notOp; switch(compOp) { case eq: notOp = ComparisonOp.ne; break; case ne: notOp = ComparisonOp.eq; break; case lt: notOp = ComparisonOp.ge; break; case gt: notOp = ComparisonOp.le; break; case le: notOp = ComparisonOp.gt; break; default: case ge: notOp = ComparisonOp.lt; break; } return new ComparisonValue(notOp, left, right); } @Override public <I,O,E extends Exception> O visit(TypedValueVisitor<I,O,E> visitor, I input) throws E
@Override public ComparisonValue withNewChildren(TypedValue newLeft, TypedValue newRight) { return new ComparisonValue(compOp, newLeft, newRight); } @Override