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:
David Huynh 2010-02-05 23:32:29 +00:00
parent 02b0c40558
commit 149330fe05

View File

@ -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,9 +121,9 @@ 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];
@ -134,7 +135,8 @@ public class Project implements Serializable {
rootKeyedGroup.cellIndices[i - 1] = i; rootKeyedGroup.cellIndices[i - 1] = i;
} }
} }
return rootKeyedGroup; keyedGroups.add(rootKeyedGroup);
}
} }
protected void setRowDependency(Row row, int cellIndex, int contextRowIndex, int contextCellIndex) { protected void setRowDependency(Row row, int cellIndex, int contextRowIndex, int contextCellIndex) {