Removed Ptg[] parameter from method IEvaluationListener.onStartEvaluate()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@883208 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1f22e9c945
commit
b6a98299a3
@ -17,7 +17,6 @@
|
||||
|
||||
package org.apache.poi.ss.formula;
|
||||
|
||||
import org.apache.poi.hssf.record.formula.Ptg;
|
||||
import org.apache.poi.hssf.record.formula.eval.ValueEval;
|
||||
|
||||
/**
|
||||
@ -39,7 +38,7 @@ interface IEvaluationListener {
|
||||
|
||||
void onCacheHit(int sheetIndex, int rowIndex, int columnIndex, ValueEval result);
|
||||
void onReadPlainValue(int sheetIndex, int rowIndex, int columnIndex, ICacheEntry entry);
|
||||
void onStartEvaluate(EvaluationCell cell, ICacheEntry entry, Ptg[] ptgs);
|
||||
void onStartEvaluate(EvaluationCell cell, ICacheEntry entry);
|
||||
void onEndEvaluate(ICacheEntry entry, ValueEval result);
|
||||
void onClearWholeCache();
|
||||
void onClearCachedValue(ICacheEntry entry);
|
||||
|
@ -259,7 +259,7 @@ public final class WorkbookEvaluator {
|
||||
if (evalListener == null) {
|
||||
result = evaluateFormula(ec, ptgs);
|
||||
} else {
|
||||
evalListener.onStartEvaluate(srcCell, cce, ptgs);
|
||||
evalListener.onStartEvaluate(srcCell, cce);
|
||||
result = evaluateFormula(ec, ptgs);
|
||||
evalListener.onEndEvaluate(cce, result);
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ public final class TestFormulaEvaluatorBugs extends TestCase {
|
||||
public void onCacheHit(int sheetIndex, int srcRowNum, int srcColNum, ValueEval result) {
|
||||
_countCacheHits++;
|
||||
}
|
||||
public void onStartEvaluate(EvaluationCell cell, ICacheEntry entry, Ptg[] ptgs) {
|
||||
public void onStartEvaluate(EvaluationCell cell, ICacheEntry entry) {
|
||||
_countCacheMisses++;
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import junit.framework.TestCase;
|
||||
|
||||
import org.apache.poi.hssf.HSSFTestDataSamples;
|
||||
import org.apache.poi.hssf.record.NameRecord;
|
||||
import org.apache.poi.hssf.record.formula.Ptg;
|
||||
import org.apache.poi.hssf.record.formula.eval.NumberEval;
|
||||
import org.apache.poi.hssf.record.formula.eval.ValueEval;
|
||||
import org.apache.poi.ss.formula.EvaluationCell;
|
||||
@ -179,7 +178,7 @@ public final class TestHSSFFormulaEvaluator extends TestCase {
|
||||
public EvalCountListener() {
|
||||
_evalCount = 0;
|
||||
}
|
||||
public void onStartEvaluate(EvaluationCell cell, ICacheEntry entry, Ptg[] ptgs) {
|
||||
public void onStartEvaluate(EvaluationCell cell, ICacheEntry entry) {
|
||||
_evalCount++;
|
||||
}
|
||||
public int getEvalCount() {
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package org.apache.poi.ss.formula;
|
||||
|
||||
import org.apache.poi.hssf.record.formula.Ptg;
|
||||
import org.apache.poi.hssf.record.formula.eval.ValueEval;
|
||||
|
||||
/**
|
||||
@ -34,7 +33,7 @@ public abstract class EvaluationListener implements IEvaluationListener {
|
||||
public void onReadPlainValue(int sheetIndex, int rowIndex, int columnIndex, ICacheEntry entry) {
|
||||
// do nothing
|
||||
}
|
||||
public void onStartEvaluate(EvaluationCell cell, ICacheEntry entry, Ptg[] ptgs) {
|
||||
public void onStartEvaluate(EvaluationCell cell, ICacheEntry entry) {
|
||||
// do nothing
|
||||
}
|
||||
public void onEndEvaluate(ICacheEntry entry, ValueEval result) {
|
||||
|
@ -36,6 +36,7 @@ import org.apache.poi.hssf.record.formula.eval.ErrorEval;
|
||||
import org.apache.poi.hssf.record.formula.eval.NumberEval;
|
||||
import org.apache.poi.hssf.record.formula.eval.StringEval;
|
||||
import org.apache.poi.hssf.record.formula.eval.ValueEval;
|
||||
import org.apache.poi.hssf.usermodel.FormulaExtractor;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFEvaluationTestHelper;
|
||||
import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
|
||||
@ -43,6 +44,7 @@ import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.hssf.util.CellReference;
|
||||
import org.apache.poi.ss.formula.IEvaluationListener.ICacheEntry;
|
||||
import org.apache.poi.ss.formula.PlainCellCache.Loc;
|
||||
import org.apache.poi.ss.usermodel.CellValue;
|
||||
|
||||
@ -55,18 +57,17 @@ import org.apache.poi.ss.usermodel.CellValue;
|
||||
*/
|
||||
public class TestEvaluationCache extends TestCase {
|
||||
|
||||
private static final class FormulaCellCacheEntryComparer implements Comparator {
|
||||
private static final class FormulaCellCacheEntryComparer implements Comparator<ICacheEntry> {
|
||||
|
||||
private final Map _formulaCellsByCacheEntry;
|
||||
private final Map<ICacheEntry,EvaluationCell> _formulaCellsByCacheEntry;
|
||||
|
||||
public FormulaCellCacheEntryComparer(Map formulaCellsByCacheEntry) {
|
||||
public FormulaCellCacheEntryComparer(Map<ICacheEntry,EvaluationCell> formulaCellsByCacheEntry) {
|
||||
_formulaCellsByCacheEntry = formulaCellsByCacheEntry;
|
||||
}
|
||||
private EvaluationCell getCell(Object a) {
|
||||
return (EvaluationCell)_formulaCellsByCacheEntry.get(a);
|
||||
private EvaluationCell getCell(ICacheEntry a) {
|
||||
return _formulaCellsByCacheEntry.get(a);
|
||||
}
|
||||
|
||||
public int compare(Object oa, Object ob) {
|
||||
public int compare(ICacheEntry oa, ICacheEntry ob) {
|
||||
EvaluationCell a = getCell(oa);
|
||||
EvaluationCell b = getCell(ob);
|
||||
int cmp;
|
||||
@ -87,16 +88,16 @@ public class TestEvaluationCache extends TestCase {
|
||||
|
||||
private static final class EvalListener extends EvaluationListener {
|
||||
|
||||
private final List _logList;
|
||||
private final List<String> _logList;
|
||||
private final HSSFWorkbook _book;
|
||||
private Map _formulaCellsByCacheEntry;
|
||||
private Map _plainCellLocsByCacheEntry;
|
||||
private Map<ICacheEntry,EvaluationCell> _formulaCellsByCacheEntry;
|
||||
private Map<ICacheEntry,Loc> _plainCellLocsByCacheEntry;
|
||||
|
||||
public EvalListener(HSSFWorkbook wb) {
|
||||
_book = wb;
|
||||
_logList = new ArrayList();
|
||||
_formulaCellsByCacheEntry = new HashMap();
|
||||
_plainCellLocsByCacheEntry = new HashMap();
|
||||
_logList = new ArrayList<String>();
|
||||
_formulaCellsByCacheEntry = new HashMap<ICacheEntry,EvaluationCell>();
|
||||
_plainCellLocsByCacheEntry = new HashMap<ICacheEntry, Loc>();
|
||||
}
|
||||
public void onCacheHit(int sheetIndex, int rowIndex, int columnIndex, ValueEval result) {
|
||||
log("hit", rowIndex, columnIndex, result);
|
||||
@ -106,20 +107,21 @@ public class TestEvaluationCache extends TestCase {
|
||||
_plainCellLocsByCacheEntry.put(entry, loc);
|
||||
log("value", rowIndex, columnIndex, entry.getValue());
|
||||
}
|
||||
public void onStartEvaluate(EvaluationCell cell, ICacheEntry entry, Ptg[] ptgs) {
|
||||
public void onStartEvaluate(EvaluationCell cell, ICacheEntry entry) {
|
||||
_formulaCellsByCacheEntry.put(entry, cell);
|
||||
log("start", cell.getRowIndex(), cell.getColumnIndex(), ptgs);
|
||||
HSSFCell hc = _book.getSheetAt(0).getRow(cell.getRowIndex()).getCell(cell.getColumnIndex());
|
||||
log("start", cell.getRowIndex(), cell.getColumnIndex(), FormulaExtractor.getPtgs(hc));
|
||||
}
|
||||
public void onEndEvaluate(ICacheEntry entry, ValueEval result) {
|
||||
EvaluationCell cell = (EvaluationCell) _formulaCellsByCacheEntry.get(entry);
|
||||
EvaluationCell cell = _formulaCellsByCacheEntry.get(entry);
|
||||
log("end", cell.getRowIndex(), cell.getColumnIndex(), result);
|
||||
}
|
||||
public void onClearCachedValue(ICacheEntry entry) {
|
||||
int rowIndex;
|
||||
int columnIndex;
|
||||
EvaluationCell cell = (EvaluationCell) _formulaCellsByCacheEntry.get(entry);
|
||||
EvaluationCell cell = _formulaCellsByCacheEntry.get(entry);
|
||||
if (cell == null) {
|
||||
Loc loc = (Loc)_plainCellLocsByCacheEntry.get(entry);
|
||||
Loc loc = _plainCellLocsByCacheEntry.get(entry);
|
||||
if (loc == null) {
|
||||
throw new IllegalStateException("can't find cell or location");
|
||||
}
|
||||
@ -135,7 +137,7 @@ public class TestEvaluationCache extends TestCase {
|
||||
Arrays.sort(entries, new FormulaCellCacheEntryComparer(_formulaCellsByCacheEntry));
|
||||
}
|
||||
public void onClearDependentCachedValue(ICacheEntry entry, int depth) {
|
||||
EvaluationCell cell = (EvaluationCell) _formulaCellsByCacheEntry.get(entry);
|
||||
EvaluationCell cell = _formulaCellsByCacheEntry.get(entry);
|
||||
log("clear" + depth, cell.getRowIndex(), cell.getColumnIndex(), entry.getValue());
|
||||
}
|
||||
|
||||
@ -692,7 +694,6 @@ public class TestEvaluationCache extends TestCase {
|
||||
private static void debugPrint(PrintStream ps, String[] log) {
|
||||
for (int i = 0; i < log.length; i++) {
|
||||
ps.println('"' + log[i] + "\",");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user