Class ApplyOperatorPromotion
java.lang.Object
de.firemage.autograder.core.integrated.evaluator.fold.ApplyOperatorPromotion
- All Implemented Interfaces:
Fold
For some binary and unary operator expressions, the operands are cast to a different type before the operation
is applied. This fold applies that cast to the operands (if they are literals).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceApplyOperatorPromotion.OperatorPredicate<T extends spoon.reflect.code.CtExpression<?>> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ApplyOperatorPromotion.OperatorPredicate<? super spoon.reflect.code.CtExpression<?>> -
Method Summary
Modifier and TypeMethodDescriptionstatic Foldcreate()Creates a new instance of this fold.static Foldcreate(ApplyOperatorPromotion.OperatorPredicate<? super spoon.reflect.code.CtBinaryOperator<?>> shouldApplyOnBinaryOperator, ApplyOperatorPromotion.OperatorPredicate<? super spoon.reflect.code.CtUnaryOperator<?>> shouldApplyOnUnaryOperator) <T> spoon.reflect.code.CtExpression<T>foldCtBinaryOperator(spoon.reflect.code.CtBinaryOperator<T> ctBinaryOperator) <T> spoon.reflect.code.CtExpression<T>foldCtUnaryOperator(spoon.reflect.code.CtUnaryOperator<T> ctUnaryOperator) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.firemage.autograder.core.integrated.evaluator.fold.Fold
enter, exit, fold, foldCtExpression, foldCtLiteral, foldCtVariableRead
-
Field Details
-
APPLY_ON_LITERAL_OPERAND
public static final ApplyOperatorPromotion.OperatorPredicate<? super spoon.reflect.code.CtExpression<?>> APPLY_ON_LITERAL_OPERAND
-
-
Method Details
-
create
Creates a new instance of this fold.It applies the operator promotion by default only on binary and unary operators with literal operands.
- Returns:
- the instance of this fold
-
create
public static Fold create(ApplyOperatorPromotion.OperatorPredicate<? super spoon.reflect.code.CtBinaryOperator<?>> shouldApplyOnBinaryOperator, ApplyOperatorPromotion.OperatorPredicate<? super spoon.reflect.code.CtUnaryOperator<?>> shouldApplyOnUnaryOperator) -
foldCtBinaryOperator
public <T> spoon.reflect.code.CtExpression<T> foldCtBinaryOperator(spoon.reflect.code.CtBinaryOperator<T> ctBinaryOperator) - Specified by:
foldCtBinaryOperatorin interfaceFold
-
foldCtUnaryOperator
public <T> spoon.reflect.code.CtExpression<T> foldCtUnaryOperator(spoon.reflect.code.CtUnaryOperator<T> ctUnaryOperator) - Specified by:
foldCtUnaryOperatorin interfaceFold
-