Package net.sf.saxon.om

## Interface AtomicSequence

- All Superinterfaces:
    `GroundedValue`, `java.lang.Iterable<AtomicValue>`, `Sequence`
  All Known Implementing Classes:
    `AnyURIValue`, `AtomicArray`, `AtomicValue`, `Base64BinaryValue`, `BigDecimalValue`, `BigIntegerValue`, `BooleanValue`, `CalendarValue`, `CompactStringValue`, `DateTimeValue`, `DateValue`, `DayTimeDurationValue`, `DecimalValue`, `DoubleValue`, `DurationValue`, `EmptyAtomicSequence`, `FloatValue`, `GDateValue`, `GDayValue`, `GMonthDayValue`, `GMonthValue`, `GYearMonthValue`, `GYearValue`, `HexBinaryValue`, `Int64Value`, `IntegerRange`, `IntegerValue`, `NestedIntegerValue`, `NotationValue`, `NumericValue`, `QNameValue`, `QualifiedNameValue`, `StringValue`, `TimeValue`, `UntypedAtomicValue`, `YearMonthDurationValue`

      public interface AtomicSequence
      extends GroundedValue, java.lang.Iterable<AtomicValue>

  Interface representing a sequence of atomic values. This is often used to represent the typed value of a node. In most cases the typed value of a node is a single atomic value, so the class AtomicValue implements this interface.

  An AtomicSequence is always represented as a GroundedValue: that is, the entire sequence is in memory, making operations such as `itemAt(int)` and `getLength()` possible.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.CharSequence` | `getCanonicalLexicalRepresentation()` | Get the canonical lexical representation as defined in XML Schema.
    `int` | `getLength()` | Get the length of the sequence
    `java.lang.Comparable<?>` | `getSchemaComparable()` | Get a Comparable value that implements the XML Schema ordering comparison semantics for this value.
    `java.lang.String` | `getStringValue()` | Get a string representation of the sequence.
    `java.lang.CharSequence` | `getStringValueCS()` | Get a string representation of the sequence.
    `AtomicValue` | `head()` | Get the first item in the sequence
    `AtomicValue` | `itemAt​(int n)` | Get the Nth item in the sequence, zero-based
    `AtomicIterator` | `iterate()` | Make an iterator over the items in the sequence

    - ### Methods inherited from interface net.sf.saxon.om.GroundedValue

      `asIterable, concatenate, containsNode, effectiveBooleanValue, materialize, reduce, subsequence, toShortString`

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

      `forEach, iterator, spliterator`

    - ### Methods inherited from interface net.sf.saxon.om.Sequence

      `makeRepeatable`

- - ### Method Detail

    - #### head

          AtomicValue head()

      Get the first item in the sequence
      Specified by:
        `head` in interface `GroundedValue`
      Specified by:
        `head` in interface `Sequence`
      Returns:
        the first item in the sequence, or null if the sequence is empty

    - #### iterate

          AtomicIterator iterate()

      Make an iterator over the items in the sequence
      Specified by:
        `iterate` in interface `GroundedValue`
      Specified by:
        `iterate` in interface `Sequence`
      Returns:
        an iterator over the items in the sequence

    - #### itemAt

          AtomicValue itemAt​(int n)

      Get the Nth item in the sequence, zero-based
      Specified by:
        `itemAt` in interface `GroundedValue`
      Parameters:
        `n` - the index of the required item, with 0 representing the first item in the sequence
      Returns:
        the Nth item in the sequence, or null if the index is out of range

    - #### getLength

          int getLength()

      Get the length of the sequence
      Specified by:
        `getLength` in interface `GroundedValue`
      Returns:
        the number of items in the sequence

    - #### getCanonicalLexicalRepresentation

          java.lang.CharSequence getCanonicalLexicalRepresentation()

      Get the canonical lexical representation as defined in XML Schema. This is not always the same as the result of casting to a string according to the XPath rules.
      Returns:
        the canonical lexical representation if defined in XML Schema; otherwise, the result of casting to string according to the XPath 2.0 rules

    - #### getSchemaComparable

          java.lang.Comparable<?> getSchemaComparable()

      Get a Comparable value that implements the XML Schema ordering comparison semantics for this value. The default implementation is written to compare sequences of atomic values. This method is overridden for AtomicValue and its subclasses.

      In the case of data types that are partially ordered, the returned Comparable extends the standard semantics of the compareTo() method by returning the value `SequenceTool.INDETERMINATE_ORDERING` when there is no defined order relationship between two given values.

      Returns:
        a Comparable that follows XML Schema comparison rules

    - #### getStringValueCS

          java.lang.CharSequence getStringValueCS()

      Get a string representation of the sequence. The is the space-separated concatenation of the result of casting each of the items in the sequence to xs:string
      Specified by:
        `getStringValueCS` in interface `GroundedValue`
      Returns:
        a whitespace-separated concatenation of the string values of the items making up the sequence, as a CharSequence.

    - #### getStringValue

          java.lang.String getStringValue()

      Get a string representation of the sequence. The is the space-separated concatenation of the result of casting each of the items in the sequence to xs:string
      Specified by:
        `getStringValue` in interface `GroundedValue`
      Returns:
        a whitespace-separated concatenation of the string values of the items making up the sequence, as a String.