Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jdom
Class ContentList

    java.lang.Object
      java.util.AbstractCollection<E>
          java.util.AbstractList
              org.jdom.ContentList

All Implemented Interfaces:
  java.io.Serializable, java.lang.Iterable, java.util.Collection, java.util.List

    final class ContentList

extends java.util.AbstractList
implements java.io.Serializable

A non-public list implementation holding only legal JDOM content, including content for Document or Element nodes. Users see this class as a simple List implementation.

See Also:
  `CDATA`, `Comment`, `Element`, `EntityRef`, `ProcessingInstruction`, `Text`

Nested Class Summary
`(package private) class` | `ContentList.FilterList` `FilterList` represents legal JDOM content, including content for `Document`s or `Element`s.
`(package private) class` | `ContentList.FilterListIterator`

Field Summary
`private static java.lang.String` | `CVS_ID`
`private Content[]` | `elementData` Our backing list
`private static int` | `INITIAL_ARRAY_SIZE`
`private Parent` | `parent` Document or Element this list belongs to
`private static long` | `serialVersionUID`
`private int` | `size`

Fields inherited from class java.util.AbstractList
`modCount`

Constructor Summary
`ContentList(Parent parent)` Force either a Document or Element parent

Method Summary
`(package private) void` | `add(int index, Content child)` Check and add the `Element` to this list at the given index.
`void` | `add(int index, java.lang.Object obj)` Inserts the specified object at the specified position in this list.
`boolean` | `addAll(java.util.Collection collection)` Add the specified collecton to the end of this list.
`boolean` | `addAll(int index, java.util.Collection collection)` Inserts the specified collecton at the specified position in this list.
`void` | `clear()` Clear the current list.
`(package private) void` | `clearAndSet(java.util.Collection collection)` Clear the current list and set it to the contents of the `Collection`.
`private void` | `documentCanContain(int index, Content child)`
`private static void` | `elementCanContain(int index, Content child)`
`(package private) void` | `ensureCapacity(int minCapacity)` Increases the capacity of this `ContentList` instance, if necessary, to ensure that it can hold at least the number of items specified by the minimum capacity argument.
`java.lang.Object` | `get(int index)` Return the object at the specified offset.
`private int` | `getModCount()` Give access of ContentList.modCount to FilterList
`(package private) java.util.List` | `getView(Filter filter)` Return a view of this list based on the given filter.
`(package private) int` | `indexOfDocType()` Return the index of the DocType element in the list.
`(package private) int` | `indexOfFirstElement()` Return the index of the first Element in the list.
`java.lang.Object` | `remove(int index)` Remove the object at the specified offset.
`private static void` | `removeParent(Content c)` Remove the parent of a Object
`java.lang.Object` | `set(int index, java.lang.Object obj)` Set the object at the specified location to the supplied object.
`int` | `size()` Return the number of items in this list
`java.lang.String` | `toString()` Return this list as a `String`
`(package private) void` | `uncheckedAddContent(Content c)` Package internal method to support building from sources that are 100% trusted.

Methods inherited from class java.util.AbstractList
`add, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList`

Methods inherited from class java.util.AbstractCollection
`contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray`

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

Methods inherited from interface java.util.List
`contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray`

Field Detail

### CVS_ID

    private static final java.lang.String CVS_ID

See Also:
  Constant Field Values

### serialVersionUID

    private static final long serialVersionUID

See Also:
  Constant Field Values

### INITIAL_ARRAY_SIZE

    private static final int INITIAL_ARRAY_SIZE

See Also:
  Constant Field Values

### elementData

    private Content[] elementData

  Our backing list

### size

    private int size

### parent

    private Parent parent

  Document or Element this list belongs to

Constructor Detail

### ContentList

    ContentList(Parent parent)

  Force either a Document or Element parent

Method Detail

### uncheckedAddContent

    final void uncheckedAddContent(Content c)

  Package internal method to support building from sources that are 100% trusted.

  Parameters:
    `c` - content to add without any checks

### add

    public void add(int index,
                    java.lang.Object obj)

  Inserts the specified object at the specified position in this list. Shifts the object currently at that position (if any) and any subsequent objects to the right (adds one to their indices).

  Specified by:
    `add` in interface `java.util.List`
  Overrides:
    `add` in class `java.util.AbstractList`
  Parameters:
    `index` - The location to set the value to.
    `obj` - The object to insert into the list. throws IndexOutOfBoundsException if index < 0 || index > size()

