private void addBlocks(ReversiblePeekingIterable<Node> nodes) {
   for (Node child : nodes) {
     if (child instanceof Block) {
       allBlockParsersMap.putValueKey((Block) child, null);
     }
   }
 }
 private void removeBlocks(ReversiblePeekingIterable<Node> nodes) {
   for (Node child : nodes) {
     if (child instanceof Block) {
       allBlockParsersMap.removeValue(child);
     }
   }
 }
 @Override
 public void blockParserAdded(BlockParser blockParser) {
   allBlockParsersMap.putKeyValue(blockParser, blockParser.getBlock());
 }
 public boolean containsValue(Block parser) {
   return allBlockParsersMap.containsValue(parser);
 }
 public boolean containsKey(BlockParser parser) {
   return allBlockParsersMap.containsKey(parser);
 }
 public BlockParser getKey(Block parser) {
   return allBlockParsersMap.getValueKey(parser);
 }
 public Block getValue(BlockParser parser) {
   return allBlockParsersMap.getKeyValue(parser);
 }
 public OrderedSet<Block> allBlocks() {
   return allBlockParsersMap.valueSet();
 }
 @Override
 public void blockAddedWithDescendants(Block node) {
   validateLinked(node);
   allBlockParsersMap.putValueKey(node, null);
   addBlocks(node.getDescendants());
 }
 @Override
 public int getIteratorModificationCount() {
   return allBlockParsersMap.getModificationCount();
 }
 @Override
 public void blockRemovedWithDescendants(Block node) {
   validateUnlinked(node);
   allBlockParsersMap.removeValue(node);
   removeBlocks(node.getDescendants());
 }
 @Override
 public void blockRemovedWithChildren(Block node) {
   validateUnlinked(node);
   allBlockParsersMap.removeValue(node);
   removeBlocks(node.getChildren());
 }
 @Override
 public void blockRemoved(Block node) {
   validateUnlinked(node);
   allBlockParsersMap.removeValue(node);
 }
 @Override
 public void blockParserRemoved(BlockParser blockParser) {
   allBlockParsersMap.removeKey(blockParser);
 }
 public OrderedSet<BlockParser> allBlockParsers() {
   return allBlockParsersMap.keySet();
 }
 @Override
 public void blockAdded(Block node) {
   validateLinked(node);
   allBlockParsersMap.putValueKey(node, null);
 }
 @Override
 public void blockAddedWithChildren(Block node) {
   validateLinked(node);
   allBlockParsersMap.putValueKey(node, null);
   addBlocks(node.getChildren());
 }