Top Description Inners Fields Constructors Methods
org.apache.xerces.impl.xs.util

public Class XSObjectListImpl

extends AbstractList
implements XSObjectList
Class Inheritance
All Implemented Interfaces
org.apache.xerces.xs.XSObjectList, java.util.List, java.util.SequencedCollection, java.util.Collection, java.lang.Iterable
Imports
java.lang.reflect.Array, java.util.AbstractList, .Iterator, .ListIterator, .NoSuchElementException, org.apache.xerces.xs.XSObject, .XSObjectList

Contains a list of XSObjects.
Author
Sandy Gao, IBM
Version
$Id: XSObjectListImpl.java 776079 2009-05-18 20:22:27Z mrglavas $

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private static final int
private static final ListIterator<E>
public static final XSObjectListImpl
EMPTY_LIST

An immutable empty list.

private XSObject[]
private int
Inherited from java.util.AbstractList:
modCount

Constructor Summary

AccessConstructor and Description
public
public
XSObjectListImpl(XSObject[]
the data array
array
,
int
the number of elements
length
)

Construct an XSObjectList implementation

Method Summary

Modifier and TypeMethod and Description
public void
public void
addXSObject(int index, XSObject object)

public void
public boolean
contains(Object
element whose presence in this list is to be tested
value
)

Overrides java.util.AbstractCollection.contains.

Implements java.util.List.contains, java.util.Collection.contains.

Returns true if this list contains the specified element.
private boolean
private boolean
public Object
get(int
index of the element to return
index
)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Returns the element at the specified position in this list.
public int
getLength()

Implements org.apache.xerces.xs.XSObjectList.getLength.

The number of XSObjects in the list.
public XSObject

Returns:

The XSObject at the indexth position in the XSObjectList, or null if that is not a valid index.
item
(int
index into the collection.
index
)

Implements org.apache.xerces.xs.XSObjectList.item.

Returns the indexth item in the collection.
public Iterator<E>
iterator()

Overrides java.util.AbstractList.iterator.

Implements java.util.List.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this list in proper sequence.
public ListIterator<E>
listIterator()

Overrides java.util.AbstractList.listIterator.

Implements java.util.List.listIterator.

Returns a list iterator over the elements in this list (in proper sequence).
public ListIterator<E>
listIterator(int
index of the first element to be returned from the list iterator (by a call to next)
index
)

Overrides java.util.AbstractList.listIterator.

Implements java.util.List.listIterator.

Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list.
private ListIterator<E>
listIterator0(int index)

public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.List.size, java.util.Collection.size.

Returns the number of elements in this list.
public Object[]
toArray()

Overrides java.util.AbstractCollection.toArray.

Implements java.util.List.toArray, java.util.Collection.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element).
public Object[]
toArray(Object[]
the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
a
)

Overrides java.util.AbstractCollection.toArray.

Implements java.util.List.toArray, java.util.Collection.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.
private void
Inherited from java.util.AbstractList:
addaddaddAllclearequalshashCodeindexOflastIndexOfremoveremoveRangesetsubList

Field Detail

DEFAULT_SIZEback to summary
private static final int DEFAULT_SIZE
EMPTY_ITERATORback to summary
private static final ListIterator<E> EMPTY_ITERATOR
EMPTY_LISTback to summary
public static final XSObjectListImpl EMPTY_LIST

An immutable empty list.

fArrayback to summary
private XSObject[] fArray
fLengthback to summary
private int fLength

Constructor Detail

XSObjectListImplback to summary
public XSObjectListImpl()
XSObjectListImplback to summary
public XSObjectListImpl(XSObject[] array, int length)

Construct an XSObjectList implementation

Parameters
array:XSObject[]

the data array

length:int

the number of elements

Method Detail

addXSObjectback to summary
public void addXSObject(XSObject object)
addXSObjectback to summary
public void addXSObject(int index, XSObject object)
clearXSObjectListback to summary
public void clearXSObjectList()
containsback to summary
public boolean contains(Object value)

Overrides java.util.AbstractCollection.contains.

Implements java.util.List.contains, java.util.Collection.contains.

Doc from java.util.List.contains.

Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that Objects.equals(o, e).

Parameters
value:Object

element whose presence in this list is to be tested

Returns:boolean

true if this list contains the specified element

