FileDocCategorySizeDatePackage
XSObjectListImpl.javaAPI DocApache Xerces 3.0.13502Fri Sep 14 20:33:54 BST 2007org.apache.xerces.impl.xs.util

XSObjectListImpl

public class XSObjectListImpl extends Object implements org.apache.xerces.xs.XSObjectList
Containts a list of XSObject's.
xerces.internal
author
Sandy Gao, IBM
version
$Id: XSObjectListImpl.java 446723 2006-09-15 20:37:45Z mrglavas $

Fields Summary
public static final org.apache.xerces.xs.XSObjectList
EMPTY_LIST
An immutable empty list.
private static final int
DEFAULT_SIZE
private org.apache.xerces.xs.XSObject[]
fArray
private int
fLength
Constructors Summary
public XSObjectListImpl()

    


      
        fArray = new XSObject[DEFAULT_SIZE];
        fLength = 0;
    
public XSObjectListImpl(org.apache.xerces.xs.XSObject[] array, int length)
Construct an XSObjectList implementation

param
array the data array
param
length the number of elements

        fArray = array;
        fLength = length;
    
Methods Summary
public voidadd(org.apache.xerces.xs.XSObject object)

       if (fLength == fArray.length){  
           XSObject[] temp = new XSObject[fLength + 4];
           System.arraycopy(fArray, 0, temp, 0, fLength);
           fArray = temp;
       }
       fArray[fLength++]=object;
    
public voidadd(int index, org.apache.xerces.xs.XSObject object)

        fArray [index] = object;
    
public voidclear()

        for (int i=0; i<fLength; i++) {
            fArray[i] = null;
        }
        fArray = null;
        fLength = 0;
    
public intgetLength()
The number of XSObjects in the list. The range of valid child node indices is 0 to length-1 inclusive.

        return fLength;
    
public org.apache.xerces.xs.XSObjectitem(int index)
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.

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

        if (index < 0 || index >= fLength)
            return null;
        return fArray[index];