getValue method

  1. @override
bool getValue(
  1. DartBlockArbiter arbiter
)
override

Implementation

@override
bool getValue(DartBlockArbiter arbiter) {
  if (leftChild != null && operator != null && rightChild != null) {
    switch (operator!) {
      case DartBlockBooleanOperator.and:
        return leftChild!.getValue(arbiter) && rightChild!.getValue(arbiter);
      case DartBlockBooleanOperator.or:
        return leftChild!.getValue(arbiter) || rightChild!.getValue(arbiter);
    }
  } else if (leftChild == null && operator != null && rightChild != null) {
    return rightChild!.getValue(arbiter);
  } else if (leftChild != null && operator != null && rightChild == null) {
    return leftChild!.getValue(arbiter);
  } else if (leftChild != null && operator == null && rightChild != null) {
    throw MalformedBooleanLogicalExpressionException(
      null,
      null,
      null,
      "Missing operator (&&, ||). ('${toString()}')",
    );
  } else if (leftChild == null && operator == null && rightChild != null) {
    return rightChild!.getValue(arbiter);
  } else if (leftChild == null && operator != null && rightChild == null) {
    throw MalformedBooleanLogicalExpressionException(
      null,
      null,
      null,
      "Missing operands. ('${toString()}')",
    );
  } else if (leftChild != null && operator == null && rightChild == null) {
    return leftChild!.getValue(arbiter);
  } else {
    // All null
    throw MalformedBooleanLogicalExpressionException(
      null,
      null,
      null,
      "Missing operands and operator (&&, ||). ('${toString()}')",
    );
  }
}