Package dev.roanh.cpqindex
Class CanonForm.CoreHash
java.lang.Object
dev.roanh.cpqindex.CanonForm.CoreHash
- Enclosing class:
- CanonForm
A small wrapper class for binary canonical forms that
caches the hash code of the canonical form.
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprivate
CoreHash
(byte[] canon) Constructs a new core hash by wrapping the given canonical form. -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
static final CanonForm.CoreHash
read
(DataInputStream in) Reads a previously written CoreHash from the given input stream.void
write
(DataOutputStream out) Writes this canonical form to the given output stream.
-
Field Details
-
canon
private final byte[] canonThe binary canonical form.- See Also:
-
hash
private final int hashThe pre computed hash code ofcanon
.
-
-
Constructor Details
-
CoreHash
private CoreHash(byte[] canon) Constructs a new core hash by wrapping the given canonical form.- Parameters:
canon
- The binary canonical form to wrap.
-
-
Method Details
-
write
Writes this canonical form to the given output stream.- Parameters:
out
- The stream to write to.- Throws:
IOException
- When an IOException occurs- See Also:
-
hashCode
public int hashCode() -
equals
-
read
Reads a previously written CoreHash from the given input stream.- Parameters:
in
- The stream to read from.- Returns:
- The read CoreHash instance.
- Throws:
IOException
- When an IOException occurs
-