public boolean equalsNegated(GuardExpression other) { boolean negated = false; DSLExpression thisExpression = expression; if (thisExpression instanceof Negate) { negated = true; thisExpression = ((Negate) thisExpression).getReceiver(); } boolean otherNegated = false; DSLExpression otherExpression = other.expression; if (otherExpression instanceof Negate) { otherNegated = true; otherExpression = ((Negate) otherExpression).getReceiver(); } return Objects.equals(thisExpression, otherExpression) && negated != otherNegated; }
public void visitNegate(Negate negate) { TypeMirror booleanType = context.getType(boolean.class); TypeMirror resolvedType = negate.getResolvedType(); if (!ElementUtils.typeEquals(resolvedType, booleanType)) { throw new InvalidExpressionException(String.format("The operator %s is undefined for the argument type %s.", "!", ElementUtils.getSimpleName(resolvedType))); } }
public boolean equalsNegated(GuardExpression other) { boolean negated = false; DSLExpression thisExpression = expression; if (thisExpression instanceof Negate) { negated = true; thisExpression = ((Negate) thisExpression).getReceiver(); } boolean otherNegated = false; DSLExpression otherExpression = other.expression; if (otherExpression instanceof Negate) { otherNegated = true; otherExpression = ((Negate) otherExpression).getReceiver(); } return Objects.equals(thisExpression, otherExpression) && negated != otherNegated; }
DSLExpression NegateFactor() { DSLExpression result; boolean negated = false; if (la.kind == 10) { Get(); negated = true; } result = Factor(); result = negated ? new Negate(result) : result; return result; }
DSLExpression NegateFactor() { DSLExpression result; boolean negated = false; if (la.kind == 10) { Get(); negated = true; } result = Factor(); result = negated ? new Negate(result) : result; return result; }
public void visitNegate(Negate negate) { TypeMirror booleanType = context.getType(boolean.class); TypeMirror resolvedType = negate.getResolvedType(); if (!ElementUtils.typeEquals(resolvedType, booleanType)) { throw new InvalidExpressionException(String.format("The operator %s is undefined for the argument type %s.", "!", ElementUtils.getSimpleName(resolvedType))); } }
@Override public DSLExpression reduce(DSLExpressionReducer visitor) { DSLExpression newReceiver = receiver.reduceImpl(visitor); DSLExpression negate = this; if (newReceiver != receiver) { negate = new Negate(newReceiver); negate.setResolvedTargetType(getResolvedTargetType()); } return negate; }