|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.nrao.sss.model.resource.ResourceSpecification
public class ResourceSpecification
A science view of the hardware needed for an observation.
Version Info:
$Revision: 851 $ |
$Date: 2007-08-27 13:29:48 -0600 (Mon, 27 Aug 2007) $ |
$Author: dharland $ |
Constructor Summary | |
---|---|
ResourceSpecification()
Creates a new instance. |
Method Summary | |
---|---|
ResourceSpecification |
clone()
Returns a resource specification that is a copy of this one. |
boolean |
equals(Object o)
Returns true if o is equal to this specification. |
static ResourceSpecification |
fromXml(Reader reader)
Creates a new specification based on the XML data read from reader . |
static ResourceSpecification |
fromXml(String xmlFile)
Creates a new specification from the XML data in the given file. |
List<PulsarSpecification> |
getPulsarSpecs()
Returns this specification's list of pulsar specifications. |
List<SkyFrequencySpecification> |
getSkyFrequencySpecs()
Returns this specification's list of sky frequency specifications. |
List<SpectralLineSpecification> |
getSpectralLineSpecs()
Returns this specification's list of spectral line specifications. |
FrequencySpectrum |
getSpectrum()
Returns the portions of the frequency spectrum covered by these specifications. |
int |
hashCode()
Returns a hash code value for this specification. |
static ResourceSpecification |
makeFrom(PulsarSpecification specs)
Creates a new instance based on the given specifications. |
static ResourceSpecification |
makeFrom(SkyFrequencySpecification specs)
Creates a new instance based on the given specifications. |
static ResourceSpecification |
makeFrom(SpectralLineSpecification specs)
Creates a new instance based on the given specifications. |
ResourceSpecification |
modifyToFit(FrequencyRange targetRange)
Modifies this resource specification to fit the given frequency range. |
ResourceSpecification |
modifyToFit(FrequencySpectrum targetSpectrum)
Modifies this resource specification to fit the given frequency spectrum. |
void |
setPulsarSpecs(List<PulsarSpecification> newSpecs)
Sets a new list of pulsar specifications. |
void |
setSkyFrequencySpecs(List<SkyFrequencySpecification> newSpecs)
Sets a new list of sky frequency specifications. |
void |
setSpectralLineSpecs(List<SpectralLineSpecification> newSpecs)
Sets a new list of spectral line specifications. |
String |
toXml()
Returns an XML representation of this specification. |
void |
writeAsXmlTo(Writer writer)
Writes an XML representation of this specification to writer . |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResourceSpecification()
Method Detail |
---|
public static ResourceSpecification makeFrom(SkyFrequencySpecification specs)
specs
- an entry in this specification's list of spectral
specifications.
public static ResourceSpecification makeFrom(SpectralLineSpecification specs)
specs
- an entry in this specification's list of spectral
specifications.
public static ResourceSpecification makeFrom(PulsarSpecification specs)
specs
- an entry in this specification's list of pulsar
specifications.
public void setSkyFrequencySpecs(List<SkyFrequencySpecification> newSpecs)
newSpecs
is null, it will be interpreted
as an empty list.
Note that this specification will hold an internal reference to
newSpecs
(unless it is null). This means that any
changes made to newSpecs
after this call will be
reflected in this object.
newSpecs
- a list of sky frequency specifications.public List<SkyFrequencySpecification> getSkyFrequencySpecs()
Note that the returned list is the one held internally by this specification. This means that any changes made to the returned list after this call will be reflected in this object.
public void setSpectralLineSpecs(List<SpectralLineSpecification> newSpecs)
newSpecs
is null, it will be interpreted
as an empty list.
Note that this specification will hold an internal reference to
newSpecs
(unless it is null). This means that any
changes made to newSpecs
after this call will be
reflected in this object.
newSpecs
- a list of spectral line specifications.public List<SpectralLineSpecification> getSpectralLineSpecs()
Note that the returned list is the one held internally by this specification. This means that any changes made to the returned list after this call will be reflected in this object.
public void setPulsarSpecs(List<PulsarSpecification> newSpecs)
newSpecs
is null, it will be interpreted
as an empty list.
Note that this specification will hold an internal reference to
newSpecs
(unless it is null). This means that any
changes made to newSpecs
after this call will be
reflected in this object.
newSpecs
- a list of pulsar specifications.public List<PulsarSpecification> getPulsarSpecs()
Note that the returned list is the one held internally by this specification. This means that any changes made to the returned list after this call will be reflected in this object.
public FrequencySpectrum getSpectrum()
public ResourceSpecification modifyToFit(FrequencyRange targetRange)
Any frequency ranges held by this specification that have no overlap with
targetRange
are deleted. Those ranges that do overlap the target
range are trimmed to the overlapping portions. The net effect is that the
frequency ranges of this specification after the modification are the
result of intersecting the current ranges with targetRange
.
targetRange
- the frequency range used to modify this specification.
Only the portions of the ranges held by this
specification that intersect this parameter are
retained.
public ResourceSpecification modifyToFit(FrequencySpectrum targetSpectrum)
Any frequency ranges held by this specification that have no overlap with
targetSpectrum
are deleted. Those ranges that do overlap the
target spectrum are trimmed to the overlapping portions. The net effect
is that the frequency ranges of this specification after the modification
are the result of intersecting the current ranges with
targetSpectrum
.
Note: one consequence of this method is that the internal lists of subspecifications are replaced with new lists.
targetSpectrum
- the frequency speumctr used to modify this
specification. Only the portions of the ranges held
by this specification that intersect this parameter
are retained.
public String toXml() throws JAXBException
JAXBException
- if anything goes wrong during the conversion to XML.writeAsXmlTo(Writer)
public void writeAsXmlTo(Writer writer) throws JAXBException
writer
.
writer
- the device to which XML is written.
JAXBException
- if anything goes wrong during the conversion to XML.public static ResourceSpecification fromXml(String xmlFile) throws JAXBException, XMLStreamException, FileNotFoundException
xmlFile
- the name of an XML file. This method will attempt to locate
the file by using Class.getResource(String)
.
FileNotFoundException
- if the XML file cannot be found.
JAXBException
- if the schema file used (if any) is malformed, if
the XML file cannot be read, or if the XML file is not
schema-valid.
XMLStreamException
- if there is a problem opening the XML file,
if the XML is not well-formed, or for some other
"unexpected processing conditions".public static ResourceSpecification fromXml(Reader reader) throws JAXBException, XMLStreamException
reader
.
reader
- the specification of the XML data.
If this value is null, null is returned.
reader
.
XMLStreamException
- if the XML is not well-formed,
or for some other "unexpected processing conditions".
JAXBException
- if anything else goes wrong during the
transformation.public ResourceSpecification clone()
If anything goes wrong during the cloning procedure,
a RuntimeException
will be thrown.
clone
in class Object
public boolean equals(Object o)
o
is equal to this specification.
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |