コード例 #1
0
ファイル: ConsoleDisplay.java プロジェクト: balraja/hitdb
 private void printRow(Row row, Collection<String> fieldNames, StringBuilder builder) {
   Formater formater = Formater.getInstance();
   builder.setLength(0);
   boolean isFirst = true;
   for (String fieldName : fieldNames) {
     if (isFirst) {
       isFirst = false;
     } else {
       builder.append("\t");
     }
     builder.append(formater.format(row.getFieldValue(fieldName)));
   }
   System.out.println(builder.toString());
 }
コード例 #2
0
ファイル: ConsoleDisplay.java プロジェクト: balraja/hitdb
 /** {@inheritDoc} */
 @Override
 public void publishRows(String query, Collection<Row> rows) {
   if (rows.isEmpty()) {
     System.out.println("EMPTY RESULT");
   } else {
     Row firstRow = rows.iterator().next();
     Collection<String> fieldNames = firstRow.getFieldNames();
     StringBuilder builder = new StringBuilder();
     boolean isFirst = true;
     for (String fieldName : fieldNames) {
       if (isFirst) {
         isFirst = false;
       } else {
         builder.append("\t");
       }
       builder.append(fieldName);
     }
     System.out.println(builder.toString());
     System.out.println("\n");
     for (Row row : rows) {
       printRow(row, fieldNames, builder);
     }
   }
 }