Class Rule

java.lang.Object
org.omegat.core.segmentation.Rule

public class Rule extends Object
The class representing a single segmentation rule.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new empty instance of segmentation rule
    Rule(boolean breakRule, String beforebreak, String afterbreak)
    Creates an initialized instance of segmentation rule
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    boolean
    equals(@Nullable Object obj)
    Indicates whether some other Rule is "equal to" this one.
    Returns a regular expression which represents the text that appears after a segment break.
    Returns a regular expression which represents the text that appears before a segment break.
    Returns a regular expression which represents the text that appears after a segment break.
    Returns a regular expression which represents the text that appears before a segment break.
    int
    Returns a hash code value for the object.
    boolean
    Returns whether this is a rule that determines a break or an exception.
    void
    setAfterbreak(String afterbreak)
    Sets a regular expression which represents the text that appears after a segment break.
    void
    setBeforebreak(String beforebreak)
    Sets a regular expression which represents the text that appears before a segment break.
    void
    setBreakRule(boolean breakRule)
    Sets whether this is a rule that determines a break or an exception.
    Returns a string representation of the Rule for debugging purposes.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Rule

      public Rule()
      Creates a new empty instance of segmentation rule
    • Rule

      public Rule(boolean breakRule, String beforebreak, String afterbreak)
      Creates an initialized instance of segmentation rule
    • Rule

      public Rule(Rule s)
  • Method Details

    • copy

      public Rule copy()
    • isBreakRule

      public boolean isBreakRule()
      Returns whether this is a rule that determines a break or an exception.
      Returns:
      true is this is a break rule.
    • setBreakRule

      public void setBreakRule(boolean breakRule)
      Sets whether this is a rule that determines a break or an exception.
      Parameters:
      breakRule - New value -- true for a break rule, false for an exception.
    • getBeforebreak

      public String getBeforebreak()
      Returns a regular expression which represents the text that appears before a segment break.
      Returns:
      regular expression of a text before break.
    • getCompiledBeforebreak

      public Pattern getCompiledBeforebreak()
      Returns a regular expression which represents the text that appears before a segment break.
      Returns:
      regular expression of a text before break.
    • setBeforebreak

      public void setBeforebreak(String beforebreak) throws PatternSyntaxException
      Sets a regular expression which represents the text that appears before a segment break.
      Parameters:
      beforebreak - Regular expression string of a text before break.
      Throws:
      PatternSyntaxException
    • getAfterbreak

      public String getAfterbreak()
      Returns a regular expression which represents the text that appears after a segment break.
      Returns:
      regular expression of a text after break.
    • getCompiledAfterbreak

      public Pattern getCompiledAfterbreak()
      Returns a regular expression which represents the text that appears after a segment break.
      Returns:
      regular expression of a text after break.
    • setAfterbreak

      public void setAfterbreak(String afterbreak) throws PatternSyntaxException
      Sets a regular expression which represents the text that appears after a segment break.
      Parameters:
      afterbreak - Regular expression string of a text after break.
      Throws:
      PatternSyntaxException
    • equals

      public boolean equals(@Nullable Object obj)
      Indicates whether some other Rule is "equal to" this one.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Returns a hash code value for the object.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns a string representation of the Rule for debugging purposes.
      Overrides:
      toString in class Object