|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.nrao.sss.model.source.Source
public class Source
An astronomical emitter of radio waves.
Version Info:
$Revision: 1709 $ |
$Date: 2008-11-14 11:22:37 -0700 (Fri, 14 Nov 2008) $ |
$Author: dharland $ (last person to modify) |
Field Summary | |
---|---|
static String |
CENTER_POSITION_NAME
|
Fields inherited from interface edu.nrao.sss.util.Identifiable |
---|
UNIDENTIFIED |
Fields inherited from interface edu.nrao.sss.model.UserAccountable |
---|
NULL_USER_ID |
Constructor Summary | |
---|---|
Source()
Creates a new unnamed source. |
|
Source(String name)
Creates a new instance with the given name. |
Method Summary | |
---|---|
void |
addSubsource(Subsource newSubsource)
Adds newSubsource to this source. |
Frequency |
calcShiftedFrequency(Frequency restFreq,
EarthPosition observer,
Date dateTime)
Returns an observed frequency based on a rest frequency and the relative motion between this source and an earth-bound observer. |
LinearVelocity |
calcVelocityRelativeTo(EarthPosition observer,
Date dateTime)
Returns the velocity of this source toward or away from the observer at the given point in time. |
void |
clearId()
Resets this entry's ID, and the IDs of all its components, to a value that represents the unidentified state. |
Source |
clone()
Returns a source that is equal to this one. |
boolean |
equals(Object o)
Returns true if o is equal to this source. |
static Source |
fromXml(Reader reader)
Creates a new source based on the XML data read from reader . |
static Source |
fromXml(String xmlFile)
Creates a new source from the XML data in the given file. |
Source |
get(Date pointInTime)
Returns the source associated with this entry as of the given point in time. |
List<String> |
getAliases()
Returns a list of other names by which this source is known. |
Subsource |
getCentralSubsource()
Returns the subsource that represents the center position of this source. |
Long |
getCreatedBy()
Returns the ID of the user who created this object. |
Date |
getCreatedOn()
Returns the date on which this object was created. |
List<String> |
getHistoricalRecords()
Returns one element of text for each historical record held by this source. |
Long |
getId()
|
List<SourceImageLink> |
getImageLinks()
Returns a collection of links to images of this source. |
Long |
getLastUpdatedBy()
Returns the ID of the user who most recently updated this object. |
Date |
getLastUpdatedOn()
Returns the most recent date on which this object was updated. |
List<URL> |
getLinks()
Returns a list of URL links to more information about this source. |
String |
getName()
Returns the name of this source. |
List<String> |
getNotes()
Returns a list of notes about this source. |
String |
getOriginOfInformation()
Returns the origin of this source's information. |
SkyPosition |
getPosition()
Returns the position of this source. |
SortedSet<Subsource> |
getSubsources()
Returns this source's collection of subsources. |
SortedMap<String,String> |
getUserDefinedValues()
Returns a collection of user-defined key/value pairs. |
int |
hashCode()
Returns a hash code value for this source. |
boolean |
isMoving()
Returns true if the position of this source at time T could be different than its position at time U ≠ T. |
static String |
makeUdbKeyVlaCalibQuality(ReceiverBand band,
TelescopeConfiguration cfg)
Returns text that can be used as a key for the user defined values map . |
static String |
makeUdbKeyVlaCalibQuality(String bandCode,
String teleCfgCode)
Returns text that can be used as a key for the user defined values map . |
static String |
makeUdbKeyVlaUvMax(ReceiverBand band)
Returns text that can be used as a key for the user defined values map . |
static String |
makeUdbKeyVlaUvMax(String bandCode)
Returns text that can be used as a key for the user defined values map . |
static String |
makeUdbKeyVlaUvMin(ReceiverBand band)
Returns text that can be used as a key for the user defined values map . |
static String |
makeUdbKeyVlaUvMin(String bandCode)
Returns text that can be used as a key for the user defined values map . |
void |
removeAllSubsources()
Removes all subsources from this source. |
void |
removeSubsource(Subsource oldSubsource)
Removes oldSubsource from this source. |
void |
reset()
Resets this source to its initial state. |
void |
setCreatedBy(Long userId)
Sets the ID of the user who created this object. |
void |
setCreatedOn(Date d)
Sets the date on which this object was created. |
void |
setId(Long id)
Do not use. |
void |
setLastUpdatedBy(Long userId)
Sets the ID of the user who most recently updated this object. |
void |
setLastUpdatedOn(Date d)
Sets the date on which this object was most recently updated. |
void |
setName(String newName)
Sets the name of this source. |
void |
setOriginOfInformation(String origin)
Sets the origin of this source's information. |
void |
setSubsources(SortedSet<Subsource> replacementSet)
Replaces this source's collection of subsources with replacementSet . |
String |
toString()
Returns a text representation of this source. |
String |
toXml()
Returns an XML representation of this source. |
void |
writeAsXmlTo(Writer writer)
Writes an XML representation of this source to writer . |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String CENTER_POSITION_NAME
Constructor Detail |
---|
public Source()
CENTER_POSITION_NAME
.
public Source(String name)
CENTER_POSITION_NAME
.
Method Detail |
---|
public void reset()
public Source get(Date pointInTime)
SourceCatalogEntry
get
in interface SourceCatalogEntry
pointInTime
- the time at which a source is desired.
public boolean isMoving()
The determination of motion will be made with respect to the coordinate system in which the position of this source is expressed. For example, a position that is expressed in the equatorial system, and that is holding steady at its position in that system, will said to be not moving, even though in other coordinate systems it may be moving quite rapidly.
This is a convenience method that is equivalent to calling getCentralSubsource().isMoving().
public Long getId()
getId
in interface Identifiable
public void setId(Long id)
SourceCatalogEntry
setId
in interface SourceCatalogEntry
public void clearId()
SourceCatalogEntry
This method is useful for preparing an entry for storage in a database. The ID property (as of now, though this may change in the future) is used by our persistence mechanism to identify objects. If you are persisting this entry for the first time, you may need to call this method before performing a save. This is especially true if you have created this source from XML, as the XML unmarshalling brings along the ID property.
clearId
in interface SourceCatalogEntry
public void setName(String newName)
If newName
is null or the empty string
(""), the request to change the name will be
denied and the current name will remain in place.
setName
in interface SourceCatalogEntry
setName
in interface Nameable
newName
- the new name for this source.public String getName()
getName
in interface SourceCatalogEntry
getName
in interface Nameable
public SortedMap<String,String> getUserDefinedValues()
Note that the returned map is the one actually held by this object. This means that any changes made to the returned map will be reflected in this source. It also means that to add, delete, or change a keyword mapping, clients call this method and then operate directly on the returned map.
public static String makeUdbKeyVlaCalibQuality(ReceiverBand band, TelescopeConfiguration cfg)
user defined values map
.
The returned key is used to get a VLA calibrator quality code and
consists of some boiler plate text, a code for the receiver
band, and a code for the telescope configuration.
band
- the receiver band for which a key is desired.cfg
- the telescope configuration for which a key is desired.
public static String makeUdbKeyVlaCalibQuality(String bandCode, String teleCfgCode)
user defined values map
.
The returned key is used to get a VLA calibrator quality code and
consists of some boiler plate text, a code for the receiver
band, and a code for the telescope configuration.
bandCode
- a code for a receiver band. By convention this should be a value returned
by the getDisplayName() method
of
ReceiverBand
.teleCfgCode
- a code for a telescope configuration. By convention this should be a value
returned by the getCode method
of
TelescopeConfiguration
.
public static String makeUdbKeyVlaUvMax(ReceiverBand band)
user defined values map
.
The returned key is used to get a UVmax value and
consists of some boiler plate text and a code for the receiver band.
band
- the receiver band for which a key is desired.
public static String makeUdbKeyVlaUvMax(String bandCode)
user defined values map
.
The returned key is used to get a UVmax value and
consists of some boiler plate text and a code for the receiver band.
bandCode
- a code for a receiver band. By convention this should be a value returned
by the getDisplayName() method
of
ReceiverBand
.
public static String makeUdbKeyVlaUvMin(ReceiverBand band)
user defined values map
.
The returned key is used to get a UVmin value and
consists of some boiler plate text and a code for the receiver band.
band
- the receiver band for which a key is desired.
public static String makeUdbKeyVlaUvMin(String bandCode)
user defined values map
.
The returned key is used to get a UVmin value and
consists of some boiler plate text and a code for the receiver band.
bandCode
- a code for a receiver band. By convention this should be a value returned
by the getDisplayName() method
of
ReceiverBand
.
public void setOriginOfInformation(String origin)
origin
- the origin of this source's information. A value of
null will be replaced by a non-null default value.public String getOriginOfInformation()
public List<String> getAliases()
Note that the returned list is the one actually held by this object. This means that any changes made to the returned list will be reflected in this source. It also means that to add or delete an alias, clients call this method and then operate directly on the returned list.
public List<SourceImageLink> getImageLinks()
Note that the returned list is the one actually held by this object. This means that any changes made to the returned list will be reflected in this source. It also means that to add, delete, or change an image link, clients call this method and then operate directly on the returned list.
public List<String> getHistoricalRecords()
This method returns the list actually held by this Source
, so
any list manipulations may be performed by first fetching the list and
then operating on it.
public List<String> getNotes()
This method returns the list actually held by this Source
, so
any list manipulations may be performed by first fetching the list and
then operating on it.
getNotes
in interface SourceCatalogEntry
public List<URL> getLinks()
This method returns the list actually held by this Source
, so
any list manipulations may be performed by first fetching the list and
then operating on it.
public void addSubsource(Subsource newSubsource)
newSubsource
to this source.
If newSubsource
is null, no action is taken.
newSubsource
- the new subsource to be added to this source.public void removeSubsource(Subsource oldSubsource)
oldSubsource
from this source.
If this source is not holding oldSubsource
, this method
does nothing.
oldSubsource
- the subsource to be removed from this source.public void removeAllSubsources()
public void setSubsources(SortedSet<Subsource> replacementSet)
replacementSet
.
Note that this source will hold a reference to replacementSet
(unless it is null); it will not store a copy. This means
that any changes a client makes to replacementSet
after
calling this method will be reflected in this source.
replacementSet
- a replacement set of subsources for this source.
If replacementSet
is null, it will
be interpreted as an empty set.public SortedSet<Subsource> getSubsources()
Note that returned set is the one actually held by this source, not a clone thereof. That means that any changes that a client makes to the set will affect this source.
public Subsource getCentralSubsource()
This method will search this source's set of subsources for one whose
name is CENTER_POSITION_NAME
. If no such subsource is found,
an arbitrary subsource will be returned. If this source has no subsources
the returned value will be null.
public SkyPosition getPosition()
getCentralSubsource().getPosition()
.
public LinearVelocity calcVelocityRelativeTo(EarthPosition observer, Date dateTime) throws CoordinateConversionException
observer
- a position on earth. The radial velocity of this source is
calculated relative this observer.dateTime
- the point in time at which the velocity is calculated.
CoordinateConversionException
- if the position of this source cannot be converted to
an equatorial RA / Dec position.public Frequency calcShiftedFrequency(Frequency restFreq, EarthPosition observer, Date dateTime) throws CoordinateConversionException
restFreq
- the rest frequency for which an observed frequency is requested.observer
- a position on earth. The relative radial velocity between this
observer and this source determines the amount by which the
restFreq
is shifted into an observed frequency.dateTime
- the time for which the velocity calculation is performed.
restFreq
and the relative
motion between this source and the observer
.
CoordinateConversionException
- if the position of this source cannot be converted to
an equatorial RA / Dec position.public void setCreatedBy(Long userId)
UserAccountable
If userId
is null, this object will be updated
not with null but with UserAccountable.NULL_USER_ID
instead.
setCreatedBy
in interface UserAccountable
userId
- the ID of the user who most recently updated this object.public void setCreatedOn(Date d)
UserAccountable
If d
is null it will be ignored and this method
will do nothing.
setCreatedOn
in interface UserAccountable
d
- the date on which this object was created.public void setLastUpdatedBy(Long userId)
UserAccountable
If userId
is null, this object will be updated
not with null but with UserAccountable.NULL_USER_ID
instead.
setLastUpdatedBy
in interface UserAccountable
userId
- the ID of the user who most recently updated this object.public void setLastUpdatedOn(Date d)
UserAccountable
If d
is null it will be ignored and this method
will do nothing.
setLastUpdatedOn
in interface UserAccountable
d
- the date on which this object was most recently updated.public Long getCreatedBy()
UserAccountable
If this object does not know the identity of the user who created
it, the returned ID will be UserAccountable.NULL_USER_ID
.
getCreatedBy
in interface UserAccountable
public Date getCreatedOn()
UserAccountable
getCreatedOn
in interface UserAccountable
public Long getLastUpdatedBy()
UserAccountable
If this object does not know the identity of the user who lasted
updated it, the returned ID will be UserAccountable.NULL_USER_ID
.
getLastUpdatedBy
in interface UserAccountable
public Date getLastUpdatedOn()
UserAccountable
getLastUpdatedOn
in interface UserAccountable
public String toString()
toString
in class Object
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 Source 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 Source fromXml(Reader reader) throws JAXBException, XMLStreamException
reader
.
reader
- the source 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 Source clone()
If anything goes wrong during the cloning procedure,
a RuntimeException
will be thrown.
clone
in interface CatalogItem<SourceCatalogEntry>
clone
in class Object
public boolean equals(Object o)
o
is equal to this source.
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 |