diff options
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/esodata/SimpleDirectory.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/esodata/SimpleDirectory.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/esodata/SimpleDirectory.java b/BJC-Utils2/src/main/java/bjc/utils/esodata/SimpleDirectory.java index 3c1ced5..741b33d 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/esodata/SimpleDirectory.java +++ b/BJC-Utils2/src/main/java/bjc/utils/esodata/SimpleDirectory.java @@ -57,4 +57,47 @@ public class SimpleDirectory<K, V> implements Directory<K, V> { public V putKey(K key, V val) { return data.put(key, val); } + + @Override + public int hashCode() { + final int prime = 31; + + int result = 1; + result = prime * result + ((children == null) ? 0 : children.hashCode()); + result = prime * result + ((data == null) ? 0 : data.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; + + SimpleDirectory<?, ?> other = (SimpleDirectory<?, ?>) obj; + + if(children == null) { + if(other.children != null) return false; + } else if(!children.equals(other.children)) return false; + + if(data == null) { + if(other.data != null) return false; + } else if(!data.equals(other.data)) return false; + + return true; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + + builder.append("SimpleDirectory [children="); + builder.append(children); + builder.append(", data="); + builder.append(data); + builder.append("]"); + + return builder.toString(); + } }
\ No newline at end of file |
