jsky.science
Class Wavelength1DFormula

java.lang.Object
  extended by jsky.science.AbstractScienceObject
      extended by jsky.science.AbstractScienceObjectNode
          extended by jsky.science.AbstractWavelength1D
              extended by jsky.science.Wavelength1DFormula
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable, java.util.EventListener, ScienceObjectModel, ScienceObjectNodeModel, Wavelength1DModel, ReplaceablePropertyChangeListener

public abstract class Wavelength1DFormula
extends AbstractWavelength1D

Implements a Wavelength1Dmodel as a formula value=f(wavelength) with a minimum and maximum wavelength, and a number of expected points.

This code was developed by NASA, Goddard Space Flight Center, Code 588 for the Scientist's Expert Assistant (SEA) project for Next Generation Space Telescope (NGST).

Version:
06.30.00
Author:
Sandy Grosvenor
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class jsky.science.AbstractScienceObject
AbstractScienceObject.EventMonitor
 
Field Summary
protected  Wavelength fMaxWavelength
           
protected  Wavelength fMinWavelength
           
protected  int fNumPoints
           
 
Fields inherited from class jsky.science.AbstractWavelength1D
fFluxUnits, MAXWAVELENGTH_PROPERTY, MINWAVELENGTH_PROPERTY, NUMPOINTS_PROPERTY
 
Fields inherited from class jsky.science.AbstractScienceObjectNode
cloneIndent
 
Fields inherited from interface jsky.science.ScienceObjectNodeModel
DATA_SOURCE_PROPERTY, MORE_DATA_PROPERTY
 
Fields inherited from interface jsky.science.ScienceObjectModel
NAME_PROPERTY, PENDING_PROPERTY, VALID_PROPERTY
 
Constructor Summary
Wavelength1DFormula()
          Creates a new Wavelength1DFormula, with default number of points (100 points), and default wavelength range (100 to 1100 nanometers).
Wavelength1DFormula(int inPoints)
          Creates a new Wavelength1DFormula of specified number of points, no name, and default wavelength range
Wavelength1DFormula(java.lang.String inName)
          Creates a new Wavelength1DFormula with specified name and default number of points and range.
Wavelength1DFormula(java.lang.String inProp, Wavelength inMin, Wavelength inMax, int inPts)
          Creates a new Wavelength1DFormula of with specified name, number of points and wavelength range.
Wavelength1DFormula(Wavelength inMin, Wavelength inMax, int inPts)
          Creates a new Wavelength1DFormula of with no name and specified number of points and wavelength range.
 
Method Summary
 java.lang.Object clone()
          Clones this object, and does a DEEP clone on the fChildren.
 boolean equals(java.lang.Object obj)
          After check with superclass, returns true if objects are same Class and have same min/max and number of points.
 Wavelength getMaxWavelength()
           
 Wavelength getMinWavelength()
           
 int getNumPoints()
          returns the length of the array that would be returned by toArrayWavelengths() and toArrayData().
 double getValueAtIndex(int i)
          This is a trivial implementation that returns the formula value for a specified index.
 Wavelength getWavelengthAtIndex(int index)
          Returns the wavelength data value for specified index as a Wavelength
 double getWavelengthAtIndexAsDouble(int index)
          Returns the wavelength data value for specified index as a double value in the current default wavelength units
 void setMaxWavelength(Wavelength newWL)
           
 void setMinWavelength(Wavelength newWL)
           
 void setNumPoints(int newP)
          Changes the length of the array that would be returned by toArrayWavelengths() and toArrayData().
 void setPending(boolean b)
          overriding to public access
 double[] toArrayData()
          Returns an array of doubles containing containing the formula's value for each wavelength returned by toArrayWavelengths().
 double[] toArrayWavelengths()
          Creates an array of doubles containing wavelength values at even intervals across the min/max wavelength of the object and of size getNumPoints()
 
Methods inherited from class jsky.science.AbstractWavelength1D
calcArea, calculateArea, getArea, getArea, getArea, getArea, getFluxUnits, getIndexOf, getIndexOf, getIndexOf, getIndexOf, isEditable, setFluxUnits, setValue, toArrayData, toArrayWavelengths
 
Methods inherited from class jsky.science.AbstractScienceObjectNode
addChild, getChildren, getDataSource, indexOfChild, initializeTransients, isHolding, isMoreDataAvailable, isPending, isUpToDate, isValid, namedClone, processUpdates, removeAllChildren, removeChild, repeat, replaceChild, replaceObject, requestMoreData, retrieveMoreData, saveAsText, saveAsText, setDataSource, setHolding, setMoreDataAvailable, setTracing, setUpdatesPending, update
 
