Package acdp.misc

Class Layout.Seq

java.lang.Object
acdp.misc.Layout.Seq
Enclosing class:
Layout

public static final class Layout.Seq extends Object
Defines the sequence value type of a layout. A sequence is one of the three value types of an entry in a layout or of an element in a sequence.
Author:
Beat Hörmann
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Layout layout)
    Appends the specified layout to the end of this sequence.
    Appends the specified sequence to the end of this sequence.
    add(String value)
    Appends the specified string value to the end of this sequence.
    final Layout
    Creates a new layout, appends it to the end of this sequence and returns the new layout.
    Creates a new sequence, appends it to the end of this sequence and returns the new sequence.
    final List<Object>
    Returns this sequence as an unmodifiable list.
    final Layout
    getLayout(int index)
    Returns the layout at the specified position in this sequence.
    getSeq(int index)
    Returns the sequence at the specified position in this sequence.
    final String
    getString(int index)
    Returns the string value at the specified position in this sequence.
    insert(int index, Layout layout)
    Inserts the specified layout at the specified position in this sequence.
    insert(int index, Layout.Seq seq)
    Inserts the specified sequence at the specified position in this sequence.
    insert(int index, String value)
    Inserts the specified string value at the specified position in this sequence.
    final Layout
    insertLayout(int index)
    Creates a new layout, inserts it at the specified position in this sequence and returns the new layout.
    insertSeq(int index)
    Creates a new sequence, inserts it at the specified position in this sequence and returns the new sequence.
    remove(int index)
    Removes the element at the specified position in this sequence.
    replace(int index, Layout layout)
    Replaces the layout at the specified position in this sequence with the specified layout.
    replace(int index, Layout.Seq seq)
    Replaces the sequence at the specified position in this sequence with the specified sequence.
    replace(int index, String value)
    Replaces the string value at the specified position in this sequence with the specified string value.
    final int
    Returns the number of elements in this sequence.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • size

      public final int size()
      Returns the number of elements in this sequence.
      Returns:
      The number of elements in this sequence.
    • asList

      public final List<Object> asList()
      Returns this sequence as an unmodifiable list. The elements of the returned list are the elements of this sequence in the correct order. They are of type String, Seq or Layout.
      Returns:
      The sequence as an unmodifiable list.
    • getString

      public final String getString(int index) throws IndexOutOfBoundsException, ClassCastException
      Returns the string value at the specified position in this sequence.
      Parameters:
      index - The index of the element to return.
      Returns:
      The string value at the specified position in this sequence.
      Throws:
      IndexOutOfBoundsException - If the index is out of range (index < 0 || indexsize()).
      ClassCastException - If the stored element is not a string.
    • getSeq

      public final Layout.Seq getSeq(int index) throws IndexOutOfBoundsException, ClassCastException
      Returns the sequence at the specified position in this sequence.
      Parameters:
      index - The index of the element to return.
      Returns:
      The sequence at the specified position in this sequence.
      Throws:
      IndexOutOfBoundsException - If the index is out of range (index < 0 || indexsize()).
      ClassCastException - If the stored element is not a sequence.
    • getLayout

      public final Layout getLayout(int index) throws IndexOutOfBoundsException, ClassCastException
      Returns the layout at the specified position in this sequence.
      Parameters:
      index - The index of the element to return.
      Returns:
      The layout at the specified position in this sequence.
      Throws:
      IndexOutOfBoundsException - If the index is out of range (index < 0 || indexsize()).
      ClassCastException - If the stored element is not a layout.
    • insert

      public final Layout.Seq insert(int index, String value) throws IndexOutOfBoundsException, NullPointerException
      Inserts the specified string value at the specified position in this sequence.
      Parameters:
      index - The index at which the specified string value is to be inserted.
      value - The string value to be inserted.
      Returns:
      This sequence.
      Throws:
      IndexOutOfBoundsException - If the index is out of range (index < 0 || index > size()).
      NullPointerException - If the specified string value is null.
    • insertSeq

      public final Layout.Seq insertSeq(int index) throws IndexOutOfBoundsException
      Creates a new sequence, inserts it at the specified position in this sequence and returns the new sequence.
      Parameters:
      index - The index at which the created sequence is to be inserted.
      Returns:
      seq The newly created empty sequence, never null
      Throws:
      IndexOutOfBoundsException - If the index is out of range (index < 0 || index > size()).
    • insert

      public final Layout.Seq insert(int index, Layout.Seq seq) throws IndexOutOfBoundsException, NullPointerException
      Inserts the specified sequence at the specified position in this sequence.
      Parameters:
      index - The index at which the specified sequence is to be inserted.
      seq - The sequence to be inserted.
      Returns:
      This sequence.
      Throws:
      IndexOutOfBoundsException - If the index is out of range (index < 0 || index > size()).
      NullPointerException - If the specified sequence is null.
    • insertLayout

      public final Layout insertLayout(int index) throws IndexOutOfBoundsException
      Creates a new layout, inserts it at the specified position in this sequence and returns the new layout.
      Parameters:
      index - The index at which the created layout is to be inserted.
      Returns:
      The newly created empty layout, never null
      Throws:
      IndexOutOfBoundsException - If the index is out of range (index < 0 || index > size()).
    • insert

      public final Layout.Seq insert(int index, Layout layout) throws IndexOutOfBoundsException, NullPointerException
      Inserts the specified layout at the specified position in this sequence.
      Parameters:
      index - The index at which the specified layout is to be inserted.
      layout - The layout to be inserted.
      Returns:
      This sequence.
      Throws:
      IndexOutOfBoundsException - If the index is out of range (index < 0 || index > size()).
      NullPointerException - If the specified layout is null.
    • add

      public final Layout.Seq add(String value) throws NullPointerException
      Appends the specified string value to the end of this sequence.
      Parameters:
      value - The string value to be appended to this sequence, not allowed to be null.
      Returns:
      This sequence.
      Throws:
      NullPointerException - If the specified string value is null.
    • addSeq

      public final Layout.Seq addSeq()
      Creates a new sequence, appends it to the end of this sequence and returns the new sequence.
      Returns:
      The newly created empty sequence, never null.
    • add

      public final Layout.Seq add(Layout.Seq seq) throws NullPointerException
      Appends the specified sequence to the end of this sequence.
      Parameters:
      seq - The sequence to be appended to this sequence, not allowed to be null.
      Returns:
      This sequence.
      Throws:
      NullPointerException - If the specified sequence is null.
    • addLayout

      public final Layout addLayout() throws NullPointerException
      Creates a new layout, appends it to the end of this sequence and returns the new layout.
      Returns:
      The newly created empty layout, never null
      Throws:
      NullPointerException
    • add

      public final Layout.Seq add(Layout layout) throws NullPointerException
      Appends the specified layout to the end of this sequence.
      Parameters:
      layout - The layout to be appended to this sequence, not allowed to be null.
      Returns:
      This sequence.
      Throws:
      NullPointerException - If the specified layout is null.
    • replace

      public final Layout.Seq replace(int index, String value) throws IndexOutOfBoundsException, NullPointerException, ClassCastException
      Replaces the string value at the specified position in this sequence with the specified string value.
      Parameters:
      index - The index of the string value to replace.
      value - The value to be inserted.
      Returns:
      This sequence.
      Throws:
      IndexOutOfBoundsException - If the index is out of range (index < 0 || index > size()).
      NullPointerException - If the specified value is null.
      ClassCastException - If the stored value at the specified position is not a string.
    • replace

      Replaces the sequence at the specified position in this sequence with the specified sequence.
      Parameters:
      index - The index of the sequence to replace.
      seq - The sequence to be inserted.
      Returns:
      This sequence.
      Throws:
      IndexOutOfBoundsException - If the index is out of range (index < 0 || indexsize()).
      NullPointerException - If the specified sequence is null.
      ClassCastException - If the stored value at the specified position is not a sequence.
    • replace

      public final Layout.Seq replace(int index, Layout layout) throws IndexOutOfBoundsException, NullPointerException, ClassCastException
      Replaces the layout at the specified position in this sequence with the specified layout.
      Parameters:
      index - The index of the layout to replace.
      layout - The layout to be inserted.
      Returns:
      This sequence.
      Throws:
      IndexOutOfBoundsException - If the index is out of range (index < 0 || indexsize()).
      NullPointerException - If the specified layout is null.
      ClassCastException - If the stored value at the specified position is not a layout.
    • remove

      public final Layout.Seq remove(int index) throws IndexOutOfBoundsException
      Removes the element at the specified position in this sequence.
      Parameters:
      index - The index of the element to be removed.
      Returns:
      This sequence.
      Throws:
      IndexOutOfBoundsException - If the index is out of range (index < 0 || indexsize()).