org.jscience.ml.om
Class Site

java.lang.Object
  extended by org.jscience.ml.om.SchemaElement
      extended by org.jscience.ml.om.Site
All Implemented Interfaces:
ISchemaElement, ISite

public class Site
extends SchemaElement
implements ISite

An Site describes an observation site where an observation took place.
A site can be identified by its latitude and longitude values, but as for processing reasons this class has some more mandatory fields, such as e.g. elevation and timezone.

Since:
1.0

Field Summary
 
Fields inherited from interface org.jscience.ml.om.ISite
XML_ELEMENT_ELEVATION, XML_ELEMENT_IAUCODE, XML_ELEMENT_LATITUDE, XML_ELEMENT_LONGITUDE, XML_ELEMENT_NAME, XML_ELEMENT_SITE, XML_ELEMENT_TIMEZONE
 
Fields inherited from interface org.jscience.ml.om.ISchemaElement
XML_ELEMENT_ATTRIBUTE_ID
 
Constructor Summary
Site(org.w3c.dom.Node site)
          Constructs a new Site instance from a given XML Schema Node.
Site(java.lang.String name, Angle longitude, Angle latitude, int timezone)
          Constructs a new instance of a Site.
 
Method Summary
 org.w3c.dom.Element addAsLinkToXmlElement(org.w3c.dom.Element element)
          Adds the site link to an given XML DOM Element The site element itself will be attached to given elements ownerDocument.
 org.w3c.dom.Element addToXmlElement(org.w3c.dom.Element element)
          Adds this Site to a given parent XML DOM Element.
 boolean equals(java.lang.Object obj)
          Overwrittes equals(Object) method from java.lang.Object.
 java.lang.String getDisplayName()
          Returns a display name for this element.
 float getElevation()
          Returns the elevation of the site.
 java.lang.String getIAUCode()
          Returns the IAU station code of the site.
 Angle getLatitude()
          Returns the latitude of the site.
 Angle getLongitude()
          Returns the longitude of the site.
 java.lang.String getName()
          Returns the name of the site.
 int getTimezone()
          Returns the timezone of the site.
 void setElevation(float elevation)
          Sets the elevation of the site.
 void setIAUCode(java.lang.String IAUCode)
          Sets the IAU code of the site.
 void setLatitude(Angle latitude)
          Sets the latitude of the site.
 void setLongitude(Angle longitude)
          Sets the longitude of the site.
 void setName(java.lang.String name)
          Sets the name of the site.
 void setTimezone(int timezone)
          Sets the timezone of the site.
 java.lang.String toString()
          Overwrittes toString() method from java.lang.Object.
 
Methods inherited from class org.jscience.ml.om.SchemaElement
getID, setID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jscience.ml.om.ISchemaElement
getID
 

Constructor Detail

Site

public Site(org.w3c.dom.Node site)
     throws SchemaException,
            java.lang.IllegalArgumentException
Constructs a new Site instance from a given XML Schema Node. Normally this constructor is only called by org.jscience.ml.om.util.SchemaLoader

Parameters:
site - The XML Schema Node that represents this Site object
Throws:
java.lang.IllegalArgumentException - if the parameter is null
SchemaException - if the given Node does not match the XML Schema specifications

Site

public Site(java.lang.String name,
            Angle longitude,
            Angle latitude,
            int timezone)
     throws java.lang.IllegalArgumentException
Constructs a new instance of a Site.

Parameters:
name - The sites name
longitude - The sites longitude
latitude - The sites latitude
timezone - The sites timezone offset in minutes from GMT
Throws:
java.lang.IllegalArgumentException
Method Detail

getDisplayName

public java.lang.String getDisplayName()
Returns a display name for this element.
The method differs from the toString() method as toString() shows more technical information about the element. Also the formating of toString() can spread over several lines.
This method returns a string (in one line) that can be used as displayname in e.g. a UI dropdown box.

Specified by:
getDisplayName in interface ISchemaElement
Specified by:
getDisplayName in class SchemaElement
Returns:
Returns a String with a one line display name
See Also:
java.lang.Object.toString();

toString

public java.lang.String toString()
Overwrittes toString() method from java.lang.Object.
Returns the field values of this Site.

Overrides:
toString in class java.lang.Object
Returns:
This DeepSkyTarget field values
See Also:
Object

equals

public boolean equals(java.lang.Object obj)
Overwrittes equals(Object) method from java.lang.Object.
Checks if this Site and the given Object are equal. The given object is equal with this Site, if it derives from ISite and if its name, longitude, latitude and elevation equals this Sites name, longitude, latitude and elevation.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The Object to compare this Site with.
Returns:
true if the given Object is an instance of ISite and its name, longitude, latitude and elevation is equal to this Sites name, longitude, latitude and elevation.
* (Name comparism is not casesensitive)
See Also:
Object

