Search Results for

    Show / Hide Table of Contents

    Class MeasureToken

    A Token which represents a measurement, which consists of a numeric value and a unit.

    Inheritance
    System.Object
    SegmentElement
    Token
    NumberToken
    MeasureToken
    Implements
    ILocalizableToken
    Inherited Members
    NumberToken.SetValue(String, String, String, NumberFormatInfo)
    NumberToken.FormatNumber(CultureInfo)
    NumberToken.FormatNumber(NumberFormatInfo)
    NumberToken.Value
    NumberToken.ValueValid
    NumberToken.Sign
    NumberToken.RawSign
    NumberToken.DecimalSeparator
    NumberToken.GroupSeparator
    NumberToken.AlternateGroupSeparator
    NumberToken.AlternateDecimalSeparator
    NumberToken.RawFractionalDigits
    NumberToken.RawDecimalDigits
    Token.SetTokenType(TokenType)
    Token.GetWeakHashCode()
    Token.GetBundleSimilarity(SegmentElement)
    Token.TokenizationContext
    Token.Text
    Token.Span
    Token.Type
    Token.IsWord
    Token.IsPunctuation
    Token.IsWhitespace
    Token.Culture
    System.Object.ToString()
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.Core.Tokenization
    Assembly: Sdl.LanguagePlatform.Core.dll
    Syntax
    public class MeasureToken : NumberToken, ILocalizableToken

    Constructors

    MeasureToken(MeasureToken)

    Initializes a new instance with the values of another instance, creating a deep copy.

    Declaration
    public MeasureToken(MeasureToken other)
    Parameters
    Type Name Description
    MeasureToken other

    The instance to create a copy of

    MeasureToken(String, NumberToken, Unit, String, Char)

    Initializes a new instance with the specified values. This constructor is for internal purposes only and should not be used directly.

    Declaration
    public MeasureToken(string text, NumberToken numericPart, Unit unit, string unitString, char unitSeparator)
    Parameters
    Type Name Description
    System.String text
    NumberToken numericPart
    Unit unit
    System.String unitString
    System.Char unitSeparator

    MeasureToken(String, NumberToken, Unit, String, Char, String)

    Declaration
    public MeasureToken(string text, NumberToken numericPart, Unit unit, string unitString, char unitSeparator, string customCategory)
    Parameters
    Type Name Description
    System.String text
    NumberToken numericPart
    Unit unit
    System.String unitString
    System.Char unitSeparator
    System.String customCategory

    MeasureToken(String, String, String, String, Unit, String, Char, NumberFormatInfo)

    Initializes a new instance with the specified values.

    Declaration
    public MeasureToken(string text, string sign, string decimalPart, string fractionalPart, Unit unit, string unitString, char unitSeparator, NumberFormatInfo format)
    Parameters
    Type Name Description
    System.String text

    The token text to assign to the token

    System.String sign

    The sign of the numeric value

    System.String decimalPart

    The decimal part of the numeric value

    System.String fractionalPart

    The fractional part of the numeric value

    Unit unit

    The unit of the measurement

    System.String unitString

    The textual unit of the measurement

    System.Char unitSeparator

    The unit separator used between the numeric part and the unit

    System.Globalization.NumberFormatInfo format

    The token's culture default number format info, to determine whether primary or alternate separators are used

    Properties

    CustomCategory

    Gets or sets the CustomCategory for this value, if available (see CustomUnitDefinition)

    Declaration
    public string CustomCategory { get; set; }
    Property Value
    Type Description
    System.String

    IsPlaceable

    IsPlaceable. Always true for this class.

    Declaration
    public override bool IsPlaceable { get; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    NumberToken.IsPlaceable

    IsSubstitutable

    IsSubstitutable. Always true for this class.

    Declaration
    public override bool IsSubstitutable { get; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    NumberToken.IsSubstitutable

    IsValid

    Gets a boolean value which indicates whether this measurement is valid. A measurement is valid if either the unit is not the default unit (Unit.NoUnit) or the UnitString is set. In most cases, both are set by the tokenizer.

    Declaration
    public bool IsValid { get; }
    Property Value
    Type Description
    System.Boolean

    Unit

    Gets or sets the unit.

    Declaration
    public Unit Unit { get; set; }
    Property Value
    Type Description
    Unit

    UnitSeparator

    Gets or sets the unit separator.

    Declaration
    public char UnitSeparator { get; set; }
    Property Value
    Type Description
    System.Char

    UnitString

    Gets or sets the unit string, in case the unit is unknown.

    Declaration
    public string UnitString { get; set; }
    Property Value
    Type Description
    System.String

    Methods

    AcceptSegmentElementVisitor(ISegmentElementVisitor)

    Visitor pattern implementation. Calls VisitMeasureToken(MeasureToken).

    Declaration
    public override void AcceptSegmentElementVisitor(ISegmentElementVisitor visitor)
    Parameters
    Type Name Description
    ISegmentElementVisitor visitor

    The visitor instance

    Overrides
    NumberToken.AcceptSegmentElementVisitor(ISegmentElementVisitor)

    Duplicate()

    See Duplicate()

    Declaration
    public override SegmentElement Duplicate()
    Returns
    Type Description
    SegmentElement

    A new instance that is a deep copy of this instance.

    Overrides
    NumberToken.Duplicate()

    Equals(Object)

    System.Object.Equals(object)
    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    NumberToken.Equals(Object)

    GetHashCode()

    System.Object.GetHashCode()
    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    NumberToken.GetHashCode()

    GetSimilarity(SegmentElement)

    Declaration
    public override SegmentElement.Similarity GetSimilarity(SegmentElement other)
    Parameters
    Type Name Description
    SegmentElement other
    Returns
    Type Description
    SegmentElement.Similarity
    Overrides
    NumberToken.GetSimilarity(SegmentElement)

    GetSimilarity(SegmentElement, Boolean)

    GetSimilarity(SegmentElement)
    Declaration
    public override SegmentElement.Similarity GetSimilarity(SegmentElement other, bool allowCompatibility)
    Parameters
    Type Name Description
    SegmentElement other

    The other instance.

    System.Boolean allowCompatibility
    Returns
    Type Description
    SegmentElement.Similarity

    A value indicating the degree of similarity to the provided segment element.

    Overrides
    SegmentElement.GetSimilarity(SegmentElement, Boolean)

    GetTokenType()

    Type
    Declaration
    protected override TokenType GetTokenType()
    Returns
    Type Description
    TokenType
    Overrides
    NumberToken.GetTokenType()

    Localize(CultureInfo, AutoLocalizationSettings)

    Auto-localizes the token according to the settings of the specified target culture and the provided auto-localization settings. The text of the token will be changed, but not the values.

    For some token types, special AutoLocalizationSettings will be used, if provided.

    Declaration
    public override bool Localize(CultureInfo culture, AutoLocalizationSettings autoLocalizationSettings)
    Parameters
    Type Name Description
    System.Globalization.CultureInfo culture

    The target culture

    AutoLocalizationSettings autoLocalizationSettings

    Contains the AutoLocalizationSettings to use for some token types. May be null, in which case default settings will be used.

    Returns
    Type Description
    System.Boolean

    true if the token text has been changed, and false otherwise

    Overrides
    NumberToken.Localize(CultureInfo, AutoLocalizationSettings)

    Localize(CultureInfo, AutoLocalizationSettings, ILocalizableToken, Boolean)

    Auto-localizes the token according to the settings of the specified target culture and the provided auto-localization settings. The text of the token will be changed, but not the values.

    For some token types, special AutoLocalizationSettings will be used, if provided.

    Declaration
    public override bool Localize(CultureInfo culture, AutoLocalizationSettings autoLocalizationSettings, ILocalizableToken originalMemoryToken, bool adjustCasing)
    Parameters
    Type Name Description
    System.Globalization.CultureInfo culture

    The target culture

    AutoLocalizationSettings autoLocalizationSettings

    Contains the AutoLocalizationSettings to use for some token types. May be null, in which case default settings will be used.

    ILocalizableToken originalMemoryToken

    The original memory token. Some auto-localization settings will be derived from the token, if provided.

    System.Boolean adjustCasing

    If true, it is assumed that the token is in segment-initial position. Then, casing will be adjusted if the original memory token is supplied as well.

    Returns
    Type Description
    System.Boolean

    true if the token text has been changed, and false otherwise

    Overrides
    NumberToken.Localize(CultureInfo, AutoLocalizationSettings, ILocalizableToken, Boolean)

    SetValue(Token, Boolean)

    Overwrites the current token's value with the value from blueprint, which also must be a DateTimeToken. Note that only the value and the type are overwritten, not the textual representation.

    Declaration
    public override bool SetValue(Token blueprint, bool keepNumericSeparators)
    Parameters
    Type Name Description
    Token blueprint

    The token to take the value from

    System.Boolean keepNumericSeparators

    Applicable to numeric (number and measurement) tokens only: if true, do not override the original group and decimal separators.

    Returns
    Type Description
    System.Boolean

    A flag indicating whether the token's value or type were changed.

    Overrides
    NumberToken.SetValue(Token, Boolean)

    Implements

    ILocalizableToken

    On this page

    • Constructors
      • MeasureToken(MeasureToken)
      • MeasureToken(String, NumberToken, Unit, String, Char)
      • MeasureToken(String, NumberToken, Unit, String, Char, String)
      • MeasureToken(String, String, String, String, Unit, String, Char, NumberFormatInfo)
    • Properties
      • CustomCategory
      • IsPlaceable
      • IsSubstitutable
      • IsValid
      • Unit
      • UnitSeparator
      • UnitString
    • Methods
      • AcceptSegmentElementVisitor(ISegmentElementVisitor)
      • Duplicate()
      • Equals(Object)
      • GetHashCode()
      • GetSimilarity(SegmentElement)
      • GetSimilarity(SegmentElement, Boolean)
      • GetTokenType()
      • Localize(CultureInfo, AutoLocalizationSettings)
      • Localize(CultureInfo, AutoLocalizationSettings, ILocalizableToken, Boolean)
      • SetValue(Token, Boolean)
    • Implements
    Back to top Generated by DocFX