/** * Copyright (c): Uwe Schmidt, FH Wedel * * You may study, modify and distribute this source code * FOR NON-COMMERCIAL PURPOSES ONLY. * This copyright message has to remain unchanged. * * Note that this document is provided 'as is', * WITHOUT WARRANTY of any kind either expressed or implied. */ package ds.util; /** just an example class for comparable elements */ public class P implements Comparable

{ public final int prio; public P(int p) { prio = p; } // smart constructor public static P mkP(int v) { return new P(v); } public int compareTo(P p2) { if (prio == p2.prio) return 0; if (prio > p2.prio) return 1; else return -1; } public boolean equalTo(P p2) { return compareTo(p2) == 0; } public String toString() { return "" + prio; } }