class ByteTrie implements ByteTrieIfc<T> {

	@Override
	public boolean add(byte[] value, T item) {
		boolean absent;
		versionId = getVersionId();
		if (value == null) {
			absent = !root.isTerminal();
			root.setTerminal(null);
			if (absent) {
				++size;
			}
			return absent;
		}
		ByteTrieNode<T> node = root;
		int offset = 0;
		while (offset < value.length) {
			byte c = value[offset];
			ByteTrieNode<T> childNode = node.getChild(c);
			if (childNode == null) {
				childNode = generateNode(c, node, node.length() + 1);
				node.addChild(c, childNode);
				++numberOfNodes;
			}
			++offset;
			node = childNode;
		}
		absent = !node.isTerminal();
		node.setTerminal(item);
		if (absent) {
			++size;
		}
		return absent;
	}

	public  ByteTrie();

}