containsNullback to summary
private boolean containsNull()
containsObjectback to summary
private boolean containsObject(Object value)
getback to summary
public Object get(int index)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Doc from java.util.List.get.

Returns the element at the specified position in this list.

Parameters
index:int

index of the element to return

Returns:Object

the element at the specified position in this list

getLengthback to summary
public int getLength()

Implements org.apache.xerces.xs.XSObjectList.getLength.

The number of XSObjects in the list. The range of valid child node indices is 0 to length-1 inclusive.

itemback to summary
public XSObject item(int index)

Implements org.apache.xerces.xs.XSObjectList.item.

Returns the indexth item in the collection. The index starts at 0. If index is greater than or equal to the number of nodes in the list, this returns null.

Parameters
index:int

index into the collection.

Returns:XSObject

The XSObject at the indexth position in the XSObjectList, or null if that is not a valid index.

iteratorback to summary
public Iterator<E> iterator()

Overrides java.util.AbstractList.iterator.

Implements java.util.List.iterator, java.util.Collection.iterator.

Doc from java.util.List.iterator.

Returns an iterator over the elements in this list in proper sequence.

Returns:Iterator<E>

an iterator over the elements in this list in proper sequence

listIteratorback to summary
public ListIterator<E> listIterator()

Overrides java.util.AbstractList.listIterator.

Implements java.util.List.listIterator.

Doc from java.util.List.listIterator.

Returns a list iterator over the elements in this list (in proper sequence).

Returns:ListIterator<E>

a list iterator over the elements in this list (in proper sequence)

listIteratorback to summary
public ListIterator<E> listIterator(int index)

Overrides java.util.AbstractList.listIterator.

Implements java.util.List.listIterator.

Doc from java.util.List.listIterator.

Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list. The specified index indicates the first element that would be returned by an initial call to next. An initial call to previous would return the element with the specified index minus one.

Parameters
index:int

index of the first element to be returned from the list iterator (by a call to next)

Returns:ListIterator<E>

a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list

listIterator0back to summary
private ListIterator<E> listIterator0(int index)
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.List.size, java.util.Collection.size.

Doc from java.util.List.size.

Returns the number of elements in this list. If this list contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this list

toArrayback to summary
public Object[] toArray()

Overrides java.util.AbstractCollection.toArray.

Implements java.util.List.toArray, java.util.Collection.toArray.

Doc from java.util.List.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element).

The returned array will be "safe" in that no references to it are maintained by this list. (In other words, this method must allocate a new array even if this list is backed by an array). The caller is thus free to modify the returned array.

This method acts as bridge between array-based and collection-based APIs.

Returns:Object[]

an array containing all of the elements in this list in proper sequence

toArrayback to summary
public Object[] toArray(Object[] a)

Overrides java.util.AbstractCollection.toArray.

Implements java.util.List.toArray, java.util.Collection.toArray.

Doc from java.util.List.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array. If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this list.

If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the list is set to null. (This is useful in determining the length of the list only if the caller knows that the list does not contain any null elements.)

Like the toArray() method, this method acts as bridge between array-based and collection-based APIs. Further, this method allows precise control over the runtime type of the output array, and may, under certain circumstances, be used to save allocation costs.

Suppose x is a list known to contain only strings. The following code can be used to dump the list into a newly allocated array of String:

String[] y = x.toArray(new String[0]);
Note that toArray(new Object[0]) is identical in function to toArray().
Parameters
a:Object[]

the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.

Returns:Object[]

an array containing the elements of this list

toArray0back to summary
private void toArray0(Object[] a)
org.apache.xerces.impl.xs.util back to summary

private final Class XSObjectListImpl.XSObjectListIterator

extends Object
implements ListIterator
Class Inheritance
  • java.lang.Object
  • org.apache.xerces.impl.xs.util.XSObjectListImpl.XSObjectListIterator
All Implemented Interfaces
java.util.ListIterator, java.util.Iterator

Field Summary

Modifier and TypeField and Description
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
add(Object
the element to insert
o
)

Implements java.util.ListIterator.add.

Inserts the specified element into the list (optional operation).
public boolean
hasNext()

Implements java.util.ListIterator.hasNext.

Returns true if this list iterator has more elements when traversing the list in the forward direction.
public boolean
hasPrevious()

