01: package org.geotools.caching.quatree;
02:
03: import org.geotools.caching.CacheEntry;
04: import org.geotools.caching.spatialindex.spatialindex.INode;
05:
06: import java.util.ArrayList;
07:
08: public class NodeCacheEntry implements CacheEntry {
09: protected ArrayList linkedFeatures = new ArrayList();
10: private final INode node;
11: private final Integer key;
12: private int hits;
13: private long creationTime;
14: private long lastAccessTime;
15: private boolean valid = false;
16:
17: public NodeCacheEntry(INode node) {
18: this .node = node;
19: key = new Integer(node.getIdentifier());
20: hits = 0;
21: creationTime = System.currentTimeMillis();
22: lastAccessTime = creationTime;
23: }
24:
25: public long getCost() {
26: // TODO Auto-generated method stub
27: return -1;
28: }
29:
30: public long getCreationTime() {
31: return creationTime;
32: }
33:
34: public long getExpirationTime() {
35: // TODO Auto-generated method stub
36: return -1;
37: }
38:
39: public int getHits() {
40: return hits;
41: }
42:
43: public long getLastAccessTime() {
44: return lastAccessTime;
45: }
46:
47: public long getLastUpdateTime() {
48: return -1;
49: }
50:
51: public long getVersion() {
52: // TODO Auto-generated method stub
53: return -1;
54: }
55:
56: public boolean isValid() {
57: return valid;
58: }
59:
60: public void invalidate() {
61: valid = false;
62: linkedFeatures.clear();
63: }
64:
65: public void setValid() {
66: valid = true;
67: }
68:
69: public Object getKey() {
70: return key;
71: }
72:
73: public Object getValue() {
74: return node;
75: }
76:
77: public Object setValue(Object arg0) {
78: throw new UnsupportedOperationException();
79: }
80:
81: public void hit() {
82: hits++;
83: lastAccessTime = System.currentTimeMillis();
84: }
85: }
|