本文整理汇总了Java中org.apache.poi.ss.formula.eval.ValueEval类的典型用法代码示例。如果您正苦于以下问题:Java ValueEval类的具体用法?Java ValueEval怎么用?Java ValueEval使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValueEval类属于org.apache.poi.ss.formula.eval包,在下文中一共展示了ValueEval类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
@Override
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex,
ValueEval arg0, ValueEval arg1, ValueEval arg2)
{
/*
try
{
ValueEval ve = OperandResolver.getSingleValue(arg0, srcRowIndex, srcColumnIndex);
} catch (EvaluationException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
*/
//evalu
return new NumberEval(2);
}
示例2: prepareQueryArgs
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
static List<ValueEval> prepareQueryArgs(List<ValueEval> queryArgs) throws EvaluationException {
List<ValueEval> args = new LinkedList<>();
for (ValueEval arg : queryArgs) {
if (arg instanceof AreaEval) {
AreaEval range = (AreaEval) arg;
for (int i = range.getFirstRow(); i <= range.getLastRow(); i++) {
for (int j = range.getFirstColumn(); j <= range.getLastColumn(); j++)
{ args.add(getSingleValue(arg, i, j)); }
}
} else {
args.add(arg);
}
}
return args;
}
示例3: initialize
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
@Setup(Level.Trial)
public void initialize() throws Exception {
String excelFile = "src/test/resources/datamodel/nativepoi/CalcEngine_vs_POI_" + cell_iterations + "times.xlsx";
XSSFWorkbook wb = new XSSFWorkbook(excelFile);
XSSFEvaluationWorkbook ewb = XSSFEvaluationWorkbook.create(wb);
this.ccEvaluator = new SpreadsheetEvaluator(Converters.toDataModel(wb));
this.poiEvaluator = new WorkbookEvaluator(ewb, IStabilityClassifier.TOTALLY_IMMUTABLE, null);
this.ccExpectedValues = new Object[from + cell_iterations];
for (int i = from; i < from + cell_iterations; i++)
this.ccExpectedValues[i] = ccEvaluator.evaluate(fromA1Address(columnA + i)).getResult().get();
this.poiExpectedValues = new ValueEval[from + cell_iterations - 1];
for (int i = from - 1; i < from + cell_iterations - 1; i++)
this.poiExpectedValues[i] = poiEvaluator.evaluate(ewb.getSheet(0).getCell(i, columnAIndex));
this.addressA = new IA1Address[from + cell_iterations];
for (int i = from; i < from + cell_iterations; i++)
this.addressA[i] = fromA1Address(columnA + i);
this.addressB = new EvaluationCell[from + cell_iterations - 1];
for (int i = from - 1; i < from + cell_iterations - 1; i++)
this.addressB[i] = ewb.getSheet(0).getCell(i, columnAIndex);
}
示例4: initialize
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
@Setup(Level.Trial)
public void initialize() throws Exception {
String excelFile = "src/test/resources/datamodel/nativepoi/CalcEngine_vs_POI_set" + cell_iterations + "formulas.xlsx";
XSSFWorkbook wb = new XSSFWorkbook(excelFile);
XSSFEvaluationWorkbook ewb = XSSFEvaluationWorkbook.create(wb);
this.ccEvaluator = new SpreadsheetEvaluator(Converters.toDataModel(wb));
this.poiEvaluator = new WorkbookEvaluator(ewb, IStabilityClassifier.TOTALLY_IMMUTABLE, null);
this.ccExpectedValues = new Object[from + cell_iterations];
for (int i = from; i < from + cell_iterations; i++)
this.ccExpectedValues[i] = ccEvaluator.evaluate(fromA1Address(columnB + i)).getResult().get();
this.poiExpectedValues = new ValueEval[from + cell_iterations - 1];
for (int i = from - 1; i < from + cell_iterations - 1; i++)
this.poiExpectedValues[i] = poiEvaluator.evaluate(ewb.getSheet(0).getCell(i, columnAIndex));
this.addressA = new IA1Address[from + cell_iterations];
for (int i = from; i < from + cell_iterations; i++)
this.addressA[i] = fromA1Address(columnA + i);
this.addressB = new EvaluationCell[from + cell_iterations - 1];
for (int i = from - 1; i < from + cell_iterations - 1; i++)
this.addressB[i] = ewb.getSheet(0).getCell(i, columnAIndex);
}
示例5: apachepoi_ExcelFile_ExecutionTimeIsOk
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
@Benchmark
public void apachepoi_ExcelFile_ExecutionTimeIsOk(CalcEngine_vs_POI_One_Formula_Test state, Blackhole bh) {
for (int i = state.from - 1; i < state.from + state.cell_iterations - 1; i++) {
ValueEval value = state.poiEvaluator.evaluate(state.addressB[i]);
assertThat(value).isEqualTo(state.poiExpectedValues[i]); /* comment for better performance */
bh.consume(value);
}
}
示例6: apachepoi_ExcelFile_ExecutionTimeIsOk
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
@Benchmark
public void apachepoi_ExcelFile_ExecutionTimeIsOk(CalcEngine_vs_POI_Formula_Set_Test state, Blackhole bh) {
for (int i = state.from - 1; i < state.from + state.cell_iterations - 1; i++) {
ValueEval value = state.poiEvaluator.evaluate(state.addressB[i]);
assertThat(value).isEqualTo(state.poiExpectedValues[i]); /* comment for better performance */
bh.consume(value);
}
}
示例7: evaluate
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
/**
* This function does nothing, since it should never be evaluated.
* DEFINE function is a spreadsheet metadata and it cannot have a value.
*/
@Override
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
log.debug("In evaluate() of DEFINE function. Args = {}", Arrays.toString(args));
return new StringEval(DefineFunction.class.getAnnotation(CustomFunctionMeta.class).value());
}
示例8: fetchValuesWithFullScan
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
protected List<ValueEval> fetchValuesWithFullScan(IDataSet set, Map<Integer, Object> where, int columnIndex) {
List<ValueEval> found = new ArrayList<>();
for (IDsRow row : set) {
boolean allFieldsMatch = true;
int allFieldsPresent = where.size();
for (Entry<Integer, Object> whereColumn : where.entrySet()) {
IDsCell cell = row.getCell(whereColumn.getKey());
if (cell != null) {
allFieldsPresent--;
Object extValue = coerceValueTo(whereColumn.getValue());
/* Such a strange conversion because of Number types - everything is Double in POI */
Object intValue = coerceValueTo(valueToValueEval(cell.getValue().get()));
if (!intValue.equals(extValue)) { allFieldsMatch = false; break; }
}
}
if (allFieldsPresent == 0 && allFieldsMatch) {
found.add(valueToValueEval(row.getCell(columnIndex).getValue().get()));
break; // collecting only the first matching record according to product owner requirements
}
}
return found;
}
示例9: evaluate
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
try {
final ValueEval p = OperandResolver.getSingleValue(args[0], ec.getRowIndex(), ec.getColumnIndex()) ;
final ValueEval mu = OperandResolver.getSingleValue(args[1], ec.getRowIndex(), ec.getColumnIndex()) ;
final ValueEval sigma = OperandResolver.getSingleValue(args[2], ec.getRowIndex(), ec.getColumnIndex()) ;
return new NumberEval(this.compute(OperandResolver.coerceValueToDouble(p), OperandResolver.coerceValueToDouble(mu), OperandResolver.coerceValueToDouble(sigma)));
} catch (EvaluationException e) {
return e.getErrorEval();
}
}
示例10: evaluate
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
public final ValueEval evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex) {
switch (args.length) {
case 1:
return evaluate(srcRowIndex, srcColumnIndex, args[0], null);
case 2:
return evaluate(srcRowIndex, srcColumnIndex, args[0], args[1]);
}
return ErrorEval.VALUE_INVALID;
}
示例11: evaluate
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
@Override
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
return super.evaluate(args, ec);
}
示例12: putVertexToStack
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
@Override
public void putVertexToStack(ValueEval value, IExecutionGraphVertex vertex) {
if (value == null) { throw new CalculationEngineException("ValueEval to assosiate vertex with cannot be null."); }
this.valueToVertex.putIfAbsent(value, new LinkedList<>());
this.valueToVertex.get(value).push((ExecutionGraphVertex) vertex);
}
示例13: getVertexFromStack
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
@Override
public ExecutionGraphVertex getVertexFromStack(ValueEval value) {
if (value == null) { throw new CalculationEngineException("ValueEval to assosiate vertex with cannot be null."); }
/* the value is taken from the Deque while it is taken from the stack in poi WorkbookEvaluator class */
return this.valueToVertex.get(value).pop();
}
示例14: dereference
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
protected static <T extends ValueEval> T dereference(Class<T> target, ValueEval value) {
if (!(value instanceof RefEval)) { return null; }
ValueEval candidateValue = ((RefEval) value).getInnerValueEval(0);
return candidateValue.getClass() == target ? (T) candidateValue : null;
}
示例15: toArrayEval
import org.apache.poi.ss.formula.eval.ValueEval; //导入依赖的package包/类
private static TwoDEval toArrayEval(List<ValueEval> outputValues) {
ArrayEval ae = new ArrayEval();
ae.setValues(outputValues);
return ae;
}