Hit.java
1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Decompiled with CFR 0_118.
*/
package com.day.cq.wcm.core.contentfinder;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class Hit
implements Comparable<Hit> {
private Map<String, Object> map = new HashMap<String, Object>();
public Object get(String name) {
return this.map.get(name);
}
public void set(String name, Object value) {
this.map.put(name, value);
}
public Iterator<String> getKeys() {
return this.map.keySet().iterator();
}
@Override
public int compareTo(Hit other) {
long otherLastModified;
long lastModified = Hit.getLastModified(this);
if (lastModified < (otherLastModified = Hit.getLastModified(other))) {
return -1;
}
if (lastModified > otherLastModified) {
return 1;
}
String path = Hit.getPath(this);
String otherPath = Hit.getPath(other);
return path.compareTo(otherPath);
}
private static long getLastModified(Hit hit) {
Object cal = hit.get("lastModified");
if (cal instanceof Calendar) {
return ((Calendar)cal).getTimeInMillis();
}
return 0;
}
private static String getPath(Hit hit) {
Object path = hit.get("path");
if (path instanceof String) {
return (String)path;
}
return "";
}
}