Hash and implement the hashRegion method. The test
suite will automatically pick up the new function through reflection.
To add another folding function (method of squashing a 32 bit hash code into
the hash tables smaller array index space), declare a new instance field of
type Fold and implement the logic. The test suite will automatically
pick up the new function through reflection.
| Modifier and Type | Class and Description |
|---|---|
| private abstract static class | TextHashFunctions.
Base class for any hashCode folding function to be tested. |
| private static class | |
| private abstract static class | TextHashFunctions.
Base class for any hashCode function to be tested. |
| private static class | TextHashFunctions.
Utility to help us identify unique lines in a file. |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final TextHashFunctions. | djb
Professor Daniel J. |
| pack-priv List | |
| pack-priv List | |
| pack-priv final TextHashFunctions. | golden_ratio
Applies the golden ratio and takes the upper bits. |
| pack-priv List | |
| pack-priv final TextHashFunctions. | rabin_DeltaIndex
The Rabin polynomial hash that is used by our own DeltaIndex. |
| pack-priv final TextHashFunctions. | sha1
Standard SHA-1 on the line, using the first 4 bytes as the hash code. |
| pack-priv final TextHashFunctions. | string_hash31
Hash function commonly used by java.lang.String. |
| pack-priv int | |
| pack-priv final TextHashFunctions. | truncate
Bitwise-and to extract only the low bits. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private static boolean | |
| private List | |
| protected boolean | requiresRepository()
Overrides org. If this command requires a repository. |
| protected void | |
| private void | |
| private static int | |
| private static void |
| djb | back to summary |
|---|---|
| pack-priv final TextHashFunctions. Professor Daniel J. Bernstein's rather popular string hash. | |
| foldFunctions | back to summary |
|---|---|
pack-priv List<String> foldFunctions
| |
| gitDirs | back to summary |
|---|---|
pack-priv List<File> gitDirs
| |
| golden_ratio | back to summary |
|---|---|
| pack-priv final TextHashFunctions. Applies the golden ratio and takes the upper bits. | |
| hashFunctions | back to summary |
|---|---|
pack-priv List<String> hashFunctions
| |
| rabin_DeltaIndex | back to summary |
|---|---|
| pack-priv final TextHashFunctions. The Rabin polynomial hash that is used by our own DeltaIndex. | |
| sha1 | back to summary |
|---|---|
| pack-priv final TextHashFunctions. Standard SHA-1 on the line, using the first 4 bytes as the hash code. | |
| string_hash31 | back to summary |
|---|---|
| pack-priv final TextHashFunctions. Hash function commonly used by java.lang.String. | |
| textLimit | back to summary |
|---|---|
pack-priv int textLimit
| |
| truncate | back to summary |
|---|---|
| pack-priv final TextHashFunctions. Bitwise-and to extract only the low bits. | |
| TextHashFunctions | back to summary |
|---|---|
| pack-priv TextHashFunctions() | |
| include | back to summary |
|---|---|
| private static boolean include(String name, List<String> want) | |
| init | back to summary |
|---|---|
| private List | |
| requiresRepository | back to summary |
|---|---|
| protected boolean requiresRepository() Overrides org. Doc from org. If this command requires a repository.
| |
| run | back to summary |
|---|---|
| protected void run() throws Exception Implements abstract org. Doc from org. Perform the actions of this command.
This method should only be invoked by | |
| run | back to summary |
|---|---|
| private void run(Repository repo) throws Exception | |
| tableBits | back to summary |
|---|---|
| private static int tableBits(int sz) | |
| testOne | back to summary |
|---|---|
| private static void testOne(TextHashFunctions. | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv abstract int | Returns: the folded hash, squeezed into onlybits.the 32 bit hash code to be folded into a smaller value. hash, int total number of bits that can appear in the output. The
output value must be in the range bits)[0, 1 << bits).
When bits = 2, valid outputs are 0, 1, 2, 3.Fold the given 32-bit hash code into only |
| name | back to summary |
|---|---|
| pack-priv String name | |
| Fold | back to summary |
|---|---|
| private Fold() | |
| fold | back to summary |
|---|---|
| pack-priv abstract int fold(int hash, int bits) Fold the given 32-bit hash code into only
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final TextHashFunctions. | |
| pack-priv final TextHashFunctions. | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| fold | back to summary |
|---|---|
| pack-priv final TextHashFunctions. | |
| hash | back to summary |
|---|---|
| pack-priv final TextHashFunctions. | |
| maxChainLength | back to summary |
|---|---|
| pack-priv int maxChainLength | |
| Function | back to summary |
|---|---|
| pack-priv Function(TextHashFunctions. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv String |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(RawText
the first sequence. a, int item of ai, RawText ai to compare.the second sequence. b, int item of bi)bi to compare.Implements abstract org. Compare two items to determine if they are equivalent. |
| name | back to summary |
|---|---|
| pack-priv String name | |
| Hash | back to summary |
|---|---|
| private Hash() | |
| equals | back to summary |
|---|---|
| public boolean equals(RawText a, int ai, RawText b, int bi) Implements abstract org. Doc from org. Compare two items to determine if they are equivalent.
It is permissible to compare sequence | |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Indicates whether some other object is "equal to" this one. |
| public int |
| Line | back to summary |
|---|---|
| pack-priv Line(RawText txt, int pos) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |