001    package edu.nrao.sss.model.source;
002    
003    import javax.xml.bind.annotation.XmlElement;
004    import javax.xml.bind.annotation.XmlType;
005    
006    import edu.nrao.sss.astronomy.StokesParameter;
007    import edu.nrao.sss.measure.FluxDensity;
008    import edu.nrao.sss.measure.FrequencyRange;
009    
010    /**
011     * A base class for all source brightnesses that are not file based.
012     * <p>
013     * <b>Version Info:</b>
014     * <table style="margin-left:2em">
015     *   <tr><td>$Revision: 913 $</td></tr>
016     *   <tr><td>$Date: 2007-09-25 08:55:39 -0600 (Tue, 25 Sep 2007) $</td></tr>
017     *   <tr><td>$Author: dharland $</td></tr>
018     * </table></p>
019     *  
020     * @author David M. Harland
021     * @since 2006-05-16
022     */
023    @XmlType(propOrder= {"polarization",    "validFrequency",
024                         "peakFluxDensity", "totalFluxDensity"})
025    public abstract class DescriptiveBrightness
026      extends SourceBrightness
027    {
028      /** Helps create a new instance. */
029      DescriptiveBrightness()
030      {
031        super();
032      }
033      
034      /**
035       * Sets the polarization for this brightness.
036       * <p>
037       * If {@code newPolarization} is <i>null</i>, this brightness's polarization
038       * will be set to a default value.</p>
039       * 
040       * @param newPolarization the polarization for this source brightness.
041       */
042      @XmlElement
043      public void setPolarization(StokesParameter newPolarization)
044      {
045        polarization = (newPolarization == null) ? StokesParameter.getDefault()
046                                                 : newPolarization;
047      }
048    
049      /**
050       * Sets the valid frequency range for this source brightness.
051       * <p>
052       * If {@code newRange} is <i>null</i>, this brightness's frequency
053       * range will be set to all (positive) frequencies.</p>
054       * <p>
055       * Note that this brightness will hold a reference to {@code newRange}
056       * (unless it is <i>null</i>).  This means that any changes to
057       * {@code newRange} by other objects after this call is made will
058       * be reflected in this brightness.</p>
059       * 
060       * @param newRange the frequency range for this source brightness.
061       */
062      @XmlElement
063      public void setValidFrequency(FrequencyRange newRange)
064      {
065        validFrequency = (newRange == null) ? new FrequencyRange() : newRange;
066      }
067    
068      /**
069       * Sets the peak flux density of this brightness.
070       * <p>
071       * If {@code newDensity} is <i>null</i>, this brightness's peak flux density
072       * will be set zero janskies.</p>
073       * <p>
074       * Note that this brightness will hold a reference to {@code newDensity}
075       * (unless it is <i>null</i>).  This means that any changes to
076       * {@code newDensity} by other objects after this call is made will
077       * be reflected in this brightness.</p>
078       * 
079       * @param newDensity the new peak flux density for this source brightness.
080       */
081      @XmlElement
082      public void setPeakFluxDensity(FluxDensity newDensity)
083      {
084        peakFluxDensity = (newDensity == null) ? new FluxDensity() : newDensity;
085      }
086    
087      /**
088       * Sets the total flux density of this brightness.
089       * <p>
090       * If {@code newDensity} is <i>null</i>, this brightness's total flux density
091       * will be set zero janskies.</p>
092       * <p>
093       * Note that this brightness will hold a reference to {@code newDensity}
094       * (unless it is <i>null</i>).  This means that any changes to
095       * {@code newDensity} by other objects after this call is made will
096       * be reflected in this brightness.</p>
097       * 
098       * @param newDensity the new total flux density for this source brightness.
099       */
100      @XmlElement
101      public void setTotalFluxDensity(FluxDensity newDensity)
102      {
103        totalFluxDensity = (newDensity == null) ? new FluxDensity() : newDensity;
104      }
105      
106    
107      //These get methods are here only for JAXB purposes.  If they were not here,
108      //JAXB would complain that it found setX, but not getX, even though getX is
109      //present in an ancestral class.
110    
111      public StokesParameter getPolarization()
112      {
113        return super.getPolarization();
114      }
115    
116      public FrequencyRange getValidFrequency()
117      {
118        return super.getValidFrequency();
119      }
120      
121      public FluxDensity getPeakFluxDensity()
122      {
123        return super.getPeakFluxDensity();
124      }
125      
126      public FluxDensity getTotalFluxDensity()
127      {
128        return super.getTotalFluxDensity();
129      }
130    
131    }