Search in sources :

Example 1 with Operator

use of au.csiro.pathling.fhirpath.operator.Operator in project pathling by aehrc.

the class Visitor method visitBinaryOperator.

@Nonnull
private FhirPath visitBinaryOperator(@Nullable final ParseTree leftContext, @Nullable final ParseTree rightContext, @Nullable final String operatorName) {
    checkNotNull(operatorName);
    // Parse the left and right expressions.
    final FhirPath left = new Visitor(context).visit(leftContext);
    final FhirPath right = new Visitor(context).visit(rightContext);
    // Retrieve an Operator instance based upon the operator string.
    final Operator operator = Operator.getInstance(operatorName);
    final OperatorInput operatorInput = new OperatorInput(context, left, right);
    return operator.invoke(operatorInput);
}
Also used : Operator(au.csiro.pathling.fhirpath.operator.Operator) FhirPath(au.csiro.pathling.fhirpath.FhirPath) FhirPathBaseVisitor(au.csiro.pathling.fhirpath.parser.generated.FhirPathBaseVisitor) OperatorInput(au.csiro.pathling.fhirpath.operator.OperatorInput) Nonnull(javax.annotation.Nonnull)

Aggregations

FhirPath (au.csiro.pathling.fhirpath.FhirPath)1 Operator (au.csiro.pathling.fhirpath.operator.Operator)1 OperatorInput (au.csiro.pathling.fhirpath.operator.OperatorInput)1 FhirPathBaseVisitor (au.csiro.pathling.fhirpath.parser.generated.FhirPathBaseVisitor)1 Nonnull (javax.annotation.Nonnull)1