|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--anthill.util.SHADigest | +--anthill.types.SHADocumentId
Probabilistic identifier for a document.
Field Summary | |
protected int |
length
Length of the document |
Fields inherited from class anthill.util.SHADigest |
digest, DIGEST_SIZE, DIGEST_TYPE, hashcode, random, RANDOM_TYPE, rdigest |
Constructor Summary | |
SHADocumentId()
Default constructor for externalization. |
Method Summary | |
protected void |
computeHash()
Computes the hash code for this SHADocumentId .
|
protected void |
computeSHADocumentId(String urlPath)
Computes a fake SHADocumentId based on the path component
of the specified URL. |
protected void |
computeSHADocumentId(URL url)
Reads data from the specified URL and computes the length and digest components that comprise the SHADocumentId . |
boolean |
equals(Object obj)
Check whether this SHADocumentId is equal
to the specified object. |
int |
getLength()
Returns the length component of the SHADocumentId . |
void |
readExternal(ObjectInput in)
Marshals this SHADocumentId to the specified output stream. |
String |
toString()
Returns a string representation of the object. |
void |
writeExternal(ObjectOutput out)
Marshals this SHADocumentId to the specified output stream. |
Methods inherited from class anthill.util.SHADigest |
compareTo, compareTo, computeDigest, computeRandomSHA, getBytes, hashCode, initRandom, isCloser |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int length
Constructor Detail |
public SHADocumentId()
Method Detail |
protected void computeSHADocumentId(URL url) throws IOException
SHADocumentId
.
url
- the URL from which to read the data needed to compute
the SHADocumentId
.
IOException
- if an error occursprotected void computeSHADocumentId(String urlPath)
SHADocumentId
based on the path component
of the specified URL. This is useful for simulation purposes only.
urlPath
- the path component of a URL.protected void computeHash()
SHADocumentId
.
Note that we wish to avoid computing the hashcode of a big integer every time, so therefore we compute the hashcode prior to its use and store it for future calls to the hashcode method.
computeHash
in class SHADigest
public int getLength()
SHADocumentId
.
SHADocumentId
.public boolean equals(Object obj)
SHADocumentId
is equal
to the specified object.
equals
in class SHADigest
obj
- the reference object with which to compare.
public String toString()
toString
in class SHADigest
public void readExternal(ObjectInput in) throws IOException
SHADocumentId
to the specified output stream.
readExternal
in interface Externalizable
readExternal
in class SHADigest
in
- an ObjectInput
stream object
IOException
- if an error occurspublic void writeExternal(ObjectOutput out) throws IOException
SHADocumentId
to the specified output stream.
writeExternal
in interface Externalizable
writeExternal
in class SHADigest
out
- an ObjectOutput
stream object
IOException
- if an error occurs
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |