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

StringListImpl

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

Fields Summary
public static final StringList
EMPTY_LIST
An immutable empty list.
private String[]
fArray
private int
fLength
private Vector
fVector
Constructors Summary
public StringListImpl(Vector v)


       
        fVector = v;        
        fLength = (v == null) ? 0 : v.size();
    
public StringListImpl(String[] 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 booleancontains(java.lang.String item)
Checks if the GenericString item is a member of this list.

param
item GenericString whose presence in this list is to be tested.
return
True if this list contains the GenericString item.

        if (fVector != null)
            return fVector.contains(item);
        
        if (item == null) {
            for (int i = 0; i < fLength; i++) {
                if (fArray[i] == null)
                    return true;
            }
        }
        else {
            for (int i = 0; i < fLength; i++) {
                if (item.equals(fArray[i]))
                    return true;
            }
        }
        return false;
    
public intgetLength()
The number of Objects in the list. The range of valid child node indices is 0 to length-1 inclusive.

        return fLength;
    
public java.lang.Stringitem(int index)

        if (index < 0 || index >= fLength)
            return null;
        if (fVector != null) {
            return (String)fVector.elementAt(index);
        }
        return fArray[index];