projects
/
org.ibex.util.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3de2ebe
)
fix indexmultiple setting
author
crawshaw
<crawshaw@ibex.org>
Sat, 8 Jan 2005 09:58:46 +0000
(09:58 +0000)
committer
crawshaw
<crawshaw@ibex.org>
Sat, 8 Jan 2005 09:58:46 +0000
(09:58 +0000)
darcs-hash:
20050108095846
-2eb37-
1c31430009f5a98a5922f6cbd42cddede2ce7fdf
.gz
src/org/ibex/util/Basket.java
patch
|
blob
|
history
diff --git
a/src/org/ibex/util/Basket.java
b/src/org/ibex/util/Basket.java
index
04d7d97
..
648b884
100644
(file)
--- a/
src/org/ibex/util/Basket.java
+++ b/
src/org/ibex/util/Basket.java
@@
-187,7
+187,7
@@
public interface Basket extends Serializable {
/** Used to determine the number of array slots required by each
* mapping entry. */
/** Used to determine the number of array slots required by each
* mapping entry. */
- protected final int indexmultiple = 1;
+ protected final int indexmultiple;
/** Number of entries with non-null key (includes placeholder slots). */
protected int usedslots = 0;
/** Number of entries with non-null key (includes placeholder slots). */
protected int usedslots = 0;
@@
-210,13
+210,15
@@
public interface Basket extends Serializable {
*/
protected Object[] entries = null;
*/
protected Object[] entries = null;
- public Hash(int initialCapacity, float loadFactor) {
+ public Hash(int indexmultiple, int initialCapacity, float loadFactor) {
// using a pseudoprime in the form 4x+3 ensures full coverage
initialCapacity = initialCapacity / 4;
initialCapacity = 4 * initialCapacity + 3;
// using a pseudoprime in the form 4x+3 ensures full coverage
initialCapacity = initialCapacity / 4;
initialCapacity = 4 * initialCapacity + 3;
- entries = new Object[initialCapacity * indexmultiple];
this.numslots = initialCapacity;
this.loadFactor = loadFactor;
this.numslots = initialCapacity;
this.loadFactor = loadFactor;
+ this.indexmultiple = indexmultiple;
+
+ entries = new Object[initialCapacity * indexmultiple];
}
public int size() { return size; }
}
public int size() { return size; }
@@
-338,10
+340,8
@@
public interface Basket extends Serializable {
public class HashMap extends Hash implements Map {
private static final long serialVersionUID = 2348905755L;
public class HashMap extends Hash implements Map {
private static final long serialVersionUID = 2348905755L;
- protected final int indexmultiple = 2;
-
public HashMap() { this(16, 0.75F); }
public HashMap() { this(16, 0.75F); }
- public HashMap(int cap, float load) { super(cap, load); }
+ public HashMap(int cap, float load) { super(2, cap, load); }
public Object get(Object key) { int i = indexOf(key); return i >= 0 ? entries[i + 1] : null; }
public Object put(Object key, Object value) {
public Object get(Object key) { int i = indexOf(key); return i >= 0 ? entries[i + 1] : null; }
public Object put(Object key, Object value) {