Fixed bug in context row dependency calculations.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@53 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
02b0c40558
commit
149330fe05
@ -49,7 +49,8 @@ public class Project implements Serializable {
|
|||||||
public void recomputeRowContextDependencies() {
|
public void recomputeRowContextDependencies() {
|
||||||
List<Group> keyedGroups = new ArrayList<Group>();
|
List<Group> keyedGroups = new ArrayList<Group>();
|
||||||
|
|
||||||
keyedGroups.add(createRootKeyedGroup());
|
addRootKeyedGroup(keyedGroups);
|
||||||
|
|
||||||
for (ColumnGroup group : columnModel.columnGroups) {
|
for (ColumnGroup group : columnModel.columnGroups) {
|
||||||
if (group.keyColumnIndex >= 0) {
|
if (group.keyColumnIndex >= 0) {
|
||||||
Group keyedGroup = new Group();
|
Group keyedGroup = new Group();
|
||||||
@ -120,21 +121,22 @@ public class Project implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Group createRootKeyedGroup() {
|
protected void addRootKeyedGroup(List<Group> keyedGroups) {
|
||||||
int count = columnModel.getMaxCellIndex();
|
int count = columnModel.getMaxCellIndex() + 1;
|
||||||
|
if (count > 0 && columnModel.getKeyColumnIndex() < columnModel.columns.size()) {
|
||||||
Group rootKeyedGroup = new Group();
|
Group rootKeyedGroup = new Group();
|
||||||
|
|
||||||
rootKeyedGroup.cellIndices = new int[count - 1];
|
rootKeyedGroup.cellIndices = new int[count - 1];
|
||||||
rootKeyedGroup.keyCellIndex = columnModel.columns.get(columnModel.getKeyColumnIndex()).getCellIndex();
|
rootKeyedGroup.keyCellIndex = columnModel.columns.get(columnModel.getKeyColumnIndex()).getCellIndex();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
if (i < rootKeyedGroup.keyCellIndex) {
|
if (i < rootKeyedGroup.keyCellIndex) {
|
||||||
rootKeyedGroup.cellIndices[i] = i;
|
rootKeyedGroup.cellIndices[i] = i;
|
||||||
} else if (i > rootKeyedGroup.keyCellIndex) {
|
} else if (i > rootKeyedGroup.keyCellIndex) {
|
||||||
rootKeyedGroup.cellIndices[i - 1] = i;
|
rootKeyedGroup.cellIndices[i - 1] = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
keyedGroups.add(rootKeyedGroup);
|
||||||
}
|
}
|
||||||
return rootKeyedGroup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setRowDependency(Row row, int cellIndex, int contextRowIndex, int contextCellIndex) {
|
protected void setRowDependency(Row row, int cellIndex, int contextRowIndex, int contextCellIndex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user