public static ScaleFactor UseIfValid(int numerator, int denominator, ScaleFactor lastResort) { if (numerator <= 0 || denominator <= 0) { return lastResort; } else { return new ScaleFactor(numerator, denominator); } }
public static ScaleFactor Min(int n1, int d1, int n2, int d2, ScaleFactor lastResort) { ScaleFactor a = UseIfValid(n1, d1, lastResort); ScaleFactor b = UseIfValid(n2, d2, lastResort); return ScaleFactor.Min(a, b); }
public static ScaleFactor Min(ScaleFactor lhs, ScaleFactor rhs) { if (lhs < rhs) { return lhs; } else { return rhs; } }
public static ScaleFactor Max(ScaleFactor lhs, ScaleFactor rhs) { if (lhs > rhs) { return lhs; } else { return lhs; } }