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

View File

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