whitespace (3sp to 4sp)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751839 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-07-07 22:38:09 +00:00
parent 2e142f4d6a
commit 85def647c9
1 changed files with 70 additions and 69 deletions

View File

@ -624,95 +624,95 @@ public final class WorkbookEvaluator {
}
/**
* returns an appropriate Eval impl instance for the Ptg. The Ptg must be
* one of: Area3DPtg, AreaPtg, ReferencePtg, Ref3DPtg, IntPtg, NumberPtg,
* StringPtg, BoolPtg <br/>special Note: OperationPtg subtypes cannot be
* passed here!
*/
private ValueEval getEvalForPtg(Ptg ptg, OperationEvaluationContext ec) {
// consider converting all these (ptg instanceof XxxPtg) expressions to (ptg.getClass() == XxxPtg.class)
/**
* returns an appropriate Eval impl instance for the Ptg. The Ptg must be
* one of: Area3DPtg, AreaPtg, ReferencePtg, Ref3DPtg, IntPtg, NumberPtg,
* StringPtg, BoolPtg <br/>special Note: OperationPtg subtypes cannot be
* passed here!
*/
private ValueEval getEvalForPtg(Ptg ptg, OperationEvaluationContext ec) {
// consider converting all these (ptg instanceof XxxPtg) expressions to (ptg.getClass() == XxxPtg.class)
if (ptg instanceof NamePtg) {
// Named ranges, macro functions
NamePtg namePtg = (NamePtg) ptg;
EvaluationName nameRecord = _workbook.getName(namePtg);
return getEvalForNameRecord(nameRecord, ec);
}
if (ptg instanceof NameXPtg) {
// Externally defined named ranges or macro functions
return processNameEval(ec.getNameXEval((NameXPtg)ptg), ec);
}
if (ptg instanceof NameXPxg) {
// Externally defined named ranges or macro functions
return processNameEval(ec.getNameXEval((NameXPxg)ptg), ec);
}
if (ptg instanceof NamePtg) {
// Named ranges, macro functions
NamePtg namePtg = (NamePtg) ptg;
EvaluationName nameRecord = _workbook.getName(namePtg);
return getEvalForNameRecord(nameRecord, ec);
}
if (ptg instanceof NameXPtg) {
// Externally defined named ranges or macro functions
return processNameEval(ec.getNameXEval((NameXPtg)ptg), ec);
}
if (ptg instanceof NameXPxg) {
// Externally defined named ranges or macro functions
return processNameEval(ec.getNameXEval((NameXPxg)ptg), ec);
}
if (ptg instanceof IntPtg) {
if (ptg instanceof IntPtg) {
return new NumberEval(((IntPtg)ptg).getValue());
}
if (ptg instanceof NumberPtg) {
return new NumberEval(((NumberPtg)ptg).getValue());
}
if (ptg instanceof StringPtg) {
}
if (ptg instanceof NumberPtg) {
return new NumberEval(((NumberPtg)ptg).getValue());
}
if (ptg instanceof StringPtg) {
return new StringEval(((StringPtg) ptg).getValue());
}
if (ptg instanceof BoolPtg) {
}
if (ptg instanceof BoolPtg) {
return BoolEval.valueOf(((BoolPtg) ptg).getValue());
}
if (ptg instanceof ErrPtg) {
}
if (ptg instanceof ErrPtg) {
return ErrorEval.valueOf(((ErrPtg) ptg).getErrorCode());
}
if (ptg instanceof MissingArgPtg) {
}
if (ptg instanceof MissingArgPtg) {
return MissingArgEval.instance;
}
if (ptg instanceof AreaErrPtg ||ptg instanceof RefErrorPtg
}
if (ptg instanceof AreaErrPtg ||ptg instanceof RefErrorPtg
|| ptg instanceof DeletedArea3DPtg || ptg instanceof DeletedRef3DPtg) {
return ErrorEval.REF_INVALID;
}
if (ptg instanceof Ref3DPtg) {
}
if (ptg instanceof Ref3DPtg) {
return ec.getRef3DEval((Ref3DPtg)ptg);
}
if (ptg instanceof Ref3DPxg) {
}
if (ptg instanceof Ref3DPxg) {
return ec.getRef3DEval((Ref3DPxg)ptg);
}
if (ptg instanceof Area3DPtg) {
}
if (ptg instanceof Area3DPtg) {
return ec.getArea3DEval((Area3DPtg)ptg);
}
if (ptg instanceof Area3DPxg) {
}
if (ptg instanceof Area3DPxg) {
return ec.getArea3DEval((Area3DPxg)ptg);
}
if (ptg instanceof RefPtg) {
}
if (ptg instanceof RefPtg) {
RefPtg rptg = (RefPtg) ptg;
return ec.getRefEval(rptg.getRow(), rptg.getColumn());
}
if (ptg instanceof AreaPtg) {
}
if (ptg instanceof AreaPtg) {
AreaPtg aptg = (AreaPtg) ptg;
return ec.getAreaEval(aptg.getFirstRow(), aptg.getFirstColumn(), aptg.getLastRow(), aptg.getLastColumn());
}
}
if (ptg instanceof UnknownPtg) {
// POI uses UnknownPtg when the encoded Ptg array seems to be corrupted.
// This seems to occur in very rare cases (e.g. unused name formulas in bug 44774, attachment 21790)
// In any case, formulas are re-parsed before execution, so UnknownPtg should not get here
throw new RuntimeException("UnknownPtg not allowed");
}
if (ptg instanceof ExpPtg) {
// ExpPtg is used for array formulas and shared formulas.
// it is currently unsupported, and may not even get implemented here
throw new RuntimeException("ExpPtg currently not supported");
}
if (ptg instanceof UnknownPtg) {
// POI uses UnknownPtg when the encoded Ptg array seems to be corrupted.
// This seems to occur in very rare cases (e.g. unused name formulas in bug 44774, attachment 21790)
// In any case, formulas are re-parsed before execution, so UnknownPtg should not get here
throw new RuntimeException("UnknownPtg not allowed");
}
if (ptg instanceof ExpPtg) {
// ExpPtg is used for array formulas and shared formulas.
// it is currently unsupported, and may not even get implemented here
throw new RuntimeException("ExpPtg currently not supported");
}
throw new RuntimeException("Unexpected ptg class (" + ptg.getClass().getName() + ")");
throw new RuntimeException("Unexpected ptg class (" + ptg.getClass().getName() + ")");
}
private ValueEval processNameEval(ValueEval eval, OperationEvaluationContext ec) {
if (eval instanceof ExternalNameEval) {
EvaluationName name = ((ExternalNameEval)eval).getName();
return getEvalForNameRecord(name, ec);
}
return eval;
}
private ValueEval processNameEval(ValueEval eval, OperationEvaluationContext ec) {
if (eval instanceof ExternalNameEval) {
EvaluationName name = ((ExternalNameEval)eval).getName();
return getEvalForNameRecord(name, ec);
}
return eval;
}
private ValueEval getEvalForNameRecord(EvaluationName nameRecord, OperationEvaluationContext ec) {
if (nameRecord.isFunctionName()) {
@ -738,7 +738,8 @@ public final class WorkbookEvaluator {
/**
* Used by the lazy ref evals whenever they need to get the value of a contained cell.
*/
/* package */ ValueEval evaluateReference(EvaluationSheet sheet, int sheetIndex, int rowIndex,
/* package */ ValueEval evaluateReference(
EvaluationSheet sheet, int sheetIndex, int rowIndex,
int columnIndex, EvaluationTracker tracker) {
EvaluationCell cell = sheet.getCell(rowIndex, columnIndex);