All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.javanut.pronghorn.pipe.util.hash.LongHashTable Maven / Gradle / Ivy

Go to download

Ring buffer based queuing utility for applications that require high performance and/or a small footprint. Well suited for embedded and stream based processing.

There is a newer version: 1.1.27
Show newest version
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