net.sf.saxon.expr

Class VennExpression

public class VennExpression extends BinaryExpression

An expression representing a nodeset that is a union, difference, or intersection of two other NodeSets
Constructor Summary
VennExpression(Expression p1, int op, Expression p2)
Constructor
Method Summary
intcomputeCardinality()
Determine the static cardinality of the expression
intcomputeSpecialProperties()
Get the static properties of this expression (other than its type).
Expressioncopy()
Copy an expression.
booleaneffectiveBooleanValue(XPathContext context)
Get the effective boolean value.
booleanequals(Object other)
Is this expression the same as another expression?
voidgatherComponents(int operator, Set set)
Gather the component operands of a union or intersect expression
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the items returned by this expression
inthashCode()
SequenceIteratoriterate(XPathContext c)
Iterate over the value of the expression.
Expressionoptimize(ExpressionVisitor visitor, ItemType contextItemType)
Perform optimisation of an expression and its subexpressions.
Expressionsimplify(ExpressionVisitor visitor)
Simplify the expression
ExpressiontypeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression

Constructor Detail

VennExpression

public VennExpression(Expression p1, int op, Expression p2)
Constructor

Parameters: p1 the left-hand operand op the operator (union, intersection, or difference) p2 the right-hand operand

Method Detail

computeCardinality

public final int computeCardinality()
Determine the static cardinality of the expression

computeSpecialProperties

public int computeSpecialProperties()
Get the static properties of this expression (other than its type). The result is bit-signficant. These properties are used for optimizations. In general, if property bit is set, it is true, but if it is unset, the value is unknown.

copy

public Expression copy()
Copy an expression. This makes a deep copy.

Returns: the copy of the original expression

effectiveBooleanValue

public boolean effectiveBooleanValue(XPathContext context)
Get the effective boolean value. In the case of a union expression, this is reduced to an OR expression, for efficiency

equals

public boolean equals(Object other)
Is this expression the same as another expression?

gatherComponents

public void gatherComponents(int operator, Set set)
Gather the component operands of a union or intersect expression

Parameters: operator union or intersect set the set into which the components are to be gathered. If the operator is union, this follows the tree gathering all operands of union expressions. Ditto, mutatis mutandis, for intersect expressions.

getItemType

public final ItemType getItemType(TypeHierarchy th)
Determine the data type of the items returned by this expression

Parameters: th the type hierarchy cache

Returns: the data type

hashCode

public int hashCode()

iterate

public SequenceIterator iterate(XPathContext c)
Iterate over the value of the expression. The result will always be sorted in document order, with duplicates eliminated

Parameters: c The context for evaluation

Returns: a SequenceIterator representing the union of the two operands

optimize

public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType)
Perform optimisation of an expression and its subexpressions.

This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.

Parameters: visitor an expression visitor contextItemType the static type of "." at the point where this expression is invoked. The parameter is set to null if it is known statically that the context item will be undefined. If the type of the context item is not known statically, the argument is set to ITEM_TYPE

Returns: the original expression, rewritten if appropriate to optimize execution

Throws: net.sf.saxon.trans.XPathException if an error is discovered during this phase (typically a type error)

simplify

public Expression simplify(ExpressionVisitor visitor)
Simplify the expression

Parameters: visitor an expression visitor

typeCheck

public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression