C# Class YAMP.Physics.CombinedUnit

Used to represent combined units -- temporary and defined.
Inheritance: PhysicalUnit
Afficher le fichier Open project: FlorianRappl/YAMP Class Usage Examples

Méthodes publiques

Méthode Description
CombinedUnit ( String unit ) : System
ConvertTo ( String unit ) : Double>>.List

Tries to convert the unit to the given unit.

CreateFrom ( String unit ) : CombinedUnit
Divide ( CombinedUnit unit ) : CombinedUnit

Divides the given combined unit by another unit.

Divide ( String unit ) : CombinedUnit

Divides the given combined unit by the string representation of another unit.

Multiply ( CombinedUnit unit ) : CombinedUnit

Multiplies the given combined unit with another combined unit.

Multiply ( String unit ) : CombinedUnit

Multiplies the given combined unit with the string representation of another unit.

Raise ( Double pwr ) : CombinedUnit

Raises the current unit to the specified power, i.e. kg*s --> raised to 2 is kg^2 * s^2.

Simplify ( ) : CombinedUnit

Tries to simplify the current expression by considering combined types.

Sqrt ( ) : CombinedUnit

Takes the square root of the current unit, i.e. raises it to the power 1/2.

ToString ( ) : String
Unpack ( ) : String

Unpacks the given units, i.e. returns the representation of the unit in elementary units.

Méthodes protégées

Méthode Description
CombinedUnit ( String combination, Double factor ) : System
Create ( ) : PhysicalUnit
IsNumber ( char ch ) : bool
IsWhiteSpace ( char ch ) : bool

Private Methods

Méthode Description
AddUnit ( Double>.Dictionary units, String unit, Double exp ) : void
ConvertToDouble ( String s ) : Double
ConvertToInteger ( string s ) : int
Count ( Token token, Token tokens ) : Int32
EatWhile ( Token token, Token tokens, String text, Int32 start ) : String
FindMapping ( String source, Double>.Dictionary target, Int32 sign, Double>.List list ) : String
GetChanges ( CombinedUnit unit, System.Boolean &reversed ) : Double
GetToken ( char ch ) : Token
Parse ( String unit ) : Double>.Dictionary
Parse ( String unit, Double>.Dictionary units ) : void

Method Details

CombinedUnit() public méthode

public CombinedUnit ( String unit ) : System
unit String
Résultat System

CombinedUnit() protected méthode

protected CombinedUnit ( String combination, Double factor ) : System
combination String
factor Double
Résultat System

ConvertTo() public méthode

Tries to convert the unit to the given unit.
public ConvertTo ( String unit ) : Double>>.List
unit String The unit (combination) to convert to.
Résultat Double>>.List

Create() protected méthode

protected Create ( ) : PhysicalUnit
Résultat PhysicalUnit

CreateFrom() public méthode

public CreateFrom ( String unit ) : CombinedUnit
unit String
Résultat CombinedUnit

Divide() public méthode

Divides the given combined unit by another unit.
public Divide ( CombinedUnit unit ) : CombinedUnit
unit CombinedUnit The combined unit to divide the current unit.
Résultat CombinedUnit

Divide() public méthode

Divides the given combined unit by the string representation of another unit.
public Divide ( String unit ) : CombinedUnit
unit String The combined unit to divide the current unit.
Résultat CombinedUnit

IsNumber() protected méthode

protected IsNumber ( char ch ) : bool
ch char
Résultat bool

IsWhiteSpace() protected méthode

protected IsWhiteSpace ( char ch ) : bool
ch char
Résultat bool

Multiply() public méthode

Multiplies the given combined unit with another combined unit.
public Multiply ( CombinedUnit unit ) : CombinedUnit
unit CombinedUnit The combined unit which is multiplied to the current unit.
Résultat CombinedUnit

Multiply() public méthode

Multiplies the given combined unit with the string representation of another unit.
public Multiply ( String unit ) : CombinedUnit
unit String The unit to multiply the current unit with.
Résultat CombinedUnit

Raise() public méthode

Raises the current unit to the specified power, i.e. kg*s --> raised to 2 is kg^2 * s^2.
public Raise ( Double pwr ) : CombinedUnit
pwr Double The power to raise the unit with.
Résultat CombinedUnit

Simplify() public méthode

Tries to simplify the current expression by considering combined types.
public Simplify ( ) : CombinedUnit
Résultat CombinedUnit

Sqrt() public méthode

Takes the square root of the current unit, i.e. raises it to the power 1/2.
public Sqrt ( ) : CombinedUnit
Résultat CombinedUnit

ToString() public méthode

public ToString ( ) : String
Résultat String

Unpack() public méthode

Unpacks the given units, i.e. returns the representation of the unit in elementary units.
public Unpack ( ) : String
Résultat String