static public <E extends Comparable<E>> E max(E e1, E e2) { return minmax(e1, e2).min(); }
public int compareTo(SinglePath other) { // comparison //MinMax<Integer> pathLengthMinMax = Algorithm.minmax(this.size(), other.size()); // define the order so that absolute paths are less then the relative path int cmp = Algorithm.boolToInt(!this.isAbsolutePath()) - Algorithm.boolToInt(!other.isAbsolutePath()); if (cmp != 0) return cmp; // lexicographical order cmp = Algorithm.lexicographicalCompare(this.getPath(), other.getPath()); return cmp; }
public int compareTo(InvertedPath other) { return Algorithm.lexicographicalCompare(this.getPath(), other.getPath()); }
static public <E extends Comparable<E>> E min(E e1, E e2) { return minmax(e1, e2).min(); }
/** * compare * * @param other * @return */ public int compareTo(ECN other) { MinMax<Integer> minmax = Algorithm.minmax(this.size(), other.size()); for (int i = 0; i < minmax.min(); ++i) { int cmp = val.get(i) - other.get(i); if (cmp != 0) return cmp; } ECN largerECN = this.size() > other.size() ? this : other; for (int i = minmax.min(); i < minmax.max(); ++i) { int cmp = largerECN.get(i); if (cmp != 0) return cmp; } return 0; }