*/
public boolean equals(Object aObj) {
if (!(aObj instanceof MetaDataObject)) {
return false;
}
MetaDataObject mdo = (MetaDataObject) aObj;
// get the attributes (and classes) for the two objects
List<NameClassPair> theseAttrs = this.listAttributes();
List<NameClassPair> thoseAttrs = mdo.listAttributes();
// attribute lists must be same length
if (theseAttrs.size() != thoseAttrs.size()) {
return false;
}
// iterate through all attributes in this object
Iterator<NameClassPair> i = theseAttrs.iterator();
while (i.hasNext()) {
NameClassPair ncp = i.next();
// other object must contain this attribute
if (!thoseAttrs.contains(ncp)) {
return false;
}
// get values and test equivalency
Object val1 = this.getAttributeValue(ncp.getName());
Object val2 = mdo.getAttributeValue(ncp.getName());
if (!valuesEqual(val1, val2)) {
return false;
}
}
// if we get this far, objects are equal