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
    object
    SegmentElement
    Token
    NumberToken
    MeasureToken
    Implements
    ILocalizableToken
    Inherited Members
    NumberToken.SetValue(string, string, string, NumberFormatInfo)
    NumberToken.FormatNumber(CultureInfo)
    NumberToken.FormatNumber(NumberFormatInfo)
    NumberToken.Localize(CultureInfo, AutoLocalizationSettings)
    NumberToken.Localize(CultureInfo, AutoLocalizationSettings, ILocalizableToken, bool)
    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.GetIdentityStringAsync()
    Token.TokenizationContext
    Token.Text
    Token.Span
    Token.Type
    Token.IsWord
    Token.IsPunctuation
    Token.IsWhitespace
    Token.Culture
    SegmentElement.GetSimilarity(SegmentElement)
    SegmentElement.GetSimilarity(SegmentElement, bool)
    SegmentElement.GetSimilarityAsync(SegmentElement)
    SegmentElement.GetSimilarityAsync(SegmentElement, bool)
    object.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.Core.Tokenization
    Assembly: Sdl.LanguagePlatform.Core.dll
    Syntax
    [DataContract]
    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, ICultureMetadataManager)

    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, ICultureMetadataManager cultureMetadataManager)
    Parameters
    Type Name Description
    string text
    NumberToken numericPart
    Unit unit
    string unitString
    char unitSeparator
    ICultureMetadataManager cultureMetadataManager

    MeasureToken(string, NumberToken, Unit, string, char, string, ICultureMetadataManager)

    Declaration
    public MeasureToken(string text, NumberToken numericPart, Unit unit, string unitString, char unitSeparator, string customCategory, ICultureMetadataManager cultureMetadataManager)
    Parameters
    Type Name Description
    string text
    NumberToken numericPart
    Unit unit
    string unitString
    char unitSeparator
    string customCategory
    ICultureMetadataManager cultureMetadataManager

    Properties

    CustomCategory

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

    Declaration
    [DataMember]
    public string CustomCategory { get; set; }
    Property Value
    Type Description
    string

    IsPlaceable

    IsPlaceable. Always true for this class.

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

    IsSubstitutable

    IsSubstitutable. Always true for this class.

    Declaration
    public override bool IsSubstitutable { get; }
    Property Value
    Type Description
    bool
    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
    bool

    Unit

    Gets or sets the unit.

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

    UnitSeparator

    Gets or sets the unit separator.

    Declaration
    [DataMember]
    public char UnitSeparator { get; set; }
    Property Value
    Type Description
    char

    UnitString

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

    Declaration
    [DataMember]
    public string UnitString { get; set; }
    Property Value
    Type Description
    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
    object obj
    Returns
    Type Description
    bool
    Overrides
    NumberToken.Equals(object)

    GetHashCode()

    GetHashCode()

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

    GetTokenType()

    Type

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

    LocalizeAsync(CultureInfo, AutoLocalizationSettings, ICultureMetadataManager)

    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 Task<bool> LocalizeAsync(CultureInfo culture, AutoLocalizationSettings autoLocalizationSettings, ICultureMetadataManager cultureMetadataManager)
    Parameters
    Type Name Description
    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.

    ICultureMetadataManager cultureMetadataManager
    Returns
    Type Description
    Task<bool>

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

    Overrides
    NumberToken.LocalizeAsync(CultureInfo, AutoLocalizationSettings, ICultureMetadataManager)

    LocalizeAsync(CultureInfo, AutoLocalizationSettings, ILocalizableToken, bool, ICultureMetadataManager)

    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 Task<bool> LocalizeAsync(CultureInfo culture, AutoLocalizationSettings autoLocalizationSettings, ILocalizableToken originalMemoryToken, bool adjustCasing, ICultureMetadataManager cultureMetadataManager)
    Parameters
    Type Name Description
    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.

    bool 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.

    ICultureMetadataManager cultureMetadataManager
    Returns
    Type Description
    Task<bool>

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

    Overrides
    NumberToken.LocalizeAsync(CultureInfo, AutoLocalizationSettings, ILocalizableToken, bool, ICultureMetadataManager)

    SetValue(Token, bool)

    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

    bool keepNumericSeparators

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

    Returns
    Type Description
    bool

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

    Overrides
    NumberToken.SetValue(Token, bool)

    Implements

    ILocalizableToken
    In this article
    • Constructors
      • MeasureToken(MeasureToken)
      • MeasureToken(string, NumberToken, Unit, string, char, ICultureMetadataManager)
      • MeasureToken(string, NumberToken, Unit, string, char, string, ICultureMetadataManager)
    • Properties
      • CustomCategory
      • IsPlaceable
      • IsSubstitutable
      • IsValid
      • Unit
      • UnitSeparator
      • UnitString
    • Methods
      • AcceptSegmentElementVisitor(ISegmentElementVisitor)
      • Duplicate()
      • Equals(object)
      • GetHashCode()
      • GetTokenType()
      • LocalizeAsync(CultureInfo, AutoLocalizationSettings, ICultureMetadataManager)
      • LocalizeAsync(CultureInfo, AutoLocalizationSettings, ILocalizableToken, bool, ICultureMetadataManager)
      • SetValue(Token, bool)
    • Implements
    Back to top Generated by DocFX