1 7 8 package org.dom4j.tree; 9 10 import org.dom4j.Element; 11 import org.dom4j.Namespace; 12 13 23 public class DefaultNamespace extends Namespace { 24 25 private Element parent; 26 27 35 public DefaultNamespace(String prefix, String uri) { 36 super(prefix, uri); 37 } 38 39 49 public DefaultNamespace(Element parent, String prefix, String uri) { 50 super(prefix, uri); 51 this.parent = parent; 52 } 53 54 60 protected int createHashCode() { 61 int hashCode = super.createHashCode(); 62 63 if (parent != null) { 64 hashCode ^= parent.hashCode(); 65 } 66 67 return hashCode; 68 } 69 70 79 public boolean equals(Object object) { 80 if (object instanceof DefaultNamespace) { 81 DefaultNamespace that = (DefaultNamespace) object; 82 83 if (that.parent == parent) { 84 return super.equals(object); 85 } 86 } 87 88 return false; 89 } 90 91 public int hashCode() { 92 return super.hashCode(); 93 } 94 95 public Element getParent() { 96 return parent; 97 } 98 99 public void setParent(Element parent) { 100 this.parent = parent; 101 } 102 103 public boolean supportsParent() { 104 return true; 105 } 106 107 public boolean isReadOnly() { 108 return false; 109 } 110 } 111 112 148 | Popular Tags |