01: /**
02:    This class encapsulates a work order with a priority.
03: */
04: public class WorkOrder implements Comparable
05: {
06:    /**
07:       Constructs a work order with a given priority and description.
08:       @param aPriority the priority of this work order
09:       @param aDescription the description of this work order
10:    */
11:    public WorkOrder(int aPriority, String aDescription)
12:    {
13:       priority = aPriority;
14:       description = aDescription;
15:    }
16: 
17:    public String toString()
18:    {
19:       return "priority=" + priority + ", description=" + description;
20:    }
21: 
22:    public int compareTo(Object otherObject)
23:    {
24:       WorkOrder other = (WorkOrder) otherObject;
25:       if (priority < other.priority) return -1;
26:       if (priority > other.priority) return 1;
27:       return 0;
28:    }
29: 
30:    private int priority;
31:    private String description;
32: }