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

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

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

interface IUnit, 
                U extends IUnit> extends IDimension {  
  
  property get UnitName() : String
  property get UnitSymbol() : String
  function toBaseUnits( theseUnits: B ) : B
  function from( dim: D ) : B
  
  property get FullName() : String {
    return UnitName
  }

  property get FullSymbol() : String {
    return UnitSymbol 
  }

  // implements IPostfixBinder
  function postfixBind( amount: Number ) : D {
    return new D( amount, this )
  }
    
  override function fromNumber( n: B ) : U {
    return null
  }
  
  override function numberType() : Class {
    return B
  }
  
  override function compareTo( o: U ) : int {
    return toNumber().compareTo( o.toNumber() )
  }
}