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.coverage.grid;
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 * Specifies the order of the bytes in multi-byte values.
045 *
046 * <P> </P>
047 * <TABLE WIDTH="80%" ALIGN="center" CELLPADDING="18" BORDER="4" BGCOLOR="#FFE0B0">
048 * <TR><TD>
049 * <P align="justify"><STRONG>WARNING: THIS CLASS WILL CHANGE.</STRONG> Current API is derived from OGC
050 * <A HREF="http://www.opengis.org/docs/01-004.pdf">Grid Coverages Implementation specification 1.0</A>.
051 * We plan to replace it by new interfaces derived from ISO 19123 (<CITE>Schema for coverage geometry
052 * and functions</CITE>). Current interfaces should be considered as legacy and are included in this
053 * distribution only because they were part of GeoAPI 1.0 release. We will try to preserve as much
054 * compatibility as possible, but no migration plan has been determined yet.</P>
055 * </TD></TR>
056 * </TABLE>
057 *
058 * @version <A HREF="http://www.opengis.org/docs/01-004.pdf">Grid Coverage specification 1.0</A>
059 * @author Martin Desruisseaux (IRD)
060 * @since GeoAPI 1.0
061 *
062 * @see GridPacking
063 * @see ValueInBytePacking
064 * @see java.nio.ByteOrder
065 *
066 * @deprecated In favor of migrating to ISO 19123 definition for Coverage.
067 */
068 @UML(identifier="GC_ByteInValuePacking", specification=OGC_01004)
069 public final class ByteInValuePacking extends CodeList<ByteInValuePacking> {
070 /**
071 * Serial number for compatibility with different versions.
072 */
073 private static final long serialVersionUID = -5830149616089633137L;
074
075 /**
076 * List of all enumerations of this type.
077 * Must be declared before any enum declaration.
078 */
079 private static final List<ByteInValuePacking> VALUES = new ArrayList<ByteInValuePacking>(2);
080
081 /**
082 * Big Endian.
083 *
084 * @see java.nio.ByteOrder#BIG_ENDIAN
085 */
086 @UML(identifier="GC_wkbXDR", obligation=CONDITIONAL, specification=OGC_01004)
087 public static final ByteInValuePacking WKB_XDR = new ByteInValuePacking("WKB_XDR");
088
089 /**
090 * Little Endian.
091 *
092 * @see java.nio.ByteOrder#LITTLE_ENDIAN
093 */
094 @UML(identifier="GC_wkbNDR", obligation=CONDITIONAL, specification=OGC_01004)
095 public static final ByteInValuePacking WKB_NDR = new ByteInValuePacking("WKB_NDR");
096
097 /**
098 * Constructs an enum with the given name. The new enum is
099 * automatically added to the list returned by {@link #values}.
100 *
101 * @param name The enum name. This name must not be in use by an other enum of this type.
102 */
103 private ByteInValuePacking(final String name) {
104 super(name, VALUES);
105 }
106
107 /**
108 * Returns the list of {@code ByteInValuePacking}s.
109 *
110 * @return The list of codes declared in the current JVM.
111 */
112 public static ByteInValuePacking[] values() {
113 synchronized (VALUES) {
114 return VALUES.toArray(new ByteInValuePacking[VALUES.size()]);
115 }
116 }
117
118 /**
119 * Returns the list of enumerations of the same kind than this enum.
120 */
121 public ByteInValuePacking[] family() {
122 return values();
123 }
124
125 /**
126 * Returns the byte in value packing that matches the given string, or returns a
127 * new one if none match it. More specifically, this methods returns the first instance for
128 * which <code>{@linkplain #name() name()}.{@linkplain String#equals equals}(code)</code>
129 * returns {@code true}. If no existing instance is found, then a new one is created for
130 * the given name.
131 *
132 * @param code The name of the code to fetch or to create.
133 * @return A code matching the given name.
134 */
135 public static ByteInValuePacking valueOf(String code) {
136 return valueOf(ByteInValuePacking.class, code);
137 }
138 }