Source Code Cross Referenced for VPFColumn.java in  » GIS » GeoTools-2.4.1 » org » geotools » data » vpf » 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.data.vpf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    GeoTools - OpenSource mapping toolkit
003:         *    http://geotools.org
004:         *    (C) 2004-2006, Geotools Project Managment Committee (PMC)
005:         *
006:         *    This library is free software; you can redistribute it and/or
007:         *    modify it under the terms of the GNU Lesser General Public
008:         *    License as published by the Free Software Foundation; either
009:         *    version 2.1 of the License, or (at your option) any later version.
010:         *
011:         *    This library is distributed in the hope that it will be useful,
012:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *    Lesser General Public License for more details.
015:         *
016:         *    Created on Jul 30, 2004
017:         */
018:        package org.geotools.data.vpf;
019:
020:        import org.geotools.data.vpf.ifc.DataTypesDefinition;
021:        import org.geotools.data.vpf.io.TripletId;
022:        import org.geotools.data.vpf.util.DataUtils;
023:        import org.geotools.feature.AttributeType;
024:        import org.geotools.feature.AttributeTypeFactory;
025:        import org.geotools.feature.GeometryAttributeType;
026:        import org.geotools.feature.IllegalAttributeException;
027:        import org.opengis.filter.Filter;
028:
029:        import com.vividsolutions.jts.geom.Geometry;
030:
031:        /**
032:         * A column in a VPF File.
033:         *
034:         * @author <a href="mailto:jeff@ionicenterprise.com">Jeff Yutzler</a>
035:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/vpf/src/main/java/org/geotools/data/vpf/VPFColumn.java $
036:         */
037:        public class VPFColumn implements  AttributeType, DataTypesDefinition {
038:            /**
039:             * If the value is a short integer, that often means it has
040:             * an accompanying value in a string lookup table.
041:             */
042:            private boolean attemptLookup = false;
043:            /**
044:             * The contained attribute type. 
045:             * AttributeType operations are delegated to this object.
046:             */
047:            private final AttributeType attribute;
048:
049:            /** Describe variable <code>elementsNumber</code> here. */
050:            private final int elementsNumber;
051:
052:            /** Describe variable <code>narrTable</code> here. */
053:            private final String narrTable;
054:
055:            /** Describe variable <code>keyType</code> here. */
056:            private final char keyType;
057:
058:            /** Describe variable <code>colDesc</code> here. */
059:            private final String colDesc;
060:
061:            /** Describe variable <code>thematicIdx</code> here. */
062:            private final String thematicIdx;
063:
064:            /** Describe variable <code>type</code> here. */
065:            private final char typeChar;
066:
067:            /** Describe variable <code>valDescTableName</code> here. */
068:            private final String valDescTableName;
069:
070:            /**
071:             * Constructor with all of the elements of a VPF column
072:             * @param name
073:             * @param type
074:             * @param elementsNumber
075:             * @param keyType
076:             * @param colDesc
077:             * @param valDescTableName
078:             * @param thematicIdx
079:             * @param narrTable
080:             */
081:            public VPFColumn(String name, char type, int elementsNumber,
082:                    char keyType, String colDesc, String valDescTableName,
083:                    String thematicIdx, String narrTable) {
084:                this .typeChar = type;
085:                this .elementsNumber = elementsNumber;
086:                this .keyType = keyType;
087:                this .colDesc = colDesc;
088:                this .valDescTableName = valDescTableName;
089:                this .thematicIdx = thematicIdx;
090:                this .narrTable = narrTable;
091:                attribute = AttributeTypeFactory.newAttributeType(name,
092:                        getColumnClass(), true, getColumnSize());
093:            }
094:
095:            /**
096:             * Retrieves the class for the column,
097:             * based on a char value.
098:             * @return the class
099:             */
100:            public Class getColumnClass() {
101:                Class columnClass;
102:
103:                switch (typeChar) {
104:                case DATA_LONG_INTEGER:
105:                    columnClass = Integer.class;
106:
107:                    break;
108:
109:                case DATA_SHORT_FLOAT:
110:                    columnClass = Float.class;
111:
112:                    break;
113:
114:                case DATA_LONG_FLOAT:
115:                    columnClass = Double.class;
116:
117:                    break;
118:
119:                case DATA_2_COORD_F:
120:                case DATA_2_COORD_R:
121:                case DATA_3_COORD_F:
122:                case DATA_3_COORD_R:
123:                    columnClass = Geometry.class;
124:
125:                    break;
126:
127:                case DATA_TRIPLET_ID:
128:                    columnClass = TripletId.class;
129:
130:                    break;
131:
132:                // Short integers are usually coded values
133:                case DATA_SHORT_INTEGER:
134:                    attemptLookup = true;
135:                    // Fall through
136:                case DATA_TEXT:
137:                case DATA_NULL_FIELD:
138:                case DATA_LEVEL1_TEXT:
139:                case DATA_LEVEL2_TEXT:
140:                case DATA_LEVEL3_TEXT:
141:
142:                default:
143:                    columnClass = String.class;
144:
145:                    break;
146:                }
147:
148:                return columnClass;
149:            }
150:
151:            /* (non-Javadoc)
152:             * @see org.geotools.feature.AttributeType#createDefaultValue()
153:             */
154:            public Object createDefaultValue() {
155:                return attribute.createDefaultValue();
156:            }
157:
158:            /* (non-Javadoc)
159:             * @see org.geotools.feature.AttributeType#duplicate(java.lang.Object)
160:             */
161:            public Object duplicate(Object src)
162:                    throws IllegalAttributeException {
163:                return attribute.duplicate(src);
164:            }
165:
166:            /**
167:             * Gets the size of the column in bytes
168:             * @return the size
169:             */
170:            private int getColumnSize() {
171:                return DataUtils.getDataTypeSize(typeChar) * elementsNumber;
172:            }
173:
174:            // no longer in ft
175:            //    /* (non-Javadoc)
176:            //     * @see org.geotools.feature.AttributeType#getFieldLength()
177:            //     */
178:            //    public int getFieldLength() {
179:            //        return attribute.getFieldLength();
180:            //    }
181:
182:            /* (non-Javadoc)
183:             * @see org.geotools.feature.AttributeType#getName()
184:             */
185:            public String getName() {
186:                return attribute.getName();
187:            }
188:
189:            /**
190:             * {@inheritDoc}
191:             */
192:            public String getLocalName() {
193:                return attribute.getLocalName();
194:            }
195:
196:            /**
197:             * Gets the value of narrTable
198:             *
199:             * @return the value of narrTable
200:             */
201:            public String getNarrTable() {
202:                return this .narrTable;
203:            }
204:
205:            /**
206:             * Gets the value of thematicIdx
207:             *
208:             * @return the value of thematicIdx
209:             */
210:            public String getThematicIdx() {
211:                return this .thematicIdx;
212:            }
213:
214:            /* (non-Javadoc)
215:             * @see org.geotools.feature.AttributeType#getType()
216:             */
217:            public Class getType() {
218:                return attribute.getType();
219:            }
220:
221:            /**
222:             * {@inheritDoc}
223:             */
224:            public Class getBinding() {
225:                return attribute.getBinding();
226:            }
227:
228:            /**
229:             * Gets the value of valDescTableName
230:             *
231:             * @return the value of valDescTableName
232:             */
233:            public String getValDescTableName() {
234:                return valDescTableName;
235:            }
236:
237:            /* (non-Javadoc)
238:             * @see org.geotools.feature.AttributeType#isGeometry()
239:             */
240:            public boolean isGeometry() {
241:                return attribute instanceof  Geometry;
242:            }
243:
244:            // no longer needed
245:            //    /* (non-Javadoc)
246:            //     * @see org.geotools.feature.AttributeType#isNested()
247:            //     */
248:            //    public boolean isNested() {
249:            //        return attribute.isNested();
250:            //    }
251:
252:            /* (non-Javadoc)
253:             * @see org.geotools.feature.AttributeType#isNillable()
254:             */
255:            public boolean isNillable() {
256:                return attribute.isNillable();
257:            }
258:
259:            /* (non-Javadoc)
260:             * @see org.geotools.feature.AttributeType#parse(java.lang.Object)
261:             */
262:            public Object parse(Object value) throws IllegalArgumentException {
263:                return attribute.parse(value);
264:            }
265:
266:            /* (non-Javadoc)
267:             * @see org.geotools.feature.AttributeType#validate(java.lang.Object)
268:             */
269:            public void validate(Object obj) throws IllegalArgumentException {
270:                attribute.validate(obj);
271:            }
272:
273:            /**
274:             * Returns the typeChar field
275:             *
276:             * @return Returns the typeChar.
277:             */
278:            public char getTypeChar() {
279:                return typeChar;
280:            }
281:
282:            /**
283:             * Returns the elementsNumber field
284:             *
285:             * @return Returns the elementsNumber.
286:             */
287:            public int getElementsNumber() {
288:                return elementsNumber;
289:            }
290:
291:            /**
292:             * Identifies and returns the GeometryAttributeType,
293:             * or null if none exists.
294:             * @return The <code>GeometryAttributeType</code> value
295:             */
296:            public GeometryAttributeType getGeometryAttributeType() {
297:                GeometryAttributeType result = null;
298:
299:                if (isGeometry()) {
300:                    result = (GeometryAttributeType) attribute;
301:                }
302:
303:                return result;
304:            }
305:
306:            /**
307:             * @return Returns the attemptLookup.
308:             */
309:            public boolean isAttemptLookup() {
310:                return attemptLookup;
311:            }
312:
313:            /* (non-Javadoc)
314:             * @see org.geotools.feature.AttributeType#getRestriction()
315:             */
316:            public Filter getRestriction() {
317:                return attribute.getRestriction();
318:            }
319:
320:            /* (non-Javadoc)
321:             * @see org.geotools.feature.AttributeType#getMinOccurs()
322:             */
323:            public int getMinOccurs() {
324:                return 1;
325:            }
326:
327:            /* (non-Javadoc)
328:             * @see org.geotools.feature.AttributeType#getMaxOccurs()
329:             */
330:            public int getMaxOccurs() {
331:                return 1;
332:            }
333:
334:            public boolean equals(Object obj) {
335:                return attribute.equals(obj);
336:            }
337:
338:            public int hashCode() {
339:                return attribute.hashCode();
340:            }
341:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.