Index: core/src/org/netbeans/core/projects/cache/BinaryFS.java =================================================================== RCS file: /cvs/core/src/org/netbeans/core/projects/cache/BinaryFS.java,v retrieving revision 1.4 diff -u -r1.4 BinaryFS.java --- core/src/org/netbeans/core/projects/cache/BinaryFS.java 15 Dec 2002 23:52:13 -0000 1.4 +++ core/src/org/netbeans/core/projects/cache/BinaryFS.java 16 Dec 2002 15:01:05 -0000 @@ -294,32 +294,24 @@ private boolean initialized = false; private Map attrs = Collections.EMPTY_MAP; //MapAttribute> - // for equality comparisons - private int hash = 0; - public BFSBase(String name, FileObject parent, int offset) { this.name = name; this.parent = parent; this.offset = offset; } - public boolean equals(Object o) { + public final boolean equals(Object o) { if (!(o instanceof BFSBase)) return false; if (o == this) return true; BFSBase f = (BFSBase)o; - if (f.hashCode() != hashCode()) return false; return f.getPath().equals(getPath()) && specificEquals(f); } - public int hashCode() { - if (hash == 0) { - hash = getPath().hashCode() ^ (specificHashCode() + 265478956); - } - return hash; + public final int hashCode() { + return getPath().hashCode(); } protected abstract boolean specificEquals(BFSBase f); - protected abstract int specificHashCode(); /** no-op implementations of read-only, fixed, never firing FS */ public void addFileChangeListener(FileChangeListener fcl) {} @@ -704,28 +696,8 @@ if (len == -1) uri = ptr.getString(); } - // hashCode and equals compare data: URI or byte contents. + // equals compares data: URI or byte contents. - protected int specificHashCode() { - initialize(); - if (len == -1) { - return uri.hashCode(); - } else { - byte[] data; - try { - data = data(); - } catch (IOException ioe) { - return 55; - } - int x = 0; - for (int i = 0; i < data.length; i++) { - x += 876824551; - x ^= data[i]; - } - return x; - } - } - protected boolean specificEquals(BFSBase _f) { if (!(_f instanceof BFSFile)) return false; BFSFile f = (BFSFile)_f; @@ -817,17 +789,7 @@ } } - // hashCode and equals compare contents recursively. - - protected int specificHashCode() { - initialize(); - int x = 0; - Iterator it = childrenMap.values().iterator(); - while (it.hasNext()) { - x ^= ((BFSBase)it.next()).hashCode(); - } - return x; - } + // equals compares contents recursively. protected boolean specificEquals(BFSBase _f) { if (!(_f instanceof BFSFolder)) return false;