/** * 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 E implements Comparable { private int value; private E(int v) { value = v; } public int compareTo(E e2) { if (value == e2.value) return 0; if (value > e2.value) return 1; else return -1; } public boolean equalTo(E e2) { return compareTo(e2) == 0; } public String toString() { return "" + value; } // smart constructor public static E mkE(int v) { return new E(v); } }