Class Dictionary

    • Constructor Detail

      • Dictionary

        public Dictionary()
        Initializes an empty Dictionary. By default, the resulting instance will not be case-sensitive.
      • Dictionary

        public Dictionary​(boolean caseSensitive)
        Initializes an empty Dictionary.
        Parameters:
        caseSensitive - Whether the new instance will operate case-sensitive, or not.
    • Method Detail

      • put

        public void put​(StringList tokens)
        Adds the tokens to the dictionary as one new entry.
        Parameters:
        tokens - the new entry
      • getMinTokenCount

        public int getMinTokenCount()
      • getMaxTokenCount

        public int getMaxTokenCount()
      • contains

        public boolean contains​(StringList tokens)
        Checks if this dictionary has the given entry.
        Parameters:
        tokens - The query of tokens to be checked for.
        Returns:
        true if it contains the entry, false otherwise.
      • remove

        public void remove​(StringList tokens)
        Removes the given tokens form the current instance.
        Parameters:
        tokens - The tokens to be filtered out (= removed).
      • size

        public int size()
        Returns:
        Retrieves the number of tokens in the current instance.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • parseOneEntryPerLine

        public static Dictionary parseOneEntryPerLine​(Reader in)
                                               throws IOException
        Reads a Dictionary which has one entry per line. The tokens inside an entry are whitespace delimited.
        Parameters:
        in - A Reader instance used to parse the dictionary from.
        Returns:
        The parsed Dictionary instance; guaranteed to be non-null.
        Throws:
        IOException - Thrown if IO errors occurred during read and parse operations.