Class HashEntry


  • public class HashEntry
    extends java.lang.Object
    • Constructor Detail

      • HashEntry

        public HashEntry()
      • HashEntry

        public HashEntry​(int h,
                         int tcnt,
                         double weight)
        Create a hash entry with an explicit weight
        Parameters:
        h - is the 32-bit hash
        tcnt - is the (optional) term-frequency count (set to 1 if not using)
        weight - is the weight associated with the hash
      • HashEntry

        public HashEntry​(int h,
                         int tcnt,
                         int dcnt,
                         WeightFactory w)
        Create a hash entry with a weight calculated from its term frequency and idf frequency
        Parameters:
        h - is the 32-bit hash
        tcnt - is the term frequency count
        dcnt - is the (normalized) idf frequency (should be generated by an IDFLookup)
        w - is the factory used to generate the final weight
    • Method Detail

      • hashCode

        public int hashCode()
        Eclipse-generated hash function.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
      • equals

        public boolean equals​(java.lang.Object obj)
        Eclipse-generated equals function.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj -
        Returns:
      • getHash

        public int getHash()
      • getTF

        public short getTF()
      • getIDF

        public short getIDF()
      • getCoeff

        public double getCoeff()
      • saveXml

        public void saveXml​(java.io.Writer fwrite)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • saveSQL

        public void saveSQL​(java.lang.StringBuilder buf)
      • restoreXml

        public void restoreXml​(XmlPullParser parser,
                               WeightFactory w,
                               IDFLookup lookup)
        Restore entry but recalculate the idf
        Parameters:
        parser - // xml state
        w - // weight factory to calculate coefficient with
        lookup - // lookup object to recalculate idf
      • restoreSQL

        public int restoreSQL​(java.lang.String sql,
                              int start,
                              WeightFactory w,
                              IDFLookup lookup)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • restoreBase64

        public boolean restoreBase64​(char[] buffer,
                                     int offset,
                                     int[] decoder,
                                     WeightFactory w,
                                     IDFLookup lookup)
      • saveBase64

        public void saveBase64​(char[] buffer,
                               int offset,
                               char[] encoder)