fix android test: more precise DomChildrenDescription.equals/hashCode

This commit is contained in:
peter
2012-04-29 23:33:35 +02:00
parent 10eac0023e
commit 160c911499
2 changed files with 26 additions and 5 deletions
@@ -62,6 +62,29 @@ public abstract class AbstractDomChildDescriptionImpl implements AbstractDomChil
myCustomAnnotations.put(annotation.annotationType(), annotation);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AbstractDomChildDescriptionImpl that = (AbstractDomChildDescriptionImpl)o;
if (myCustomAnnotations != null ? !myCustomAnnotations.equals(that.myCustomAnnotations) : that.myCustomAnnotations != null)
return false;
if (!myType.equals(that.myType)) return false;
if (myUserMap != null ? !myUserMap.equals(that.myUserMap) : that.myUserMap != null) return false;
return true;
}
@Override
public int hashCode() {
int result = myType.hashCode();
result = 31 * result + (myCustomAnnotations != null ? myCustomAnnotations.hashCode() : 0);
result = 31 * result + (myUserMap != null ? myUserMap.hashCode() : 0);
return result;
}
public void setUserMap(final Map userMap) {
myUserMap = userMap;
}
@@ -39,20 +39,18 @@ public abstract class DomChildDescriptionImpl extends AbstractDomChildDescriptio
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
final DomChildDescriptionImpl that = (DomChildDescriptionImpl)o;
if (myTagName != null ? !myTagName.equals(that.myTagName) : that.myTagName != null) return false;
if (!getType().equals(that.getType())) return false;
return true;
}
public int hashCode() {
int result;
result = (myTagName != null ? myTagName.hashCode() : 0);
result = 31 * result + getType().hashCode();
int result = super.hashCode();
result = 31 * result + (myTagName != null ? myTagName.hashCode() : 0);
return result;
}