Exemple #1
0
 private int setWordsHelper(List<L> words, int wordNum) {
   if (isLeaf()) {
     label = words.get(wordNum);
     return wordNum + 1;
   } else {
     for (Tree<L> child : getChildren()) wordNum = child.setWordsHelper(words, wordNum);
     return wordNum;
   }
 }
Exemple #2
0
 /* Set the words at the leaves of a tree to the words from the
  * list */
 public void setWords(List<L> words) {
   setWordsHelper(words, 0);
 }