Source Code Cross Referenced for PageStore.java in  » GIS » GeoTools-2.4.1 » org » geotools » index » rtree » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.index.rtree 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2003-2006, GeoTools Project Managment Committee (PMC)
005:         *    (C) 2002, Centre for Computational Geography
006:         *
007:         *    This library is free software; you can redistribute it and/or
008:         *    modify it under the terms of the GNU Lesser General Public
009:         *    License as published by the Free Software Foundation;
010:         *    version 2.1 of the License.
011:         *
012:         *    This library is distributed in the hope that it will be useful,
013:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *    Lesser General Public License for more details.
016:         */
017:        package org.geotools.index.rtree;
018:
019:        import org.geotools.index.DataDefinition;
020:        import org.geotools.index.Lock;
021:        import org.geotools.index.LockManager;
022:        import org.geotools.index.LockTimeoutException;
023:        import org.geotools.index.TreeException;
024:
025:        /**
026:         * DOCUMENT ME!
027:         *
028:         * @author Tommaso Nolli
029:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/plugin/shapefile/src/main/java/org/geotools/index/rtree/PageStore.java $
030:         */
031:        public abstract class PageStore {
032:            public static final short SPLIT_QUADRATIC = 1;
033:            public static final short SPLIT_LINEAR = 2;
034:            protected DataDefinition def;
035:            protected int maxNodeEntries;
036:            protected int minNodeEntries;
037:            protected short splitAlg;
038:            private LockManager lockManager;
039:
040:            /**
041:             *
042:             */
043:            public PageStore() {
044:                this .lockManager = new LockManager();
045:            }
046:
047:            /**
048:             * DOCUMENT ME!
049:             *
050:             * @param def
051:             * @param maxNodeEntries
052:             * @param minNodeEntries
053:             * @param splitAlg
054:             *
055:             * @throws TreeException
056:             * @throws UnsupportedOperationException DOCUMENT ME!
057:             */
058:            public PageStore(DataDefinition def, int maxNodeEntries,
059:                    int minNodeEntries, short splitAlg) throws TreeException {
060:                this ();
061:
062:                if (minNodeEntries > (maxNodeEntries / 2)) {
063:                    throw new TreeException("minNodeEntries shoud be <= "
064:                            + "maxNodeEntries / 2");
065:                }
066:
067:                if ((splitAlg != SPLIT_LINEAR) && (splitAlg != SPLIT_QUADRATIC)) {
068:                    throw new TreeException("Split algorithm shoud be "
069:                            + "SPLIT_LINEAR or SPLIT_QUADRATIC");
070:                }
071:
072:                if (!def.isValid()) {
073:                    throw new TreeException("Invalid DataDefinition");
074:                }
075:
076:                //TODO: Remove when SPLIT_LINEAR is implemented
077:                if (splitAlg != SPLIT_QUADRATIC) {
078:                    throw new UnsupportedOperationException(
079:                            "Only SPLIT_QUARDATIC is allowed by now...");
080:                }
081:
082:                this .def = def;
083:                this .maxNodeEntries = maxNodeEntries;
084:                this .minNodeEntries = minNodeEntries;
085:                this .splitAlg = splitAlg;
086:            }
087:
088:            /**
089:             * DOCUMENT ME!
090:             *
091:             */
092:            public abstract Node getRoot();
093:
094:            /**
095:             * DOCUMENT ME!
096:             *
097:             * @param node
098:             *
099:             * @throws TreeException DOCUMENT ME!
100:             */
101:            public abstract void setRoot(Node node) throws TreeException;
102:
103:            /**
104:             * DOCUMENT ME!
105:             *
106:             * @param isLeaf
107:             *
108:             */
109:            public abstract Node getEmptyNode(boolean isLeaf);
110:
111:            /**
112:             * Returns the Node pointed by this entry and having this Node as parent
113:             *
114:             * @param parentEntry
115:             * @param parent
116:             *
117:             *
118:             * @throws TreeException DOCUMENT ME!
119:             */
120:            public abstract Node getNode(Entry parentEntry, Node parent)
121:                    throws TreeException;
122:
123:            /**
124:             * DOCUMENT ME!
125:             *
126:             * @param node
127:             *
128:             */
129:            public abstract Entry createEntryPointingNode(Node node);
130:
131:            /**
132:             * DOCUMENT ME!
133:             *
134:             * @return The maximum number of <code>Entry</code>s per page
135:             */
136:            public int getMaxNodeEntries() {
137:                return this .maxNodeEntries;
138:            }
139:
140:            /**
141:             * DOCUMENT ME!
142:             *
143:             * @return The minimum number of <code>Entry</code>s per page
144:             */
145:            public int getMinNodeEntries() {
146:                return this .minNodeEntries;
147:            }
148:
149:            /**
150:             * DOCUMENT ME!
151:             *
152:             * @return The split algorithm to use
153:             */
154:            public short getSplitAlgorithm() {
155:                return this .splitAlg;
156:            }
157:
158:            /**
159:             * DOCUMENT ME!
160:             *
161:             */
162:            public DataDefinition getDataDefinition() {
163:                return this .def;
164:            }
165:
166:            /**
167:             * Frees resources used by this <code>Node</code>
168:             *
169:             * @param node The <code>Node</code> to free
170:             */
171:            public abstract void free(Node node);
172:
173:            /**
174:             * Aquires a write lock to the store
175:             *
176:             * @return an Object rapresenting the lock
177:             *
178:             * @throws LockTimeoutException
179:             */
180:            public Lock getWriteLock() throws LockTimeoutException {
181:                return this .lockManager.aquireExclusive();
182:            }
183:
184:            /**
185:             * Aquires a read lock to the store
186:             *
187:             * @return an Object rapresenting the lock
188:             *
189:             * @throws LockTimeoutException
190:             */
191:            public Lock getReadLock() throws LockTimeoutException {
192:                return this .lockManager.aquireShared();
193:            }
194:
195:            /**
196:             * DOCUMENT ME!
197:             *
198:             * @param lock
199:             */
200:            public void releaseLock(Lock lock) {
201:                this .lockManager.release(lock);
202:            }
203:
204:            /**
205:             * DOCUMENT ME!
206:             *
207:             * @throws TreeException
208:             */
209:            public abstract void close() throws TreeException;
210:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.