### documentCanContain

    private void documentCanContain(int index,
                                    Content child)
                             throws IllegalAddException

  Throws:
    `IllegalAddException`
  See Also:
    `add(int, org.jdom.Content)`

### elementCanContain

    private static void elementCanContain(int index,
                                          Content child)
                                   throws IllegalAddException

  Throws:
    `IllegalAddException`

### add

    void add(int index,
             Content child)

  Check and add the `Element` to this list at the given index.

  Parameters:
    `index` - index where to add `Element`
    `child` - `Element` to add

### addAll

    public boolean addAll(java.util.Collection collection)

  Add the specified collecton to the end of this list.

  Specified by:
    `addAll` in interface `java.util.Collection`
  Specified by:
    `addAll` in interface `java.util.List`
  Overrides:
    `addAll` in class `java.util.AbstractCollection`
  Parameters:
    `collection` - The collection to add to the list.
  Returns:
    `true` if the list was modified as a result of the add.

### addAll

    public boolean addAll(int index,
                          java.util.Collection collection)

  Inserts the specified collecton at the specified position in this list. Shifts the object currently at that position (if any) and any subsequent objects to the right (adds one to their indices).

  Specified by:
    `addAll` in interface `java.util.List`
  Overrides:
    `addAll` in class `java.util.AbstractList`
  Parameters:
    `index` - The offset to start adding the data in the collection
    `collection` - The collection to insert into the list.
  Returns:
    `true` if the list was modified as a result of the add. throws IndexOutOfBoundsException if index < 0 || index > size()

### clear

    public void clear()

  Clear the current list.

  Specified by:
    `clear` in interface `java.util.Collection`
  Specified by:
    `clear` in interface `java.util.List`
  Overrides:
    `clear` in class `java.util.AbstractList`

### clearAndSet

    void clearAndSet(java.util.Collection collection)

  Clear the current list and set it to the contents of the `Collection`. object.

  Parameters:
    `collection` - The collection to use.

### ensureCapacity

    void ensureCapacity(int minCapacity)

  Increases the capacity of this `ContentList` instance, if necessary, to ensure that it can hold at least the number of items specified by the minimum capacity argument.

  Parameters:
    `minCapacity` - the desired minimum capacity.

### get

    public java.lang.Object get(int index)

  Return the object at the specified offset.

  Specified by:
    `get` in interface `java.util.List`
  Specified by:
    `get` in class `java.util.AbstractList`
  Parameters:
    `index` - The offset of the object.
  Returns:
    The Object which was returned.

### getView

    java.util.List getView(Filter filter)

  Return a view of this list based on the given filter.

  Parameters:
    `filter` - `Filter` for this view.
  Returns:
    a list representing the rules of the `Filter`.

### indexOfFirstElement

    int indexOfFirstElement()

  Return the index of the first Element in the list. If the parent is a `Document` then the element is the root element. If the list contains no Elements, it returns -1.

  Returns:
    index of first element, or -1 if one doesn't exist

### indexOfDocType

    int indexOfDocType()

  Return the index of the DocType element in the list. If the list contains no DocType, it returns -1.

  Returns:
    index of the DocType, or -1 if it doesn't exist

### remove

    public java.lang.Object remove(int index)

  Remove the object at the specified offset.

  Specified by:
    `remove` in interface `java.util.List`
  Overrides:
    `remove` in class `java.util.AbstractList`
  Parameters:
    `index` - The offset of the object.
  Returns:
    The Object which was removed.

### removeParent

    private static void removeParent(Content c)

  Remove the parent of a Object

### set

    public java.lang.Object set(int index,
                                java.lang.Object obj)

  Set the object at the specified location to the supplied object.

  Specified by:
    `set` in interface `java.util.List`
  Overrides:
    `set` in class `java.util.AbstractList`
  Parameters:
    `index` - The location to set the value to.
    `obj` - The location to set the value to.
  Returns:
    The object which was replaced. throws IndexOutOfBoundsException if index < 0 || index >= size()

### size

    public int size()

  Return the number of items in this list

  Specified by:
    `size` in interface `java.util.Collection`
  Specified by:
    `size` in interface `java.util.List`
  Specified by:
    `size` in class `java.util.AbstractCollection`
  Returns:
    The number of items in this list.

### toString

    public java.lang.String toString()

  Return this list as a `String`

  Overrides:
    `toString` in class `java.util.AbstractCollection`
  Returns:
    The number of items in this list.

### getModCount

    private int getModCount()

  Give access of ContentList.modCount to FilterList

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD