Source Code Cross Referenced for AbstractParameterDescriptor.java in  » GIS » GeoTools-2.4.1 » org » geotools » parameter » 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.parameter 
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:         *    (C) 2004, Institut de Recherche pour le Développement
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:         *    This package contains documentation from OpenGIS specifications.
018:         *    OpenGIS consortium's work is fully acknowledged here.
019:         */
020:        package org.geotools.parameter;
021:
022:        // J2SE dependencies
023:        import java.util.Map;
024:
025:        // OpenGIS dependencies
026:        import org.opengis.parameter.ParameterValue;
027:        import org.opengis.parameter.GeneralParameterValue;
028:        import org.opengis.parameter.GeneralParameterDescriptor;
029:
030:        // Geotools dependencies
031:        import org.geotools.referencing.AbstractIdentifiedObject;
032:        import org.geotools.referencing.wkt.Formatter;
033:        import org.geotools.resources.i18n.ErrorKeys;
034:        import org.geotools.resources.i18n.Errors;
035:
036:        /**
037:         * Abstract definition of a parameter or group of parameters used by an operation method.
038:         *
039:         * @since 2.1
040:         * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/referencing/src/main/java/org/geotools/parameter/AbstractParameterDescriptor.java $
041:         * @version $Id: AbstractParameterDescriptor.java 24607 2007-02-26 22:05:40Z desruisseaux $
042:         * @author Martin Desruisseaux
043:         *
044:         * @see AbstractParameter
045:         */
046:        public abstract class AbstractParameterDescriptor extends
047:                AbstractIdentifiedObject implements  GeneralParameterDescriptor {
048:            /**
049:             * Serial number for interoperability with different versions.
050:             */
051:            private static final long serialVersionUID = -2630644278783845276L;
052:
053:            /**
054:             * The minimum number of times that values for this parameter group or
055:             * parameter are required.
056:             */
057:            private final int minimumOccurs;
058:
059:            /**
060:             * Constructs a descriptor with the same values than the specified one. This copy constructor
061:             * may be used in order to wraps an arbitrary implementation into a Geotools one.
062:             *
063:             * @since 2.2
064:             */
065:            protected AbstractParameterDescriptor(
066:                    final GeneralParameterDescriptor descriptor) {
067:                super (descriptor);
068:                minimumOccurs = descriptor.getMinimumOccurs();
069:            }
070:
071:            /**
072:             * Constructs a parameter from a set of properties. The properties map is given unchanged to the
073:             * {@linkplain AbstractIdentifiedObject#AbstractIdentifiedObject(Map) super-class constructor}.
074:             *
075:             * @param properties Set of properties. Should contains at least {@code "name"}.
076:             * @param minimumOccurs The {@linkplain #getMinimumOccurs minimum number of times}
077:             *        that values for this parameter group or parameter are required.
078:             * @param maximumOccurs The {@linkplain #getMaximumOccurs maximum number of times}
079:             *        that values for this parameter group or parameter are required. This value
080:             *        is used in order to check the range. For {@link ParameterValue}, it should
081:             *        always be 1.
082:             */
083:            protected AbstractParameterDescriptor(final Map properties,
084:                    final int minimumOccurs, final int maximumOccurs) {
085:                super (properties);
086:                this .minimumOccurs = minimumOccurs;
087:                if (minimumOccurs < 0 || maximumOccurs < minimumOccurs) {
088:                    throw new IllegalArgumentException(Errors.format(
089:                            ErrorKeys.BAD_RANGE_$2, new Integer(minimumOccurs),
090:                            new Integer(maximumOccurs)));
091:                }
092:            }
093:
094:            /**
095:             * Creates a new instance of {@linkplain AbstractParameter parameter value or group} initialized
096:             * with the {@linkplain DefaultParameterDescriptor#getDefaultValue default value(s)}.
097:             * The {@linkplain AbstractParameter#getDescriptor parameter value descriptor} for the
098:             * created parameter value(s) will be {@code this} object.
099:             * <p>
100:             * Example implementation:
101:             * <pre>
102:             * <b>return</b> new {@linkplain Parameter}(this);
103:             * </pre>
104:             */
105:            public abstract GeneralParameterValue createValue();
106:
107:            /**
108:             * The minimum number of times that values for this parameter group or
109:             * parameter are required. The default value is one. A value of 0 means
110:             * an optional parameter.
111:             *
112:             * @see #getMaximumOccurs
113:             */
114:            public int getMinimumOccurs() {
115:                return minimumOccurs;
116:            }
117:
118:            /**
119:             * The maximum number of times that values for this parameter group or parameter
120:             * can be included. For a {@linkplain DefaultParameterDescriptor single parameter},
121:             * the value is always 1. For a {@linkplain DefaultParameterDescriptorGroup parameter group},
122:             * it may vary.
123:             *
124:             * @see #getMinimumOccurs
125:             */
126:            public abstract int getMaximumOccurs();
127:
128:            /**
129:             * Compares the specified object with this parameter for equality.
130:             *
131:             * @param  object The object to compare to {@code this}.
132:             * @param  compareMetadata {@code true} for performing a strict comparaison, or
133:             *         {@code false} for comparing only properties relevant to transformations.
134:             * @return {@code true} if both objects are equal.
135:             */
136:            public boolean equals(final AbstractIdentifiedObject object,
137:                    final boolean compareMetadata) {
138:                if (super .equals(object, compareMetadata)) {
139:                    final AbstractParameterDescriptor that = (AbstractParameterDescriptor) object;
140:                    return this .minimumOccurs == that.minimumOccurs;
141:                }
142:                return false;
143:            }
144:
145:            /**
146:             * Returns a hash value for this parameter.
147:             *
148:             * @return The hash code value. This value doesn't need to be the same
149:             *         in past or future versions of this class.
150:             */
151:            public int hashCode() {
152:                return (int) serialVersionUID ^ (int) minimumOccurs;
153:            }
154:
155:            /**
156:             * Format the inner part of a
157:             * <A HREF="http://geoapi.sourceforge.net/snapshot/javadoc/org/opengis/referencing/doc-files/WKT.html"><cite>Well
158:             * Known Text</cite> (WKT)</A> element. Note that WKT is not yet defined for parameter descriptor.
159:             * Current implementation print only the name.
160:             *
161:             * @param  formatter The formatter to use.
162:             * @return The WKT element name, which is "PARAMETER"
163:             */
164:            protected String formatWKT(final Formatter formatter) {
165:                formatter.setInvalidWKT(GeneralParameterDescriptor.class);
166:                return "PARAMETER";
167:            }
168:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.