Package net.sf.saxon.expr.oper

## Class OperandArray

- java.lang.Object
- - net.sf.saxon.expr.oper.OperandArray

- All Implemented Interfaces:
    `java.lang.Iterable<Operand>`

      public class OperandArray
      extends java.lang.Object
      implements java.lang.Iterable<Operand>

  Defines an operand set comprising an array of operands numbered zero to N. All operands must be present. Typically (but not exclusively) used for the arguments of a function call. The operands may all have the same operand roles, or have different operand roles.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `OperandArray​(Expression parent, Expression[] args)` |
    `OperandArray​(Expression parent, Expression[] args, OperandRole role)` |
    `OperandArray​(Expression parent, Expression[] args, OperandRole[] roles)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Operand[]` | `copy()` |
    `static <T> boolean` | `every​(T[] args, java.util.function.Predicate<T> condition)` | Utility method (doesn't really belong here) to test if every element of an array satisfies some condition
    `int` | `getNumberOfOperands()` | Get the number of operands in the operand array
    `Operand` | `getOperand​(int n)` | Get the operand whose identifying number is n.
    `Expression` | `getOperandExpression​(int n)` | Get the child expression associated with the operand whose identifying number is n.
    `OperandRole[]` | `getRoles()` | Get the operand roles
    `java.util.Iterator<Operand>` | `iterator()` | Returns an iterator over elements of type `T`.
    `java.lang.Iterable<Expression>` | `operandExpressions()` |
    `java.lang.Iterable<Operand>` | `operands()` | Return a collection containing all the operands.
    `void` | `setOperand​(int n, Expression child)` | Set the value of the operand with integer n.
    `static <T> boolean` | `some​(T[] args, java.util.function.Predicate<T> condition)` | Utility method (doesn't really belong here) to test if some element of an array satisfies some condition

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Constructor Detail

    - #### OperandArray

          public OperandArray​(Expression parent,
                              Expression[] args)

    - #### OperandArray

          public OperandArray​(Expression parent,
                              Expression[] args,
                              OperandRole[] roles)

    - #### OperandArray

          public OperandArray​(Expression parent,
                              Expression[] args,
                              OperandRole role)

  - ### Method Detail

    - #### iterator

          public java.util.Iterator<Operand> iterator()

      Returns an iterator over elements of type `T`.
      Specified by:
        `iterator` in interface `java.lang.Iterable<Operand>`
      Returns:
        an Iterator.

    - #### copy

          public Operand[] copy()

    - #### getRoles

          public OperandRole[] getRoles()

      Get the operand roles
      Returns:
        the roles of the operands as an array, one per operand

    - #### getOperand

          public Operand getOperand​(int n)

      Get the operand whose identifying number is n.
      Parameters:
        `n` - the identifier of the operand (counting from zero)
      Returns:
        the operand, or null in the case of an optional operand that is absent in the case of this particular expression
      Throws:
        `java.lang.IllegalArgumentException` - if there cannot be an operand at this position

    - #### getOperandExpression

          public Expression getOperandExpression​(int n)

      Get the child expression associated with the operand whose identifying number is n.
      Parameters:
        `n` - the identifier of the operand
      Returns:
        the expression associated with the operand, or null in the case of an optional operand that is absent in the case of this particular expression
      Throws:
        `java.lang.IllegalArgumentException` - if there cannot be an operand at this position

    - #### operands

          public java.lang.Iterable<Operand> operands()

      Return a collection containing all the operands. Generally there is a significance to the order of operands, which usually reflects the order in the raw textual expression.
      Returns:
        the collection of operands

    - #### operandExpressions

          public java.lang.Iterable<Expression> operandExpressions()

    - #### setOperand

          public void setOperand​(int n,
                                 Expression child)

      Set the value of the operand with integer n. The method should implement a fast path for the case where the operand has not actually been changed.
      Parameters:
        `n` - identifies the expression to be set/replaced
        `child` - the new subexpression
      Throws:
        `java.lang.IllegalArgumentException` - if the value of n identifies no operand

    - #### getNumberOfOperands

          public int getNumberOfOperands()

      Get the number of operands in the operand array
      Returns:
        the number of operands

    - #### every

          public static <T> boolean every​(T[] args,
                                          java.util.function.Predicate<T> condition)

      Utility method (doesn't really belong here) to test if every element of an array satisfies some condition
      Type Parameters:
        `T` - the type of the items in the array
      Parameters:
        `args` - the array
        `condition` - the condition
      Returns:
        true if the condition is true for every item in the array

    - #### some

          public static <T> boolean some​(T[] args,
                                         java.util.function.Predicate<T> condition)

      Utility method (doesn't really belong here) to test if some element of an array satisfies some condition
      Type Parameters:
        `T` - the type of the items in the array
      Parameters:
        `args` - the array
        `condition` - the condition
      Returns:
        true if the condition is true for every item in the array