org.deegree.cs
Class CRSIdentifiable

java.lang.Object
  extended by org.deegree.cs.CRSIdentifiable
All Implemented Interfaces:
Object, TypedObjectNode, CRSResource
Direct Known Subclasses:
Axis, CRS, Datum, Ellipsoid, PrimeMeridian, Projection, Transformation, Unit

public class CRSIdentifiable
extends Object
implements CRSResource

The CRSIdentifiable class can be used to identify Coordinate system components.

Version:
$Revision: 30120 $, $Date: 2011-03-22 10:04:15 +0100 (Tue, 22 Mar 2011) $
Author:
Rutger Bezema, last edited by: $Author: aschmitz $

Constructor Summary
CRSIdentifiable(CRSCodeType id)
           
CRSIdentifiable(CRSCodeType[] identifiers)
          Creates arrays fromt the given identifier and name without setting the versions, descriptions and areasOfUse.
CRSIdentifiable(CRSCodeType[] codes, String[] names, String[] versions, String[] descriptions, String[] areasOfUse)
           
CRSIdentifiable(CRSResource other)
          Takes the references of the other object and stores them in this CRSIdentifiable Object.
 
Method Summary
 void addAreaOfUse(String areaOfUse)
           
 void addName(String name)
           
static void checkForNullObject(Object[] toBeChecked, String message)
          throws an IllegalArgumentException if the given object array is null or empty
protected  void checkForNullObject(Object toBeChecked, String message)
          throws an InvalidParameterException if the given object is null
static void checkForNullObject(Object toBeChecked, String functionName, String paramName)
          throws an InvalidParameterException if the given object is null
 boolean equals(Object other)
           
 String getAreaOfUse()
           
 double[] getAreaOfUseBBox()
          Returns the area of use, i.e. the domain where this CRSIdentifiable is valid.
 String[] getAreasOfUse()
           
 CRSCodeType getCode()
           
 String getCodeAndName()
           
 CRSCodeType[] getCodes()
           
 String getDescription()
           
 String[] getDescriptions()
           
 String getId()
          Returns the id of the object.
 String getName()
           
 String[] getNames()
           
 String[] getOrignalCodeStrings()
           
 String getVersion()
           
 String[] getVersions()
           
 boolean hasCode(CRSCodeType id)
           
 int hashCode()
          Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast.
 boolean hasId(String id, boolean caseSensitive, boolean exact)
           
 boolean hasIdOrName(String idOrName, boolean caseSensitive, boolean exact)
          Iterates over all Ids (code type originals) and Names and tests if either one matches the given string.
 void setDefaultAreaOfUse(double[] bbox)
           
 void setDefaultDescription(String newDescription, boolean override)
           
 void setDefaultId(CRSCodeType newCodeType, boolean override)
           
 void setDefaultName(String defaultName, boolean override)
           
 void setDefaultVersion(String newVersion, boolean override)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CRSIdentifiable

public CRSIdentifiable(CRSResource other)
Takes the references of the other object and stores them in this CRSIdentifiable Object.

Parameters:
other - identifiable object.

CRSIdentifiable

public CRSIdentifiable(CRSCodeType[] codes,
                       String[] names,
                       String[] versions,
                       String[] descriptions,
                       String[] areasOfUse)
Parameters:
codes -
names - the human readable names of the object.
versions -
descriptions -
areasOfUse -
Throws:
IllegalArgumentException - if no identifier(s) was/were given.

CRSIdentifiable

public CRSIdentifiable(CRSCodeType[] identifiers)
Creates arrays fromt the given identifier and name without setting the versions, descriptions and areasOfUse.

Parameters:
identifiers - of the object.

CRSIdentifiable

public CRSIdentifiable(CRSCodeType id)
Parameters:
id - of the Identifier
Method Detail

getAreaOfUse

public final String getAreaOfUse()
Specified by:
getAreaOfUse in interface CRSResource
Returns:
the first of all areasOfUse or null if no areasOfUse were given.

getDescription

public final String getDescription()
Specified by:
getDescription in interface CRSResource
Returns:
the first of all descriptions or null if no descriptions were given.

getCode

public final CRSCodeType getCode()
Specified by:
getCode in interface CRSResource
Returns:
the first of all identifiers.

getName

public final String getName()
Specified by:
getName in interface CRSResource
Returns:
the first of all names or null if no names were given.

getVersion

public final String getVersion()
Specified by:
getVersion in interface CRSResource
Returns:
the first of all versions or null if no versions were given.

checkForNullObject

protected void checkForNullObject(Object toBeChecked,
                                  String message)
                           throws IllegalArgumentException
throws an InvalidParameterException if the given object is null

Parameters:
toBeChecked - for null
message - to put into the exception. If absent, the default message (CRS_INVALID_NULL_PARAMETER) will be inserted.
Throws:
IllegalArgumentException - if the given object is null.

checkForNullObject

