RadixTree extends BinarySearchTree<Bit, RadixTreeNode> { public void delete(int number) { RadixTreeNode node = find(number); if (node == null) { return; } node.setLastBit(false); if (node.isLeaf()) { while (true) { if (node.isLastBit()) { return; } if (!node.isLeaf()) { return; } if (node.isRoot()) { return; } final RadixTreeNode parent = (RadixTreeNode) node.getParent(); if (parent.getLeftChild() == node) { parent.setLeftChild(null); } else { parent.setRightChild(null); } node = parent; } } } 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 testBitDeletion() throws Exception { new RadixTree().delete(Bit.NEUTRAL); }