public PhraseAndCounts apply()

in phrasecount/src/main/java/phrasecount/query/RowTransform.java [30:52]


  public PhraseAndCounts apply(Iterator<Entry<Key, Value>> input) {
    String phrase = null;

    int totalPhraseCount = 0;
    int docPhraseCount = 0;

    while (input.hasNext()) {
      Entry<Key, Value> colEntry = input.next();
      String cq = colEntry.getKey().getColumnQualifierData().toString();

      if (cq.equals(PhraseCountTable.TOTAL_PC_CQ)) {
        totalPhraseCount = Integer.parseInt(colEntry.getValue().toString());
      } else {
        docPhraseCount = Integer.parseInt(colEntry.getValue().toString());
      }

      if (phrase == null) {
        phrase = colEntry.getKey().getRowData().toString();
      }
    }

    return new PhraseAndCounts(phrase, docPhraseCount, totalPhraseCount);
  }