de.lehmannet.om
Class Eyepiece

java.lang.Object
  extended by de.lehmannet.om.SchemaElement
      extended by de.lehmannet.om.Eyepiece
All Implemented Interfaces:
IEyepiece, ISchemaElement

public class Eyepiece
extends SchemaElement
implements IEyepiece

Eyepiece implements the class de.lehmannet.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
Author:
doergn@users.sourceforge.net

Field Summary
 
Fields inherited from interface de.lehmannet.om.IEyepiece
XML_ELEMENT_APPARENTFOV, XML_ELEMENT_EYEPIECE, XML_ELEMENT_FOCALLENGTH, XML_ELEMENT_MAXFOCALLENGTH, XML_ELEMENT_MODEL, XML_ELEMENT_VENDOR
 
Fields inherited from interface de.lehmannet.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.
 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.
 float getMaxFocalLength()
          Returns the maximal focal length of this eyepiece in case this eyepiece is a zoom eyepiece.
 java.lang.String getModel()
          Returns the model name of the eyepiece.
 java.lang.String getVendor()
          Returns the vendor name of the eyepiece.
 boolean isZoomEyepiece()
          Returns true if this eyepiece is a zoom 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 setMaxFocalLength(float maxFocalLength)
          Sets the maximal focal length of the zoom 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 de.lehmannet.om.SchemaElement
equals, getID, setID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.lehmannet.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 de.lehmannet.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

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:
parent - 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.
In case this eyepiece is a zoomEyepiece, this focal length is the minimum focal length. To retrieve the maximim focal length, please use getMaxFocalLength()

Specified by:
getFocalLength in interface IEyepiece
Returns:
Returns the focal length of the eyepiece.
See Also:
getMaxFocalLength()

getMaxFocalLength

public float getMaxFocalLength()
Returns the maximal focal length of this eyepiece in case this eyepiece is a zoom eyepiece. Might return Float.NaN in case this eyepiece is not a zoom eyepiece.

Specified by:
getMaxFocalLength in interface IEyepiece
Returns:
Returns the maximal focal length of the eyepiece.
Since:
1.7

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.

isZoomEyepiece

public boolean isZoomEyepiece()
Returns true if this eyepiece is a zoom eyepiece.
Basically this method just checks if the maxFocalLength field is set.

Specified by:
isZoomEyepiece in interface IEyepiece
Returns:
true if this eyepiece is a zoom eyepiece
Since:
1.7

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

setMaxFocalLength

public void setMaxFocalLength(float maxFocalLength)
Sets the maximal focal length of the zoom eyepiece.
If Float.NaN is passed, this eyepiece will no longer be treated as a zoom eyepiece.

Specified by:
setMaxFocalLength in interface IEyepiece
Parameters:
maxFocalLength - The new maximal focal length to be set.
Since:
1.7

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.