net.sf.okapi.lib.segmentation

## Class Rule

- java.lang.Object
- - net.sf.okapi.lib.segmentation.Rule

-     public class Rule
      extends java.lang.Object

  Stores the data for a SRX <rule> element.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.String` | `after` Pattern for after the break point.
    `protected java.lang.String` | `before` Pattern for before the break point.
    `protected java.lang.String` | `comment` Optional comment placed just before the rule.
    `protected boolean` | `isActive` Flag indicating if the rule is active.
    `protected boolean` | `isBreak` Flag indicating if the rule is a breaking rule.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Rule()` Creates an empty breaking and active Rule object.
    `Rule(java.lang.String before, java.lang.String after, boolean isBreak)` Creates a Rule object with given patterns and a flag indicating if the rule is a breaking one or a breaking exception.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getAfter()` Gets the pattern after the break point for this rule.
    `java.lang.String` | `getBefore()` Gets the pattern before the break point for this rule.
    `java.lang.String` | `getComment()` Gets the optional comment for this rule.
    `boolean` | `isActive()` Indicates if this rule is active.
    `boolean` | `isBreak()` Indicates if this rule is a breaking rule.
    `void` | `setActive(boolean value)` Sets the flag indicating if this rule is active.
    `void` | `setAfter(java.lang.String value)` Sets the pattern after the break point for this rule.
    `void` | `setBefore(java.lang.String value)` Sets the pattern before the break point for this rule.
    `void` | `setBreak(boolean value)` Sets the flag indicating if this rule is a breaking rule.
    `void` | `setComment(java.lang.String text)` Sets the comment for this rule.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### before

          protected java.lang.String before

      Pattern for before the break point.

    - #### after

          protected java.lang.String after

      Pattern for after the break point.

    - #### isBreak

          protected boolean isBreak

      Flag indicating if the rule is a breaking rule.

    - #### isActive

          protected boolean isActive

      Flag indicating if the rule is active.

    - #### comment

          protected java.lang.String comment

      Optional comment placed just before the rule.

  - ### Constructor Detail

    - #### Rule

          public Rule()

      Creates an empty breaking and active Rule object.

    - #### Rule

          public Rule(java.lang.String before,
                      java.lang.String after,
                      boolean isBreak)

      Creates a Rule object with given patterns and a flag indicating if the rule is a breaking one or a breaking exception.
      Parameters:
        `before` - the pattern for before the break point.
        `after` - the pattern for after the break point.
        `isBreak` - true if the rule is a breaking rule, false if it is a breaking exception.

  - ### Method Detail

    - #### getBefore

          public java.lang.String getBefore()

      Gets the pattern before the break point for this rule.
      Returns:
        the pattern before the break point for this rule.

    - #### setBefore

          public void setBefore(java.lang.String value)

      Sets the pattern before the break point for this rule.
      Parameters:
        `value` - the new pattern before the break point for this rule.

    - #### getAfter

          public java.lang.String getAfter()

      Gets the pattern after the break point for this rule.
      Returns:
        the pattern after the break point for this rule.

    - #### setAfter

          public void setAfter(java.lang.String value)

      Sets the pattern after the break point for this rule.
      Parameters:
        `value` - the new pattern after the break point for this rule.

    - #### isBreak

          public boolean isBreak()

      Indicates if this rule is a breaking rule.
      Returns:
        true if this rule is a breaking rule, false if it is a breaking exception.

    - #### setBreak

          public void setBreak(boolean value)

      Sets the flag indicating if this rule is a breaking rule.
      Parameters:
        `value` - true if this rule is a breaking rule, false if it is a breaking exception.

    - #### isActive

          public boolean isActive()

      Indicates if this rule is active.
      Returns:
        true if this rule is active, false otherwise.

    - #### setActive

          public void setActive(boolean value)

      Sets the flag indicating if this rule is active.
      Parameters:
        `value` - true if this rule is active, false otherwise.

    - #### getComment

          public java.lang.String getComment()

      Gets the optional comment for this rule.
      Returns:
        the comment for this rule, or null if there is none.

    - #### setComment

          public void setComment(java.lang.String text)

      Sets the comment for this rule.
      Parameters:
        `text` - the new comment. Use null or empty string to remove the comment.