RadixTree extends BinarySearchTree<Bit, RadixTreeNode> { public RadixTreeNode insert(int number) { final Bit[] bits = BitUtils.toBits(number); RadixTreeNode current = getRoot(); for (int i = 0; i < bits.length; i++) { final Bit bit = bits[i]; if (bit.equals(Bit.ZERO)) { if (current.getLeftChild() == null) { current.setLeftChild(getFactory().createNode(bit)); } current = (RadixTreeNode) current.getLeftChild(); } else { if (current.getRightChild() == null) { current.setRightChild(getFactory().createNode(bit)); } current = (RadixTreeNode) current.getRightChild(); } if (i == bits.length - 1) { current.setLastBit(true); } } return current; } RadixTree(); RadixTreeNode insert(int number); List<RadixTreeNode> insert(int... numbers); List<Integer> list(); RadixTreeNode find(int number); void delete(int number); @Override void setRoot(RadixTreeNode root); @Override RadixTreeNode getRoot(); @Override RadixTreeNode insert(Bit value); @Override RadixTreeNode delete(Bit value);  }
@Test(expectedExceptions = UnsupportedOperationException.class) public void testBitInsertion() throws Exception { new RadixTree().insert(Bit.NEUTRAL); }