Class HashEntry

java.lang.Object
generic.lsh.vector.HashEntry

public class HashEntry extends Object
  • Constructor Details

    • 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 Details

    • hashCode

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

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

      public int getHash()
    • getTF

      public short getTF()
    • getIDF

      public short getIDF()
    • getCoeff

      public double getCoeff()
    • saveXml

      public void saveXml(Writer fwrite) throws IOException
      Throws:
      IOException
    • saveSQL

      public void saveSQL(StringBuilder buf)
    • restoreXml

      public void restoreXml(XmlPullParser parser, WeightFactory w)
    • 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(String sql, int start, WeightFactory w, IDFLookup lookup) throws IOException
      Throws:
      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)