Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jdom
Class AttributeList  view AttributeList download AttributeList.java

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byorg.jdom.AttributeList
All Implemented Interfaces:
java.util.Collection, java.lang.Iterable, java.util.List, java.io.Serializable

class AttributeList
extends java.util.AbstractList
implements java.util.List, java.io.Serializable

AttributeList represents legal JDOM Attribute content. This class is NOT PUBLIC; users should see it as a simple List implementation.

Version:
$Revision: 1.23 $, $Date: 2004/02/28 03:30:27 $

Nested Class Summary
 
Nested classes inherited from class java.util.AbstractList
 
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

CVS_ID

private static final java.lang.String CVS_ID
See Also:
Constant Field Values

INITIAL_ARRAY_SIZE

private static final int INITIAL_ARRAY_SIZE
See Also:
Constant Field Values

elementData

private Attribute[] elementData
The backing list


size

private int size

parent

private Element parent
The parent Element

Constructor Detail

AttributeList

private AttributeList()
Force an Element parent


AttributeList

AttributeList(Element parent)
Create a new instance of the AttributeList representing Element content

Method Detail

uncheckedAddAttribute

final void uncheckedAddAttribute(Attribute a)
Package internal method to support building from sources that are 100% trusted.


add

public 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.

Specified by:
add in interface java.util.List

add

public void add(int index,
                java.lang.Object obj)
Inserts the specified attribute at the specified position in this list. Shifts the attribute currently at that position (if any) and any subsequent attributes to the right (adds one to their indices).

Specified by:
add in interface java.util.List

add

void add(int index,
         Attribute attribute)
Check and add the Attribute to this list at the given index. Note: does not check for duplicate attributes.


addAll

public boolean addAll(java.util.Collection collection)
Add all the objects in the specified collection.

Specified by:
addAll in interface java.util.List

addAll

public boolean addAll(int index,
                      java.util.Collection collection)
Inserts the specified collecton at the specified position in this list. Shifts the attribute currently at that position (if any) and any subsequent attributes to the right (adds one to their indices).

Specified by:
addAll in interface java.util.List

clear

public void clear()
Clear the current list.

Specified by:
clear in interface java.util.List

clearAndSet

void clearAndSet(java.util.Collection collection)
Clear the current list and set it to the contents of the Collection. object.


ensureCapacity

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.


get

public java.lang.Object get(int index)
Return the object at the specified offset.

Specified by:
get in interface java.util.List

get

java.lang.Object get(java.lang.String name,
                     Namespace namespace)
Return the Attribute with the given name and Namespace.


indexOf

int indexOf(java.lang.String name,
            Namespace namespace)
Return index of the Attribute with the given name and uri.


remove

public java.lang.Object remove(int index)
Remove the object at the specified offset.

Specified by:
remove in interface java.util.List

remove

boolean remove(java.lang.String name,
               Namespace namespace)
Remove the Attribute with the given name and Namespace.


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

set

java.lang.Object set(int index,
                     Attribute attribute)
Set the object at the specified location to the supplied object. Note: does not check for duplicate attributes.


indexOfDuplicate

private int indexOfDuplicate(Attribute attribute)
Return index of attribute with same name and Namespace, or -1 if one doesn't exist


size

public int size()
Return the number of items in this list

Specified by:
size in interface java.util.List

toString

public java.lang.String toString()
Return this list as a String