1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        Expr4JJava的表達(dá)式計算引擎

        聯(lián)合創(chuàng)作 · 2023-09-28 21:36

        Expr4J 是一個Java的表達(dá)式計算引擎,可以用來計算例如在 Excel 單元格中的表達(dá)式等。

        示例代碼:

        package org.boris.expr.util;

        import java.io.*;
        import org.boris.expr.*;
        import org.boris.expr.parser.ExprParser;

        public class ExprEvaluator
        {
        public static void main(String[] args) throws Exception {
        SimpleEvaluationContext context = new SimpleEvaluationContext();
        System.out.println("Expr Evaluator v1.0");
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while (true) {
        try {
        System.out.print(">");
        String line = br.readLine();
        if (line == null)
        break;
        Expr e = ExprParser.parse(line);
        Exprs.toUpperCase(e);
        if (e instanceof ExprEvaluatable) {
        e = ((ExprEvaluatable) e).evaluate(context);
        }
        System.out.println(e);
        } catch (Exception e) {
        e.printStackTrace();
        }
        }
        }
        }

        package org.boris.expr.util;

        import org.boris.expr.BasicEngineProvider;
        import org.boris.expr.engine.DependencyEngine;
        import org.boris.expr.engine.Range;

        public class DependencyExample
        {
        public static void main(String[] args) throws Exception {
        DependencyEngine e = new DependencyEngine(new BasicEngineProvider());
        e.set("B1", "=A1*2");
        e.set("A1", "=12*2");
        e.set("C1", "=B1*A1");
        System.out.println(e.getValue(Range.valueOf("B1")));
        System.out.println(e.getValue(Range.valueOf("C1")));
        e.set("A1", "2");
        System.out.println(e.getValue(Range.valueOf("B1")));
        System.out.println(e.getValue(Range.valueOf("C1")));
        }
        }

        瀏覽 31
        點(diǎn)贊
        評論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報
        評論
        圖片
        表情
        推薦
        點(diǎn)贊
        評論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            天天干天天逼 | 懂色av粉嫩av色老板 | 欧美厕所偷拍tv | 国产精品久久久久久久下载地址 | 国产精品毛片A | 色五月开心激情网 | 18禁网址大全 | 国产A级毛片 | 国产做受91 一片二 | 色哺乳xxxxhd国产 |