Search Results for

    Show / Hide Table of Contents

    Class Context

    Describes the context of a pre-break or post-break segmentation rule. The context encapsulates a regular expression pattern as well as match flags.

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

    Constructors

    Context()

    Initializes a new instance with default values.

    Declaration
    public Context()

    Context(Context)

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

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

    The other instance

    Context(string)

    Initializes a new instance with the specified values.

    Declaration
    public Context(string pattern)
    Parameters
    Type Name Description
    string pattern

    The regular expression pattern to initialize the context with.

    Context(string, bool, bool)

    Initializes a new instance with the specified values.

    Declaration
    public Context(string pattern, bool caseInsensitive, bool matchesInputBoundary)
    Parameters
    Type Name Description
    string pattern

    The regular expression pattern

    bool caseInsensitive

    Whether or not to apply case-insensitive matching

    bool matchesInputBoundary

    Whether or not the context will match at the input boundary (beginning or end of string/file)

    Properties

    CaseInsensitiveMatching

    If CaseInsensitiveMatching is true, all matching will be performed in a case-insensitive manner, provided that the used contexts support this. The default should be false.

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

    MatchesAtInputBoundary

    If MatchesInputBoundary is true, MatchesFrom() will return true if the specified position is beyond the input's length.

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

    Pattern

    Gets or sets the regular expression pattern.

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

    Methods

    Clone()

    Clone()

    Declaration
    public object Clone()
    Returns
    Type Description
    object

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

    FindAllMatches(string, int)

    Computes and returns all matches of the context in the specified input string.

    Declaration
    public List<Match> FindAllMatches(string s, int startOffset)
    Parameters
    Type Name Description
    string s

    The input string

    int startOffset

    The zero-based start index where to start the match process.

    Returns
    Type Description
    List<Match>

    A list of matches where the context matches the input string, or null if no matches can be found.

    MatchesAt(string, int, bool, bool)

    Tests whether the context matches at the specified position. A pre-break context must match up to the position (not including), and a post-break context must match from that position onwards. If true, a match is postulated directly before position.

    Declaration
    public bool MatchesAt(string s, int position, bool assumeEof, bool followedByWordBreak)
    Parameters
    Type Name Description
    string s

    The input string to test

    int position

    The position in the input to test for a match

    bool assumeEof

    If true, it is assumed that the end of input has been reached, and end-of-input constraints will match. If false, any end-of-input constraints will not match.

    bool followedByWordBreak

    If true, any end-of-word constraints will match. If false, no end-of-word constraints will match.

    Returns
    Type Description
    bool

    true iff the context at the specified position.

    MatchesUpto(string, int)

    MatchesUpto tests whether the context matches the input up to, but not including, the specified position (which may be >= the string's length).

    Declaration
    public bool MatchesUpto(string s, int position)
    Parameters
    Type Name Description
    string s

    The string to test for a match

    int position

    The position upto which to test for a match (non-inclusive).

    Returns
    Type Description
    bool

    true iff the context matches the input string up to (not including) the specified position.

    ToString()

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string representation of the object, for display purposes.

    Overrides
    object.ToString()

    Implements

    ICloneable
    In this article
    • Constructors
      • Context()
      • Context(Context)
      • Context(string)
      • Context(string, bool, bool)
    • Properties
      • CaseInsensitiveMatching
      • MatchesAtInputBoundary
      • Pattern
    • Methods
      • Clone()
      • FindAllMatches(string, int)
      • MatchesAt(string, int, bool, bool)
      • MatchesUpto(string, int)
      • ToString()
    • Implements
    Back to top Generated by DocFX