@java.lang.Override public void set(spoon.reflect.code.CtExpression replace) { this.element.setLeftHandOperand(replace); } }
@Override public <T, U> void setValue(T element, U value) { castTarget(element).setLeftHandOperand(castValue(value)); } }
/** * Creates a binary operator. * * @param <T> * the type of the expression * @param left * the left operand * @param right * the right operand * @param kind * the operator kind * @return a binary operator expression */ public <T> CtBinaryOperator<T> createBinaryOperator(CtExpression<?> left, CtExpression<?> right, BinaryOperatorKind kind) { return factory.Core().<T>createBinaryOperator().setLeftHandOperand(left).setKind(kind).setRightHandOperand(right); }
public <T> void visitCtBinaryOperator(final spoon.reflect.code.CtBinaryOperator<T> operator) { spoon.reflect.code.CtBinaryOperator<T> aCtBinaryOperator = operator.getFactory().Core().createBinaryOperator(); this.builder.copy(operator, aCtBinaryOperator); aCtBinaryOperator.setAnnotations(this.cloneHelper.clone(operator.getAnnotations())); aCtBinaryOperator.setType(this.cloneHelper.clone(operator.getType())); aCtBinaryOperator.setTypeCasts(this.cloneHelper.clone(operator.getTypeCasts())); aCtBinaryOperator.setLeftHandOperand(this.cloneHelper.clone(operator.getLeftHandOperand())); aCtBinaryOperator.setRightHandOperand(this.cloneHelper.clone(operator.getRightHandOperand())); aCtBinaryOperator.setComments(this.cloneHelper.clone(operator.getComments())); this.cloneHelper.tailor(operator, aCtBinaryOperator); this.other = aCtBinaryOperator; }
if (child instanceof CtExpression) { if (operator.getLeftHandOperand() == null) { operator.setLeftHandOperand((CtExpression<?>) child); return; } else if (operator.getRightHandOperand() == null) { CtBinaryOperator<?> op = operator.getFactory().Core().createBinaryOperator(); op.setKind(BinaryOperatorKind.PLUS); op.setLeftHandOperand(operator.getRightHandOperand()); op.setRightHandOperand((CtExpression<?>) child); operator.setRightHandOperand(op);
@Override public <T> void visitCtBinaryOperator(CtBinaryOperator<T> operator) { super.visitCtBinaryOperator(operator); @SuppressWarnings("rawtypes") CtExpression left = operator.getLeftHandOperand(); if (candidates.containsKey(left)) { operator.setLeftHandOperand(candidates.get(left)); saveSketchAndSynthesize(); operator.setLeftHandOperand(left); resoreDiskFile(); } @SuppressWarnings("rawtypes") CtExpression right = operator.getRightHandOperand(); if (candidates.containsKey(right)) { operator.setRightHandOperand(candidates.get(right)); saveSketchAndSynthesize(); operator.setRightHandOperand(right); resoreDiskFile(); } }
@Override public <T> void visitCtBinaryOperator(CtBinaryOperator<T> operator) { if (child instanceof CtExpression) { if (operator.getLeftHandOperand() == null) { operator.setLeftHandOperand((CtExpression<?>) child); return; } else if (operator.getRightHandOperand() == null) { operator.setRightHandOperand((CtExpression<?>) child); return; } } super.visitCtBinaryOperator(operator); }
/** * Creates a binary operator. * * @param <T> * the type of the expression * @param left * the left operand * @param right * the right operand * @param kind * the operator kind * @return a binary operator expression */ public <T> CtBinaryOperator<T> createBinaryOperator(CtExpression<?> left, CtExpression<?> right, BinaryOperatorKind kind) { return factory.Core().<T>createBinaryOperator().setLeftHandOperand(left).setKind(kind).setRightHandOperand(right); }
private List<Ingredient> computeIngredientsNullCheck(ModificationPoint modificationPoint, List<CtVariableAccess> varAccessInModificationPoints) { List<Ingredient> ingredients = new ArrayList(); for (CtVariableAccess iVariableAccess : varAccessInModificationPoints) { CtVariableAccess iVariableAccessC = iVariableAccess.clone(); MutationSupporter.clearPosition(iVariableAccessC); CtBinaryOperator<Boolean> binaryOp = new CtBinaryOperatorImpl<>(); binaryOp.setLeftHandOperand(iVariableAccessC); binaryOp.setRightHandOperand(MutationSupporter.getFactory().createCodeSnippetExpression("null")); binaryOp.setKind(BinaryOperatorKind.NE); ingredients.add(new Ingredient(binaryOp)); } return ingredients; }
operator.setLeftHandOperand(candidates.get(left)); saveSketchAndSynthesize(); operator.setLeftHandOperand(left); resoreDiskFile();
newcond.setKind(BinaryOperatorKind.AND); newcond.setRightHandOperand(methdodinvocation); newcond.setLeftHandOperand(cond); if(!usedBinExper.contains(newcond)) { usedBinExper.add(newcond); newcond.setLeftHandOperand(cond); if(!usedBinExper.contains(newcond)) { usedBinExper.add(newcond); newcond.setKind(BinaryOperatorKind.AND); newcond.setRightHandOperand(methdodinvocation); newcond.setLeftHandOperand(cond); if(!usedBinExper.contains(newcond)) { usedBinExper.add(newcond); newcond.setLeftHandOperand(cond); if(!usedBinExper.contains(newcond)) { usedBinExper.add(newcond); newcond.setKind(BinaryOperatorKind.AND); newcond.setRightHandOperand(methdodinvocation); newcond.setLeftHandOperand(left); if(!usedBinExper.contains(newcond)) { usedBinExper.add(newcond); expr.setLeftHandOperand(newcond); saveSketchAndSynthesize(); expr.setLeftHandOperand(left); resoreDiskFile();
private List<Ingredient> computeIngredientsFromExpressionExplansion(ModificationPoint modificationPoint, CtExpression previousExpression, List<IngredientFromDyna> ingredientsDynamoth, BinaryOperatorKind operatorKind2) { List<Ingredient> ingredientsNewBinaryExpressions = new ArrayList(); for (IngredientFromDyna ingredientFromDyna : ingredientsDynamoth) { CtBinaryOperator binaryOperator = new CtBinaryOperatorImpl<>(); binaryOperator.setKind(operatorKind2); CtExpression previousExpressionCloned = previousExpression.clone(); MutationSupporter.clearPosition(previousExpressionCloned); binaryOperator.setLeftHandOperand(previousExpressionCloned); CtExpression newRightExpression = MutationSupporter.getFactory() .createCodeSnippetExpression(ingredientFromDyna.getDynmothExpression().toString()); binaryOperator.setRightHandOperand(newRightExpression); // binaryOperator.setFactory(MutationSupporter.getFactory()); binaryOperator.setParent(previousExpression.getParent()); Ingredient newIngredientExtended = new Ingredient(binaryOperator); newIngredientExtended.setDerivedFrom(previousExpression); ingredientsNewBinaryExpressions.add(newIngredientExtended); } return ingredientsNewBinaryExpressions; }
@SuppressWarnings({ "rawtypes", "static-access" }) @Override public <T> void visitCtBinaryOperator(CtBinaryOperator<T> operator) { super.visitCtBinaryOperator(operator); if(operator.getKind()==BinaryOperatorKind.AND||operator.getKind()==BinaryOperatorKind.OR) { CtExpression right = operator.getRightHandOperand(); operator.setKind(BinaryOperatorKind.AND); CtLiteral<Boolean> literalvalue = this.mutSupporter.getFactory().Core().createLiteral(); Boolean bval=true; literalvalue.setValue(bval); operator.setRightHandOperand(literalvalue); saveSketchAndSynthesize(); operator.setRightHandOperand(right); resoreDiskFile(); CtExpression left = operator.getLeftHandOperand(); operator.setKind(BinaryOperatorKind.AND); operator.setLeftHandOperand(literalvalue); saveSketchAndSynthesize(); operator.setLeftHandOperand(left); resoreDiskFile(); } }
op.setLeftHandOperand(left); op.setRightHandOperand(right); op.setType(operator.getType());
@SuppressWarnings({ "static-access", "rawtypes", "unchecked" }) public void visitCtIf(CtIf ifElement) { super.visitCtIf(ifElement); CtExpression cond = ifElement.getCondition(); CtLiteral<Boolean> literalvalue = this.mutSupporter.getFactory().Core().createLiteral(); Boolean bval=false; literalvalue.setValue(bval); CtBinaryOperator<?> newcond = this.mutSupporter.getFactory().Core().createBinaryOperator(); newcond.setKind(BinaryOperatorKind.AND); newcond.setRightHandOperand(literalvalue); newcond.setLeftHandOperand(cond); ifElement.setCondition((CtExpression<Boolean>) newcond); saveSketchAndSynthesize(); ifElement.setCondition(cond); resoreDiskFile(); }