Cell cell = _project.rows.get(rowIndex).getCell(cellIndex);
if (cell == null || !ExpressionUtils.isNonBlankData(cell.value)) {
throw new Exception("Cell is blank or error");
}
Column column = _project.columnModel.getColumnByCellIndex(cellIndex);
if (column == null) {
throw new Exception("No such column");
}
Judgment oldJudgment = cell.recon == null ? Judgment.None : cell.recon.judgment;
newCell = new Cell(
cell.value,
cell.recon == null ? new Recon(historyEntryID, identifierSpace, schemaSpace) : cell.recon.dup(historyEntryID)
);
String cellDescription =
"single cell on row " + (rowIndex + 1) +
", column " + column.getName() +
", containing \"" + cell.value + "\"";
String description = null;
newCell.recon.matchRank = -1;
newCell.recon.judgmentAction = "single";
newCell.recon.judgmentBatchSize = 1;
if (judgment == Judgment.None) {
newCell.recon.judgment = Recon.Judgment.None;
newCell.recon.match = null;
description = "Discard recon judgment for " + cellDescription;
} else if (judgment == Judgment.New) {
newCell.recon.judgment = Recon.Judgment.New;
newCell.recon.match = null;
description = "Mark to create new topic for " + cellDescription;
} else {
newCell.recon.judgment = Recon.Judgment.Matched;
newCell.recon.match = this.match;
if (newCell.recon.candidates != null) {
for (int m = 0; m < newCell.recon.candidates.size(); m++) {
if (newCell.recon.candidates.get(m).id.equals(this.match.id)) {
newCell.recon.matchRank = m;
break;
}
}
}
description = "Match " + this.match.name +
" (" + match.id + ") to " +
cellDescription;
}
ReconStats stats = column.getReconStats();
if (stats == null) {
stats = ReconStats.create(_project, cellIndex);
} else {
int newChange = 0;
int matchChange = 0;
if (oldJudgment == Judgment.New) {
newChange--;
}
if (oldJudgment == Judgment.Matched) {
matchChange--;
}
if (newCell.recon.judgment == Judgment.New) {
newChange++;
}
if (newCell.recon.judgment == Judgment.Matched) {
matchChange++;
}
stats = new ReconStats(
stats.nonBlanks,
stats.newTopics + newChange,
stats.matchedTopics + matchChange);
}
Change change = new ReconChange(
new CellChange(rowIndex, cellIndex, cell, newCell),
column.getName(),
column.getReconConfig(),
stats
);
return new HistoryEntry(
historyEntryID, _project, description, null, change);