001    package edu.nrao.sss.model.project;
002    
003    import javax.xml.bind.annotation.XmlType;
004    
005    import edu.nrao.sss.util.EnumerationUtility;
006    
007    /**
008     * An enumeration of scheduling types.
009     * <p>
010     * This list is based on Bryan Butler's schedBlock_v2.xsd file
011     * from March 2006.
012     * It was then modified based on an email reply from
013     * B.Clark to D.Harland on 2008-01-10 regarding the
014     * overlap between ProjectType and SchedulingType.
015     * </p>
016     * <p>
017     * <b>Version Info:</b>
018     * <table style="margin-left:2em">
019     *   <tr><td>$Revision: 1710 $</td></tr>
020     *   <tr><td>$Date: 2008-11-14 11:54:07 -0700 (Fri, 14 Nov 2008) $</td></tr>
021     *   <tr><td>$Author: dharland $</td></tr>
022     * </table></p>
023     *  
024     * @since 2006-07-28
025     */
026    @XmlType
027    public enum SchedulingType
028    {
029      /**
030       * Used for standard scheduling blocks that may be scheduled dynamically.
031       * The term <i>standard</i> is used to mean that the scheduling block
032       * is not used for {@link #MONITORING monitoring} or for observering
033       * {@link #PERIODIC periodic phenomena}.
034       * <blockquote><i>
035       * Find acceptable time interval. Priority for scheduling is very
036       * low if current time does not lie in this interval. 
037       * </i><br/>-- Barry Clark, from email to D.Harland, 2008-Jan-10 
038       * </blockquote>
039       */
040      DYNAMIC,
041      
042      /**
043       * Used for scheduling blocks that should begin a precise
044       * point in time.
045       */
046      FIXED_DATE,
047      
048      /**
049       * Used for scheduling blocks that are rerun from time to time.
050       * <blockquote><i>
051       * Find requested monitoring interval and time of last observation.
052       * Priority for scheduling is low in the interval between the time
053       * of the last observation and, say, the time of the last observation
054       * +0.8*(monitoring interval). 
055       * </i><br/>-- Barry Clark, from email to D.Harland, 2008-Jan-10 
056       * </blockquote>
057       */
058      MONITORING,
059      
060      /**
061       * Used for scheduling blocks that observe phenomena that occur
062       * on a periodic basis.
063       * <blockquote><i>
064       * Find period, reference time, and requested phase. Priority for
065       * scheduling is very low except when
066       * (current time + 0.5*observation length - reference time)/period - N
067       * is within, say, 0.1 of the requested phase. 
068       * </i><br/>-- Barry Clark, from email to D.Harland, 2008-Jan-10 
069       * </blockquote>
070       */
071      PERIODIC;
072    
073      /**
074       * Returns a default scheduling type.
075       * @return a default scheduling type.
076       */
077      public static SchedulingType getDefault()
078      {
079        return DYNAMIC;
080      }
081      
082      /**
083       * Returns a text representation of this enumeration constant.
084       * @return a text representation of this enumeration constant.
085       */
086      public String toString()
087      {
088        return EnumerationUtility.getSharedInstance().enumToString(this);
089      }
090      
091      /**
092       * Returns the scheduling type represented by {@code text}.
093       * <p>
094       * For details about the transformation, see
095       * {@link EnumerationUtility#enumFromString(Class, String)}.</p>
096       * 
097       * @param text a text representation of a scheduling type.
098       * 
099       * @return the scheduling type represented by {@code text}.
100       */
101      public static SchedulingType fromString(String text)
102      {
103        return EnumerationUtility.getSharedInstance()
104                                 .enumFromString(SchedulingType.class, text);
105      }
106    }