public class MinPQElement extends PQElement {

    public MinPQElement(Object o, int p) {
	super(o,p);
    }

    // let smaller value mean MORE priority:
    // return (this.p - o.p)
    // so, return neg means this.p > o.p -> o.p - this.p < 0
    //     return pos means this.p < o.p -> o.p - this.p > 0
    public int compareTo(Object o) {
        if (o instanceof MinPQElement)
            return (((MinPQElement)o).getPriority() - getPriority());
        else { 
            System.out.println("Cannot compare elements!");
            return 0;
        }
    }
}
