## net.sf.saxon.value
Class SequenceValue

    java.lang.Object
      |
      +--net.sf.saxon.value.Value
            |
            +--net.sf.saxon.value.SequenceValue

All Implemented Interfaces:
  Expression, java.io.Serializable

Direct Known Subclasses:
  Closure, EmptySequence, SequenceExtent, SequenceIntent

public abstract class SequenceValue
extends Value

A SequenceValue object represents a sequence whose members are all AtomicValues or Nodes.

See Also:
  Serialized Form

Field Summary

Fields inherited from interface net.sf.saxon.expr.Expression
`EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD`

Constructor Summary
`SequenceValue()`

Method Summary
`java.lang.Object` `convertToJava(java.lang.Class target, Configuration config, XPathContext context)` Convert to Java object (for passing to external functions)
`void` `display(int level, NamePool pool, java.io.PrintStream out)` Diagnostic display of the expression
`boolean` `effectiveBooleanValue(XPathContext context)` Get the effective boolean value of the expression.
`boolean` `equals(java.lang.Object obj)` Compare two sequence values for equality.
`java.lang.String` `evaluateAsString(XPathContext context)` Evaluate an expression as a String.
`Item` `evaluateItem(XPathContext context)` Evaluate as a singleton item (or empty sequence)
`int` `getCardinality()` Determine the cardinality
`int` `getImplementationMethod()` An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
`ItemType` `getItemType()` Determine the data type of the items in the expression, if possible
`java.lang.String` `getStringValue()` Convert the value to a string, using the serialization rules.
`int` `hashCode()` Return a hash code to support the equals() function
`Item` `itemAt(int n)` Get the n'th item in the sequence (starting from 0).
`SequenceExtent` `materialize()` Materialize the SequenceValue as a SequenceExtent
`void` `process(XPathContext context)` Process the instruction, without returning any tail calls

Methods inherited from class net.sf.saxon.value.Value
`analyze, asItem, asValue, collapseWhitespace, convertJavaObjectToXPath, getDependencies, getParentExpression, getSpecialProperties, inverse, iterateSubExpressions, normalizeWhitespace, promote, simplify, stringToNumber, toString, trimWhitespace`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface net.sf.saxon.expr.Expression
`iterate`

Constructor Detail

### SequenceValue

    public SequenceValue()

Method Detail

### materialize

    public SequenceExtent materialize()
                               throws XPathException

  Materialize the SequenceValue as a SequenceExtent

    `XPathException`

### getImplementationMethod

    public final int getImplementationMethod()

  An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is prefered.

### process

    public final void process(XPathContext context)
                       throws XPathException

  Process the instruction, without returning any tail calls

  Parameters:
    `context` - The dynamic context, giving access to the current node, the current variables, etc.
    `XPathException`

### getItemType

    public ItemType getItemType()

  Determine the data type of the items in the expression, if possible

  Returns:
    AnyItemType (not known)

### getCardinality

    public int getCardinality()

  Determine the cardinality

  Returns:
    one of the values Cardinality.ONE_OR_MORE, Cardinality.ZERO_OR_MORE, Cardinality.EXACTLY_ONE, Cardinality.ZERO_OR_ONE, Cardinality.EMPTY. This default implementation returns ZERO_OR_MORE (which effectively gives no information).

### itemAt

    public Item itemAt(int n)
                throws XPathException

  Get the n'th item in the sequence (starting from 0). This is defined for all SequenceValues, but its real benefits come for a SequenceValue stored extensionally

    `XPathException`

### evaluateItem

    public Item evaluateItem(XPathContext context)
                      throws XPathException

  Evaluate as a singleton item (or empty sequence)

  Parameters:
    `context` - The context in which the expression is to be evaluated
  Returns:
    the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
  Throws:
    `XPathException` - if any dynamic error occurs evaluating the expression

### getStringValue

    public java.lang.String getStringValue()
                                    throws XPathException

  Convert the value to a string, using the serialization rules. For atomic values this is the same as a cast; for sequence values it gives a space-separated list.

  Specified by:
    `getStringValue` in class `Value`
  Throws:
    `XPathException` - The method can fail if evaluation of the value has been deferred, and if a failure occurs during the deferred evaluation. No failure is possible in the case of an AtomicValue.

### evaluateAsString

    public java.lang.String evaluateAsString(XPathContext context)
                                      throws XPathException

  Evaluate an expression as a String. This function must only be called in contexts where it is known that the expression will return a single string (or where an empty sequence is to be treated as a zero-length string). Implementations should not attempt to convert the result to a string, other than converting () to "". This method is used mainly to evaluate expressions produced by compiling an attribute value template.

  Parameters:
    `context` - The context in which the expression is to be evaluated
  Returns:
    the value of the expression, evaluated in the current context. The expression must return a string or (); if the value of the expression is (), this method returns "".
  Throws:
    `XPathException` - if any dynamic error occurs evaluating the expression
    `java.lang.ClassCastException` - if the result type of the expression is not xs:string?

### effectiveBooleanValue

    public boolean effectiveBooleanValue(XPathContext context)
                                  throws XPathException

  Get the effective boolean value of the expression. This returns false if the value is the empty sequence, a zero-length string, a number equal to zero, or the boolean false. Otherwise it returns true.

  Parameters:
    `context` - The context in which the expression is to be evaluated
  Returns:
    the effective boolean value
  Throws:
    `XPathException` - if any dynamic error occurs evaluating the expression

### equals

    public boolean equals(java.lang.Object obj)

  Compare two sequence values for equality. This supports identity constraints in XML Schema, which allow list-valued elements and attributes to participate in key and uniqueness constraints. This method returns false if any error occurs during the comparison, or if any of the items in either sequence is a node rather than an atomic value.

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Return a hash code to support the equals() function

  Overrides:
    `hashCode` in class `java.lang.Object`

### convertToJava

    public java.lang.Object convertToJava(java.lang.Class target,
                                          Configuration config,
                                          XPathContext context)
                                   throws XPathException

  Convert to Java object (for passing to external functions)

  Specified by:
    `convertToJava` in class `Value`
  Parameters:
    `target` - The class required by the external function
    `config` - The configuration (needed for access to schema information)
  Returns:
    an object of the target class
    `XPathException`

### display

    public void display(int level,
                        NamePool pool,
                        java.io.PrintStream out)

  Diagnostic display of the expression

  Parameters:
    `level` - indentation level for this expression
    `pool` - NamePool used to expand any names appearing in the expression
    `out` - Output destination