Exemplo n.º 1
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();
   }
 }