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

ShortListImpl

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

Fields Summary
private short[]
fArray
private int
fLength
Constructors Summary
public ShortListImpl(short[] 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(short item)
Checks if the unsigned short item is a member of this list.

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

        for (int i = 0; i < fLength; i++) {
            if (fArray[i] == item)
                return true;
        }
        return false;
    
public booleanequals(java.lang.Object obj)

        if (obj == null || !(obj instanceof ShortList)) {
            return false;
        }
        ShortList rhs = (ShortList)obj;
        
        if (fLength != rhs.getLength()) {
            return false;
        }
        
        for (int i = 0;i < fLength; ++i) {
            if (fArray[i] != rhs.item(i)) {
                return false;
            }
        }
        return true;
    
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 shortitem(int index)

        if (index < 0 || index >= fLength)
            throw new XSException(XSException.INDEX_SIZE_ERR, null);
        return fArray[index];