Converted ConcatEval to singleton
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@797238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
15e434d684
commit
e6d41ed590
@ -17,18 +17,15 @@
|
|||||||
|
|
||||||
package org.apache.poi.hssf.record.formula.eval;
|
package org.apache.poi.hssf.record.formula.eval;
|
||||||
|
|
||||||
import org.apache.poi.hssf.record.formula.ConcatPtg;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Amol S. Deshmukh < amolweb at ya hoo dot com >
|
* @author Amol S. Deshmukh < amolweb at ya hoo dot com >
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public final class ConcatEval implements OperationEval {
|
public final class ConcatEval implements OperationEval {
|
||||||
|
|
||||||
private ConcatPtg delegate;
|
public static final OperationEval instance = new ConcatEval();
|
||||||
|
|
||||||
public ConcatEval(ConcatPtg ptg) {
|
private ConcatEval() {
|
||||||
delegate = ptg;
|
// enforce singleton
|
||||||
}
|
}
|
||||||
|
|
||||||
public Eval evaluate(Eval[] args, int srcRow, short srcCol) {
|
public Eval evaluate(Eval[] args, int srcRow, short srcCol) {
|
||||||
@ -58,6 +55,6 @@ public final class ConcatEval implements OperationEval {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getNumberOfOperands() {
|
public int getNumberOfOperands() {
|
||||||
return delegate.getNumberOfOperands();
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ final class OperationEvaluatorFactory {
|
|||||||
m.put(LessThanPtg.class, LessThanEval.instance);
|
m.put(LessThanPtg.class, LessThanEval.instance);
|
||||||
m.put(NotEqualPtg.class, NotEqualEval.instance);
|
m.put(NotEqualPtg.class, NotEqualEval.instance);
|
||||||
|
|
||||||
|
m.put(ConcatPtg.class, ConcatEval.instance);
|
||||||
m.put(AddPtg.class, AddEval.instance);
|
m.put(AddPtg.class, AddEval.instance);
|
||||||
m.put(DividePtg.class, DivideEval.instance);
|
m.put(DividePtg.class, DivideEval.instance);
|
||||||
m.put(MultiplyPtg.class, MultiplyEval.instance);
|
m.put(MultiplyPtg.class, MultiplyEval.instance);
|
||||||
@ -119,9 +120,6 @@ final class OperationEvaluatorFactory {
|
|||||||
if (ptgClass == FuncVarPtg.class) {
|
if (ptgClass == FuncVarPtg.class) {
|
||||||
return new FuncVarEval((FuncVarPtg)ptg);
|
return new FuncVarEval((FuncVarPtg)ptg);
|
||||||
}
|
}
|
||||||
if (ptgClass == ConcatPtg.class) {
|
|
||||||
return new ConcatEval((ConcatPtg)ptg);
|
|
||||||
}
|
|
||||||
throw new RuntimeException("Unexpected operation ptg class (" + ptgClass.getName() + ")");
|
throw new RuntimeException("Unexpected operation ptg class (" + ptgClass.getName() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user