compareTo method
Compares this {@link PrecisionModel} object with the specified object for order. A PrecisionModel is greater than another if it provides greater precision. The comparison is based on the value returned by the {@link #getMaximumSignificantDigits} method. This comparison is not strictly accurate when comparing floating precision models to fixed models; however, it is correct when both models are either floating or fixed.
@param o the PrecisionModel
with which this PrecisionModel
is being compared
@return a negative integer, zero, or a positive integer as this PrecisionModel
is less than, equal to, or greater than the specified PrecisionModel
Implementation
int compareTo(dynamic o) {
PrecisionModel other = o;
int sigDigits = getMaximumSignificantDigits();
int otherSigDigits = other.getMaximumSignificantDigits();
return sigDigits.compareTo(otherSigDigits);
// if (sigDigits > otherSigDigits)
// return 1;
// else if
// if (modelType == FLOATING && other.modelType == FLOATING) return 0;
// if (modelType == FLOATING && other.modelType != FLOATING) return 1;
// if (modelType != FLOATING && other.modelType == FLOATING) return -1;
// if (modelType == FIXED && other.modelType == FIXED) {
// if (scale > other.scale)
// return 1;
// else if (scale < other.scale)
// return -1;
// else
// return 0;
// }
// Assert.shouldNeverReachHere("Unknown Precision Model type encountered");
// return 0;
}