Methods inherited from class jsky.science.AbstractScienceObject
addEventMonitor, addPropertyChangeListener, areNamesEqual, clearAllListeners, compareTo, createDefaultName, firePropertyChange, firePropertyChange, fireReplaceObject, fireReplaceObject, fireReplaceObject, fireVetoableChange, fireVetoableChange, getException, getLabel, getName, getObjectIdString, getObjectIdString, getParent, isTracing, notifyEventMonitors, propertyChange, removeEventMonitor, removePropertyChangeListener, replaceObjectNYI, setException, setName, setParent, setTraceAll, toString, writeDebug, writeError
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jsky.science.Wavelength1DModel
addPropertyChangeListener, getValue, removePropertyChangeListener, toArrayData, toArrayWavelengths
 
Methods inherited from interface jsky.science.ScienceObjectNodeModel
addChild, getChildren, getDataSource, isMoreDataAvailable, isPending, removeAllChildren, removeChild, replaceChild, requestMoreData, retrieveMoreData, setDataSource, setMoreDataAvailable
 
Methods inherited from interface jsky.science.ScienceObjectModel
clearAllListeners, firePropertyChange, getException, getLabel, getName, getParent, isHolding, isTracing, isValid, setException, setHolding, setName, setParent, setTracing
 
Methods inherited from interface jsky.util.ReplaceablePropertyChangeListener
replaceObject
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 

Field Detail

fMinWavelength

protected Wavelength fMinWavelength

fMaxWavelength

protected Wavelength fMaxWavelength

fNumPoints

protected int fNumPoints
Constructor Detail

Wavelength1DFormula

public Wavelength1DFormula()
Creates a new Wavelength1DFormula, with default number of points (100 points), and default wavelength range (100 to 1100 nanometers).


Wavelength1DFormula

public Wavelength1DFormula(int inPoints)
Creates a new Wavelength1DFormula of specified number of points, no name, and default wavelength range


Wavelength1DFormula

public Wavelength1DFormula(java.lang.String inName)
Creates a new Wavelength1DFormula with specified name and default number of points and range.


Wavelength1DFormula

public Wavelength1DFormula(Wavelength inMin,
                           Wavelength inMax,
                           int inPts)
Creates a new Wavelength1DFormula of with no name and specified number of points and wavelength range.

Parameters:
inMin - Minimum Wavelength for the dataset
inMax - Maximum Wavelength for the dataset
inPts - number of points in the dataset

Wavelength1DFormula

public Wavelength1DFormula(java.lang.String inProp,
                           Wavelength inMin,
                           Wavelength inMax,
                           int inPts)
Creates a new Wavelength1DFormula of with specified name, number of points and wavelength range.

Parameters:
inProp - Name of the dataset
inMin - Minimum Wavelength for the dataset
inMax - Maximum Wavelength for the dataset
inPts - number of points in the dataset
Method Detail

clone

public java.lang.Object clone()
Description copied from class: AbstractScienceObjectNode
Clones this object, and does a DEEP clone on the fChildren.

NOTE: for subclasses! If a subclass has a separate variable or list that points at fChildren, remember that after this clone() method is completed all fChildren will have also been cloned.

So subclasses may need to "repoint" variables or elemenets of lists that reference child objects, but should NOT re-clone those children.

See ExposureGroup.clone() and Exposure.clone() as examples of classes that need to re-proint existing pointers to correctly point at the correct elements.

Specified by:
clone in interface ScienceObjectModel
Overrides:
clone in class AbstractScienceObjectNode

equals

public boolean equals(java.lang.Object obj)
After check with superclass, returns true if objects are same Class and have same min/max and number of points.

Overrides:
equals in class AbstractScienceObjectNode

getMinWavelength

public Wavelength getMinWavelength()

getMaxWavelength

public Wavelength getMaxWavelength()

setMinWavelength

public void setMinWavelength(Wavelength newWL)

setMaxWavelength

public void setMaxWavelength(Wavelength newWL)

setPending

public void setPending(boolean b)
overriding to public access

Overrides:
setPending in class AbstractScienceObjectNode

toArrayData

public double[] toArrayData()
Returns an array of doubles containing containing the formula's value for each wavelength returned by toArrayWavelengths().


toArrayWavelengths

public double[] toArrayWavelengths()
Creates an array of doubles containing wavelength values at even intervals across the min/max wavelength of the object and of size getNumPoints()


getWavelengthAtIndex

public Wavelength getWavelengthAtIndex(int index)
Returns the wavelength data value for specified index as a Wavelength


getWavelengthAtIndexAsDouble

public double getWavelengthAtIndexAsDouble(int index)
Returns the wavelength data value for specified index as a double value in the current default wavelength units


getValueAtIndex

public double getValueAtIndex(int i)
This is a trivial implementation that returns the formula value for a specified index. Most subclasses of Wavelength1DFormula will define getValue( Wavelength) and rarely if ever reference this method.

However, if you have an array of wavelength values that you are "sharing" across several different Wavelength1DFormula, then overriding this method to define the formula's functionality, and then writing getValue to reference this method may be computationally much faster. See SEA's ExpCalcSpectroscopy for an example.


setNumPoints

public void setNumPoints(int newP)
Changes the length of the array that would be returned by toArrayWavelengths() and toArrayData().


getNumPoints

public int getNumPoints()
returns the length of the array that would be returned by toArrayWavelengths() and toArrayData().