Interface Cmp<T>

All Superinterfaces:
Comparable<Cmp<T>>
All Known Implementing Classes:
CmpFactory.CmpMax, CmpFactory.CmpMin, CmpFactory.CmpValue

public interface Cmp<T> extends Comparable<Cmp<T>>
Interface for abstracting comparison of values. Only one of the methods isMin(), isMax(), or hasValue() may return true on any instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the value of this cmp.
    boolean
    Whether this cmp instance carries a value.
    boolean
    Whether this cmp instance is the maximum.
    boolean
    Whether this cmp instance is the minimum.

    Methods inherited from interface java.lang.Comparable

    compareTo
  • Method Details

    • isMin

      boolean isMin()
      Whether this cmp instance is the minimum. compareTo(min, x) returns 0 iff x is min and -1 otherwise
    • isMax

      boolean isMax()
      Whether this cmp instance is the maximum. compareTo(max, x) returns 0 iff x is ax and 1 otherwise
    • hasValue

      boolean hasValue()
      Whether this cmp instance carries a value.
    • getValue

      T getValue()
      Get the value of this cmp. Raises an exception if there is no value.