Methods Summary |
---|
public boolean | equals(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.
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 int | hashCode()Returns the sum of the hashcodes of the underlying idrefs, an
operation which is not sensitive to ordering.
int hash = 0;
for (int i = 0; i < idrefs.length; i++) {
hash += idrefs[i].hashCode();
}
return hash;
|
public void | setValue(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.String | toString()
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();
|