Source Code Cross Referenced for FeatureSchemaTools.java in  » GIS » openjump » de » fho » jump » pirol » utilities » apiTools » 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 » openjump » de.fho.jump.pirol.utilities.apiTools 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on 28.06.2005 for PIROL
003:         *
004:         * SVN header information:
005:         *  $Author: javamap $
006:         *  $Rev: 856 $
007:         *  $Date: 2007-06-18 21:15:27 -0700 (Mon, 18 Jun 2007) $
008:         *  $Id: FeatureSchemaTools.java 856 2007-06-19 04:15:27Z javamap $
009:         */
010:        package de.fho.jump.pirol.utilities.apiTools;
011:
012:        import java.util.ArrayList;
013:
014:        import com.vividsolutions.jump.feature.AttributeType;
015:        import com.vividsolutions.jump.feature.FeatureSchema;
016:
017:        import de.fho.jump.pirol.utilities.attributes.AttributeInfo;
018:
019:        /**
020:         * Class for easier handling of featureSchema objects.
021:         *
022:         * @author Ole Rahn
023:         * <br>
024:         * <br>FH Osnabr&uuml;ck - University of Applied Sciences Osnabr&uuml;ck,
025:         * <br>Project: PIROL (2005),
026:         * <br>Subproject: Daten- und Wissensmanagement
027:         * 
028:         * @version $Rev: 856 $
029:         * 
030:         */
031:        public class FeatureSchemaTools extends ToolToMakeYourLifeEasier {
032:
033:            /**
034:             * Extracts information of all attributes with one of the given types from the given FeatureSchema
035:             *@param fs FeatureSchema to get information from
036:             *@param allowedTypes array with AttributeTypes, that specify which attribute to get information about
037:             *@return array with information on matching attributes
038:             */
039:            public static AttributeInfo[] getAttributesWithTypes(
040:                    FeatureSchema fs, AttributeType[] allowedTypes) {
041:                ArrayList<AttributeInfo> attrInfosList = new ArrayList<AttributeInfo>();
042:                AttributeInfo[] attrInfoArray = AttributeInfo
043:                        .schema2AttributeInfoArray(fs);
044:                int numInfos = attrInfoArray.length;
045:
046:                for (int i = 0; i < numInfos; i++) {
047:                    if (FeatureSchemaTools.isAttributeTypeAllowed(
048:                            attrInfoArray[i].getAttributeType(), allowedTypes)) {
049:                        attrInfosList.add(attrInfoArray[i]);
050:                    }
051:                }
052:
053:                numInfos = attrInfosList.size();
054:                AttributeInfo[] attrInfoRaw = (AttributeInfo[]) attrInfosList
055:                        .toArray(new AttributeInfo[0]);
056:
057:                return attrInfoRaw;
058:            }
059:
060:            /**
061:             * Extracts information on the attribute at the given index from the feature schema.
062:             *@param fs FeatureSchema to get information from
063:             *@param attrIndex index of the attribute in the given featureSchema to get information about
064:             *@return information about the attribute
065:             */
066:            public static AttributeInfo getAttributesInfoFor(FeatureSchema fs,
067:                    int attrIndex) {
068:                AttributeInfo attrInfo = new AttributeInfo(fs
069:                        .getAttributeName(attrIndex), fs
070:                        .getAttributeType(attrIndex));
071:
072:                attrInfo.setIndex(attrIndex);
073:
074:                return attrInfo;
075:            }
076:
077:            /**
078:             * Extracts information on the attribute with the given name from the feature schema.
079:             *@param fs FeatureSchema to get information from
080:             *@param attrName name of the attribute in the given featureSchema to get information about
081:             *@return information about the attribute
082:             */
083:            public static AttributeInfo getAttributesInfoFor(FeatureSchema fs,
084:                    String attrName) {
085:                return FeatureSchemaTools.getAttributesInfoFor(fs, fs
086:                        .getAttributeIndex(attrName));
087:            }
088:
089:            /**
090:             * Checks if the given attribute type is contained in the given array of allowed attribute types.
091:             *@param at attribute type to be checked
092:             *@param allowedTypes array of allowed attribute types
093:             *@return true if <code>at</code> is contained in <code>allowedTypes</code>, else false
094:             */
095:            public static boolean isAttributeTypeAllowed(AttributeType at,
096:                    AttributeType[] allowedTypes) {
097:                int numTypes = allowedTypes.length;
098:                for (int i = 0; i < numTypes; i++) {
099:                    if (allowedTypes[i].equals(at))
100:                        return true;
101:                }
102:                return false;
103:            }
104:
105:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.