C# Класс LitDev.LDUnits

Показать файл Открыть проект

Открытые методы

Метод Описание
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).

Описание методов

AddBaseUnit() публичный статический Метод

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).
Результат void

AddConstant() публичный статический Метод

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.
Результат void

AddDerivedUnit() публичный статический Метод

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.
Результат void

Convert() публичный статический Метод

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.
Результат Primitive

Export() публичный статический Метод

Export the current unit system to a file (units.txt in the current program folder).
public static Export ( ) : void
Результат void

GetBaseUnits() публичный статический Метод

Get a list of current base units.
public static GetBaseUnits ( ) : Primitive
Результат Primitive

GetConstants() публичный статический Метод

Get a list of current constants.
public static GetConstants ( ) : Primitive
Результат Primitive

GetDerivedUnits() публичный статический Метод

Get a list of current derived units.
public static GetDerivedUnits ( ) : Primitive
Результат Primitive

GetDimensions() публичный статический Метод

Get an array of dimensions for a unit.
public static GetDimensions ( Primitive unit ) : Primitive
unit Primitive The unit to get dimensins of.
Результат Primitive

GetErrors() публичный статический Метод

Get an array of error messages if a Convert fails or conflicts are found for added units or constants.
public static GetErrors ( ) : Primitive
Результат Primitive

GetPrefixes() публичный статический Метод

Get a list of current prefixes.
public static GetPrefixes ( ) : Primitive
Результат Primitive

Import() публичный статический Метод

Import a unit system from a file (units.txt in the current program folder).
public static Import ( ) : void
Результат void