Class PrefixExtractor

java.lang.Object
games.stendhal.common.grammar.PrefixExtractor

public class PrefixExtractor extends Object
PrefixProcessor is used to process prefix texts in a text string.
  • Constructor Details

    • PrefixExtractor

      public PrefixExtractor(String text)
  • Method Details

    • removePrefix

      public boolean removePrefix(String prefix)
      Removes a prefix, if present. If the prefix was found at the beginning of the object name, it is removed. Otherwise txt remains unchanged.
      Parameters:
      prefix -
      Returns:
      true if a prefix was removed
    • extractNounSingular

      public boolean extractNounSingular()
      Extracts noun from a string, that may be prefixed with a singular expression like "piece of", ... The result is stored in txt.
      Returns:
      true on any change of txt
    • extractNounPlural

      public boolean extractNounPlural()
      Extracts noun from a string, that may be prefixed with a plural expression like "piece of", ... The result is stored in txt.
      Returns:
      true on any change of txt
    • toString

      public String toString()
      Overrides:
      toString in class Object