Class Rule

  • All Implemented Interfaces:
    java.io.Serializable

    public class Rule
    extends java.lang.Object
    implements java.io.Serializable
    The class representing a single segmentation rule.
    See Also:
    Serialized Form
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Rule copy()  
      boolean equals​(java.lang.Object obj)
      Indicates whether some other Rule is "equal to" this one.
      java.lang.String getAfterbreak()
      Returns a regular expression which represents the text that appears after a segment break.
      java.lang.String getBeforebreak()
      Returns a regular expression which represents the text that appears before a segment break.
      java.util.regex.Pattern getCompiledAfterbreak()
      Returns a regular expression which represents the text that appears after a segment break.
      java.util.regex.Pattern getCompiledBeforebreak()
      Returns a regular expression which represents the text that appears before a segment break.
      int hashCode()
      Returns a hash code value for the object.
      boolean isBreakRule()
      Returns whether this is a rule that determines a break or an exception.
      void setAfterbreak​(java.lang.String afterbreak)
      Sets a regular expression which represents the text that appears after a segment break.
      void setBeforebreak​(java.lang.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.
      java.lang.String toString()
      Returns a string representation of the Rule for debugging purposes.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Rule

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

        public Rule​(boolean breakRule,
                    java.lang.String beforebreak,
                    java.lang.String afterbreak)
        Creates an initialized instance of segmentation rule
    • Method Detail

      • 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 java.lang.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 java.util.regex.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​(java.lang.String beforebreak)
                            throws java.util.regex.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:
        java.util.regex.PatternSyntaxException
      • getAfterbreak

        public java.lang.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 java.util.regex.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​(java.lang.String afterbreak)
                           throws java.util.regex.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:
        java.util.regex.PatternSyntaxException
      • equals

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

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

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