001    package edu.nrao.sss.model.resource;
002    
003    import java.util.SortedSet;
004    
005    import edu.nrao.sss.astronomy.StokesParameter;
006    import edu.nrao.sss.measure.TimeDuration;
007    import edu.nrao.sss.util.Identifiable;
008    
009    /**
010     * A grouping of correlation products that share certain properties.
011     * <p>
012     * <b>Version Info:</b>
013     * <table style="margin-left:2em">
014     *   <tr><td>$Revision: 2200 $</td></tr>
015     *   <tr><td>$Date: 2009-04-15 16:00:47 -0600 (Wed, 15 Apr 2009) $</td></tr>
016     *   <tr><td>$Author: dharland $ (last person to modify)</td></tr>
017     * </table></p>
018     * 
019     * @author David M. Harland
020     * @since 2008-11-21
021     */
022    public interface CorrelationProductGroup
023      extends Identifiable
024    {
025      /**
026       * Resets this instance's ID, and the IDs of all its components,
027       * to a value that represents the unidentified state.
028       * <p>
029       * This method is useful for preparing an instance for storage in a database.
030       * The ID property (as of now, though this may change in the future) is
031       * used by our persistence mechanism to identify objects.  If you are
032       * persisting this instance for the first time, you may need to call
033       * this method before performing a save.  This is especially true if
034       * you have created this instance from XML, as the XML unmarshalling
035       * brings along the ID property.</p> 
036       */
037      public void clearId();
038      
039      /**
040       * Returns an ID that attempts to be universally unique.
041       * This ID <i>will</i> be unique for a given group within
042       * its containing subband.
043       * 
044       * @return
045       *   an ID that attempts to be universally unique.
046       */
047      public String getUUID();
048      
049      //============================================================================
050      // CORRELATION PRODUCTS
051      //============================================================================
052      
053      //TODO change "PolarizationProduct" to "CorrelationProduct"
054      /**
055       * Returns a set of the polarization products that may be obtained
056       * from this group.
057       * 
058       * @return
059       *    a set of the polarization products that may be obtained
060       *    from this group.
061       */
062      public SortedSet<StokesParameter> getAllowablePolarizationProducts();
063    
064      /**
065       * Attempts to add the given product to this group.
066       * The product will be added only if it is an
067       * {@link #getAllowablePolarizationProducts() allowable product}.
068       * This method returns <i>true</i> if it already contained
069       * <tt>stokes</tt> or if this method successfully added it.
070       * 
071       * @param stokes
072       *   the product to be added to this group.
073       *   
074       * @return
075       *   <i>true</i> if this group contains {@code stokes} after a
076       *   call to this method.
077       */
078      public boolean addPolarizationProduct(StokesParameter stokes);
079      
080      /**
081       * Removes the given product from this group, if present.
082       * 
083       * @param stokes
084       *   the product to be removed to this group.
085       *   
086       * @return
087       *   the number of channels that had been allocated to
088       *   the given product.
089       */
090      public int removePolarizationProduct(StokesParameter stokes);
091      
092      /**
093       * Removes all polarization products from this group.
094       */
095      public void removeAllPolarizationProducts();
096      
097      /**
098       * Returns the total number of spectral channels, summed over all
099       * correlation products, for this group.
100       * 
101       * @return
102       *   the total number of spectral channels for this group.
103       */
104      public int getSpectralChannels();
105      
106      /**
107       * Returns the number of spectral channels of this group that are
108       * allocated to the given product.
109       * 
110       * @param stokes
111       *   the product for which a number of channels is requested.
112       *   
113       * @return
114       *   the number of channels in this group for {@code stokes}.
115       */
116      public int getSpectralChannels(StokesParameter stokes);
117      
118      //============================================================================
119      // INTEGRATION TIME
120      //============================================================================
121      
122      /**
123       * Sets the total integration time for this product.
124       * Concrete implementations of this interface may break this duration into
125       * several component times.
126       * 
127       * @param totalDuration
128       *   the total integration duration for this product.
129       */
130      public void setTotalIntegrationTime(TimeDuration totalDuration);
131      
132      /**
133       * Returns the total integration time for this product.
134       * @return the total integration time for this product.
135       */
136      public TimeDuration getTotalIntegrationTime();
137      
138      /**
139       * Returns the minimum total integration time for this product.
140       * @return the minimum total integration time for this product.
141       */
142      public TimeDuration getMinimumTotalIntegrationTime();
143    }