1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.vfs2.cache;
18
19 import org.apache.commons.vfs2.FileName;
20 import org.apache.commons.vfs2.FileSystem;
21
22
23
24
25
26
27
28 final class FileSystemAndNameKey implements Comparable<FileSystemAndNameKey> {
29
30 private final FileSystem fileSystem;
31
32
33 private final FileName fileName;
34
35
36 private final int fileSystemId;
37
38 FileSystemAndNameKey(final FileSystem fileSystem, final FileName fileName) {
39 this.fileSystem = fileSystem;
40 this.fileSystemId = System.identityHashCode(fileSystem);
41
42 this.fileName = fileName;
43 }
44
45 @Override
46 public int compareTo(final FileSystemAndNameKey other) {
47 if (fileSystemId < other.fileSystemId) {
48 return -1;
49 }
50 if (fileSystemId > other.fileSystemId) {
51 return 1;
52 }
53
54 return fileName.compareTo(other.fileName);
55 }
56
57 FileSystem getFileSystem() {
58 return fileSystem;
59 }
60
61 FileName getFileName() {
62 return fileName;
63 }
64 }