|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.Observable
spv.spectrum.SpectrumDecorator
public abstract class SpectrumDecorator
This abstract class can be extended by classes that act as
decorators for Spectrum objects.
This class is just a convenience class that implements all methods
defined in the Spectrum interface to make them execute
the corresponding method in the decorated object. Thus, real decorator
classes that extend this class do not have to re-implement all methods,
but just override the ones specific to implement their functionality.
Notice that this class extends Observable, so every
decorated object inherits observable properties.
| Field Summary | |
|---|---|
protected boolean |
notify
|
Spectrum |
sp
|
| Fields inherited from interface spv.spectrum.Spectrum |
|---|
REST_SUFFIX |
| Constructor Summary | |
|---|---|
SpectrumDecorator()
|
|
| Method Summary | |
|---|---|
void |
addMetaParameter(java.lang.String utype,
MetaParameter parameter)
Adds a meta parameter. |
void |
addMetaParameter(java.lang.String utype,
java.lang.String value)
Adds a meta parameter. |
void |
addMetaParameter(java.lang.String utype,
java.lang.String value,
java.lang.String units)
Adds a meta parameter. |
void |
addRadialVelocity(RadialVelocity rv)
Add a radial velocity object. |
void |
addSpectrum(java.lang.Object spid,
Spectrum sp)
Adds a Spectrum instance to this object. |
java.lang.Object |
clone()
Creates a clone copy of this object. |
void |
enableNotifications(boolean notify)
Enables/disables notifications to listeners. |
java.util.List |
explodeSpectrum()
Returns a list with all internal Spectrum |
DQBits[] |
getArrayDQBits()
Returns the list of supported DQ bits in each element of the composite. |
int[] |
getArrayDQMask()
Gets the current DQ mask value in each element of the composite. |
double |
getAverageDispersion()
Returns the average dispersion. |
double |
getAverageValue()
Gets the average value obtained in the last integration operation. |
Spectrum |
getChild()
Gets the child spectrum. |
Spectrum |
getDecoratedSpectrum()
Returns the decorated spectrum. |
int[] |
getDQ()
Returns an array with all DQ flags stored in the currently selected array. |
DQBits |
getDQBits()
Returns the list of supported DQ bits in this object. |
java.util.Enumeration |
getDQList()
Returns an Enumeration with the String
objects that identify the data quality arrays stored in this object. |
int |
getDQMask()
Gets the current DQ mask value. |
double[] |
getErrors()
Returns an array with all errors stored in the currently selected array. |
double |
getExtremumPosition()
Gets the extremum position obtained in the last integration operation. |
double |
getFluxWeightedPosition()
Gets the flux weighted position obtained in the last integration operation. |
double |
getFluxWeightedPositionError()
Gets the error associated with the flux weighted position obtained in the last integration operation. |
SpectrumHeader |
getHeader()
Returns the SpectrumHeader associated with this spectrum. |
double |
getIntegralError()
Gets the error of the integral obtained in the last integration operation. |
int |
getIntegrationBins()
Gets the number of bins used in the last integration operation. |
java.util.Enumeration |
getIntensityList()
Returns an Enumeration with the String
objects that identify the intensity arrays stored in this object. |
double |
getMaxWavelength()
Returns the maximum wavelength. |
java.util.Map |
getMetaParameters()
Gets the meta parameters. |
double |
getMinWavelength()
Returns the minimum wavelength. |
java.lang.String |
getName()
Returns the spectrum's name. |
int |
getNBins()
Returns the total number of bins in this spectrum. |
DataTableModel |
getNewTableModel()
Returns a new table model that represents the spectrum contents. |
int |
getNumberOfSpectra()
Returns the number of spectra (leaves) in the composite. |
Units |
getOriginalUnits()
Returns the original Units associated with the
selected intensity array in this spectrum. |
Units |
getOriginalWavelengthUnits()
Returns the original Units associated with the
wavelength array in this spectrum. |
java.util.List |
getRadialVelocities()
Gets a list of all available radial velocity objects. |
double[] |
getRestWavelengths()
Returns an array with rest wavelength values. |
java.lang.String |
getSelectedDQID()
Gets the current DQ array ID. |
java.lang.String |
getSelectedIntensityID()
Gets the current intensity array ID. |
RadialVelocity |
getSelectedRadialVelocity()
Gets the currently selected radial velocity object. |
double |
getSigma()
Gets the standard deviation obtained in the last integration operation. |
Spectrum |
getSpectrum(java.lang.Object spid)
Returns the specified Spectrum object. |
java.util.Enumeration |
getSpectrumList()
Returns an Enumeration with the ids of all internal
Spectrum instances stored in this object. |
java.util.List |
getSpectrumListAsList()
Returns a List with the id objetcs
of the Spectrum instances stored in this object. |
DataTableModel |
getTableModel()
Returns a table model that represents the spectrum contents. |
java.lang.String |
getTag()
Returns the tag associated with this spectrum. |
java.lang.String |
getTargetName()
Returns the target name. |
Units |
getUnits()
Returns the Units associated with the selected
intensity array in this spectrum. |
double[] |
getValues()
Returns an array with all values stored in the currently selected array. |
java.lang.String |
getWavelengthID()
Gets the wavelength ID. |
double[] |
getWavelengths()
Returns an array with all wavelength values stored in this spectrum. |
Units |
getWavelengthUnits()
Returns the Units associated with the wavelength
array in this spectrum. |
double |
getX(double wavelength)
Returns the (fractional) bin number corresponding to the wavelength. |
void |
initializeParametersFromMap(java.util.Map map)
Initializes spectrum parameters from a map. |
double |
integrate(double w1,
double w2)
Integrate the selected array between given wavelengths. |
boolean |
isEquallySpaced()
Is the wavelength array equally spaced ? |
boolean |
isEvenlySampled()
Is the wavelength array evenly sampled ? |
boolean |
isMultiSegment()
Is spectrum multi-segment? |
boolean |
isNormalizable()
Checks if the spectrum instance is bormalizable. |
boolean |
isRestWavelengths()
Gets the rest wavelengths flag. |
boolean |
isSpectrogram()
Is spectrum a spectrogram? |
void |
maskAll()
Sets all DQ masks. |
void |
normalize(double wave,
double flux,
Units ounits)
Normalize the selected flux array to the given value |
void |
process(Command command)
Executes a process encapsulated inside a Command
object, using "this" as argument to the process. |
void |
removeMetaParameter(java.lang.String utype)
Removes a meta parameter. |
void |
removeRadialVelocity(RadialVelocity rv)
Remove a radial velocity object. |
void |
removeSpectrum(java.lang.Object spid)
Removes a Spectrum instance from this object. |
void |
renormalize(double wave,
double flux,
java.lang.Object spid)
Renormalize the selected flux array to the new (wave,flux) point. |
void |
reorderWavelengths()
If wavelength array is arranged in decreasing wavelength order, reorder it and all other arrays in increasing wavelength order. |
void |
resetArraySelection()
Resets array selection. |
void |
saveAsSED(java.lang.String filename)
Saves spectrum as a SED document. |
void |
saveSpectrumParameters(com.sun.xml.tree.XmlDocument document,
com.sun.xml.tree.ElementNode parent)
Saves spectrum parameters in a XML file. |
void |
selectDQ(java.lang.String arrayid)
Selects DQ array. |
void |
selectIntensity(java.lang.String arrayid)
Selects intensity array. |
void |
selectRadialVelocity(RadialVelocity rv)
Selects a radial velocity object. |
void |
setChild(Spectrum child)
Sets a reference to a child spectrum, that is, a different instance of Spectrum that was derived from this
instance. |
void |
setDQBits(DQBits dqbits)
Stores a copy of the DQBits/code> object. |
void |
setDQMask(int mask)
Sets the DQ mask value used in subsequent data retrieval operations. |
void |
setDQMasks(int[] masks)
Sets the DQ masks into each element of the composite. |
void |
setHeader(SpectrumHeader header)
Stores a copy of the SpectrumHeader object. |
void |
setMultiSegment(boolean multi_segment)
Sets the multi-segment flag. |
void |
setName(java.lang.String name)
Sets the spectrum's name. |
void |
setNormalizable(boolean normalizable)
Sets the normalizable state of the spectrum. |
void |
setRestWavelengthsFlag(boolean flag)
Sets a flag that tells that rest wavelengths are to be gotten from this spectrum. |
void |
setSpectrogram(boolean spectrogram)
Sets the spectrogram mode. |
void |
setTargetName(java.lang.String targetName)
Sets the target name. |
void |
setUnits(Units units)
Stores physical units in the currently selected intensity array. |
void |
setWavelengthID(java.lang.String waveid)
Sets the wavelength ID. |
void |
setWavelengths(double[] wavelengths)
Sets a new wavelength array. |
void |
setWavelengthUnits(Units units)
Stores wavelength current physical units. |
boolean |
supportsRadialVelocity()
Returns true for spectral data that can be
represented in a rest wavelength frame. |
void |
update(java.util.Observable obs,
java.lang.Object arg)
Implements update from the Observer
interface. |
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface spv.spectrum.Spectrum |
|---|
addObserver, deleteObserver |
| Field Detail |
|---|
public Spectrum sp
protected boolean notify
| Constructor Detail |
|---|
public SpectrumDecorator()
| Method Detail |
|---|
public Spectrum getDecoratedSpectrum()
public java.lang.String getName()
getName in interface Spectrumpublic java.lang.String getTag()
A tag is an auxiliary string used for internal identification purposes.
getTag in interface Spectrumpublic boolean isSpectrogram()
isSpectrogram in interface Spectrumtrue if spectrum is a spectrogrampublic void setSpectrogram(boolean spectrogram)
setSpectrogram in interface Spectrumspectrogram - the spectrogram modepublic java.lang.String getTargetName()
null, or
the appropriate keyword is not found, an empty string is returned.
getTargetName in interface Spectrumpublic void setTargetName(java.lang.String targetName)
setTargetName in interface SpectrumtargetName - the target namepublic SpectrumHeader getHeader()
SpectrumHeader associated with this spectrum.
getHeader in interface Spectrumpublic DQBits getDQBits()
getDQBits in interface Spectrumpublic DQBits[] getArrayDQBits()
getArrayDQBits in interface Spectrumpublic int getDQMask()
getDQMask in interface Spectrumpublic int[] getArrayDQMask()
getArrayDQMask in interface Spectrumpublic int getNBins()
getNBins in interface Spectrumpublic RadialVelocity getSelectedRadialVelocity()
getSelectedRadialVelocity in interface Spectrumpublic java.util.List getRadialVelocities()
getRadialVelocities in interface Spectrumpublic void selectRadialVelocity(RadialVelocity rv)
selectRadialVelocity in interface Spectrumrv - the radial velocity to be selectedpublic DataTableModel getTableModel()
getTableModel in interface Spectrumpublic DataTableModel getNewTableModel()
This method should be used when changes in the internal spectrum contents took place.
getNewTableModel in interface Spectrum
public double integrate(double w1,
double w2)
integrate in interface Spectrumw1 - wavelength limit for integration, in standard unitsw2 - wavelength limit for integration, in standard units
public void normalize(double wave,
double flux,
Units ounits)
normalize in interface Spectrumwave - the wavelength were to normalizeflux - the resulting flux density at that wavelengthounits - the original units to be associated with the new flux,
or null if none.
public void renormalize(double wave,
double flux,
java.lang.Object spid)
renormalize in interface Spectrumwave - the reference wavelengthflux - the new flux at the reference wavelengthspid - the spectrum identification object. If non-null,
the method should act on the specified element only.public double getIntegralError()
getIntegralError in interface Spectrumpublic double getAverageValue()
getAverageValue in interface Spectrumpublic double getSigma()
getSigma in interface Spectrumpublic double getFluxWeightedPosition()
getFluxWeightedPosition in interface Spectrumpublic double getFluxWeightedPositionError()
getFluxWeightedPositionError in interface Spectrumpublic double getExtremumPosition()
getExtremumPosition in interface Spectrumpublic int getIntegrationBins()
getIntegrationBins in interface Spectrumpublic void addRadialVelocity(RadialVelocity rv)
addRadialVelocity in interface Spectrumrv - a radial velocity objectpublic void removeRadialVelocity(RadialVelocity rv)
removeRadialVelocity in interface Spectrumrv - a radial velocity objectpublic java.util.Enumeration getIntensityList()
Enumeration with the String
objects that identify the intensity arrays stored in this object.
getIntensityList in interface SpectrumString instancespublic java.util.Enumeration getDQList()
Enumeration with the String
objects that identify the data quality arrays stored in this object.
getDQList in interface SpectrumEnumeration with array namespublic Units getUnits()
Units associated with the selected
intensity array in this spectrum.
getUnits in interface SpectrumUnits instancepublic Units getWavelengthUnits()
Units associated with the wavelength
array in this spectrum.
getWavelengthUnits in interface SpectrumUnits instancepublic Units getOriginalUnits()
Units associated with the
selected intensity array in this spectrum.
getOriginalUnits in interface SpectrumUnits instancepublic Units getOriginalWavelengthUnits()
Units associated with the
wavelength array in this spectrum.
getOriginalWavelengthUnits in interface SpectrumUnits instancepublic java.util.Enumeration getSpectrumList()
Enumeration with the ids of all internal
Spectrum instances stored in this object.
getSpectrumList in interface SpectrumSpectrum instancespublic java.util.List getSpectrumListAsList()
List with the id objetcs
of the Spectrum instances stored in this object.
This method was introduced for efficiency purposes.
getSpectrumListAsList in interface SpectrumSpectrum instancespublic int getNumberOfSpectra()
getNumberOfSpectra in interface Spectrumpublic java.util.List explodeSpectrum()
Spectrum
instances in this.
- Specified by:
explodeSpectrum in interface Spectrum
- Returns:
- a list with all internal
Spectrum
instances in this
public Spectrum getSpectrum(java.lang.Object spid)
Spectrum object.
getSpectrum in interface Spectrumspid - the spectrum identification object
Spectrum instancepublic double[] getWavelengths()
getWavelengths in interface Spectrumpublic double[] getRestWavelengths()
getRestWavelengths in interface Spectrumpublic void setRestWavelengthsFlag(boolean flag)
setRestWavelengthsFlag in interface Spectrumflag - a flag that tells that rest wavelengths are to be
gotten from this spectrumpublic boolean isRestWavelengths()
isRestWavelengths in interface Spectrumpublic boolean isNormalizable()
isNormalizable in interface Spectrumtrue if the spectrum is normalizablepublic void setNormalizable(boolean normalizable)
setNormalizable in interface Spectrumnormalizable - the normalizable state of the spectrumpublic double getX(double wavelength)
Note that the concept only applies if the wavelengths are monotonically sorted. If not, this method may deliver bogus results.
getX in interface Spectrumpublic double getMinWavelength()
getMinWavelength in interface Spectrumpublic double getMaxWavelength()
getMaxWavelength in interface Spectrumpublic double getAverageDispersion()
getAverageDispersion in interface Spectrumpublic double[] getValues()
getValues in interface Spectrumpublic double[] getErrors()
getErrors in interface Spectrumpublic int[] getDQ()
getDQ in interface Spectrumpublic boolean isMultiSegment()
This flag does *NOT* overlap with spectrum types that have internal structure. It is designed to tell to external software (such as a graphics library) taht the spectrum must be depicted explictly with a multi-segment glyph.
isMultiSegment in interface Spectrumtrue if the spectrum must be depicted has a
multi-segment entity.public void setMultiSegment(boolean multi_segment)
setMultiSegment in interface Spectrummulti_segment - the multi-segment flagpublic boolean isEvenlySampled()
isEvenlySampled in interface Spectrumtrue if the wavelength array returned
by this object is more or less evenly sampled.public boolean isEquallySpaced()
isEquallySpaced in interface Spectrumtrue if the wavelength array returned
by this object is sampled with a uniform step.public java.lang.String getWavelengthID()
getWavelengthID in interface Spectrumpublic void setWavelengthID(java.lang.String waveid)
setWavelengthID in interface Spectrumwaveid - the wavelength ID
public void setWavelengths(double[] wavelengths)
throws SpectrumException
This method causes the entire spectrum to be resanpled at the new wavelength values.
setWavelengths in interface Spectrumwavelengths - the new wavelength array
SpectrumException - if the provided array is not
compatible with the existing wavelength arraypublic void setName(java.lang.String name)
setName in interface Spectrumname - the spectrum's namepublic void setHeader(SpectrumHeader header)
SpectrumHeader object.
setHeader in interface Spectrumheader - the object to be storedpublic void setDQBits(DQBits dqbits)
DQBits/code> object.
- Specified by:
setDQBits in interface Spectrum
- Parameters:
dqbits - the object to be stored
public void setDQMask(int mask)
setDQMask in interface Spectrummask - the DQ mask valuepublic void setDQMasks(int[] masks)
setDQMasks in interface Spectrummasks - array with the DQ maskspublic void maskAll()
maskAll in interface Spectrumpublic java.lang.String getSelectedIntensityID()
getSelectedIntensityID in interface Spectrumpublic java.lang.String getSelectedDQID()
getSelectedDQID in interface Spectrumpublic void selectIntensity(java.lang.String arrayid)
selectIntensity in interface Spectrumarrayid - the array identificationpublic void selectDQ(java.lang.String arrayid)
selectDQ in interface Spectrumarrayid - the array identificationpublic void resetArraySelection()
resetArraySelection in interface Spectrumpublic void setUnits(Units units)
setUnits in interface Spectrumunits - the physical units to be stored as currentpublic void setWavelengthUnits(Units units)
setWavelengthUnits in interface Spectrumunits - the physical units to be stored as currentpublic void enableNotifications(boolean notify)
enableNotifications in interface Spectrumnotify - true if notifications are to be
enabled, false otherwise.public void process(Command command)
Command
object, using "this" as argument to the process.
process in interface Spectrumcommand - the command object that encapsulates the
processor algorithm
public void addSpectrum(java.lang.Object spid,
Spectrum sp)
Spectrum instance to this object.
addSpectrum in interface Spectrumspid - the identificationsp - the Spectrum instance to be addedpublic void removeSpectrum(java.lang.Object spid)
Spectrum instance from this object.
removeSpectrum in interface Spectrumspid - the identificationpublic void reorderWavelengths()
reorderWavelengths in interface Spectrumpublic void initializeParametersFromMap(java.util.Map map)
This operation should be handled by a single base class; therefore decorator should,'t propagate it. This method is a no-op.
initializeParametersFromMap in interface Spectrummap - the map, ignored
public void saveSpectrumParameters(com.sun.xml.tree.XmlDocument document,
com.sun.xml.tree.ElementNode parent)
This operation should be handled by a single base class; therefore decorator should,'t propagate it. This method is a no-op.
saveSpectrumParameters in interface Spectrumdocument - the DOM document, ignored.parent - the parent node, ignored.public void saveAsSED(java.lang.String filename)
saveAsSED in interface Spectrumfilename - the SED file namepublic java.util.Map getMetaParameters()
getMetaParameters in interface Spectrum
public void addMetaParameter(java.lang.String utype,
java.lang.String value)
addMetaParameter in interface Spectrumutype - the utypevalue - the value
public void addMetaParameter(java.lang.String utype,
java.lang.String value,
java.lang.String units)
addMetaParameter in interface Spectrumutype - the utypevalue - the valueunits - the units
public void addMetaParameter(java.lang.String utype,
MetaParameter parameter)
addMetaParameter in interface Spectrumutype - the utypeparameter - the parameterpublic void removeMetaParameter(java.lang.String utype)
removeMetaParameter in interface Spectrumutype - the utypepublic boolean supportsRadialVelocity()
true for spectral data that can be
represented in a rest wavelength frame.
supportsRadialVelocity in interface Spectrumtrue for spectral data that can be
represented in a rest wavelength framepublic void setChild(Spectrum child)
Spectrum that was derived from this
instance.
setChild in interface Spectrumchild - the child spectrumpublic Spectrum getChild()
getChild in interface Spectrum
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface Spectrumclone in class java.lang.Objectjava.lang.CloneNotSupportedException
public void update(java.util.Observable obs,
java.lang.Object arg)
update from the Observer
interface. This method intercept update requests from the
decorated spectrum and just passes them up to observers,
without any processing.
The Observable object that sent the update request
is compared with the decorated spectrum object. The request is
propagated upwards only if they are the same object.
update in interface java.util.Observerobs - the object that notifies thisarg - the optional object used to convey state info
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||