1 16 19 package org.apache.xml.dtm.ref; 20 21 25 public final class ExtendedType 26 { 27 private int nodetype; 28 private String namespace; 29 private String localName; 30 private int hash; 31 32 40 public ExtendedType (int nodetype, String namespace, String localName) 41 { 42 this.nodetype = nodetype; 43 this.namespace = namespace; 44 this.localName = localName; 45 this.hash = nodetype + namespace.hashCode() + localName.hashCode(); 46 } 47 48 57 public ExtendedType (int nodetype, String namespace, String localName, int hash) 58 { 59 this.nodetype = nodetype; 60 this.namespace = namespace; 61 this.localName = localName; 62 this.hash = hash; 63 } 64 65 70 protected void redefine(int nodetype, String namespace, String localName) 71 { 72 this.nodetype = nodetype; 73 this.namespace = namespace; 74 this.localName = localName; 75 this.hash = nodetype + namespace.hashCode() + localName.hashCode(); 76 } 77 78 83 protected void redefine(int nodetype, String namespace, String localName, int hash) 84 { 85 this.nodetype = nodetype; 86 this.namespace = namespace; 87 this.localName = localName; 88 this.hash = hash; 89 } 90 91 94 public int hashCode() 95 { 96 return hash; 97 } 98 99 105 public boolean equals(ExtendedType other) 106 { 107 try 108 { 109 return other.nodetype == this.nodetype && 110 other.localName.equals(this.localName) && 111 other.namespace.equals(this.namespace); 112 } 113 catch(NullPointerException e) 114 { 115 return false; 116 } 117 } 118 119 122 public int getNodeType() 123 { 124 return nodetype; 125 } 126 127 130 public String getLocalName() 131 { 132 return localName; 133 } 134 135 138 public String getNamespace() 139 { 140 return namespace; 141 } 142 143 } 144 | Popular Tags |