private void changeToLeaf(Tree node){
  Map<String,Integer> counterMap=node.getSubtreeCounterMap();
  int maximum=0;
  String label="";
  for (  String entry : counterMap.keySet()) {
    int number=counterMap.get(entry);
    node.addCount(entry,number);
    if (number > maximum) {
      maximum=number;
      label=entry;
    }
  }
  node.removeChildren();
  node.setLeaf(label);
}

private void changeToLeaf ( Tree node ) { Map < String , Integer > counterMap = node . getSubtreeCounterMap ( ) ; int maximum = 0 ; String label = "" ; for ( String entry : counterMap . keySet ( ) ) { int number = counterMap . get ( entry ) ; node . addCount ( entry , number ) ; if ( number > maximum ) { maximum = number ; label = entry ; } } node . removeChildren ( ) ; node . setLeaf ( label ) ; }
removes the children of the node and adds the information a leaf must contain .