addToXmlElement

public org.w3c.dom.Element addToXmlElement(org.w3c.dom.Element element)
Adds this Site to a given parent XML DOM Element. The Site element will be set as a child element of the passed element.

Specified by:
addToXmlElement in interface ISite
Parameters:
element - The parent element for this Site
Returns:
Returns the element given as parameter with this Site as child element.
* Might return null if parent was null.
See Also:
Element

addAsLinkToXmlElement

public org.w3c.dom.Element addAsLinkToXmlElement(org.w3c.dom.Element element)
Adds the site link to an given XML DOM Element The site element itself will be attached to given elements ownerDocument. If the ownerDocument has no site container, it will be created.
Example:
<parameterElement>
<siteLink>123</siteLink>
</parameterElement>
More stuff of the xml document goes here
<siteContainer>
<site id="123">
site description goes here
</site>
</siteContainer>

Specified by:
addAsLinkToXmlElement in interface ISite
Parameters:
element - The element under which the the site link is created
Returns:
Returns the Element given as parameter with a additional site link, and the site element under the site container of the ownerDocument Might return null if element was null.
See Also:
Element

getLatitude

public Angle getLatitude()
Returns the latitude of the site.
The latitude is a positiv angle if its north of the equator, and negative if south of the equator.

Specified by:
getLatitude in interface ISite
Returns:
Returns an Angle with the geographical latitude

getLongitude

public Angle getLongitude()
Returns the longitude of the site.
The longitude is a positiv angle if its east of Greenwich, and negative if west of Greenwich.

Specified by:
getLongitude in interface ISite
Returns:
Returns an Angle with the geographical longitude

getName

public java.lang.String getName()
Returns the name of the site.
The name may be any string describing the site as precise as it can be.

Specified by:
getName in interface ISite
Returns:
Returns the name of the site

getTimezone

public int getTimezone()
Returns the timezone of the site.
The timezone is given as positiv or negative value, depending on the sites timezone difference to the GMT in minutes.

Specified by:
getTimezone in interface ISite
Returns:
Returns timzone offset (in comparism to GMT) in minutes

setLatitude

public void setLatitude(Angle latitude)
                 throws java.lang.IllegalArgumentException
Sets the latitude of the site.
The latitude must be a positiv angle if its north of the equator, and negative if south of the equator.

Specified by:
setLatitude in interface ISite
Parameters:
latitude - The new latitude for this site
Throws:
java.lang.IllegalArgumentException - if latitude is null

setLongitude

public void setLongitude(Angle longitude)
                  throws java.lang.IllegalArgumentException
Sets the longitude of the site.
The longitude must be a positiv angle if its east of Greenwich, and negative if west of Greenwich.

Specified by:
setLongitude in interface ISite
Parameters:
longitude - The new longitude for this site
Throws:
java.lang.IllegalArgumentException - if longitude is null

setName

public void setName(java.lang.String name)
             throws java.lang.IllegalArgumentException
Sets the name of the site.
The name should be any string describing the site as precise as it can be.

Specified by:
setName in interface ISite
Parameters:
name - The new name for this site
Throws:
java.lang.IllegalArgumentException - if name is null

setTimezone

public void setTimezone(int timezone)
                 throws java.lang.IllegalArgumentException
Sets the timezone of the site.
The timezone must be given as positiv or negative value, depending on the sites timezone difference to the GMT in minutes.

Specified by:
setTimezone in interface ISite
Parameters:
timezone - The new timezone for this site in minutes
Throws:
java.lang.IllegalArgumentException - if new timezone is greater than 720 (1260) or lower than -720 (1260)

setIAUCode

public void setIAUCode(java.lang.String IAUCode)
Sets the IAU code of the site.

Specified by:
setIAUCode in interface ISite
Parameters:
IAUCode - The new IAU code for this site

setElevation

public void setElevation(float elevation)
Sets the elevation of the site.
The elevation should be given in meters above/under sea level.

Specified by:
setElevation in interface ISite
Parameters:
elevation - The new elevation for this site

getElevation

public float getElevation()
Returns the elevation of the site.
The elevation is given in meters above/under sea level.

Specified by:
getElevation in interface ISite
Returns:
Returns the sites elevation in meters above or under sea level, or NULL if value was never set

getIAUCode

public java.lang.String getIAUCode()
Returns the IAU station code of the site.
This method may return null as the site may not have an IAU (International Astronomical Union) station code.

Specified by:
getIAUCode in interface ISite
Returns:
Returns the IAU code of the site, or null if no code exists, or was never set.