C# Class LitDev.LDUnits

Afficher le fichier Open project: litdev1/LitDev

Méthodes publiques

Méthode Description
AddBaseUnit ( Primitive dimension, Primitive name ) : void

Add a base unit to the system.

AddConstant ( Primitive description, Primitive name, Primitive value ) : void

Add a dimensionless constant to the system.

AddDerivedUnit ( Primitive description, Primitive name, Primitive units, Primitive add ) : void

Add a derived unit to the system.

Convert ( Primitive value, Primitive fromUnit, Primitive toUnit ) : Primitive

Convert a value from one unit to another.

Export ( ) : void

Export the current unit system to a file (units.txt in the current program folder).

GetBaseUnits ( ) : Primitive

Get a list of current base units.

GetConstants ( ) : Primitive

Get a list of current constants.

GetDerivedUnits ( ) : Primitive

Get a list of current derived units.

GetDimensions ( Primitive unit ) : Primitive

Get an array of dimensions for a unit.

GetErrors ( ) : Primitive

Get an array of error messages if a Convert fails or conflicts are found for added units or constants.

GetPrefixes ( ) : Primitive

Get a list of current prefixes.

Import ( ) : void

Import a unit system from a file (units.txt in the current program folder).

Method Details

AddBaseUnit() public static méthode

Add a base unit to the system.
public static AddBaseUnit ( Primitive dimension, Primitive name ) : void
dimension Primitive The base unit dimension (e.g. TEMPERATURE).
name Primitive The unit name (be careful it doesn't confict with existing unit names).
Résultat void

AddConstant() public static méthode

Add a dimensionless constant to the system.
public static AddConstant ( Primitive description, Primitive name, Primitive value ) : void
description Primitive An optional long name or description of the constant.
name Primitive The constant name (be careful it doesn't confict with existing constant names).
value Primitive The derived constant value.
Résultat void

AddDerivedUnit() public static méthode

Add a derived unit to the system.
public static AddDerivedUnit ( Primitive description, Primitive name, Primitive units, Primitive add ) : void
description Primitive An optional long name or description of the derived unit.
name Primitive The unit name (be careful it doesn't confict with existing unit names).
units Primitive The derived unit definition.
add Primitive An optional addition term.
Résultat void

Convert() public static méthode

Convert a value from one unit to another.
public static Convert ( Primitive value, Primitive fromUnit, Primitive toUnit ) : Primitive
value Primitive The value to convert.
fromUnit Primitive The units to convert from.
toUnit Primitive The units to convert to.
Résultat Primitive

Export() public static méthode

Export the current unit system to a file (units.txt in the current program folder).
public static Export ( ) : void
Résultat void

GetBaseUnits() public static méthode

Get a list of current base units.
public static GetBaseUnits ( ) : Primitive
Résultat Primitive

GetConstants() public static méthode

Get a list of current constants.
public static GetConstants ( ) : Primitive
Résultat Primitive

GetDerivedUnits() public static méthode

Get a list of current derived units.
public static GetDerivedUnits ( ) : Primitive
Résultat Primitive

GetDimensions() public static méthode

Get an array of dimensions for a unit.
public static GetDimensions ( Primitive unit ) : Primitive
unit Primitive The unit to get dimensins of.
Résultat Primitive

GetErrors() public static méthode

Get an array of error messages if a Convert fails or conflicts are found for added units or constants.
public static GetErrors ( ) : Primitive
Résultat Primitive

GetPrefixes() public static méthode

Get a list of current prefixes.
public static GetPrefixes ( ) : Primitive
Résultat Primitive

Import() public static méthode

Import a unit system from a file (units.txt in the current program folder).
public static Import ( ) : void
Résultat void