Class PhysicalUnitDescription
Represents data associated with physical units known and processed by the system.
Inheritance
Inherited Members
Namespace: Sdl.LanguagePlatform.Core.Tokenization
Assembly: Sdl.LanguagePlatform.Core.dll
Syntax
public class PhysicalUnitDescription
Constructors
PhysicalUnitDescription()
For XML (de)serialization only
Declaration
public PhysicalUnitDescription()
PhysicalUnitDescription(PhysicalUnitDescription)
Initializes a new instance, using the values of another instance, creating a deep copy.
Declaration
public PhysicalUnitDescription(PhysicalUnitDescription other)
Parameters
Type | Name | Description |
---|---|---|
PhysicalUnitDescription | other | The instance to copy |
PhysicalUnitDescription(Unit, UnitType, UnitSystem, Boolean, Int32, Double, Unit, String, String)
Initializes a new instance with the provided values.
Declaration
public PhysicalUnitDescription(Unit u, UnitType ut, UnitSystem us, bool isCanonical, int magnitude, double conversionFactor, Unit conversionUnit, string name, string abbreviation)
Parameters
Type | Name | Description |
---|---|---|
Unit | u | The unit |
UnitType | ut | The unit type |
UnitSystem | us | The unit system |
System.Boolean | isCanonical | A flag indicating whether this unit is canonical for the specified unit type (i.e. is the base for conversions) |
System.Int32 | magnitude | The magnitude level of this unit |
System.Double | conversionFactor | The conversion factor to the conversion unit |
Unit | conversionUnit | The unit to use for conversions |
System.String | name | The name of the unit |
System.String | abbreviation | The abbreviations of this unit, separated by a vertical bar |
PhysicalUnitDescription(Unit, UnitType, UnitSystem, Boolean, Int32, Double, Unit, String, String, String)
Initializes a new instance with the provided values.
Declaration
public PhysicalUnitDescription(Unit u, UnitType ut, UnitSystem us, bool isCanonical, int magnitude, double conversionFactor, Unit conversionUnit, string name, string abbreviation, string preferredAbbreviation)
Parameters
Type | Name | Description |
---|---|---|
Unit | u | The unit |
UnitType | ut | The unit type |
UnitSystem | us | The unit system |
System.Boolean | isCanonical | A flag indicating whether this unit is canonical for the specified unit type (i.e. is the base for conversions) |
System.Int32 | magnitude | The magnitude level of this unit |
System.Double | conversionFactor | The conversion factor to the conversion unit |
Unit | conversionUnit | The unit to use for conversions |
System.String | name | The name of the unit |
System.String | abbreviation | The abbreviations of this unit, separated by a vertical bar |
System.String | preferredAbbreviation | The preferred abbreviation (optional) |
Properties
Abbreviations
Gets or sets the standard (culture-independent) abbreviations of this unit, separated by a vertical bar.
Declaration
public string Abbreviations { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Category
Declaration
public string Category { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ConversionFactor
Gets or sets the conversion factor to apply when converting to the ConversionUnit
Declaration
public double ConversionFactor { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
ConversionUnit
Gets or sets the conversion unit to use when converting across unit systems
Declaration
public Unit ConversionUnit { get; set; }
Property Value
Type | Description |
---|---|
Unit |
CultureSpecificAbbreviations
Gets or sets a list of culture-specific abbreviations for this unit, in the form of pairs where the first part is a culture code, and the second is the list of abbreviations.
Declaration
public List<Pair<string>> CultureSpecificAbbreviations { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<Pair<System.String>> |
IsCanonical
Gets or sets a flag which indicates whether this unit is the canonical unit in the current unit type and system
Declaration
public bool IsCanonical { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Magnitude
Gets or sets the magnitude of this unit, in comparison to other units of the same type and system.
Declaration
public int Magnitude { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Name
Gets or sets the name of the unit
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Unit
Gets or sets the unit
Declaration
public Unit Unit { get; set; }
Property Value
Type | Description |
---|---|
Unit |
UnitSystem
Gets or sets the unit system
Declaration
public UnitSystem UnitSystem { get; set; }
Property Value
Type | Description |
---|---|
UnitSystem |
UnitType
Gets or sets the unit type
Declaration
public UnitType UnitType { get; set; }
Property Value
Type | Description |
---|---|
UnitType |
Methods
GetCultureSpecificAbbreviations(CultureInfo)
Obtains the culture-specific abbreviations for this unit, separated by a vertical bar.
Declaration
public string GetCultureSpecificAbbreviations(CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | culture | The culture to obtain the abbreviations for |
Returns
Type | Description |
---|---|
System.String | The culture-specific unit abbreviations, or |
GetPreferredAbbreviation(CultureInfo)
Declaration
public string GetPreferredAbbreviation(CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | culture |
Returns
Type | Description |
---|---|
System.String |
HasAbbreviation(String)
Computes a value indicating whether the specified abbreviation is a known abbreviation for this unit.
Declaration
public bool HasAbbreviation(string abbr)
Parameters
Type | Name | Description |
---|---|---|
System.String | abbr | A unit abbreviation |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the specified abbreviation is a known abbreviation for this unit. |
HasAbbreviation(String, CultureInfo)
Computes a value indicating whether the specified abbreviation is a known abbreviation for this unit.
Declaration
public bool HasAbbreviation(string abbr, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
System.String | abbr | A unit abbreviation |
System.Globalization.CultureInfo | culture | If specified, the culture-specific abbreviations for the unit will be checked in addition to the default abbreviations. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the specified abbreviation is a known abbreviation for this unit. |