public DoubleArrayTrieBuilder(int thread_num) { array = null; thread_num_ = thread_num; lastQPS = 0.0; lastQPSDelta = 0.0; }
public bool Build(IList <string> keyList, IList <int> valList, double max_slot_usage_rate_threshold = 0.95) { if (keyList == null) { Console.WriteLine("Key list is empty"); return(false); } if (valList == null) { Console.WriteLine("Value list is empty"); return(false); } if (keyList.Count != valList.Count) { Console.WriteLine("The size of key list and value list is not equal"); return(false); } for (int i = 0; i < valList.Count; i++) { if (valList[i] <= -1) { Console.WriteLine("Invalidated value {0} at index {1}", valList[i], i); return(false); } } MAX_SLOT_USAGE_RATE_THRESHOLD = max_slot_usage_rate_threshold; slot_usage_rate_threshold_ = max_slot_usage_rate_threshold; progress_ = 0; key_ = keyList; val_ = valList; startDT = DateTime.Now; array = new VarBigArray <unit_t>(key_.Count * 5); used = new VarBigArray <int>(key_.Count * 5); array[0] = new unit_t(); array[0].base1 = 1; used[0] = 1; next_chk_pos_ = 0; Node root_node = new Node(); root_node.left = 0; root_node.right = key_.Count; root_node.depth = 0; List <Node> siblings = new List <Node>(); Fetch(root_node, siblings); Insert(siblings); return(true); }
void Clear() { array = null; }