All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gw.util.science.Momentum.gs Maven / Gradle / Ivy

There is a newer version: 1.18.2
Show newest version
package gw.util.science

uses gw.util.Rational
uses java.math.RoundingMode
uses java.math.MathContext

final class Momentum extends AbstractMeasure {
  construct( value : Rational, unit: MomentumUnit, displayUnit: MomentumUnit ) {
    super( value, unit, displayUnit, MomentumUnit.BASE )
  }
  construct( value : Rational, unit: MomentumUnit ) {
    this( value, unit, unit )
  }
 
  function multiply( v: Velocity ) : Energy {
    return new Energy( toBaseNumber() * v.toBaseNumber(), EnergyUnit.BASE, Unit * v.Unit )
  }
  
  function divide( mass: Mass ) : Velocity {
    return new Velocity( toBaseNumber() / mass.toBaseNumber(), VelocityUnit.BASE, Unit.VelocityUnit )
  }
  function divide( v: Velocity ) : Mass {
    return new Mass( toBaseNumber() / v.toBaseNumber(), MassUnit.BASE, Unit.MassUnit )
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy