@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public Comparable getMax() {
Comparable maxValue = null;
MaxConstraint maxConstraint = (MaxConstraint)appliedConstraints.get(MAX_CONSTRAINT);
RangeConstraint rangeConstraint = (RangeConstraint)appliedConstraints.get(RANGE_CONSTRAINT);
if (maxConstraint != null || rangeConstraint != null) {
Comparable maxConstraintValue = maxConstraint == null ? null : maxConstraint.getMaxValue();
Comparable rangeConstraintHighValue = rangeConstraint == null ? null : rangeConstraint.getRange().getTo();
if (maxConstraintValue != null && rangeConstraintHighValue != null) {
maxValue = (maxConstraintValue.compareTo(rangeConstraintHighValue) < 0) ? maxConstraintValue : rangeConstraintHighValue;
}