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
    System.Object
    Context
    Implements
    System.ICloneable
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.Core.Segmentation
    Assembly: Sdl.LanguagePlatform.Core.dll
    Syntax
    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
    System.String pattern

    The regular expression pattern to initialize the context with.

    Context(String, Boolean, Boolean)

    Initializes a new instance with the specified values.

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

    The regular expression pattern

    System.Boolean caseInsensitive

    Whether or not to apply case-insensitive matching

    System.Boolean 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
    public bool CaseInsensitiveMatching { get; set; }
    Property Value
    Type Description
    System.Boolean

    MatchesAtInputBoundary

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

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

    Pattern

    Gets or sets the regular expression pattern.

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

    Methods

    Clone()

    System.ICloneable.Clone()
    Declaration
    public object Clone()
    Returns
    Type Description
    System.Object

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

    FindAllMatches(String, Int32)

    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
    System.String s

    The input string

    System.Int32 startOffset

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

    Returns
    Type Description
    System.Collections.Generic.List<Match>

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

    MatchesAt(String, Int32, Boolean, Boolean)

    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
    System.String s

    The input string to test

    System.Int32 position

    The position in the input to test for a match

    System.Boolean 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.

    System.Boolean followedByWordBreak

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

    Returns
    Type Description
    System.Boolean

    true iff the context at the specified position.

    MatchesUpto(String, Int32)

    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
    System.String s

    The string to test for a match

    System.Int32 position

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

    Returns
    Type Description
    System.Boolean

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

    ToString()

    System.Object.ToString()
    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    A string representation of the object, for display purposes.

    Overrides
    System.Object.ToString()

    Implements

    System.ICloneable

    On this page

    Back to top Generated by DocFX