Class OperandRole


  • public class OperandRole
    extends java.lang.Object
    Defines the role of a child expression relative to its parent expression. The properties of an operand role depend only on the kind of expression and not on the actual arguments supplied to a specific instance of the kind of operand.
    • Method Detail

      • setsNewFocus

        public boolean setsNewFocus()
        Ask whether the child expression sets the focus for evaluation of other child expressions
        Returns:
        true if the child expression is evaluated with the same focus as its parent expression
      • 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
      • hasSpecialFocusRules

        public boolean hasSpecialFocusRules()
      • isHigherOrder

        public boolean isHigherOrder()
        Ask whether the operand is a higher-order operand
        Returns:
        true if the operand is higher-order
      • isEvaluatedRepeatedly

        public boolean isEvaluatedRepeatedly()
        Ask whether the operand is a evaluated repeatedly during a single evaluation of the parent expression
        Returns:
        true if the operand is evaluated repeatedly
      • isConstrainedClass

        public boolean isConstrainedClass()
        Ask whether the operand is constrained to be of a particular class (preventing substitution of a variable binding)
        Returns:
        true if the operand expression is constrained to be of a particular class
      • setConstraint

        public void setConstraint​(java.util.function.Predicate<Expression> constraint)
        Set a constraint on the expression that can be associated with this operand type
      • withConstraint

        public OperandRole withConstraint​(java.util.function.Predicate<Expression> constraint)
      • withConstrainedClass

        public OperandRole withConstrainedClass()
      • getConstraint

        public java.util.function.Predicate<Expression> getConstraint()
        Get any constraint on the expression that can be associated with this operand type
        Returns:
        any constraint that has been registered, or null
      • getUsage

        public OperandUsage getUsage()
        Get the usage of the operand
        Returns:
        the 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
      • getTypeDeterminedUsage

        public static OperandUsage getTypeDeterminedUsage​(ItemType type)
        Static method to get the type-determined usage for a particular ItemType
        Parameters:
        type - the required type
        Returns:
        the type-determined operand usage
      • modifyProperty

        public OperandRole modifyProperty​(int property,
                                          boolean on)
      • getProperties

        public int getProperties()