001 package edu.nrao.sss.model.project.scheduling.priority; 002 003 import edu.nrao.sss.util.EnumerationUtility; 004 005 /** 006 * Methods for combining priorities to obtain a single number 007 * representing the overall priority. 008 * @author slovelan 009 */ 010 011 public enum PriorityMeasureType { 012 013 014 /** 015 * Calculates the sum of the priorities multiplied by their weights 016 * and divides by the total weight of all the priorities. 017 */ 018 019 WEIGHTED_SUM_OF_PRIORITIES; 020 021 022 /** 023 * Returns a default priority measure type. 024 * @return a default priority measure type. 025 */ 026 027 public static PriorityMeasureType getDefault(){ 028 return WEIGHTED_SUM_OF_PRIORITIES; 029 } 030 031 032 /** 033 * Returns a text representation of this enumeration constant. 034 * @return a text representation of this enumeration constant. 035 */ 036 037 public String toString(){ 038 return EnumerationUtility.getSharedInstance().enumToString(this); 039 } 040 041 /** 042 * Returns the priority measure type represented by {@code text}. 043 * <p> 044 * For details about the transformation, see 045 * {@link EnumerationUtility#enumFromString(Class, String)}.</p> 046 * 047 * @param text a text representation of a priority measure type. 048 * 049 * @return the priority measure type represented by {@code text}. 050 */ 051 public static PriorityMeasureType fromString(String text){ 052 return EnumerationUtility.getSharedInstance() 053 .enumFromString(PriorityMeasureType.class, text); 054 } 055 056 }