java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList
ContentList
final class ContentList
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.
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 int | ADD |
private static int | CREATE Used inner class FilterListIterator to help hasNext and hasPrevious the next index of our cursor (must be here for JDK1.1). |
private static java.lang.String | CVS_ID |
private Content[] | elementData Our backing list |
private static int | HASNEXT |
private static int | HASPREV |
private static int | INITIAL_ARRAY_SIZE |
private static int | NEXT |
private Parent | parent Document or Element this list belongs to |
private static int | PREV |
private static int | REMOVE |
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 |
---|
private static final java.lang.String CVS_ID
private static final int INITIAL_ARRAY_SIZE
private static final int CREATE
private static final int HASPREV
private static final int HASNEXT
private static final int PREV
private static final int NEXT
private static final int ADD
private static final int REMOVE
private Content[] elementData
private int size
private Parent parent
Constructor Detail |
---|
ContentList(Parent parent)
Method Detail |
---|
final void uncheckedAddContent(Content c)
c
- content to add without any checkspublic void add(int index, java.lang.Object obj)
add
in interface java.util.List
add
in class java.util.AbstractList
index
- The location to set the value to.obj
- The object to insert into the list. throws IndexOutOfBoundsException if index < 0 || index > size()private void documentCanContain(int index, Content child) throws IllegalAddException
IllegalAddException
ContentList#add(int, org.jdom.Content)
private static void elementCanContain(int index, Content child) throws IllegalAddException
IllegalAddException
void add(int index, Content child)
Element
to this list at the given index. index
- index where to add Element
child
- Element
to addpublic boolean addAll(java.util.Collection collection)
addAll
in interface java.util.Collection
addAll
in interface java.util.List
addAll
in class java.util.AbstractCollection
collection
- The collection to add to the list. true
if the list was modified as a result of the add.public boolean addAll(int index, java.util.Collection collection)
addAll
in interface java.util.List
addAll
in class java.util.AbstractList
index
- The offset to start adding the data in the collectioncollection
- The collection to insert into the list. true
if the list was modified as a result of the add. throws IndexOutOfBoundsException if index < 0 || index > size()public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.List
clear
in class java.util.AbstractList
void clearAndSet(java.util.Collection collection)
Collection
. object. collection
- The collection to use.void ensureCapacity(int minCapacity)
ContentList
instance, if necessary, to ensure that it can hold at least the number of items specified by the minimum capacity argument. minCapacity
- the desired minimum capacity.public java.lang.Object get(int index)
get
in interface java.util.List
get
in class java.util.AbstractList
index
- The offset of the object. java.util.List getView(Filter filter)
filter
- Filter
for this view. Filter
.int indexOfFirstElement()
Document
then the element is the root element. If the list contains no Elements, it returns -1. int indexOfDocType()
public java.lang.Object remove(int index)
remove
in interface java.util.List
remove
in class java.util.AbstractList
index
- The offset of the object. private static void removeParent(Content c)
public java.lang.Object set(int index, java.lang.Object obj)
set
in interface java.util.List
set
in class java.util.AbstractList
index
- The location to set the value to.obj
- The location to set the value to. public int size()
size
in interface java.util.Collection
size
in interface java.util.List
size
in class java.util.AbstractCollection
public java.lang.String toString()
String
toString
in class java.util.AbstractCollection
private int getModCount()