Package net.sf.saxon.expr.oper
Class OperandArray
java.lang.Object
net.sf.saxon.expr.oper.OperandArray
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
ConstructorsConstructorDescriptionOperandArray
(Expression parent, Expression[] args) OperandArray
(Expression parent, Expression[] args, OperandRole role) OperandArray
(Expression parent, Expression[] args, OperandRole[] roles) -
Method Summary
Modifier and TypeMethodDescriptionOperand[]
copy()
static <T> boolean
Utility method (doesn't really belong here) to test if every element of an array satisfies some conditionint
Get the number of operands in the operand arraygetOperand
(int n) Get the operand whose identifying number is n.getOperandExpression
(int n) Get the child expression associated with the operand whose identifying number is n.getRoles()
Get the operand rolesiterator()
Returns an iterator over elements of typeT
.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
Utility method (doesn't really belong here) to test if some element of an array satisfies some conditionMethods 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 Details
-
OperandArray
-
OperandArray
-
OperandArray
-
-
Method Details
-
iterator
Returns an iterator over elements of typeT
. -
copy
-
getRoles
Get the operand roles- Returns:
- the roles of the operands as an array, one per operand
-
getOperand
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:
IllegalArgumentException
- if there cannot be an operand at this position
-
getOperandExpression
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:
IllegalArgumentException
- if there cannot be an operand at this position
-
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
-
setOperand
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/replacedchild
- the new subexpression- Throws:
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
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 arraycondition
- the condition- Returns:
- true if the condition is true for every item in the array
-
some
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 arraycondition
- the condition- Returns:
- true if the condition is true for every item in the array
-