gw.util.science.AbstractQuotientUnit.gs Maven / Gradle / Ivy
package gw.util.science
uses gw.util.Rational
abstract class AbstractQuotientUnit,
B extends IUnit,
D extends IDimension,
U extends AbstractQuotientUnit> extends AbstractBinaryUnit {
protected construct( leftUnit: A, rightUnit: B, factor: Rational = null, name: String = null, symbol: String = null ) {
super( leftUnit, rightUnit, factor, name, symbol )
}
override property get UnitName() : String {
return super.UnitName == null
? LeftUnit.UnitName + "/" + RightUnit.UnitName
: super.UnitName
}
override property get UnitSymbol() : String {
return super.UnitSymbol == null
? LeftUnit.UnitSymbol + "/" + RightUnit.UnitSymbol
: super.UnitSymbol
}
override property get FullName() : String {
return LeftUnit.FullName + "/" + RightUnit.FullName
}
override property get FullSymbol() : String {
return LeftUnit.FullSymbol + "/" + RightUnit.FullSymbol
}
override function toBaseUnits( myUnits: Rational ) : Rational {
return (LeftUnit.toBaseUnits( 1 ) / RightUnit.toBaseUnits( 1 )) * myUnits * Factor
}
override function toNumber() : Rational {
return LeftUnit.toNumber() / RightUnit.toNumber()
}
function multiply( a: B ) : A {
return LeftUnit
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy