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

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

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

uses gw.util.science.Charge //to prevent conflict with Guidewire's entity.Charge type
uses gw.util.Rational

final class Time extends AbstractMeasure {
  construct( value : Rational, unit: TimeUnit, displayUnit: TimeUnit ) {
    super( value, unit, displayUnit, TimeUnit.Second )
  }
  construct( value : Rational, unit: TimeUnit ) {
    this( value, unit, unit )
  }

  static property get Now() : Time {
    return new( Rational.get( System.nanoTime() ), Nano )
  }

  function multiply( r: Velocity ) : Length {
    return new Length( toBaseNumber() * r.toBaseNumber(), LengthUnit.BASE, r.Unit.LengthUnit )
  }

  function multiply( acc: Acceleration ) : Velocity {
    return new Velocity( toBaseNumber() * acc.toBaseNumber(), VelocityUnit.BASE, acc.Unit.VelocityUnit )
  }

  function multiply( current: Current ) : Charge {
    return new Charge( toBaseNumber() * current.toBaseNumber(), ChargeUnit.BASE, current.Unit.ChargeUnit )
  }

  function multiply( frequency: Frequency ) : Angle {
    return new Angle( toBaseNumber() * frequency.toBaseNumber(), AngleUnit.BASE, frequency.Unit.AngleUnit )
  }

  function multiply( power: Power ) : Energy {
    return new Energy( toBaseNumber() * power.toBaseNumber(), EnergyUnit.BASE, power.Unit.EnergyUnit )
  }

  function multiply( force: Force ) : Momentum {
    return new Momentum( toBaseNumber() * force.toBaseNumber(), MomentumUnit.BASE, Unit * force.Unit )
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy