it.unimi.dsi.mg4j.util
Class ShiftAddXorSignedMinimalPerfectHash

java.lang.Object
  extended by it.unimi.dsi.mg4j.index.AbstractTermMap
      extended by it.unimi.dsi.mg4j.util.MinimalPerfectHash
          extended by it.unimi.dsi.mg4j.util.SignedMinimalPerfectHash
              extended by it.unimi.dsi.mg4j.util.ShiftAddXorSignedMinimalPerfectHash
All Implemented Interfaces:
TermMap, Serializable

Deprecated. Use the new hashing stuff in Sux4J.

@Deprecated
public class ShiftAddXorSignedMinimalPerfectHash
extends SignedMinimalPerfectHash

Order-preserving minimal perfect hash tables signed using Shift-Add-Xor hashes. See “Performance in practice of string hashing functions”, by M.V. Ramakrishna and Justin Zobel, Proc. of the Fifth International Conference on Database Systems for Advanced Applications, 1997, pages 215−223.

Since:
1.1.2
Author:
Sebastiano Vigna
See Also:
Serialized Form

Field Summary
protected  int[] signature
          Deprecated. The array of signatures.
 
Fields inherited from class it.unimi.dsi.mg4j.util.MinimalPerfectHash
ENLARGEMENT_FACTOR, g, init, m, n, n4, NODE_OVERHEAD, rightShift, t, TERM_THRESHOLD, WEIGHT_UNKNOWN, WEIGHT_UNKNOWN_SORTED_TERMS, weight0, weight1, weight2, weightLength
 
Constructor Summary
ShiftAddXorSignedMinimalPerfectHash(Iterable<? extends CharSequence> terms)
          Deprecated. Creates a new Shift-Add-Xor-signed order-preserving minimal perfect hash table for the given terms, using as many weights as the longest term in the collection.
ShiftAddXorSignedMinimalPerfectHash(Iterable<? extends CharSequence> terms, int weightLength)
          Deprecated. Creates a new Shift-Add-Xor-signed order-preserving minimal perfect hash table for the given terms using the given number of weights.
