org.deegree.cs
Class CRSCodeType

java.lang.Object
  extended by org.deegree.cs.CRSCodeType
Direct Known Subclasses:
EPSGCode

public class CRSCodeType
extends Object

The CRSCodeType class formalizes the access to CRSIdentifiable, replacing the old "identifiers". Any prefix patterns that are noticed as for example

are encapsulated in codespace( in this case "EPSG") and code( the respective value). If any new codetypes are noticed, please add them to the constructor and valueOf method.

Version:
$Revision: $, $Date: $
Author:
Andrei Ionita, last edited by: $Author: ionita $

Constructor Summary
CRSCodeType(String codeAsString)
          Create a CRSCodeType from a string.
CRSCodeType(String code, String codeSpace)
          Create a CRSCodeType from the code and codeSpace.
 
Method Summary
 boolean equals(Object o)
           
 String getCode()
           
 String getCodeSpace()
           
 String getCodeVersion()
           
 String getOriginal()
           
static CRSCodeType getUndefined()
           
 int hashCode()
          Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast.
 String toString()
          Returns the codespace codeversion and code, or just the original string if it could not be parsed.
static CRSCodeType valueOf(String codeAsString)
          Returns the CRSCodeType that can be constructed from the string parameter.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CRSCodeType

public CRSCodeType(String code,
                   String codeSpace)
Create a CRSCodeType from the code and codeSpace. This constructor should be used when the "$codeSpace:$code" string is an actual id (and not just a compressed version).

Parameters:
code -
codeSpace -

CRSCodeType

public CRSCodeType(String codeAsString)
Create a CRSCodeType from a string. The string is parsed into code, codeSpace and codeVersion. When it cannot, only the original field is non-empty (it will be equal to codeAsString).

Parameters:
codeAsString -
Method Detail

valueOf

public static CRSCodeType valueOf(String codeAsString)
                           throws IllegalArgumentException
Returns the CRSCodeType that can be constructed from the string parameter.

Parameters:
codeAsString -
Returns:
the parsed string as a code type
Throws:
IllegalArgumentException

getCode

public String getCode()
Returns:
the code number from the code (e.g. "4326" ). Can be an empty string if the id could not be parsed. To get the id use getOriginal()

getCodeSpace

public String getCodeSpace()
Returns:
the code space from the code (e.g. "EPSG" ). Can be an empty string if the id could not be parsed.

getCodeVersion

public String getCodeVersion()
Returns:
the version of the code. If it does not exist, an empty string is returned.

getOriginal

public String getOriginal()
Returns:
the code id before parsing.

getUndefined

public static CRSCodeType getUndefined()
Returns:
The code used when a CRSIdentifiable has no id. The code used is "NOT PROVIDED".

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast. It is created from field f as follows:

Combining the hash code(s) computed above: result = 37 * result + code;

Overrides:
hashCode in class Object
Returns:
(int) ( result >>> 32 ) ^ (int) result;
See Also:
Object.hashCode()

toString

public String toString()
Returns the codespace codeversion and code, or just the original string if it could not be parsed. Recommended for presentation purposes only.

Overrides:
toString in class Object
Returns:
the code in the form $codespace:$codeversion:$code


Copyright © 2011. All Rights Reserved.