Implements java.util.ListIterator.hasPrevious.

Returns true if this list iterator has more elements when traversing the list in the reverse direction.
public Object
next()

Implements java.util.ListIterator.next.

Returns the next element in the list and advances the cursor position.
public int
nextIndex()

Implements java.util.ListIterator.nextIndex.

Returns the index of the element that would be returned by a subsequent call to next.
public Object
previous()

Implements java.util.ListIterator.previous.

Returns the previous element in the list and moves the cursor position backwards.
public int
previousIndex()

Implements java.util.ListIterator.previousIndex.

Returns the index of the element that would be returned by a subsequent call to previous.
public void
remove()

Implements java.util.ListIterator.remove.

Removes from the list the last element that was returned by next or previous (optional operation).
public void
set(Object
the element with which to replace the last element returned by next or previous
o
)

Implements java.util.ListIterator.set.

Replaces the last element returned by next or previous with the specified element (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

indexback to summary
private int index

Constructor Detail

XSObjectListIteratorback to summary
public XSObjectListIterator(int index)

Method Detail

addback to summary
public void add(Object o)

Implements java.util.ListIterator.add.

Doc from java.util.ListIterator.add.

Inserts the specified element into the list (optional operation). The element is inserted immediately before the element that would be returned by next, if any, and after the element that would be returned by previous, if any. (If the list contains no elements, the new element becomes the sole element on the list.) The new element is inserted before the implicit cursor: a subsequent call to next would be unaffected, and a subsequent call to previous would return the new element. (This call increases by one the value that would be returned by a call to nextIndex or previousIndex.)

Parameters
o:Object

the element to insert

hasNextback to summary
public boolean hasNext()

Implements java.util.ListIterator.hasNext.

Doc from java.util.ListIterator.hasNext.

Returns true if this list iterator has more elements when traversing the list in the forward direction. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the list iterator has more elements when traversing the list in the forward direction

hasPreviousback to summary
public boolean hasPrevious()

Implements java.util.ListIterator.hasPrevious.

Doc from java.util.ListIterator.hasPrevious.

Returns true if this list iterator has more elements when traversing the list in the reverse direction. (In other words, returns true if previous would return an element rather than throwing an exception.)

Returns:boolean

true if the list iterator has more elements when traversing the list in the reverse direction

nextback to summary
public Object next()

Implements java.util.ListIterator.next.

Doc from java.util.ListIterator.next.

Returns the next element in the list and advances the cursor position. This method may be called repeatedly to iterate through the list, or intermixed with calls to previous to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)

Returns:Object

the next element in the list

nextIndexback to summary
public int nextIndex()

Implements java.util.ListIterator.nextIndex.

Doc from java.util.ListIterator.nextIndex.

Returns the index of the element that would be returned by a subsequent call to next. (Returns list size if the list iterator is at the end of the list.)

Returns:int

the index of the element that would be returned by a subsequent call to next, or list size if the list iterator is at the end of the list

previousback to summary
public Object previous()

Implements java.util.ListIterator.previous.

Doc from java.util.ListIterator.previous.

Returns the previous element in the list and moves the cursor position backwards. This method may be called repeatedly to iterate through the list backwards, or intermixed with calls to next to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)

Returns:Object

the previous element in the list

previousIndexback to summary
public int previousIndex()

Implements java.util.ListIterator.previousIndex.

Doc from java.util.ListIterator.previousIndex.

Returns the index of the element that would be returned by a subsequent call to previous. (Returns -1 if the list iterator is at the beginning of the list.)

Returns:int

the index of the element that would be returned by a subsequent call to previous, or -1 if the list iterator is at the beginning of the list

removeback to summary
public void remove()

Implements java.util.ListIterator.remove.

Doc from java.util.ListIterator.remove.

Removes from the list the last element that was returned by next or previous (optional operation). This call can only be made once per call to next or previous. It can be made only if add has not been called after the last call to next or previous.

setback to summary
public void set(Object o)

Implements java.util.ListIterator.set.

Doc from java.util.ListIterator.set.

Replaces the last element returned by next or previous with the specified element (optional operation). This call can be made only if neither remove nor add have been called after the last call to next or previous.

Parameters
o:Object

the element with which to replace the last element returned by next or previous