public static void checkForNullObject(Object toBeChecked,
                                      String functionName,
                                      String paramName)
                               throws IllegalArgumentException
throws an InvalidParameterException if the given object is null

Parameters:
toBeChecked - for null
functionName - of the caller
paramName - of the parameter to be checked.
Throws:
IllegalArgumentException - if the given object is null.

checkForNullObject

public static void checkForNullObject(Object[] toBeChecked,
                                      String message)
                               throws IllegalArgumentException
throws an IllegalArgumentException if the given object array is null or empty

Parameters:
toBeChecked - for null or empty
message - to put into the exception. If absent, the default message (CRS_INVALID_NULL_PARAMETER) will be inserted.
Throws:
IllegalArgumentException - if the given object array is null or empty.

toString

public String toString()
Overrides:
toString in class Object

getCodeAndName

public String getCodeAndName()
Specified by:
getCodeAndName in interface CRSResource
Returns:
the first id and the name (if given) as id: id, name: name.

equals

public boolean equals(Object other)
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()

getAreasOfUse

public final String[] getAreasOfUse()
Specified by:
getAreasOfUse in interface CRSResource
Returns:
the areasOfUse or null if no areasOfUse were given.

getDescriptions

public final String[] getDescriptions()
Specified by:
getDescriptions in interface CRSResource
Returns:
the descriptions or null if no descriptions were given.

getCodes

public final CRSCodeType[] getCodes()
Specified by:
getCodes in interface CRSResource
Returns:
the identifiers, each identifiable object has atleast one id.

getOrignalCodeStrings

public final String[] getOrignalCodeStrings()
Specified by:
getOrignalCodeStrings in interface CRSResource
Returns:
the codetypes as the original strings, each identifiable object has atleast one id.

getNames

public final String[] getNames()
Specified by:
getNames in interface CRSResource
Returns:
the names or null if no names were given.

getVersions

public final String[] getVersions()
Specified by:
getVersions in interface CRSResource
Returns:
the versions or null if no versions were given.

hasCode

public boolean hasCode(CRSCodeType id)
Specified by:
hasCode in interface CRSResource
Parameters:
id - a string which could match this identifiable.
Returns:
true if this identifiable can be identified with the given string, false otherwise.

hasIdOrName

public boolean hasIdOrName(String idOrName,
                           boolean caseSensitive,
                           boolean exact)
Iterates over all Ids (code type originals) and Names and tests if either one matches the given string.

Specified by:
hasIdOrName in interface CRSResource
Parameters:
idOrName - a String which might be an id or a name.
caseSensitive - should the match me case sensitive
exact - should the names and ids contain the given string or match exact.
Returns:
true if any of the names or codes match without case the given string.

hasId

public boolean hasId(String id,
                     boolean caseSensitive,
                     boolean exact)
Specified by:
hasId in interface CRSResource
Parameters:
id -
caseSensitive -
exact -
Returns:
true if the given id is present in this objects id's.

getAreaOfUseBBox

public double[] getAreaOfUseBBox()
Returns the area of use, i.e. the domain where this CRSIdentifiable is valid.

Specified by:
getAreaOfUseBBox in interface CRSResource
Returns:
the domain of validity (EPSG:4326 coordinates), order: minX, minY, maxX, maxY, never null (-180,-90,180,90) if no such information is available

setDefaultId

public void setDefaultId(CRSCodeType newCodeType,
                         boolean override)
Specified by:
setDefaultId in interface CRSResource
Parameters:
newCodeType -
override -

setDefaultAreaOfUse

public void setDefaultAreaOfUse(double[] bbox)
Specified by:
setDefaultAreaOfUse in interface CRSResource
Parameters:
bbox - an envelope of validity in epsg:4326 coordinates, min(lon,lat) max(lon,lat);

addAreaOfUse

public void addAreaOfUse(String areaOfUse)
Specified by:
addAreaOfUse in interface CRSResource
Parameters:
areaOfUse -

addName

public void addName(String name)
Specified by:
addName in interface CRSResource
Parameters:
name -

setDefaultName

public void setDefaultName(String defaultName,
                           boolean override)
Specified by:
setDefaultName in interface CRSResource
Parameters:
defaultName - the new default name
override - true if the new name should override the name currently at position 0

setDefaultDescription

public void setDefaultDescription(String newDescription,
                                  boolean override)
Specified by:
setDefaultDescription in interface CRSResource
Parameters:
newDescription - the new default description
override - true if the new description should override the description currently at position 0

setDefaultVersion

public void setDefaultVersion(String newVersion,
                              boolean override)
Specified by:
setDefaultVersion in interface CRSResource
Parameters:
newVersion - the new default version
override - true if the new version should override the version currently at position 0

getId

public String getId()
Description copied from interface: Object
Returns the id of the object.

Specified by:
getId in interface Object
Returns:
the id of the object, or null if it doesn't have an id


Copyright © 2011. All Rights Reserved.