mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-02 08:40:01 +01:00
Corrections for LookupTree.
This commit is contained in:
parent
0915725410
commit
3e56b95c02
@ -26,7 +26,7 @@ public class LookupTree<K, N extends Node<K>>{
|
||||
|
||||
public Node<K> getChild(final K key, final NodeFactory<K, Node<K>> factory){
|
||||
if (children == null){
|
||||
if (factory != null) children = new HashMap<K, Node<K>>();
|
||||
if (factory != null) children = new HashMap<K, Node<K>>(3);
|
||||
else return null;
|
||||
}
|
||||
Node<K> node = children.get(key);
|
||||
@ -108,9 +108,12 @@ public class LookupTree<K, N extends Node<K>>{
|
||||
depth ++;
|
||||
}
|
||||
}
|
||||
if (create || insertion.isEnd && depth == keys.size()){
|
||||
if (create){
|
||||
node = current;
|
||||
current.isEnd = true;
|
||||
}
|
||||
else if (depth == keys.size()){
|
||||
node = current;
|
||||
if (insertion != current) current.isEnd = true;
|
||||
}
|
||||
return new LookupEntry<K, N>(node, insertion, depth);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user