Class Thesaurus


  • public final class Thesaurus
    extends java.lang.Object
    Represents thesaurus file that can be used in multiple querylets. Holds thesaurus file name and type. Immutable class. Can load the thesaurus to a Patterns server.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Thesaurus.Type
      The type of a thesaurus file.
    • Constructor Summary

      Constructors 
      Constructor Description
      Thesaurus​(java.lang.String fileName)
      Creates Thesaurus using the default thesaurus type SUBSTITUTION.
      Thesaurus​(java.lang.String fileName, Thesaurus.Type type)
      Creates Thesaurus with the given name and type.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void createOnServer​(com.netrics.likeit.NetricsServerInterface server, java.lang.String serverThesName, java.nio.file.Path thesDir)
      Creates the thesaurus of the appropriate type on the Patterns server.
      boolean equals​(java.lang.Object obj)  
      java.lang.String getName()  
      Thesaurus.Type getType()  
      int hashCode()
      Hash code uses thesaurus name only.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • Thesaurus

        public Thesaurus​(java.lang.String fileName,
                         Thesaurus.Type type)
        Creates Thesaurus with the given name and type.
        Parameters:
        fileName - - the file name of the thesaurus.
      • Thesaurus

        public Thesaurus​(java.lang.String fileName)
        Creates Thesaurus using the default thesaurus type SUBSTITUTION.
        See Also:
        Thesaurus(String, Type)
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • createOnServer

        public void createOnServer​(com.netrics.likeit.NetricsServerInterface server,
                                   java.lang.String serverThesName,
                                   java.nio.file.Path thesDir)
                            throws java.io.IOException,
                                   com.netrics.likeit.NetricsException
        Creates the thesaurus of the appropriate type on the Patterns server.
        Parameters:
        server - - the Patterns server to load the thesaurus. Not null.
        serverThesName - - the name of the new thesaurus on the server. Not null.
        thesDir - - the directory that has the thesaurus file. Not null.
        Throws:
        com.netrics.likeit.NetricsException - if an error occured on server.
        java.io.IOException - if the server does not exist, is not accessible, or if an I/O error occurs while communicating with server.
      • getName

        public java.lang.String getName()
        Returns:
        the name of the thesaurus file (not null).
      • getType

        public Thesaurus.Type getType()
        Returns:
        the type of the thesaurus file (not null).
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
        Returns:
        true if the thesaurus names are equal.
      • hashCode

        public int hashCode()
        Hash code uses thesaurus name only.
        Overrides:
        hashCode in class java.lang.Object