public FileDesc getFileDescForUrn(URN urn) {

    if (urn.toString().equals(FileDescStub.DEFAULT_URN)) return fdStub;
    else if (urn.equals(_notHave)) return null;
    else if (_urns.containsKey(urn)) return (FileDesc) _urns.get(urn);
    else return new FileDescStub("other.txt");
  }
Пример #2
0
 /** @see similar(RemoteFileDesc, RemoteFileDesc) */
 static boolean same(String name1, long size1, URN hash1, String name2, long size2, URN hash2) {
   // Either they have the same hashes...
   if (hash1 != null && hash2 != null) return hash1.equals(hash2);
   // ..or same name and size and no conflicting hashes.
   else return size1 == size2 && name1.equals(name2);
 }