ShiftAddXorSignedMinimalPerfectHash(String termFile, String encoding)
          Deprecated. Creates a new Shift-Add-Xor-signed order-preserving minimal perfect hash table for the (possibly gzip'd) given file of terms.
ShiftAddXorSignedMinimalPerfectHash(String termFile, String encoding, boolean zipped)
          Deprecated. Creates a new Shift-Add-Xor-signed order-preserving minimal perfect hash table for the given file of terms.
ShiftAddXorSignedMinimalPerfectHash(String termFile, String encoding, int weightLength)
          Deprecated. Creates a new Shift-Add-Xor-signed order-preserving minimal perfect hash table for the given file of terms using the given number of weights.
ShiftAddXorSignedMinimalPerfectHash(String termFile, String encoding, int weightLength, boolean zipped)
          Deprecated. Creates a new Shift-Add-Xor-signed order-preserving minimal perfect hash table for the (possibly gzip'd) given file of terms using the given number of weights.
 
Method Summary
 boolean checkSignature(byte[] a, int off, int len, int index)
          Deprecated. Checks a signature against a byte-array fragment.
 boolean checkSignature(CharSequence word, int index)
          Deprecated. Checks a signature against a character sequence.
 void initSignatures(Iterable<? extends CharSequence> terms)
          Deprecated. Sets up the signature system from a collection.
static void main(String[] arg)
          Deprecated.  
 
Methods inherited from class it.unimi.dsi.mg4j.util.SignedMinimalPerfectHash
asUnsigned, getNumber, getNumber, getNumber
 
Methods inherited from class it.unimi.dsi.mg4j.util.MinimalPerfectHash
getFromT, getNumber, hash, hasTerms, main, size, weightLength
 
Methods inherited from class it.unimi.dsi.mg4j.index.AbstractTermMap
getIndex, getTerm, getTerm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

signature

protected int[] signature
Deprecated. 
The array of signatures.

Constructor Detail

ShiftAddXorSignedMinimalPerfectHash

public ShiftAddXorSignedMinimalPerfectHash(Iterable<? extends CharSequence> terms,
                                           int weightLength)
Deprecated. 
Creates a new Shift-Add-Xor-signed order-preserving minimal perfect hash table for the given terms using the given number of weights.

Parameters:
terms - some terms to hash; it is assumed that no terms share a common prefix of weightLength characters.
weightLength - the number of weights used generating the intermediate hash functions.
See Also:
MinimalPerfectHash.MinimalPerfectHash(Iterable, int)

ShiftAddXorSignedMinimalPerfectHash

public ShiftAddXorSignedMinimalPerfectHash(Iterable<? extends CharSequence> terms)
Deprecated. 
Creates a new Shift-Add-Xor-signed order-preserving minimal perfect hash table for the given terms, using as many weights as the longest term in the collection.

Parameters:
terms - some terms to hash; it is assumed that there are no duplicates.
See Also:
MinimalPerfectHash.MinimalPerfectHash(Iterable)

ShiftAddXorSignedMinimalPerfectHash

public ShiftAddXorSignedMinimalPerfectHash(String termFile,
                                           String encoding,
                                           int weightLength)
Deprecated. 
Creates a new Shift-Add-Xor-signed order-preserving minimal perfect hash table for the given file of terms using the given number of weights.

Parameters:
termFile - an UTF-8 file containing one term on each line; it is assumed that it does not contain terms with a common prefix of weightLength characters.
encoding - the encoding of wordFile; if null, it is assumed to be the platform default encoding.
weightLength - the number of weights used generating the intermediate hash functions.
See Also:
MinimalPerfectHash.MinimalPerfectHash(String, String, int)

ShiftAddXorSignedMinimalPerfectHash

public ShiftAddXorSignedMinimalPerfectHash(String termFile,
                                           String encoding)
Deprecated. 
Creates a new Shift-Add-Xor-signed order-preserving minimal perfect hash table for the (possibly gzip'd) given file of terms.

Parameters:
termFile - an UTF-8 file containing one term on each line; it is assumed that it does not contain terms with a common prefix of weightLength characters.
encoding - the encoding of wordFile; if null, it is assumed to be the platform default encoding.
See Also:
MinimalPerfectHash.MinimalPerfectHash(String, String, int)

ShiftAddXorSignedMinimalPerfectHash

public ShiftAddXorSignedMinimalPerfectHash(String termFile,
                                           String encoding,
                                           int weightLength,
                                           boolean zipped)
Deprecated. 
Creates a new Shift-Add-Xor-signed order-preserving minimal perfect hash table for the (possibly gzip'd) given file of terms using the given number of weights.

Parameters:
termFile - an UTF-8 file containing one term on each line; it is assumed that it does not contain terms with a common prefix of weightLength characters.
encoding - the encoding of wordFile; if null, it is assumed to be the platform default encoding.
weightLength - the number of weights used generating the intermediate hash functions.
zipped - if true, the provided file is zipped and will be opened using a GZIPInputStream.
See Also:
MinimalPerfectHash.MinimalPerfectHash(String, String, int)

ShiftAddXorSignedMinimalPerfectHash

public ShiftAddXorSignedMinimalPerfectHash(String termFile,
                                           String encoding,
                                           boolean zipped)
Deprecated. 
Creates a new Shift-Add-Xor-signed order-preserving minimal perfect hash table for the given file of terms.

Parameters:
termFile - an UTF-8 file containing one term on each line; it is assumed that it does not contain terms with a common prefix of weightLength characters.
encoding - the encoding of wordFile; if null, it is assumed to be the platform default encoding.
zipped - if true, the provided file is zipped and will be opened using a GZIPInputStream.
See Also:
MinimalPerfectHash.MinimalPerfectHash(String, String, int)
Method Detail

initSignatures

public void initSignatures(Iterable<? extends CharSequence> terms)
Deprecated. 
Description copied from class: SignedMinimalPerfectHash
Sets up the signature system from a collection.

This abstract method must be overriden by implementing subclasses. It must set up all data structures that are necessary to handle signatures; in particular, it will usually compute signatures for all terms in the given collection.

Specified by:
initSignatures in class SignedMinimalPerfectHash
Parameters:
terms - the collection of terms given to the constructor of this class.
See Also:
HashCodeSignedMinimalPerfectHash.initSignatures(Iterable), LiterallySignedMinimalPerfectHash.initSignatures(Iterable)

checkSignature

public boolean checkSignature(CharSequence word,
                              int index)
Deprecated. 
Description copied from class: SignedMinimalPerfectHash
Checks a signature against a character sequence.

This abstract method must be overriden by implementing subclasses. It must check whether the signature of the given character sequence matches the one stored for the index-th term.

Note that this method and SignedMinimalPerfectHash.checkSignature(byte[], int, int, int) must be coherent.

Specified by:
checkSignature in class SignedMinimalPerfectHash
Parameters:
word - a character sequence.
index - an integer denoting a term in the indexed collection.
Returns:
true iff the signature of the given character sequence matches the one stored for the index-th term.
See Also:
HashCodeSignedMinimalPerfectHash.checkSignature(CharSequence, int), LiterallySignedMinimalPerfectHash.checkSignature(CharSequence,int)

checkSignature

public boolean checkSignature(byte[] a,
                              int off,
                              int len,
                              int index)
Deprecated. 
Description copied from class: SignedMinimalPerfectHash
Checks a signature against a byte-array fragment.

This abstract method must be overriden by implementing subclasses. It must check whether the signature of the given byte-array fragment (interpreted as an ISO-8859-1 string) matches the one stored for the index-th term.

Note that this method and SignedMinimalPerfectHash.checkSignature(CharSequence, int) must be coherent.

Specified by:
checkSignature in class SignedMinimalPerfectHash
Parameters:
a - a byte array.
off - the first valid byte in a.
len - the number of bytes composing the term, starting at off.
Returns:
true if the signature stored for the term defined by len bytes starting at off (interpreted as ISO-8859-1 characters) matches the one stored for the index-th term.
See Also:
HashCodeSignedMinimalPerfectHash.checkSignature(CharSequence, int), LiterallySignedMinimalPerfectHash.checkSignature(CharSequence,int)

main

public static void main(String[] arg)
                 throws InstantiationException,
                        IllegalAccessException,
                        InvocationTargetException,
                        NoSuchMethodException,
                        IOException,
                        com.martiansoftware.jsap.JSAPException,
                        ClassNotFoundException
Deprecated. 
Throws:
InstantiationException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
IOException
com.martiansoftware.jsap.JSAPException
ClassNotFoundException