コード例 #1
0
ファイル: Formula.cs プロジェクト: seuribe/Logik
 public Formula(string formula)
 {
     Text = formula;
     try {
         evalNode = EvalNodeBuilder.Build(formula);
     } catch (Exception) {
         evalNode = new ValueNode(0);
     }
 }
コード例 #2
0
        public EvalNodeBuilder(List <string> postfix)
        {
            var tokens = new Queue <string>(postfix);

            while (tokens.Count > 0)
            {
                var token = tokens.Dequeue();

                if (OperatorLibrary.IsOperator(token))
                {
                    PushOperator(token);
                }
                else if (IsFunction(token))
                {
                    var arity = int.Parse(tokens.Dequeue());
                    PushFunction(token, arity);
                }
                else if (IsBool(token))
                {
                    PushBool(token);
                }
                else if (IsValue(token))
                {
                    PushValue(token);
                }
                else if (IsString(token))
                {
                    PushString(token);
                }
                else
                {
                    PushCellReferenceNode(token);
                }
            }
            Root = treeNodes.Pop();
        }
コード例 #3
0
 public void AddChild(EvalNode child)
 {
     children.Insert(0, child);
 }
コード例 #4
0
ファイル: Formula.cs プロジェクト: seuribe/Logik
 public Formula()
 {
     Text     = "0";
     evalNode = new ValueNode(0);
 }