if (implMethod != GlueMethod.CrossProduct) {
int max = implMethod == GlueMethod.Longest ? Integer.MIN_VALUE : Integer.MAX_VALUE;
for (HNode hnode : hnodes) {
if (!hnode.hasNestedTable())
continue;
Node tmp = row.getNeighbor(hnode.getId());
int size = tmp.getNestedTable().getRows(0, tmp.getNestedTable().getNumRows(), selection).size();
if (size > max && implMethod == GlueMethod.Longest) {
max = size;
}
if (size < max && implMethod == GlueMethod.Shortest) {
max = size;
}
}
List<Row> newRows = new ArrayList<Row>();
for (int i = 0; i < max; i++)
newRows.add(nestedTable.addRow(factory));
for (HNode hnode : hnodes) {
if (!hnode.hasNestedTable())
continue;
Node tmp = row.getNeighbor(hnode.getId());
int i = 0;
for (Row nestedRow : tmp.getNestedTable().getRows(0, tmp.getNestedTable().getNumRows(), selection)) {
if (i >= max) {
break;
}
CloneTableUtils.cloneDataTableExistingRow(nestedRow, newRows.get(i), nestedTable, hnode.getNestedTable(), newht, childHNodes, factory, mapping, selection);
i++;
}
}
}
else {
List<List<Row>> tablesToCross = new ArrayList<List<Row>>();
for (HNode hnode : hnodes) {
if (!hnode.hasNestedTable())
continue;
Node tmp = row.getNeighbor(hnode.getId());
ArrayList<Row> rowsInTable = new ArrayList<Row>();
tablesToCross.add(rowsInTable);
for (Row nestedRow : tmp.getNestedTable().getRows(0, tmp.getNestedTable().getNumRows(), selection)) {
rowsInTable.add(nestedRow);
}
}
int size = tablesToCross.size();
int enumeration[] = new int[size + 1];