@SuppressWarnings("unchecked") @Override public <T, U> U getValue(T element) { return ((U) ((Object) (castTarget(element).getKind()))); }
@Override public <T> void visitCtBinaryOperator(CtBinaryOperator<T> e) { final CtBinaryOperator peek = (CtBinaryOperator) this.other; if (e.getKind() == null) { if (peek.getKind() != null) { setNotEqual(CtRole.OPERATOR_KIND); } } else if (peek.getKind() == null) { setNotEqual(CtRole.OPERATOR_KIND); } else if (!e.getKind().equals(peek.getKind())) { setNotEqual(CtRole.OPERATOR_KIND); } super.visitCtBinaryOperator(e); }
public <T> void visitCtBinaryOperator(spoon.reflect.code.CtBinaryOperator<T> e) { ((spoon.reflect.code.CtBinaryOperator<T>) (other)).setKind(e.getKind()); super.visitCtBinaryOperator(e); }
@Override public <T> void visitCtBinaryOperator(CtBinaryOperator<T> operator) { enterCtExpression(operator); scan(operator.getLeftHandOperand()); printer.writeSpace(); printer.writeOperator(OperatorHelper.getOperatorText(operator.getKind())); printer.writeSpace(); try (Writable _context = context.modify()) { if (operator.getKind() == BinaryOperatorKind.INSTANCEOF) { _context.forceWildcardGenerics(true); } scan(operator.getRightHandOperand()); } exitCtExpression(operator); }
Object rightObject = ((CtLiteral<?>) right).getValue(); CtLiteral<Object> res = operator.getFactory().Core().createLiteral(); switch (operator.getKind()) { case AND: res.setValue((Boolean) leftObject && (Boolean) rightObject); throw new RuntimeException("unsupported operator " + operator.getKind()); switch (operator.getKind()) { case AND: if ((Boolean) o) {
public List<MutantCtElement> execute(CtElement toMutate) { // List<CtExpression> result = new ArrayList<CtExpression>(); List<MutantCtElement> result = new ArrayList<MutantCtElement>(); if (toMutate instanceof CtBinaryOperator<?>) { CtBinaryOperator<?> op = (CtBinaryOperator<?>) toMutate; BinaryOperatorKind kind = op.getKind(); addRemainingsAndFoward(result, op, operators1); } return result; } @Override
@Override public <T> void visitCtBinaryOperator(CtBinaryOperator<T> operator) { label = operator.getKind().toString(); }
@Override public <T> void visitCtBinaryOperator(CtBinaryOperator<T> operator) { label = operator.getKind().toString(); }
public static List<CtExpression<Boolean>> getExpressions(CtExpression<Boolean> element) { List<CtExpression<Boolean>> expsRetrieved = new ArrayList<CtExpression<Boolean>>(); if (element instanceof CtUnaryOperator) { expsRetrieved.add(element); element = ((CtUnaryOperator) element).getOperand(); } if (element instanceof CtBinaryOperator) { expsRetrieved.add(element); CtBinaryOperator bin = (CtBinaryOperator) element; if (bin.getKind().equals(BinaryOperatorKind.AND) || bin.getKind().equals(BinaryOperatorKind.OR)) { expsRetrieved.addAll(getExpressions(bin.getLeftHandOperand())); expsRetrieved.addAll(getExpressions(bin.getRightHandOperand())); } } else { if (element instanceof CtInvocation && element.getType().getSimpleName().equals(boolean.class.getSimpleName())) { expsRetrieved.add(element); } } return expsRetrieved; }
return; BinaryOperatorKind kind = ((CtBinaryOperator) ctElement).getKind(); if (!statOperator.containsKey(kind)) { statOperator.put(kind, 1);
public <T> void visitCtBinaryOperator(CtBinaryOperator<T> operator) { scan(operator.getLeftHandOperand()); write(operator.getKind().toString()); scan(operator.getRightHandOperand()); }
@Override public <T> void visitCtBinaryOperator(CtBinaryOperator<T> operator) { addFrom(operator); scan(operator.getLeftHandOperand()); if (!operator.getKind().equals(BinaryOperatorKind.INSTANCEOF)) { scan(operator.getRightHandOperand()); } }
switch (binop.getKind()) { case EQ: if (binop.getLeftHandOperand().equals(binop.getRightHandOperand())) {
CtExpression exp = null; BinaryOperatorKind kind=operator.getKind(); if(rop.contains(kind)) exp = OperatorGenerator.fetchROP(operator, this.mutSupporter, this.modificationPoint, typelefthand, "ROP");
Object rightObject = ((CtLiteral<?>) right).getValue(); CtLiteral<Object> res = operator.getFactory().Core().createLiteral(); switch (operator.getKind()) { case AND: res.setValue((Boolean) leftObject && (Boolean) rightObject); throw new RuntimeException("unsupported operator " + operator.getKind()); } else if (operator.getKind() == BinaryOperatorKind.INSTANCEOF) { CtLiteral<Boolean> res = operator.getFactory().Core().createLiteral(); CtTypeReference<?> leftType = ((CtTypedElement<?>) left).getType().box(); switch (operator.getKind()) { case AND: if ((Boolean) o) { op.setKind(operator.getKind()); op.setLeftHandOperand(left); op.setRightHandOperand(right);
@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(); } }
public <T> void visitCtBinaryOperator(CtBinaryOperator<T> operator) { enterCtExpression(operator); boolean paren = false; try { paren = (operator.getParent() instanceof CtBinaryOperator) || (operator.getParent() instanceof CtUnaryOperator); } catch (ParentNotInitializedException ex) { // nothing if we have no parent } if (paren) { write("("); } scan(operator.getLeftHandOperand()); write(" ").writeOperator(operator.getKind()).write(" "); scan(operator.getRightHandOperand()); if (paren) { write(")"); } exitCtExpression(operator); }