edu.nrao.sss.model.source
Class SourceImageLink

java.lang.Object
  extended by edu.nrao.sss.model.source.SourceImageLink
All Implemented Interfaces:
Cloneable, Comparable<SourceImageLink>

public class SourceImageLink
extends Object
implements Cloneable, Comparable<SourceImageLink>

A descriptive link to an image of an astronomical source.

CVS Info:

$Revision: 1911 $
$Date: 2009-01-21 10:27:48 -0700 (Wed, 21 Jan 2009) $
$Author: dharland $

Since:
2006-11-29
Author:
David M. Harland

Constructor Summary
SourceImageLink()
          Creates a new instance with a phony URL, an unknown polarization, and a frequency of zero GHz.
SourceImageLink(Frequency frequency, StokesParameter polarization, URL imageLocation)
           
 
Method Summary
 void appendComments(String additionalComments)
          Adds additional comments to those already associated with this link.
 SourceImageLink clone()
          Returns an image link that is a copy of this one.
 int compareTo(SourceImageLink other)
          Compares this image link to other for order.
 boolean equals(Object o)
          Returns true if o is equal to this image link.
 String getComments()
          Returns free-form text related to this link.
 String getDisplayName()
          Returns text that may be used for displaying this link.
 Frequency getFrequency()
          Returns the frequency at which the linked image was observed.
 URL getImageLocation()
          Returns the URL for this image.
 StokesParameter getPolarization()
          Returns the polarization of this SourceImageLink.java.
 int hashCode()
          Returns a hash code value for this image link.
 void setComments(String replacementComments)
          Stores free-form text related to this link.
 void setDisplayName(String newName)
          Sets the display name for this link.
 void setFrequency(Frequency newFrequency)
          Sets the frequency at which the linked image was observed.
 void setImageLocation(URL imageLocation)
          Sets the URL for this image.
 void setPolarization(StokesParameter newPolarization)
          Sets the polarization for which the linked image was observed.
 String toHtmlAnchor()
          Returns a string in the form <a href="getImageLocation().toString()">getDisplayName()</a>
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceImageLink

public SourceImageLink()
Creates a new instance with a phony URL, an unknown polarization, and a frequency of zero GHz.


SourceImageLink

public SourceImageLink(Frequency frequency,
                       StokesParameter polarization,
                       URL imageLocation)
Parameters:
frequency - the frequency at which the linked image was observed. If this parameter is null, a new frequency of zero GHz will be used.
polarization - the polarization for which the linked image was observed. If this parameter is null, a default polarization will be used.
imageLocation - the URL for the image. If this parameter is null, a phony non-null URL will be used.
Method Detail

setFrequency

public void setFrequency(Frequency newFrequency)
Sets the frequency at which the linked image was observed.

Parameters:
newFrequency - the frequency at which the linked image was observed. If this parameter is null, a new frequency of zero GHz will be used.

getFrequency

public Frequency getFrequency()
Returns the frequency at which the linked image was observed. The value returned is guaranteed to be non-null.

Returns:
the frequency at which the linked image was observed.

setPolarization

public void setPolarization(StokesParameter newPolarization)
Sets the polarization for which the linked image was observed.

Parameters:
newPolarization - the polarization for which the linked image was observed. If this parameter is null, a default polarization will be used.

getPolarization

public StokesParameter getPolarization()
Returns the polarization of this SourceImageLink.java. The value returned is guaranteed to be non-null.

Returns:
the polarization of this SourceImageLink.java.

setComments

public void setComments(String replacementComments)
Stores free-form text related to this link. The comments usually relate to the manner in which the image was obtained. This might include the telescope used, the date of the acquisition, the person performing the observation, and anything else that might be of interest to other astronomers.

Parameters:
replacementComments - free-form text related to this link. These comments replace all previously set comments. A null value will be replaced by the empty string (""}).
See Also:
appendComments(String)

appendComments

public void appendComments(String additionalComments)
Adds additional comments to those already associated with this link.

Parameters:
additionalComments - new, additional, comments for this link.
See Also:
setComments(String)

getComments

public String getComments()
Returns free-form text related to this link. The value returned is guaranteed to be non-null.

See setComments(String) for the typical use of this property.

Returns:
free-form text related to this link.

setImageLocation

public void setImageLocation(URL imageLocation)
Sets the URL for this image.

Parameters:
imageLocation - the URL for the image. If this parameter is null, a phony non-null URL will be used.

getImageLocation

public URL getImageLocation()
Returns the URL for this image. The value returned is guaranteed to be non-null, but it may be a phony URL.

Returns:
the URL for this image.

setDisplayName

public void setDisplayName(String newName)
Sets the display name for this link.

Parameters:
newName - the display name for this link. If this value is null, a non-null default name is used in its place.

getDisplayName

public String getDisplayName()
Returns text that may be used for displaying this link.

Returns:
text that may be used for displaying this link.

toHtmlAnchor

public String toHtmlAnchor()
Returns a string in the form <a href="getImageLocation().toString()">getDisplayName()</a>

Returns:
an HTML anchor representing this link.

clone

public SourceImageLink clone()
Returns an image link that is a copy of this one.

If anything goes wrong during the cloning procedure, a RuntimeException will be thrown.

Overrides:
clone in class Object

equals

public boolean equals(Object o)
Returns true if o is equal to this image link.

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns a hash code value for this image link.

Overrides:
hashCode in class Object

compareTo

public int compareTo(SourceImageLink other)
Compares this image link to other for order.

One link is deemed to be "less than" the other if its frequency is lower than that of the other. In the case that two links are for the same frequency, the polarization is used as a tie-breaker. If these are the same, the text of the image location URL is the final tie-breaker. The comments are not compared.

Specified by:
compareTo in interface Comparable<SourceImageLink>
Parameters:
other - the image link to which this one is compared.
Returns:
a negative integer, zero, or a positive integer as this link is less than, equal to, or greater than the other link.


Copyright © 2009. All Rights Reserved.