01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2003-2006, GeoTools Project Managment Committee (PMC)
05: * (C) 2002, Centre for Computational Geography
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation;
10: * version 2.1 of the License.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.index.rtree.memory;
18:
19: import org.geotools.index.TreeException;
20: import org.geotools.index.rtree.Entry;
21: import org.geotools.index.rtree.Node;
22:
23: /**
24: * DOCUMENT ME!
25: *
26: * @author Tommaso Nolli
27: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/plugin/shapefile/src/main/java/org/geotools/index/rtree/memory/MemoryNode.java $
28: */
29: public class MemoryNode extends Node {
30: private Node parent;
31:
32: /**
33: * DOCUMENT ME!
34: *
35: * @param maxNodeEntries
36: */
37: public MemoryNode(int maxNodeEntries) {
38: super (maxNodeEntries);
39: }
40:
41: /**
42: * @see org.geotools.index.rtree.Node#getParent()
43: */
44: public Node getParent() throws TreeException {
45: return this .parent;
46: }
47:
48: /**
49: * @see org.geotools.index.rtree.Node#setParent(org.geotools.index.rtree.Node)
50: */
51: public void setParent(Node node) {
52: this .parent = node;
53: }
54:
55: /**
56: * @see org.geotools.index.rtree.Node#getEntry(org.geotools.index.rtree.Node)
57: */
58: protected Entry getEntry(Node node) {
59: Entry ret = null;
60: Node n = null;
61:
62: for (int i = 0; i < this .entries.length; i++) {
63: n = (Node) this .entries[i].getData();
64:
65: if (n == node) {
66: ret = this .entries[i];
67:
68: break;
69: }
70: }
71:
72: return ret;
73: }
74:
75: /**
76: * @see org.geotools.index.rtree.Node#doSave()
77: */
78: protected void doSave() throws TreeException {
79: // does nothing....
80: }
81: }
|