示例#1
0
 @Override
 public Collection<Integer> getAllTableIDs() {
   List<Integer> branchIDs = new ArrayList<>(tablesByDepth.size());
   for (Table table = leafMostTable(); table != null; table = table.getParentTable()) {
     branchIDs.add(table.getTableId());
   }
   return branchIDs;
 }
示例#2
0
  @Override
  public void computeFieldAssociations(Map<Table, Integer> ordinalMap) {
    List<Table> branchTables = new ArrayList<>();
    for (Table table = leafMostTable(); table != null; table = table.getParentTable()) {
      branchTables.add(table);
    }
    Collections.reverse(branchTables);

    Map<Table, Integer> offsetsMap = new HashMap<>();
    int offset = 0;
    columnsPerFlattenedField = new ArrayList<>();
    for (Table table : branchTables) {
      offsetsMap.put(table, offset);
      offset += table.getColumnsIncludingInternal().size();
      columnsPerFlattenedField.addAll(table.getColumnsIncludingInternal());
    }
    computeFieldAssociations(ordinalMap, offsetsMap);
    // Complete computation of inIndex bitsets
    for (ParticipatingTable participatingTable : tablesByDepth.values()) {
      participatingTable.close();
    }
  }
示例#3
0
 private void computeHKeyDerivations(Map<Table, Integer> ordinalMap) {
   indexToHKeys = new IndexToHKey[leafMostTable().getDepth() + 1];
   Table table = leafMostTable();
   while (table != null) {
     int tableDepth = table.getDepth();
     assert tableDepth <= leafMostTable().getDepth() : table;
     AssociationBuilder hKeyBuilder = new AssociationBuilder();
     HKey hKey = table.hKey();
     for (HKeySegment hKeySegment : hKey.segments()) {
       hKeyBuilder.toHKeyEntry(ordinalMap.get(hKeySegment.table()), -1);
       for (HKeyColumn hKeyColumn : hKeySegment.columns()) {
         int indexColumnPosition = positionOf(hKeyColumn.column());
         if (indexColumnPosition == -1) {
           indexColumnPosition = substituteHKeyColumnPosition(hKeyColumn);
         }
         hKeyBuilder.toHKeyEntry(-1, indexColumnPosition);
       }
     }
     indexToHKeys[tableDepth] = hKeyBuilder.createIndexToHKey();
     table = table.getParentTable();
   }
 }