001    /*
002     *    GeoAPI - Java interfaces for OGC/ISO standards
003     *    http://www.geoapi.org
004     *
005     *    Copyright (C) 2004-2012 Open Geospatial Consortium, Inc.
006     *    All Rights Reserved. http://www.opengeospatial.org/ogc/legal
007     *
008     *    Permission to use, copy, and modify this software and its documentation, with
009     *    or without modification, for any purpose and without fee or royalty is hereby
010     *    granted, provided that you include the following on ALL copies of the software
011     *    and documentation or portions thereof, including modifications, that you make:
012     *
013     *    1. The full text of this NOTICE in a location viewable to users of the
014     *       redistributed or derivative work.
015     *    2. Notice of any changes or modifications to the OGC files, including the
016     *       date changes were made.
017     *
018     *    THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
019     *    NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
020     *    TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
021     *    THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
022     *    PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
023     *
024     *    COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
025     *    CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
026     *
027     *    The name and trademarks of copyright holders may NOT be used in advertising or
028     *    publicity pertaining to the software without specific, written prior permission.
029     *    Title to copyright in this software and any associated documentation will at all
030     *    times remain with copyright holders.
031     */
032    package org.opengis.metadata.maintenance;
033    
034    import java.util.List;
035    import java.util.ArrayList;
036    import org.opengis.util.CodeList;
037    import org.opengis.annotation.UML;
038    
039    import static org.opengis.annotation.Obligation.*;
040    import static org.opengis.annotation.Specification.*;
041    
042    
043    /**
044     * Class of information to which the referencing entity applies.
045     *
046     * @author  Martin Desruisseaux (IRD)
047     * @author  Cory Horner (Refractions Research)
048     * @version 3.0
049     * @since   2.0
050     *
051     * @see org.opengis.metadata.quality.Scope
052     */
053    @UML(identifier="MD_ScopeCode", specification=ISO_19115)
054    public final class ScopeCode extends CodeList<ScopeCode> {
055        /**
056         * Serial number for compatibility with different versions.
057         */
058        private static final long serialVersionUID = -4542429199783894255L;
059    
060        /**
061         * List of all enumerations of this type.
062         * Must be declared before any enum declaration.
063         */
064        private static final List<ScopeCode> VALUES = new ArrayList<ScopeCode>(16);
065    
066        /**
067         * Information applies to the attribute value.
068         */
069        @UML(identifier="attribute", obligation=CONDITIONAL, specification=ISO_19115)
070        public static final ScopeCode ATTRIBUTE = new ScopeCode("ATTRIBUTE");
071    
072        /**
073         * Information applies to the characteristic of a feature.
074         */
075        @UML(identifier="attributeType", obligation=CONDITIONAL, specification=ISO_19115)
076        public static final ScopeCode ATTRIBUTE_TYPE = new ScopeCode("ATTRIBUTE_TYPE");
077    
078        /**
079         * Information applies to the collection hardware class.
080         */
081        @UML(identifier="collectionHardware", obligation=CONDITIONAL, specification=ISO_19115)
082        public static final ScopeCode COLLECTION_HARDWARE = new ScopeCode("COLLECTION_HARDWARE");
083    
084        /**
085         * Information applies to the collection session.
086         */
087        @UML(identifier="collectionSession", obligation=CONDITIONAL, specification=ISO_19115)
088        public static final ScopeCode COLLECTION_SESSION = new ScopeCode("COLLECTION_SESSION");
089    
090        /**
091         * Information applies to the dataset.
092         */
093        @UML(identifier="dataset", obligation=CONDITIONAL, specification=ISO_19115)
094        public static final ScopeCode DATASET = new ScopeCode("DATASET");
095    
096        /**
097         * Information applies to the series.  Note: "series" applies to any {@code DS_Aggregate}.
098         */
099        @UML(identifier="series", obligation=CONDITIONAL, specification=ISO_19115)
100        public static final ScopeCode SERIES = new ScopeCode("SERIES");
101    
102        /**
103         * information applies to non-geographic data;
104         */
105        @UML(identifier="nonGeographicDataset", obligation=CONDITIONAL, specification=ISO_19115)
106        public static final ScopeCode NON_GEOGRAPHIC_DATASET = new ScopeCode("NON_GEOGRAPHIC_DATASET");
107    
108        /**
109         * Information applies to a dimension group.
110         */
111        @UML(identifier="dimensionGroup", obligation=CONDITIONAL, specification=ISO_19115)
112        public static final ScopeCode DIMENSION_GROUP = new ScopeCode("DIMENSION_GROUP");
113    
114        /**
115         * Information applies to a feature.
116         */
117        @UML(identifier="feature", obligation=CONDITIONAL, specification=ISO_19115)
118        public static final ScopeCode FEATURE = new ScopeCode("FEATURE");
119    
120        /**
121         * Information applies to a feature type.
122         */
123        @UML(identifier="featureType", obligation=CONDITIONAL, specification=ISO_19115)
124        public static final ScopeCode FEATURE_TYPE = new ScopeCode("FEATURE_TYPE");
125    
126        /**
127         * Information applies to a property type.
128         */
129        @UML(identifier="propertyType", obligation=CONDITIONAL, specification=ISO_19115)
130        public static final ScopeCode PROPERTY_TYPE = new ScopeCode("PROPERTY_TYPE");
131    
132        /**
133         * Information applies to a field session.
134         */
135        @UML(identifier="fieldSession", obligation=CONDITIONAL, specification=ISO_19115)
136        public static final ScopeCode FIELD_SESSION = new ScopeCode("FIELD_SESSION");
137    
138        /**
139         * Information applies to a computer program or routine.
140         */
141        @UML(identifier="software", obligation=CONDITIONAL, specification=ISO_19115)
142        public static final ScopeCode SOFTWARE = new ScopeCode("SOFTWARE");
143    
144        /**
145         * Information applies to a capability which a service provider entity makes available
146         * to a service user entity through a set of interfaces that define a behaviour, such as
147         * a use case.
148         */
149        @UML(identifier="service", obligation=CONDITIONAL, specification=ISO_19115)
150        public static final ScopeCode SERVICE = new ScopeCode("SERVICE");
151    
152        /**
153         * Information applies to a copy or imitation of an existing or hypothetical object.
154         */
155        @UML(identifier="model", obligation=CONDITIONAL, specification=ISO_19115)
156        public static final ScopeCode MODEL = new ScopeCode("MODEL");
157    
158        /**
159         * Information applies to a copy or imitation of an existing or hypothetical object.
160         *
161         * @since 2.1
162         */
163        @UML(identifier="tile", obligation=CONDITIONAL, specification=ISO_19115)
164        public static final ScopeCode TILE = new ScopeCode("TILE");
165    
166        /**
167         * Constructs an enum with the given name. The new enum is
168         * automatically added to the list returned by {@link #values}.
169         *
170         * @param name The enum name. This name must not be in use by an other enum of this type.
171         */
172        private ScopeCode(final String name) {
173            super(name, VALUES);
174        }
175    
176        /**
177         * Returns the list of {@code ScopeCode}s.
178         *
179         * @return The list of codes declared in the current JVM.
180         */
181        public static ScopeCode[] values() {
182            synchronized (VALUES) {
183                return VALUES.toArray(new ScopeCode[VALUES.size()]);
184            }
185        }
186    
187        /**
188         * Returns the list of enumerations of the same kind than this enum.
189         */
190        @Override
191        public ScopeCode[] family() {
192            return values();
193        }
194    
195        /**
196         * Returns the scope code that matches the given string, or returns a
197         * new one if none match it. More specifically, this methods returns the first instance for
198         * which <code>{@linkplain #name() name()}.{@linkplain String#equals equals}(code)</code>
199         * returns {@code true}. If no existing instance is found, then a new one is created for
200         * the given name.
201         *
202         * @param code The name of the code to fetch or to create.
203         * @return A code matching the given name.
204         */
205        public static ScopeCode valueOf(String code) {
206            return valueOf(ScopeCode.class, code);
207        }
208    }