java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList
AttributeList
class AttributeList
AttributeList
represents legal JDOM Attribute
content. This class is NOT PUBLIC; users should see it as a simple List
implementation.
CDATA
,
Comment
,
Element
,
EntityRef
,
ProcessingInstruction
,
Text
Field Summary | |
---|---|
private static java.lang.String |
CVS_ID
|
private Attribute[] |
elementData
The backing list |
private static int |
INITIAL_ARRAY_SIZE
|
private Element |
parent
The parent Element |
private int |
size
|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
private |
AttributeList()
Force an Element parent |
(package private) |
AttributeList(Element parent)
Create a new instance of the AttributeList representing Element content |
Method Summary | |
---|---|
(package private) void |
add(int index,
Attribute attribute)
Check and add the Attribute to this list at
the given index. |
void |
add(int index,
java.lang.Object obj)
Inserts the specified attribute at the specified position in this list. |
boolean |
add(java.lang.Object obj)
Add a attribute to the end of the list or replace a existing attribute with the same name and Namespace . |
boolean |
addAll(java.util.Collection collection)
Add all the objects in the specified collection. |
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 |
ensureCapacity(int minCapacity)
Increases the capacity of this AttributeList 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. |
(package private) java.lang.Object |
get(java.lang.String name,
Namespace namespace)
Return the Attribute with the
given name and Namespace . |
(package private) int |
indexOf(java.lang.String name,
Namespace namespace)
Return index of the Attribute with the
given name and uri. |
private int |
indexOfDuplicate(Attribute attribute)
Return index of attribute with same name and Namespace, or -1 if one doesn't exist |
java.lang.Object |
remove(int index)
Remove the object at the specified offset. |
(package private) boolean |
remove(java.lang.String name,
Namespace namespace)
Remove the Attribute with the
given name and Namespace . |
(package private) java.lang.Object |
set(int index,
Attribute attribute)
Set the object at the specified location to the supplied 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 |
uncheckedAddAttribute(Attribute a)
Package internal method to support building from sources that are 100% trusted. |
Methods inherited from class java.util.AbstractList |
---|
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, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, retainAll, subList, toArray, toArray |
Field Detail |
---|
private static final java.lang.String CVS_ID
private static final int INITIAL_ARRAY_SIZE
private Attribute[] elementData
private int size
private Element parent
Constructor Detail |
---|
private AttributeList()
AttributeList(Element parent)
parent
- element whose attributes are to be heldMethod Detail |
---|
final void uncheckedAddAttribute(Attribute a)
a
- attribute to add without any checkspublic boolean add(java.lang.Object obj)
Namespace
.
add
in interface java.util.Collection
add
in interface java.util.List
add
in class java.util.AbstractList
obj
- The object to insert into the list.
java.lang.IndexOutOfBoundsException
- if index < 0 || index > size()public 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()void add(int index, Attribute attribute)
Attribute
to this list at
the given index. Note: does not check for duplicate
attributes.
index
- index where to add Attribute
attribute
- Attribute
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 containing all the objects to add.
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.private void ensureCapacity(int minCapacity)
AttributeList
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.lang.Object get(java.lang.String name, Namespace namespace)
Attribute
with the
given name and Namespace
.
name
- name of attribute to returnnamespace
- Namespace
to match
Attribute
, or null if one doesn't exist.int indexOf(java.lang.String name, Namespace namespace)
Attribute
with the
given name and uri.
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.
boolean remove(java.lang.String name, Namespace namespace)
Attribute
with the
given name and Namespace
.
namespace
- Namespace
to match
true
if attribute was removed,
false
otherwisepublic 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.
java.lang.Object set(int index, Attribute attribute)
index
- The location to set the value to.attribute
- The attribute to set.
private int indexOfDuplicate(Attribute attribute)
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