FileDocCategorySizeDatePackage
IDRefs.javaAPI DocApache Axis 1.43149Sat Apr 22 18:57:28 BST 2006org.apache.axis.types

IDRefs

public class IDRefs extends NCName
Custom class for supporting XSD data type IDRefs
author
Davanum Srinivas
see
XML Schema 3.3.10 IDREFS

Fields Summary
private IDRef[]
idrefs
Constructors Summary
public IDRefs()

        super();
    
public IDRefs(String stValue)
ctor for IDRefs

exception
IllegalArgumentException will be thrown if validation fails

        setValue(stValue);
    
Methods Summary
public booleanequals(java.lang.Object object)
IDREFs can be equal without having identical ordering because they represent a set of references. Hence we have to compare values here as a set, not a list.

param
object an Object value
return
a boolean value

        if (object == this) {
            return true;        // succeed quickly, when possible
        }
        if (object instanceof IDRefs) {
            IDRefs that = (IDRefs)object;
            if (this.idrefs.length == that.idrefs.length) {
                Set ourSet = new HashSet(Arrays.asList(this.idrefs));
                Set theirSet = new HashSet(Arrays.asList(that.idrefs));
                return ourSet.equals(theirSet);
            } else {
                return false;
            }
        } else {
            return false;
        }
    
public inthashCode()
Returns the sum of the hashcodes of the underlying idrefs, an operation which is not sensitive to ordering.

return
an int value

        int hash = 0;
        for (int i = 0; i < idrefs.length; i++) {
            hash += idrefs[i].hashCode();
        }
        return hash;
    
public voidsetValue(java.lang.String stValue)

        StringTokenizer tokenizer = new StringTokenizer(stValue);
        int count = tokenizer.countTokens();
        idrefs = new IDRef[count];
        for(int i=0;i<count;i++){
            idrefs[i] = new IDRef(tokenizer.nextToken());
        }
    
public java.lang.StringtoString()

        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < idrefs.length; i++) {
            IDRef ref = idrefs[i];
            if (i > 0) buf.append(" ");
            buf.append(ref.toString());
        }
        return buf.toString();