From d91ddfe924176707062ce447722993d9d9aac415 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 31 Dec 2015 16:00:54 +0000 Subject: Remove equals and hashCode from XML nodes --- .../java/org/zwobble/mammoth/xml/XmlElement.java | 49 ++++------------------ 1 file changed, 9 insertions(+), 40 deletions(-) (limited to 'src/main/java/org/zwobble/mammoth/xml/XmlElement.java') diff --git a/src/main/java/org/zwobble/mammoth/xml/XmlElement.java b/src/main/java/org/zwobble/mammoth/xml/XmlElement.java index 659be2d..f138917 100644 --- a/src/main/java/org/zwobble/mammoth/xml/XmlElement.java +++ b/src/main/java/org/zwobble/mammoth/xml/XmlElement.java @@ -28,7 +28,15 @@ public class XmlElement implements XmlNode { public String getName() { return name; } - + + public Map getAttributes() { + return attributes; + } + + public List getChildren() { + return children; + } + @Override public T accept(XmlNodeVisitor visitor) { return visitor.visit(this); @@ -43,43 +51,4 @@ public class XmlElement implements XmlNode { return "XmlElement(name=" + name + ", attributes=" + attributes + ", children=" + children + ")"; } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result - + ((attributes == null) ? 0 : attributes.hashCode()); - result = prime * result - + ((children == null) ? 0 : children.hashCode()); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - XmlElement other = (XmlElement) obj; - if (attributes == null) { - if (other.attributes != null) - return false; - } else if (!attributes.equals(other.attributes)) - return false; - if (children == null) { - if (other.children != null) - return false; - } else if (!children.equals(other.children)) - return false; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - return true; - } } -- cgit v1.2.3