|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.mg4j.index.AbstractTermMap
it.unimi.dsi.mg4j.util.MinimalPerfectHash
it.unimi.dsi.mg4j.util.SignedMinimalPerfectHash
it.unimi.dsi.mg4j.util.HashCodeSignedMinimalPerfectHash
@Deprecated public class HashCodeSignedMinimalPerfectHash
String.hashCode()
-signed order-preserving minimal perfect hash tables.
This class source exemplifies a signed minimal perfect hash table that
signes each term with the hash code that would be returned by
String.hashCode()
if the word were a String
, thus avoiding false positives with high
probability.
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 | |
---|---|
HashCodeSignedMinimalPerfectHash(Iterable<? extends CharSequence> terms)
Deprecated. Creates a new String.hashCode() -signed order-preserving minimal perfect hash table for the given
terms, using as many weights as the longest term in the collection. |
|
HashCodeSignedMinimalPerfectHash(Iterable<? extends CharSequence> terms,
int weightLength)
Deprecated. Creates a new String.hashCode() -signed order-preserving minimal perfect hash table
for the given terms using the given number of weights. |
|
HashCodeSignedMinimalPerfectHash(String termFile,
String encoding)
Deprecated. Creates a new String.hashCode() -signed order-preserving minimal perfect hash table for the given file
of terms. |
|
HashCodeSignedMinimalPerfectHash(String termFile,
String encoding,
boolean zipped)
Deprecated. Creates a new String.hashCode() -signed order-preserving minimal perfect hash table for the (possibly gzip'd) given file
of terms. |
|
HashCodeSignedMinimalPerfectHash(String termFile,
String encoding,
int weightLength)
Deprecated. Creates a new String.hashCode() -signed order-preserving minimal perfect hash table for the given file
of terms using the given number of weights. |
|
HashCodeSignedMinimalPerfectHash(String termFile,
String encoding,
int weightLength,
boolean zipped)
Deprecated. Creates a new String.hashCode() -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 |
---|
protected int[] signature
Constructor Detail |
---|
public HashCodeSignedMinimalPerfectHash(Iterable<? extends CharSequence> terms, int weightLength)
String.hashCode()
-signed order-preserving minimal perfect hash table
for the given terms using the given number of weights.
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.MinimalPerfectHash.MinimalPerfectHash(Iterable, int)
public HashCodeSignedMinimalPerfectHash(Iterable<? extends CharSequence> terms)
String.hashCode()
-signed order-preserving minimal perfect hash table for the given
terms, using as many weights as the longest term in the collection.
terms
- some terms to hash; it is assumed that there are no duplicates.MinimalPerfectHash.MinimalPerfectHash(Iterable)
public HashCodeSignedMinimalPerfectHash(String termFile, String encoding, int weightLength)
String.hashCode()
-signed order-preserving minimal perfect hash table for the given file
of terms using the given number of weights.
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.MinimalPerfectHash.MinimalPerfectHash(String, String, int)
public HashCodeSignedMinimalPerfectHash(String termFile, String encoding)
String.hashCode()
-signed order-preserving minimal perfect hash table for the given file
of terms.
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.MinimalPerfectHash.MinimalPerfectHash(String, String)
public HashCodeSignedMinimalPerfectHash(String termFile, String encoding, int weightLength, boolean zipped)
String.hashCode()
-signed order-preserving minimal perfect hash table for the (possibly gzip'd) given file
of terms using the given number of weights.
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
.MinimalPerfectHash.MinimalPerfectHash(String, String, int)
public HashCodeSignedMinimalPerfectHash(String termFile, String encoding, boolean zipped)
String.hashCode()
-signed order-preserving minimal perfect hash table for the (possibly gzip'd) given file
of terms.
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
.MinimalPerfectHash.MinimalPerfectHash(String, String)
Method Detail |
---|
public void initSignatures(Iterable<? extends CharSequence> terms)
SignedMinimalPerfectHash
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.
initSignatures
in class SignedMinimalPerfectHash
terms
- the collection of terms given to the constructor of this class.initSignatures(Iterable)
,
LiterallySignedMinimalPerfectHash.initSignatures(Iterable)
public boolean checkSignature(CharSequence word, int index)
SignedMinimalPerfectHash
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.
checkSignature
in class SignedMinimalPerfectHash
word
- a character sequence.index
- an integer denoting a term in the indexed collection.
index
-th term.checkSignature(CharSequence, int)
,
LiterallySignedMinimalPerfectHash.checkSignature(CharSequence,int)
public boolean checkSignature(byte[] a, int off, int len, int index)
SignedMinimalPerfectHash
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.
checkSignature
in class SignedMinimalPerfectHash
a
- a byte array.off
- the first valid byte in a
.len
- the number of bytes composing the term, starting at off
.
len
bytes starting at off
(interpreted
as ISO-8859-1 characters) matches the one stored for the index
-th term.checkSignature(CharSequence, int)
,
LiterallySignedMinimalPerfectHash.checkSignature(CharSequence,int)
public static void main(String[] arg) throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, IOException, com.martiansoftware.jsap.JSAPException, ClassNotFoundException
InstantiationException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
IOException
com.martiansoftware.jsap.JSAPException
ClassNotFoundException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |