Skip to content

Commit f63e673

Browse files
committed
better method name
fix occupied tracking bug
1 parent 267edd4 commit f63e673

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Count/src/com/mzlabs/count/op/SolnCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public BigInteger evalCached(final IntVecFn f, final IntVec x) {
1919
final RecNode newHolder = new RecNode(x.get(x.dim()-1));
2020
synchronized (newHolder) {
2121
synchronized(store) {
22-
cached = store.lookup(x,newHolder);
22+
cached = store.lookupAlloc(x,newHolder);
2323
}
2424
// newHolder now potentially visible to other threads (as it is in the cache and we released the mutex)
2525
// keep newHolder mutex so we can fill in value before anybody else looks

Count/src/com/mzlabs/count/op/impl/RecNode.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private void put(final RecNode x) {
8585
* @param newNode not null with key==x.get(x.dim()-1) (possible mutex locked)
8686
* @return terminal node to hold value (newNode if there was allocation)
8787
*/
88-
private static RecNode lookup(RecNode nd, final IntVec x, final RecNode newNode) {
88+
private static RecNode lookupAlloc(RecNode nd, final IntVec x, final RecNode newNode) {
8989
final int n = x.dim();
9090
if(n<=0) {
9191
throw new IllegalArgumentException("empty x");
@@ -122,12 +122,13 @@ private static RecNode lookup(RecNode nd, final IntVec x, final RecNode newNode)
122122
* @param newNode
123123
* @return
124124
*/
125-
public RecNode lookup(final IntVec x, final RecNode newNode) {
126-
return lookup(this,x,newNode);
125+
public RecNode lookupAlloc(final IntVec x, final RecNode newNode) {
126+
return lookupAlloc(this,x,newNode);
127127
}
128128

129129
public void clear() {
130130
map = null;
131+
noccupied = 0;
131132
}
132133

133134
public long size() {

0 commit comments

Comments
 (0)