public static <T extends Comparable<? super T>> T max(T c1, T c2){ return isGreater(c1, c2) ? c1 : c2; }
public static <T> T max(T o1, T o2, Comparator<? super T> comparator){ return isGreater(o1, o2, comparator) ? o1 : o2; }
/** * Sets the minimum value. * It must be an instance of Number or null. * It mustn't be bigger than the maximum value. * It ensures that the minimum value is in the range of the maximum * maximum value and the minimum minimum value. * @param minimum the minimum number value */ @Override public void setMinimum(Comparable minimum) { if (minimum != null && ! (minimum instanceof Number)){ throw new IllegalArgumentException("minimum must be an instance of Number or null"); } if (minimum != null && getMaximum() != null && Comparables.isGreater(minimum, getMaximum())){ throw new IllegalArgumentException("minimum mustn't be bigger than max!"); } // if (minimum.compareTo(getMinimumMinimumValue()) < 0){ // throw new IllegalArgumentException("minimum mustn't be smaller than the minimum minimum value!"); // } super.setMinimum((Comparable) minimumToRange((Number) minimum)); }
/** * Sets the minimum value. * It must be an instance of Number or null. * It mustn't be bigger than the maximum value. * It ensures that the minimum value is in the range of the maximum * maximum value and the minimum minimum value. * @param minimum the minimum number value */ @Override public void setMinimum(Comparable minimum) { if (minimum != null && ! (minimum instanceof Number)){ throw new IllegalArgumentException("minimum must be an instance of Number or null"); } if (minimum != null && getMaximum() != null && Comparables.isGreater(minimum, getMaximum())){ throw new IllegalArgumentException("minimum mustn't be bigger than max!"); } // if (minimum.compareTo(getMinimumMinimumValue()) < 0){ // throw new IllegalArgumentException("minimum mustn't be smaller than the minimum minimum value!"); // } super.setMinimum((Comparable) minimumToRange((Number) minimum)); }