org.jscience.ml.om
Class Eyepiece

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

public class Eyepiece
extends SchemaElement
implements IEyepiece

Eyepiece implements the class org.jscience.ml.om.IEyepiece. An Eyepiece describes a optical eyepiece. The model name and the focalLength are mandatory fields which have to be set.

Since:
1.0

Field Summary
 
Fields inherited from interface org.jscience.ml.om.IEyepiece
XML_ELEMENT_APPARENTFOV, XML_ELEMENT_EYEPIECE, XML_ELEMENT_FOCALLENGTH, XML_ELEMENT_MODEL, XML_ELEMENT_VENDOR
 
Fields inherited from interface org.jscience.ml.om.ISchemaElement
XML_ELEMENT_ATTRIBUTE_ID
 
Constructor Summary
Eyepiece(org.w3c.dom.Node eyepiece)
          Constructs a new instance of an Eyepiece from an given XML Schema Node.
Eyepiece(java.lang.String model, float focalLength)
          Constructs a new instance of an Eyepiece.
 
Method Summary
 org.w3c.dom.Element addAsLinkToXmlElement(org.w3c.dom.Element element)
          Adds the eyepiece link to an given XML DOM Element The eyepiece element itself will be attached to given elements ownerDocument.
 org.w3c.dom.Element addToXmlElement(org.w3c.dom.Element element)
          Adds this Eyepiece to a given parent XML DOM Element.
 boolean equals(java.lang.Object obj)
          Overwrittes equals(Object) method from java.lang.Object.
 Angle getApparentFOV()
          Returns the apparent field of view of this eyepiece.
 java.lang.String getDisplayName()
          Returns a display name for this element.
 float getFocalLength()
          Returns the focal length of this eyepiece.
 java.lang.String getModel()
          Returns the model name of the eyepiece.
 java.lang.String getVendor()
          Returns the vendor name of the eyepiece.
 boolean setApparentFOV(Angle apparentFOV)
          Sets the apparent field of view of this eyepiece.
 void setFocalLength(float focalLength)
          Sets the focal length of the eyepiece.
 void setModel(java.lang.String modelname)
          Sets the model name for the eyepiece.
 void setVendor(java.lang.String vendorname)
          Sets the vendor name of the eyepiece.
 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

Eyepiece

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

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

Eyepiece

public Eyepiece(java.lang.String model,
                float focalLength)
         throws java.lang.IllegalArgumentException
Constructs a new instance of an Eyepiece.

Parameters:
model - The eyepieces model name
focalLength - The focal length of the eyepiece
Throws:
java.lang.IllegalArgumentException - if model is null or focalLength is Float.NaN
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 all fields of the class Eyepiece (unset field will be ignored). The result string will look like this:
Example:
Eyepiece Model: Ultra Wide Angle 8.8mm
* Vendor: Meade Focal length: 8.8 Apparent field of view: 84 DEG

Overrides:
toString in class java.lang.Object
Returns:
A string representing the eyepiece
See Also:
Object

equals

public boolean equals(java.lang.Object obj)
Overwrittes equals(Object) method from java.lang.Object.
Checks if this Eyepiece and the given Object are equal. The given object is equal with this Eyepiece, if its implementing IEyepiece and its modelname, vendorname, focalLength and apparent field of view matches the values of this Eyepiece.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The Object to compare this Eyepiece with.
Returns:
true if the given Object is an instance of IEyepiece and its modelname, vendorname, focalLength and apparent field of view matches with this Eyepiece.
*
See Also:
Object

addToXmlElement

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

Specified by:
addToXmlElement in interface IEyepiece
Parameters:
element - The parent element for this Eyepiece
Returns:
Returns the element given as parameter with this Eyepiece 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 eyepiece link to an given XML DOM Element The eyepiece element itself will be attached to given elements ownerDocument. If the ownerDocument has no eyepiece container, it will be created.
Example:
<parameterElement>
<eyepieceLink>123</eyepieceLink>
</parameterElement>
More stuff of the xml document goes here
<eyepieceContainer>
<eyepiece id="123">
eyepiece description goes here
</eyepiece>
</eyepieceContainer>

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

getApparentFOV

public Angle getApparentFOV()
Returns the apparent field of view of this eyepiece.

Specified by:
getApparentFOV in interface IEyepiece
Returns:
Returns the apparent field of view of this eyepiece. The Angles value cannot be negative or 0.
* If null is returned the apparent field of view value was never set.
See Also:
Angle

getFocalLength

public float getFocalLength()
Returns the focal length of this eyepiece. The focal length of the telescope divided by the focal length of the eyepiece equals the amplification.

Specified by:
getFocalLength in interface IEyepiece
Returns:
Returns the focal length of the eyepiece.

getModel

public java.lang.String getModel()
Returns the model name of the eyepiece.

Specified by:
getModel in interface IEyepiece
Returns:
Returns a String representing the eyepieces model name.

getVendor

public java.lang.String getVendor()
Returns the vendor name of the eyepiece.

Specified by:
getVendor in interface IEyepiece
Returns:
Returns a String representing the eyepieces vendor name.
* If null is returned the vendor name was never set.

setApparentFOV

public boolean setApparentFOV(Angle apparentFOV)
Sets the apparent field of view of this eyepiece.
The field of view Angle cannot be negative or 0.

Specified by:
setApparentFOV in interface IEyepiece
Parameters:
apparentFOV - The new apparent field of view to be set.
Returns:
Returns true if the new apparent field of view could be set. If false is returned the parameter was null, or the Angles value was negative or 0 (apparent field of view will not be changed if false is returned).

setFocalLength

public void setFocalLength(float focalLength)
                    throws java.lang.IllegalArgumentException
Sets the focal length of the eyepiece.

Specified by:
setFocalLength in interface IEyepiece
Parameters:
focalLength - The new focal length to be set.
Throws:
java.lang.IllegalArgumentException - if focalLength was Float.NaN

setModel

public void setModel(java.lang.String modelname)
              throws java.lang.IllegalArgumentException
Sets the model name for the eyepiece.

Specified by:
setModel in interface IEyepiece
Parameters:
modelname - The new model name to be set.
Throws:
java.lang.IllegalArgumentException - if modelname was null

setVendor

public void setVendor(java.lang.String vendorname)
Sets the vendor name of the eyepiece.

Specified by:
setVendor in interface IEyepiece
Parameters:
vendorname - The new vendor name to be set.