01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.caching.impl;
17:
18: import org.geotools.caching.CacheEntry;
19: import org.geotools.caching.spatialindex.spatialindex.INode;
20:
21: public class NodeCacheEntry implements CacheEntry {
22: private final INode node;
23: private final Integer key;
24: private int hits;
25: private long creationTime;
26: private long lastAccessTime;
27:
28: public NodeCacheEntry(INode node) {
29: this .node = node;
30: key = new Integer(node.getIdentifier());
31: hits = 0;
32: creationTime = System.currentTimeMillis();
33: lastAccessTime = creationTime;
34: }
35:
36: public long getCost() {
37: // TODO Auto-generated method stub
38: return -1;
39: }
40:
41: public long getCreationTime() {
42: return creationTime;
43: }
44:
45: public long getExpirationTime() {
46: // TODO Auto-generated method stub
47: return -1;
48: }
49:
50: public int getHits() {
51: return hits;
52: }
53:
54: public long getLastAccessTime() {
55: return lastAccessTime;
56: }
57:
58: public long getLastUpdateTime() {
59: return -1;
60: }
61:
62: public long getVersion() {
63: // TODO Auto-generated method stub
64: return -1;
65: }
66:
67: public boolean isValid() {
68: // TODO Auto-generated method stub
69: return true;
70: }
71:
72: public Object getKey() {
73: return key;
74: }
75:
76: public Object getValue() {
77: return node;
78: }
79:
80: public Object setValue(Object arg0) {
81: throw new UnsupportedOperationException();
82: }
83:
84: public void hit() {
85: hits++;
86: lastAccessTime = System.currentTimeMillis();
87: }
88: }
|