concatenate method
Concatenates this converter with another converter.
The resulting converter is equivalent to first converting by the specified converter, and then converting by this converter.
Implementation
@override
UnitConverter concatenate(UnitConverter converter) {
if (converter is RationalConverter) {
var that = converter;
var dividendLong = factor.dividend * that.factor.dividend;
var divisorLong = factor.divisor * that.factor.divisor;
var gcd = _gcd(dividendLong, divisorLong);
return RationalConverter._valueOf(
dividendLong ~/ gcd, divisorLong ~/ gcd);
} else if (converter is MultiplyConverter) {
return converter.concatenate(this);
} else {
return super.concatenate(converter);
}
}