/** * Upgrades the priority of this object to the given priority. * * @param newPriority the new priority * @throws IllegalArgumentException the given priority is less important than the current priority */ public void upgradePriority(Priority newPriority) throws IllegalArgumentException { if (newPriority.numericalValue < priority.numericalValue) { throw new IllegalArgumentException( "Cannot upgrade to a less important priority (" + newPriority.toString() + "; current priority is: " + priority.toString() + ")."); } priority = newPriority; }