Class NounInflector.Replacer

  • Enclosing class:
    NounInflector

    private static class NounInflector.Replacer
    extends java.lang.Object

    Internal class that uses a regular expression matcher to both match the specified regular expression to a specified word, and (if successful) perform the appropriate substitutions.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.regex.Pattern pattern  
      private java.lang.String rule  
    • Constructor Summary

      Constructors 
      Constructor Description
      Replacer​(java.lang.String match, java.lang.String rule, boolean insensitive)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String replacement​(java.lang.String input)
      Replace the input if it matches the pattern.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • pattern

        private java.util.regex.Pattern pattern
      • rule

        private java.lang.String rule
    • Constructor Detail

      • Replacer

        public Replacer​(java.lang.String match,
                        java.lang.String rule,
                        boolean insensitive)
    • Method Detail

      • replacement

        public java.lang.String replacement​(java.lang.String input)
        Replace the input if it matches the pattern.
        Parameters:
        input - the input string.
        Returns:
        the replacement, if the input matches, otherwise null.