getValue method
Implementation
@override
bool getValue(DartBlockArbiter arbiter) {
if (operator != null && leftChild != null && rightChild != null) {
switch (operator!) {
case DartBlockNumberComparisonOperator.equal:
return leftChild!.value.getValue(arbiter) ==
rightChild!.value.getValue(arbiter);
case DartBlockNumberComparisonOperator.notEqual:
return leftChild!.value.getValue(arbiter) !=
rightChild!.value.getValue(arbiter);
case DartBlockNumberComparisonOperator.greater:
return leftChild!.value.getValue(arbiter) >
rightChild!.value.getValue(arbiter);
case DartBlockNumberComparisonOperator.greaterOrEqual:
return leftChild!.value.getValue(arbiter) >=
rightChild!.value.getValue(arbiter);
case DartBlockNumberComparisonOperator.less:
return leftChild!.value.getValue(arbiter) <
rightChild!.value.getValue(arbiter);
case DartBlockNumberComparisonOperator.lessOrEqual:
return leftChild!.value.getValue(arbiter) <=
rightChild!.value.getValue(arbiter);
}
} else {
if (operator == null && leftChild == null && rightChild == null) {
throw MalformedBooleanNumberComparisonExpressionException(
null,
null,
null,
"An operator (>, >=, ==, !=, <=, <) and two operands are required. ('${toString()}')",
);
} else if (operator == null && leftChild != null && rightChild != null) {
throw MalformedBooleanNumberComparisonExpressionException(
null,
null,
null,
"An operator (>, >=, ==, !=, <=, <) is required. ('${toString()}')",
);
} else if (operator == null && leftChild == null && rightChild != null) {
throw MalformedBooleanNumberComparisonExpressionException(
null,
null,
null,
"An operator (>, >=, ==, !=, <=, <) and a left operand are required. ('${toString()}')",
);
} else if (operator == null && leftChild != null && rightChild == null) {
throw MalformedBooleanNumberComparisonExpressionException(
null,
null,
null,
"An operator (>, >=, ==, !=, <=, <) and a right operand are required. ('${toString()}')",
);
} else if (operator != null && leftChild == null && rightChild == null) {
throw MalformedBooleanNumberComparisonExpressionException(
null,
null,
null,
"Two operands are required. ('${toString()}')",
);
} else if (operator != null && leftChild == null && rightChild != null) {
throw MalformedBooleanNumberComparisonExpressionException(
null,
null,
null,
"A left operand is required. ('${toString()}')",
);
}
// No right operand
else {
throw MalformedBooleanNumberComparisonExpressionException(
null,
null,
null,
"A right operand is required. ('${toString()}')",
);
}
}
}