コード例 #1
0
 /**
  * Reads all possible derivations of the word at the position "currentWordIndex" in the BigList
  * "in" and puts them into the List "derivations".
  *
  * @return the index of the next line containing a different word
  */
 private final long findEquals(long currentWordIndex, BigList in, List<Derivation> derivations)
     throws IOException {
   String s1 = in.getLine(currentWordIndex);
   Word w1 = (Word) mapper.toSymbolSequence(s1);
   derivations.add(w1.getDerivation());
   long pos = currentWordIndex + 1;
   long length = in.size();
   while (pos < length) {
     Word w2 = getWord(in, pos);
     if (w1.equals(w2)) {
       derivations.add(w2.getDerivation());
     } else {
       return pos;
     }
     pos++;
   }
   return pos;
 }
コード例 #2
0
 /**
  * @param from
  * @param line
  * @return
  * @throws IOException
  */
 private Word getWord(BigList from, long line) throws IOException {
   String s1 = from.getLine(line);
   Word word = (Word) mapper.toSymbolSequence(s1);
   return word;
 }