/** * Returns a tooltip showing the distribution of priorities for this container. * * @return a tooltip showing the distribution of priorities */ public String getToolTip() { StringBuilder message = new StringBuilder(); String separator = " - "; for (Priority priority : Priority.values()) { if (hasAnnotations(priority)) { message.append(priority.getLocalizedString()); message.append(":"); message.append(getNumberOfAnnotations(priority)); message.append(separator); } } return StringUtils.removeEnd(message.toString(), separator); }
/** Initializes the transient mappings. */ private void initialize() { annotationsByPriority = new EnumMap<Priority, Set<FileAnnotation>>(Priority.class); for (Priority priority : Priority.values()) { annotationsByPriority.put(priority, new HashSet<FileAnnotation>()); } annotationsByCategory = new HashMap<String, Set<FileAnnotation>>(); annotationsByType = new HashMap<String, Set<FileAnnotation>>(); filesByName = new HashMap<String, WorkspaceFile>(); packagesByName = new HashMap<String, JavaPackage>(); modulesByName = new HashMap<String, MavenModule>(); filesByHashCode = new HashMap<Integer, WorkspaceFile>(); packagesByHashCode = new HashMap<Integer, JavaPackage>(); modulesByHashCode = new HashMap<Integer, MavenModule>(); categoriesByHashCode = new HashMap<Integer, Set<FileAnnotation>>(); typesByHashCode = new HashMap<Integer, Set<FileAnnotation>>(); }
public QOSRule(String rule) throws DataFormatException { final int NUMBER_OF_FIELDS = 11; if (rule.contains(">")) throw new DataFormatException("rule cannot contain '>' delimiter."); String[] fields = rule.split("<"); if (fields.length != NUMBER_OF_FIELDS) throw new DataFormatException( "rule does not have " + NUMBER_OF_FIELDS + " fields, it has " + fields.length); try { _addressType = AddressType.values()[Integer.parseInt(fields[0])]; _address = fields[1]; _protocol = Integer.parseInt(fields[2]); _portType = PortType.valueOf(fields[3]); _port = fields[4]; _string1 = fields[5]; _string2 = fields[6]; _string3 = fields[7]; _string4 = fields[8]; _priority = Priority.values()[Integer.parseInt(fields[9]) + 1]; _comment = fields[10]; } catch (NumberFormatException ex) { throw new DataFormatException("A number was incorrectly formatted: " + ex.getMessage()); } }
/** * Returns the priority of the request, if it was changed. * * @return The new priority of the request, or {@link Priority#unknown} if the priority was not * changed */ public Priority getPriority() { return Priority.values()[ FcpUtils.safeParseInt(getField("PriorityClass"), Priority.unknown.ordinal())]; }
@Factory("priorities") public Priority[] getPriorities() { return Priority.values(); }