1 11 package org.eclipse.ui.navigator; 12 13 20 public final class Priority { 21 22 25 public static final int HIGHEST_PRIORITY_VALUE = 0; 26 27 30 public static final int HIGHER_PRIORITY_VALUE = 1; 31 32 35 public static final int HIGH_PRIORITY_VALUE = 2; 36 37 40 public static final int NORMAL_PRIORITY_VALUE = 3; 41 42 45 public static final int LOW_PRIORITY_VALUE = 4; 46 47 50 public static final int LOWER_PRIORITY_VALUE = 5; 51 52 55 public static final int LOWEST_PRIORITY_VALUE = 6; 56 57 60 public static final String HIGHEST_PRIORITY_LITERAL = "highest"; 62 65 public static final String HIGHER_PRIORITY_LITERAL = "higher"; 67 70 public static final String HIGH_PRIORITY_LITERAL = "high"; 72 75 public static final String NORMAL_PRIORITY_LITERAL = "normal"; 77 80 public static final String LOW_PRIORITY_LITERAL = "low"; 82 85 public static final String LOWER_PRIORITY_LITERAL = "lower"; 87 90 public static final String LOWEST_PRIORITY_LITERAL = "lowest"; 92 95 public static final Priority HIGHEST = new Priority(HIGHEST_PRIORITY_VALUE, 96 HIGHEST_PRIORITY_LITERAL); 97 98 101 public static final Priority HIGHER = new Priority(HIGHER_PRIORITY_VALUE, 102 HIGHER_PRIORITY_LITERAL); 103 104 107 public static final Priority HIGH = new Priority(HIGH_PRIORITY_VALUE, 108 HIGH_PRIORITY_LITERAL); 109 110 113 public static final Priority NORMAL = new Priority(NORMAL_PRIORITY_VALUE, 114 NORMAL_PRIORITY_LITERAL); 115 116 119 public static final Priority LOW = new Priority(LOW_PRIORITY_VALUE, 120 LOW_PRIORITY_LITERAL); 121 122 125 public static final Priority LOWER = new Priority(LOWER_PRIORITY_VALUE, 126 LOWER_PRIORITY_LITERAL); 127 128 131 public static final Priority LOWEST = new Priority(LOWEST_PRIORITY_VALUE, 132 LOWEST_PRIORITY_LITERAL); 133 134 138 public static final Priority[] ENUM_ARRAY = new Priority[] { HIGHEST, 139 HIGHER, HIGH, NORMAL, LOW, LOWER, LOWEST }; 140 141 154 public static Priority get(String aLiteral) { 155 for (int i = 0; i < ENUM_ARRAY.length; i++) { 156 if (ENUM_ARRAY[i].getLiteral().equals(aLiteral)) { 157 return ENUM_ARRAY[i]; 158 } 159 } 160 return NORMAL; 161 } 162 163 176 public static Priority get(int aValue) { 177 178 switch (aValue) { 179 case HIGHEST_PRIORITY_VALUE: 180 return HIGHEST; 181 case HIGHER_PRIORITY_VALUE: 182 return HIGHER; 183 case HIGH_PRIORITY_VALUE: 184 return HIGH; 185 case LOWER_PRIORITY_VALUE: 186 return LOWER; 187 case LOWEST_PRIORITY_VALUE: 188 return LOWEST; 189 case NORMAL_PRIORITY_VALUE: 190 default: 191 return NORMAL; 192 } 193 } 194 195 private final int value; 196 197 private final String literal; 198 199 protected Priority(int aValue, String aLiteral) { 200 value = aValue; 201 literal = aLiteral; 202 } 203 204 208 public String getLiteral() { 209 return literal; 210 } 211 212 217 public int getValue() { 218 return value; 219 } 220 221 224 public String toString() { 225 return "Priority ["+getLiteral()+"]"; } 227 } 228 | Popular Tags |