FileDocCategorySizeDatePackage
XSObjectListImpl.javaAPI DocJava SE 6 API3272Tue Jun 10 00:22:48 BST 2008com.sun.org.apache.xerces.internal.impl.xs.util

XSObjectListImpl

public class XSObjectListImpl extends Object implements XSObjectList
Containts a list of XSObject's.
xerces.internal
author
Sandy Gao, IBM
version
$Id: XSObjectListImpl.java,v 1.2.6.1 2005/09/09 07:28:13 sunithareddy Exp $

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

    


      
        fArray = new XSObject[DEFAULT_SIZE];
        fLength = 0;
    
public XSObjectListImpl(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(com.sun.org.apache.xerces.internal.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, com.sun.org.apache.xerces.internal.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 com.sun.org.apache.xerces.internal.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];