001    package edu.nrao.sss.model.project.scheduling.priority;
002    
003    import javax.xml.bind.annotation.XmlType;
004    
005    import edu.nrao.sss.util.EnumerationUtility;
006    
007    /**
008    * An enumeration of priority types.
009    * <p>
010    * The list of priority types is based on an email from
011    * Barry Clark.</p>
012    * <p>
013    */
014    @XmlType
015    public enum PriorityType {
016            
017            /**
018             * Barry puts this one in because he considers it to be a more
019             * fine grained than the PSC rating, even though they both tend
020             * to be similar.  He uses it as a tie-breaker.  Not as important
021             * for the VLA as for the VLBA because the VLBA has more large
022             * blocks.  This means that for the VLBA things close in priority
023             * can ge many days apart.  Tie-breaking may be more important 
024             * when more emphasis is placed on large projects?????
025             */
026            
027            MEAN_REFEREE_PRIORITY ( "The mean referee rating."),
028    
029            /**
030             * This usually follows the refreee ratings pretty well.  Barry
031             * considers this one as more course grained than the referee
032             * rating.
033             */
034    
035            PROPOSAL_SELECTION_COMMITTEE_PRIORITY( "The mean proposal selection committee rating." ),
036    
037            /**
038             * Barry uses this to put a weighting in to favor longer blocks
039             * slightly more than shorter blocks.  He automatically assigns
040             * it half the logarithm of the length of the SB.  Idea from ALMA
041             * is that the project manager, whose job is to keep an eye on the
042             * various SBs of the project, would condense his ruminations into
043             * a single number.
044             */
045    
046            CMP_SOFTWARE_PRIORITY( "A software rating that can be used to favor particular types of scheduling blocks." ),
047    
048    
049            /**
050             * Reserved for the scheduler to type in a number if he knows
051             * something the software doesn't about the urgency of getting the
052             * scheduling block done.  Barry uses this about once a year on the
053             * VLBA, but has not yet used it on the VLA.
054             */
055            SP_SCHEDULER_PRIORITY( "Used by the scheduler to reflect a particular urgency in completing the execution of a scheduling block." ),
056            
057            /**
058             * A relative priority withen the project that indicates the importance
059             * of the scheduling block compared to other scheduling blocks in the project.
060             */
061            PROJECT_PRIORITY( "A priority that can be adjusted by the astronomer to reflect the relative importance of a scheduling block compared to other scheduling blocks in the project." );
062    
063            private PriorityType( String description ){
064                    this.description = description;
065            }
066            
067            private String description = null;
068            
069            public String getDescription(){
070                    return description;
071            }
072            
073            /**
074             * Returns a default priority type.
075             * @return a default priority type.
076             */
077            
078            public static PriorityType getDefault(){
079                    return MEAN_REFEREE_PRIORITY;
080            }
081    
082            
083            /**
084             * Returns a text representation of this enumeration constant.
085             * @return a text representation of this enumeration constant.
086             */
087            
088            public String toString(){
089                    return EnumerationUtility.getSharedInstance().enumToString(this);
090            }
091    
092            /**
093             * Returns the priority type represented by {@code text}.
094             * <p>
095             * For details about the transformation, see
096             * {@link EnumerationUtility#enumFromString(Class, String)}.</p>
097             * 
098             * @param text a text representation of a priority type.
099             * 
100             * @return the priority type represented by {@code text}.
101             */
102            
103            public static PriorityType fromString(String text){
104                    return EnumerationUtility.getSharedInstance()
105                               .enumFromString(PriorityType.class, text);
106            }
107    }