Search Results for

    Show / Hide Table of Contents

    Class SegmentRange

    Represents the range of a segment, indicated by two specified positions. The segment positions are inclusive ("into" semantics).

    Inheritance
    object
    SegmentRange
    Inherited Members
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.Core
    Assembly: Sdl.LanguagePlatform.Core.dll
    Syntax
    [DataContract]
    public class SegmentRange

    Constructors

    SegmentRange()

    Initializes a new instance with default values.

    Declaration
    public SegmentRange()

    SegmentRange(SegmentPosition, SegmentPosition)

    Initializes a new instance with the provided positions. No checks are performed to verify that the start position precedes the end position.

    Declaration
    public SegmentRange(SegmentPosition from, SegmentPosition into)
    Parameters
    Type Name Description
    SegmentPosition from

    The start position.

    SegmentPosition into

    The end position.

    SegmentRange(int, int, int)

    Initializes a new instance of with the given parameters.

    Declaration
    public SegmentRange(int run, int from, int into)
    Parameters
    Type Name Description
    int run

    The segment element index (run) of the range.

    int from

    The start position in the run.

    int into

    The end position (inclusive) in the run.

    Properties

    From

    Gets or sets the start position.

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

    Into

    Gets or sets the end position.

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

    Length

    Gets the length of this range if start and end positions are in the same text run, and -1 otherwise.

    Declaration
    public int Length { get; }
    Property Value
    Type Description
    int

    Methods

    Compare(SegmentRange, SegmentRange)

    Compares two segment ranges and returns a value indicating their order.

    Declaration
    public static int Compare(SegmentRange a, SegmentRange b)
    Parameters
    Type Name Description
    SegmentRange a

    The first of the two items to compare.

    SegmentRange b

    The second of the two items to compare.

    Returns
    Type Description
    int

    An integer value less than zero if a precedes b, zero if a and b are in the same range, and a value greater than zero if a follows b. Only the start positions are compared.

    Contains(SegmentRange)

    Tests whether the other range is entirely included in this range (peripheral positions may be identical).

    Declaration
    public bool Contains(SegmentRange other)
    Parameters
    Type Name Description
    SegmentRange other
    Returns
    Type Description
    bool

    true if other is entirely "within" this segment range, and false otherwise.

    Duplicate()

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

    Declaration
    public SegmentRange Duplicate()
    Returns
    Type Description
    SegmentRange

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

    Equals(SegmentRange)

    Compares the current range to another segment range.

    Declaration
    public bool Equals(SegmentRange other)
    Parameters
    Type Name Description
    SegmentRange other

    The range to compare with.

    Returns
    Type Description
    bool

    true if both ranges are identical.

    Equals(object)

    System.Object.Equals(object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current object.

    Returns
    Type Description
    bool

    true if the specified object is equal to the current object; otherwise, false.

    Overrides
    object.Equals(object)

    GetHashCode()

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

    IsInside(SegmentPosition)

    Tests whether the segment position p is inside this range.

    Declaration
    public bool IsInside(SegmentPosition p)
    Parameters
    Type Name Description
    SegmentPosition p

    The segment position to test

    Returns
    Type Description
    bool

    true if p is "inside" this range, and false otherwise.

    OverlapsWith(SegmentRange)

    Tests whether this segment range overlaps with another range.

    Declaration
    public bool OverlapsWith(SegmentRange other)
    Parameters
    Type Name Description
    SegmentRange other
    Returns
    Type Description
    bool

    true if the two ranges overlap, and false otherwise.

    ToString()

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string representation of the object, for display purposes.

    Overrides
    object.ToString()
    In this article
    • Constructors
      • SegmentRange()
      • SegmentRange(SegmentPosition, SegmentPosition)
      • SegmentRange(int, int, int)
    • Properties
      • From
      • Into
      • Length
    • Methods
      • Compare(SegmentRange, SegmentRange)
      • Contains(SegmentRange)
      • Duplicate()
      • Equals(SegmentRange)
      • Equals(object)
      • GetHashCode()
      • IsInside(SegmentPosition)
      • OverlapsWith(SegmentRange)
      • ToString()
    Back to top Generated by DocFX