Class Operand

    • Constructor Detail

      • Operand

        public Operand​(Expression parentExpression,
                       Expression childExpression,
                       OperandRole role)
        Create an operand object
        Parameters:
        parentExpression - the expression of which this is an operand
        childExpression - the actual expression used as the operand
        role - information about the role this operand plays within the parent expression
    • Method Detail

      • getParentExpression

        public Expression getParentExpression()
        Get the parent expression of this operand
        Returns:
        the parent expression
      • getChildExpression

        public Expression getChildExpression()
        Get the expression used as the actual operand
        Returns:
        the child expression
      • setChildExpression

        public void setChildExpression​(Expression childExpression)
        Change the child expression used for this operand. This is the only approved way of making structural changes to the expression tree, and the implementation of this method is responsible for maintaining the consistency of the tree
        Specified by:
        setChildExpression in interface ExpressionOwner
        Parameters:
        childExpression - the new child expression
      • detachChild

        public void detachChild()
      • getOperandRole

        public OperandRole getOperandRole()
        Get the operand role
        Returns:
        the operand role
      • setOperandRole

        public void setOperandRole​(OperandRole role)
        Set the operand role
        Parameters:
        role - the operand role
      • setsNewFocus

        public boolean setsNewFocus()
        Ask whether the child expression sets a new focus for evaluation of other operands
        Returns:
        true if the child expression is evaluated with the same focus as its parent expression
      • hasSpecialFocusRules

        public boolean hasSpecialFocusRules()
      • hasSameFocus

        public boolean hasSameFocus()
        Ask whether the child expression is evaluated with the same focus as its parent expression
        Returns:
        true if the child expression is evaluated with the same focus as its parent expression
      • isEvaluatedRepeatedly

        public boolean isEvaluatedRepeatedly()
        Ask whether the operand is a higher-order operand, in the sense that the child expression is evaluated repeatedly during a single evaluation of the parent expression
        Returns:
        true if the operand is higher-order
      • isHigherOrder

        public boolean isHigherOrder()
        Ask whether the operand is a higher-order operand, in the sense that the child expression is evaluated repeatedly during a single evaluation of the parent expression
        Returns:
        true if the operand is higher-order
      • getUsage

        public OperandUsage getUsage()
        Get the usage of the operand
        Returns:
        the usage
      • setUsage

        public void setUsage​(OperandUsage usage)
        Set the usage of the operand
        Parameters:
        usage - the operand usage
      • getRequiredType

        public SequenceType getRequiredType()
        Get the required type of the operand
        Returns:
        the required type
      • isInChoiceGroup

        public boolean isInChoiceGroup()
        Ask whether the operand is a member of a choice group
        Returns:
        true if the operand is in a choice group
      • iterator

        public Iterator<Operand> iterator()
        Get a singleton iterator that returns this operand only
        Specified by:
        iterator in interface Iterable<Operand>
        Returns:
        a singleton iterator