com.javanut.pronghorn.pipe.util.hash.LongHashTable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pronghorn-pipes Show documentation
Show all versions of pronghorn-pipes Show documentation
Ring buffer based queuing utility for applications that require high performance and/or a small
footprint. Well suited for embedded and stream based processing.
package com.javanut.pronghorn.pipe.util.hash;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Non-Thread safe simple fast hash for long to int mapping.
*
* No set is allowed unless no previous value is found.
* To change previous value replace must be called.
* Remove can not be supported.
* Key must not be zero.
*
* @author Nathan Tippy
*
*/
public class LongHashTable {
private final static Logger logger = LoggerFactory.getLogger(LongHashTable.class);
private final int mask;
private final long[] keys;
private final int[] values;
private int space;
public LongHashTable(int bits) {
int size = 1<=0) {
long key = ht.keys[j];
if (0!=key) {
visitor.visit(key,ht.values[j]);
}
}
}
public static int computeBits(int count) {
return (int)Math.ceil(Math.log(count)/Math.log(2));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy