Class Expression

java.lang.Object
org.rumbledb.expressions.Node
org.rumbledb.expressions.Expression
Direct Known Subclasses:
AdditiveExpression, AndExpression, AppendExpression, ArrayConstructorExpression, ArrayLookupExpression, ArrayUnboxingExpression, AttributeNodeContentExpression, AttributeNodeExpression, BlockExpression, BooleanLiteralExpression, CastableExpression, CastExpression, CommaExpression, ComparisonExpression, ComputedAttributeConstructorExpression, ComputedElementConstructorExpression, ConditionalExpression, ContextItemExpression, CreateCollectionExpression, DecimalLiteralExpression, DeleteExpression, DeleteIndexFromCollectionExpression, DeleteSearchFromCollectionExpression, DirElemConstructorExpression, DocumentNodeConstructorExpression, DoubleLiteralExpression, DynamicFunctionCallExpression, EditCollectionExpression, FilterExpression, FlworExpression, FunctionCallExpression, InlineFunctionExpression, InsertExpression, InsertIndexIntoCollectionExpression, InsertSearchIntoCollectionExpression, InstanceOfExpression, IntegerLiteralExpression, IsStaticallyExpression, MultiplicativeExpression, NamedFunctionReferenceExpression, NodeComparisonExpression, NotExpression, NullLiteralExpression, ObjectConstructorExpression, ObjectLookupExpression, OrExpression, PostfixLookupExpression, RangeExpression, RenameExpression, ReplaceExpression, SimpleMapExpression, SlashExpr, StatementsAndExpr, StatementsAndOptionalExpr, StepExpr, StringConcatExpression, StringLiteralExpression, SwitchExpression, TextNodeConstructorExpression, TextNodeExpression, TransformExpression, TreatExpression, TruncateCollectionExpression, TryCatchExpression, TypeSwitchExpression, UnaryExpression, UnaryLookupExpression, ValidateTypeExpression, VariableReferenceExpression

public abstract class Expression extends Node
An expression is the first-class citizen in JSONiq syntax. Any expression returns a sequence of items. Expressions form a tree, but this tree may contain other nodes, such as clauses and function declarations. An expression is associated with a static context containing information such as the in-scope variables. An expression has a classification, largely denoting it as UPDATING or SIMPLE.
  • Field Details

    • staticContext

      protected StaticContext staticContext
    • staticSequenceType

      protected SequenceType staticSequenceType
    • expressionClassification

      protected ExpressionClassification expressionClassification
    • isSequential

      protected boolean isSequential
  • Constructor Details

  • Method Details

    • getStaticContext

      public StaticContext getStaticContext()
      Retrieves the static context attached to this expression.
      Returns:
      the static context.
    • setStaticContext

      public void setStaticContext(StaticContext staticContext)
      Sets the static context of the expression.
      Parameters:
      staticContext - the static context to set.
    • getStaticContextForRuntime

      public RuntimeStaticContext getStaticContextForRuntime(RumbleRuntimeConfiguration conf, VisitorConfig visitorConfig)
    • getStaticSequenceType

      public SequenceType getStaticSequenceType()
      Provides the inferred static type, only if static analysis is activated.
      Returns:
      the statically inferred sequence type.
    • alwaysReturnsAtMostOneItem

      public boolean alwaysReturnsAtMostOneItem()
      Tells whether this expression is guaranteed to return zero or one item but not more.
      Returns:
      true if yes, false otherwise.
    • setStaticSequenceType

      public void setStaticSequenceType(SequenceType staticSequenceType)
      Sets the inferred static type, for used by the static analysis visitor.
      Parameters:
      staticSequenceType - the statically inferred sequence type to set.
    • getExpressionClassification

      public ExpressionClassification getExpressionClassification()
      Gets the inferred expression classification of this node, for use ...
      Returns:
      Expression Classification of the expression.
    • setExpressionClassification

      public void setExpressionClassification(ExpressionClassification expressionClassification)
      Sets the inferred expression classification of this node, for use ...
      Parameters:
      expressionClassification - the statically inferred expression classification.
    • isUpdating

      public boolean isUpdating()
      Tells whether this node is an updating expression or not.
      Returns:
      true if yes, false otherwise.
    • isUnset

      public boolean isUnset()
      Tells whether this node has an unset expression classification.
      Returns:
      true if yes, false otherwise.
    • setSequential

      public void setSequential(boolean isSequential)
      Sets the sequential property of the expression. An expression can only be one of the following: - non-updating sequential, - non-updating non-sequential, - updating non-sequential.
      Parameters:
      isSequential - a boolean value defining if the expression is sequential or not.
      Throws:
      InvalidExpressionClassification - if the expression is both updating and sequential.
    • isSequential

      public boolean isSequential()
    • isUpdatingNonSequential

      public boolean isUpdatingNonSequential()
      Returns true if this node is updating and non-sequential.
      Returns:
      true if updating and non-sequential, false otherwise.
    • print

      public void print(StringBuffer buffer, int indent)
      Description copied from class: Node
      Prints the node tree to a string buffer.
      Overrides:
      print in class Node
      Parameters:
      buffer - a string buffer to write to
      indent - the current level of indentation