Example #1
0
  public Table addTable(Table t2) {
    Table t1 = this;
    Table t = new Table();

    t.startHeaders();

    for (Cell c : t1.getHeaders()) {
      t.addCell(c);
    }

    for (Cell c : t2.getHeaders()) {
      t.addCell(c);
    }

    t.endHeaders();

    if (t1.rows.size() != t2.rows.size()) {
      StringBuilder sb = new StringBuilder();
      sb.append("cannot add a table with ");
      sb.append(t2.rows.size());
      sb.append(" rows to table with ");
      sb.append(t1.rows.size());
      sb.append(" rows");
      throw new ElasticSearchIllegalArgumentException(sb.toString());
    }

    for (int i = 0; i < t1.rows.size(); i++) {
      t.startRow();
      for (Cell c : t1.rows.get(i)) {
        t.addCell(c);
      }
      for (Cell c : t2.rows.get(i)) {
        t.addCell(c);
      }
      t.endRow(false);
    }

    return t;
  }
Example #2
0
 private void createGeneralHeaderVectorMap(ArrayList<Table> tables) {
   Map<String, Integer> generalHeaderMap = new LinkedHashMap<String, Integer>();
   for (Table table : tables) {
     ArrayList<String> headers = table.getHeaders();
     for (String header : headers) {
       header = header.replace("fi", "fi");
       header = header.toLowerCase();
       if (generalHeaderMap.containsKey(header)) {
         generalHeaderMap.put(header, generalHeaderMap.get(header) + 1);
       } else {
         generalHeaderMap.put(header, 1);
       }
     }
   }
   generalHeaderMap = sortByValue(generalHeaderMap);
   this.generalHeaderMap = generalHeaderMap;
 }