protected ComparisonBuilder comparisonBuilder( DynamicOperand right ) {
DynamicOperand leftOperand = null;
// If the left operand is an arithmetic operand, then we need to check the operator precedence ...
if (left instanceof ArithmeticOperand) {
ArithmeticOperand leftArith = (ArithmeticOperand)left;
ArithmeticOperator operator = leftArith.operator();
if (this.operator.precedes(operator)) {
// Need to do create an operand with leftArith.right and right
DynamicOperand inner = new ArithmeticOperand(leftArith.getRight(), this.operator, right);
leftOperand = new ArithmeticOperand(leftArith.getLeft(), operator, inner);
} else {
// the left preceds this, so we can add the new operand on top ...
leftOperand = new ArithmeticOperand(leftArith, operator, right);
}
} else {
// The left isn't an arith ...
leftOperand = new ArithmeticOperand(left, operator, right);
}
return new ComparisonBuilder(comparisonBuilder.constraintBuilder, leftOperand);
}