86 lines
2.0 KiB
Java
86 lines
2.0 KiB
Java
package com.xgiovio;
|
|
|
|
import dictionary.ChainingHashTable;
|
|
import dictionary.LogFile;
|
|
import priorityqueue.Entry;
|
|
|
|
import java.security.InvalidKeyException;
|
|
import java.util.Iterator;
|
|
|
|
/**
|
|
* Created with MONSTER.
|
|
* User: xgiovio
|
|
* Date: 11/05/2014
|
|
* Time: 21:17
|
|
*/
|
|
public class ChainingHashTableTest {
|
|
|
|
public static void main(String[] args) throws InvalidKeyException{
|
|
|
|
ChainingHashTable<String,Integer> h = new ChainingHashTable<String, Integer>();
|
|
|
|
System.out.println(h.load_factor());
|
|
|
|
h.insert("1", 100);
|
|
System.out.println(h.load_factor());
|
|
System.out.println(h.size());
|
|
|
|
|
|
h.insert("2", 100);
|
|
System.out.println(h.load_factor());
|
|
System.out.println(h.size());
|
|
|
|
h.insert("3", 100);
|
|
System.out.println(h.load_factor());
|
|
System.out.println(h.size());
|
|
|
|
h.insert("4", 100);
|
|
System.out.println(h.load_factor());
|
|
System.out.println(h.size());
|
|
|
|
h.insert("5", 100);
|
|
System.out.println(h.load_factor());
|
|
System.out.println(h.size());
|
|
|
|
h.insert("6", 100);
|
|
System.out.println(h.load_factor());
|
|
System.out.println(h.size());
|
|
|
|
h.insert("7", 100);
|
|
System.out.println(h.load_factor());
|
|
System.out.println(h.size());
|
|
|
|
h.insert("7", 200);
|
|
System.out.println(h.load_factor());
|
|
System.out.println(h.size());
|
|
|
|
h.insert("7", 511);
|
|
System.out.println(h.load_factor());
|
|
System.out.println(h.size());
|
|
|
|
h.insert("8", 100);
|
|
System.out.println(h.load_factor());
|
|
System.out.println(h.size());
|
|
|
|
h.insert("9", 100);
|
|
System.out.println(h.load_factor());
|
|
System.out.println(h.size());
|
|
|
|
Entry<String,Integer> t = h.insert("10", 100);
|
|
|
|
System.out.println(h.load_factor());
|
|
System.out.println(h.size());
|
|
|
|
|
|
System.out.println(h);
|
|
System.out.println(h.raw_size());
|
|
|
|
|
|
Iterator<Entry<String,Integer>> ite = h.findAll("9").iterator();
|
|
System.out.println(ite.next());
|
|
|
|
|
|
}
|
|
|
|
}
|