1 16 package org.apache.commons.vfs.cache; 17 18 import org.apache.commons.vfs.FileName; 19 import org.apache.commons.vfs.FileSystem; 20 21 27 class FileSystemAndNameKey implements Comparable 28 { 29 private final FileSystem fileSystem; 30 private final FileName fileName; 31 private final int fileSystemId; 32 33 FileSystemAndNameKey(final FileSystem fileSystem, final FileName fileName) 34 { 35 this.fileSystem = fileSystem; 36 this.fileSystemId = System.identityHashCode(fileSystem); 37 38 this.fileName = fileName; 39 } 40 41 public int compareTo(Object o) 42 { 43 FileSystemAndNameKey other = (FileSystemAndNameKey) o; 44 45 if (fileSystemId < other.fileSystemId) 46 { 47 return -1; 48 } 49 if (fileSystemId > other.fileSystemId) 50 { 51 return 1; 52 } 53 54 return fileName.compareTo(other.fileName); 55 } 56 57 FileSystem getFileSystem() 58 { 59 return fileSystem; 60 } 61 62 FileName getFileName() 63 { 64 return fileName; 65 } 66 } 67 | Popular Tags |