FileDocCategorySizeDatePackage
StringListImpl.javaAPI DocJava SE 5 API5003Fri Aug 26 14:55:52 BST 2005com.sun.org.apache.xerces.internal.impl.xs.util

StringListImpl

public class StringListImpl extends Object implements StringList
Containts a list of Object's.
author
Sandy Gao, IBM
version
$Id: StringListImpl.java,v 1.5 2003/11/12 23:17:34 sandygao Exp $

Fields Summary
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];