001    package edu.nrao.sss.model.project;
002    
003    import edu.nrao.sss.util.EnumerationUtility;
004    
005    /**
006     * Signals that indicate when a service calibration should occur
007     * in relation to a {@link SchedulingBlock}.
008     * <p>
009     * <b>CVS Info:</b>
010     * <table style="margin-left:2em">
011     *   <tr><td>$Revision: 161 $</td></tr>
012     *   <tr><td>$Date: 2006-12-15 11:48:34 -0700 (Fri, 15 Dec 2006) $</td></tr>
013     *   <tr><td>$Author: btruitt $</td></tr>
014     * </table></p>
015     * 
016     * @author David M. Harland
017     * @since 2006-12-12
018     */
019    public enum ServiceCalibrationTiming
020    {
021      /**
022       * Indicates that a service calibration should be peformed <i>before</i>
023       * a scheduling block is executed.
024       */
025      BEFORE_SCHEDULING_BLOCK,
026      
027      /**
028       * Indicates that a service calibration should be peformed <i>after</i>
029       * a scheduling block is executed.
030       */
031      AFTER_SCHEDULING_BLOCK,
032      
033      /**
034       * Indicates that it is permissible to run the service calibration
035       * <i>either</i> before <i>or</i> after a scheduling block is executed.
036       */
037      EITHER_BEFORE_OR_AFTER_SCHEDULING_BLOCK;
038      
039      /**
040       * Returns a default service calibration timing.
041       * @return a default service calibration timing.
042       */
043      public static ServiceCalibrationTiming getDefault()
044      {
045        return EITHER_BEFORE_OR_AFTER_SCHEDULING_BLOCK;
046      }
047      
048      /**
049       * Returns a text representation of this enumeration constant.
050       * @return a text representation of this enumeration constant.
051       */
052      public String toString()
053      {
054        return EnumerationUtility.getSharedInstance().enumToString(this);
055      }
056      
057      /**
058       * Returns the service calibration timing represented by {@code text}.
059       * <p>
060       * For details about the transformation, see
061       * {@link EnumerationUtility#enumFromString(Class, String)}.</p>
062       * 
063       * @param text a text representation of a service calibration timing.
064       * 
065       * @return the service calibration timing represented by {@code text}.
066       */
067      public static ServiceCalibrationTiming fromString(String text)
068      {
069        return EnumerationUtility.getSharedInstance()
070                                 .enumFromString(ServiceCalibrationTiming.class,
071                                                 text);
072      }
073    }