Class Codes

java.lang.Object
org.apache.sis.referencing.cs.Codes

final class Codes extends Object
Map units of measurement and axis directions to CoordinateSystem objects defined in the EPSG database. Current version uses hard-coded mapping.
Since:
0.8
Version:
1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) final int
    Axis directions as a maximum of 4 directions packed in a single integer.
    (package private) final short
    EPSG code of the coordinate reference system.
    private static final Map<Codes,Codes>
    All hard-coded EPSG codes known to this class.
    (package private) final short
    EPSG code of the target unit of measurement.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Codes(int directions, short unit, short epsg)
    Creates a new code for the given axis directions and units.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares this Codes instance with the given object for equality.
    int
    Returns the hash code value for this Codes instance.
    (package private) static short
    lookup(javax.measure.Unit<?> unit, org.opengis.referencing.cs.AxisDirection[] directions)
    Returns the EPSG code for the given axis directions and unit of measurement, or 0 if none.
    private static int
    pack(org.opengis.referencing.cs.AxisDirection[] directions)
    Packs the given axis directions in a single integer.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • directions

      final int directions
      Axis directions as a maximum of 4 directions packed in a single integer. Each byte is an CodeList.ordinal() value.
      See Also:
    • unit

      final short unit
      EPSG code of the target unit of measurement. Applies only to the two first axes. The third axis, if any, is assumed in metres.
    • epsg

      final short epsg
      EPSG code of the coordinate reference system.
    • EPSG

      private static final Map<Codes,Codes> EPSG
      All hard-coded EPSG codes known to this class.
  • Constructor Details

    • Codes

      private Codes(int directions, short unit, short epsg)
      Creates a new code for the given axis directions and units.
  • Method Details

    • pack

      private static int pack(org.opengis.referencing.cs.AxisDirection[] directions)
      Packs the given axis directions in a single integer.
      Returns:
      the packed directions, or 0 if the given directions cannot be packed.
    • lookup

      static short lookup(javax.measure.Unit<?> unit, org.opengis.referencing.cs.AxisDirection[] directions)
      Returns the EPSG code for the given axis directions and unit of measurement, or 0 if none.
      Parameters:
      unit - the unit of the two first axis. The third axis, if any, is assumed in metres.
      directions - axis directions to look for.
    • hashCode

      public int hashCode()
      Returns the hash code value for this Codes instance. Note that lookup(Unit, AxisDirection[]) needs that the hash code excludes the EPSG code.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Compares this Codes instance with the given object for equality. Note that lookup(Unit, AxisDirection[]) needs that the comparison excludes the EPSG code.
      Overrides:
      equals in class Object