Interface IExpression

All Known Subinterfaces:
IMetapathExpression

public interface IExpression
The common interface of all Metapath expression nodes.

Metapath expression nodes represent the different types of expressions that can appear in a Metapath query, forming a composite structure that can be traversed and evaluated.

Since:
1.0.0
See Also:
  • IExpressionVisitor
  • Method Summary

    Modifier and Type
    Method
    Description
    <RESULT, CONTEXT>
    RESULT
    accept(dev.metaschema.core.metapath.cst.IExpressionVisitor<RESULT,CONTEXT> visitor, CONTEXT context)
    Provides a double dispatch callback for visitor handling.
    ISequence<? extends IItem>
    accept(DynamicContext dynamicContext, ISequence<?> focus)
    Provides a double dispatch callback for visitor handling.
    default Class<? extends IItem>
    The minimum expected result type to be produced when evaluating the expression.
    List<? extends IExpression>
    Retrieve the child expressions associated with this expression.
    Get the text for the expression.
    default Class<? extends IItem>
    The expected result type produced by evaluating the expression.
    default String
    Produce a string representation of this expression including the expression's name.
  • Method Details

    • getPath

      @NonNull String getPath()
      Get the text for the expression.
      Returns:
      the expression text
    • getChildren

      @NonNull List<? extends IExpression> getChildren()
      Retrieve the child expressions associated with this expression.
      Returns:
      a list of expressions, which may be empty
    • getBaseResultType

      @NonNull default Class<? extends IItem> getBaseResultType()
      The minimum expected result type to be produced when evaluating the expression. The result may be a sub-class or sub-interface of this value.
      Returns:
      the base result type
    • getStaticResultType

      @NonNull default Class<? extends IItem> getStaticResultType()
      The expected result type produced by evaluating the expression. The result must be the same or a sub-class or sub-interface of the value provided by getBaseResultType().

      This method can be overloaded to provide static analysis of the expression to determine a more specific result type.

      Returns:
      the result type
    • toCSTString

      @NonNull default String toCSTString()
      Produce a string representation of this expression including the expression's name.

      This method can be overloaded to provide a more appropriate representation of the expression.

      Returns:
      a string representing the data elements of the expression
    • accept

      @NonNull ISequence<? extends IItem> accept(@NonNull DynamicContext dynamicContext, @NonNull ISequence<?> focus)
      Provides a double dispatch callback for visitor handling.
      Parameters:
      dynamicContext - the dynamic evaluation context
      focus - the outer focus of the expression
      Returns:
      the result of evaluation
    • accept

      <RESULT, CONTEXT> RESULT accept(@NonNull dev.metaschema.core.metapath.cst.IExpressionVisitor<RESULT,CONTEXT> visitor, @NonNull CONTEXT context)
      Provides a double dispatch callback for visitor handling.
      Type Parameters:
      RESULT - the type of the evaluation result
      CONTEXT - the type of the visitor context
      Parameters:
      visitor - the visitor calling this method
      context - the visitor context
      Returns:
      the result of evaluation