Inheritance: IFormulaTokenizer, IStringBuilderSerializable, IFormulaInterpreter, IFormulaEvaluation
コード例 #1
0
 public static FormulaNodeRound CreateRoundNode(FormulaTree child)
 {
     return(new FormulaNodeRound
     {
         Child = child
     });
 }
コード例 #2
0
 public static FormulaNodeNegativeSign CreateNegativeSignNode(FormulaTree child)
 {
     return new FormulaNodeNegativeSign
     {
         Child = child
     };
 }
コード例 #3
0
 public static FormulaNodeLog CreateLogNode(FormulaTree child)
 {
     return(new FormulaNodeLog
     {
         Child = child
     });
 }
コード例 #4
0
 internal void CloneMember(ref FormulaTree member, CloneSpriteContext context)
 {
     if (member != null)
     {
         member = member.Clone(context);
     }
 }
コード例 #5
0
 internal void CloneMember(ref FormulaTree member)
 {
     if (member != null)
     {
         member = member.Clone();
     }
 }
コード例 #6
0
 private void ViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs arg)
 {
     if (arg.PropertyName == "Formula")
     {
         Formula = ((FormulaEditorViewModel)sender).Formula;
     }
 }
コード例 #7
0
 public static FormulaNodeNegativeSign CreateNegativeSignNode(FormulaTree child)
 {
     return(new FormulaNodeNegativeSign
     {
         Child = child
     });
 }
コード例 #8
0
 public static FormulaNodeParentheses CreateParenthesesNode(FormulaTree child)
 {
     return(new FormulaNodeParentheses
     {
         Child = child
     });
 }
コード例 #9
0
 public static FormulaNodeExp CreateExpNode(FormulaTree child)
 {
     return(new FormulaNodeExp
     {
         Child = child
     });
 }
コード例 #10
0
 public static FormulaNodeAbs CreateAbsNode(FormulaTree child)
 {
     return(new FormulaNodeAbs
     {
         Child = child
     });
 }
コード例 #11
0
 public static FormulaNodeSqrt CreateSqrtNode(FormulaTree child)
 {
     return(new FormulaNodeSqrt
     {
         Child = child
     });
 }
コード例 #12
0
 public static FormulaNodeArctan CreateArctanNode(FormulaTree child)
 {
     return(new FormulaNodeArctan
     {
         Child = child
     });
 }
コード例 #13
0
 public static FormulaNodeSin CreateSinNode(FormulaTree child)
 {
     return(new FormulaNodeSin
     {
         Child = child
     });
 }
コード例 #14
0
 public static FormulaNodeModulo CreateModuloNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return(new FormulaNodeModulo
     {
         LeftChild = leftChild,
         RightChild = rightChild
     });
 }
コード例 #15
0
 public static FormulaNodeEquals CreateEqualsNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return(new FormulaNodeEquals
     {
         LeftChild = leftChild,
         RightChild = rightChild
     });
 }
コード例 #16
0
 public static FormulaNodePower CreatePowerNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return(new FormulaNodePower
     {
         LeftChild = leftChild,
         RightChild = rightChild
     });
 }
コード例 #17
0
 public static FormulaNodeDivide CreateDivideNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return(new FormulaNodeDivide
     {
         LeftChild = leftChild,
         RightChild = rightChild
     });
 }
コード例 #18
0
 public static FormulaNodeMultiply CreateMultiplyNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return(new FormulaNodeMultiply
     {
         LeftChild = leftChild,
         RightChild = rightChild
     });
 }
コード例 #19
0
 public static FormulaNodeSubtract CreateSubtractNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return(new FormulaNodeSubtract
     {
         LeftChild = leftChild,
         RightChild = rightChild
     });
 }
コード例 #20
0
 public static FormulaNodeAdd CreateAddNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return(new FormulaNodeAdd
     {
         LeftChild = leftChild,
         RightChild = rightChild
     });
 }
コード例 #21
0
 public static FormulaNodeMax CreateMaxNode(FormulaTree firstChild, FormulaTree secondChild)
 {
     return(new FormulaNodeMax
     {
         FirstChild = firstChild,
         SecondChild = secondChild
     });
 }
コード例 #22
0
 public static FormulaNodeRandom CreateRandomNode(FormulaTree firstChild, FormulaTree secondChild)
 {
     return(new FormulaNodeRandom
     {
         FirstChild = firstChild,
         SecondChild = secondChild
     });
 }
コード例 #23
0
 public static FormulaNodePower CreatePowerNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return new FormulaNodePower
     {
         LeftChild = leftChild,
         RightChild = rightChild
     };
 }
コード例 #24
0
        public static string Serialize(FormulaTree formula)
        {
            if (formula == null) return string.Empty;

            var sb = new StringBuilder();
            formula.Append(sb);
            return sb.ToString();
        }
コード例 #25
0
 public static FormulaNodeAdd CreateAddNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return new FormulaNodeAdd
     {
         LeftChild = leftChild, 
         RightChild = rightChild
     };
 }
コード例 #26
0
 public static FormulaNodeGreaterEqual CreateGreaterEqualNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return(new FormulaNodeGreaterEqual
     {
         LeftChild = leftChild,
         RightChild = rightChild
     });
 }
コード例 #27
0
 public static FormulaNodeDivide CreateDivideNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return new FormulaNodeDivide
     {
         LeftChild = leftChild,
         RightChild = rightChild
     };
 }
コード例 #28
0
 public static FormulaNodeSubtract CreateSubtractNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return new FormulaNodeSubtract
     {
         LeftChild = leftChild,
         RightChild = rightChild
     };
 }
コード例 #29
0
 public static FormulaNodeMultiply CreateMultiplyNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return new FormulaNodeMultiply
     {
         LeftChild = leftChild,
         RightChild = rightChild
     };
 }
コード例 #30
0
 private void InterpretTokens()
 {
     var interpretedFormula = FormulaInterpreter.Interpret(Tokens, out _parsingError);
     if (interpretedFormula != null)
     {
         _formula = interpretedFormula;
         RaisePropertyChanged(() => Formula);
     }
     RaisePropertyChanged(() => ParsingError);
     RaisePropertyChanged(() => HasError);
 }
コード例 #31
0
 protected abstract bool TestEquals(FormulaTree other);
コード例 #32
0
 public static FormulaNodeParentheses CreateParenthesesNode(FormulaTree child)
 {
     return new FormulaNodeParentheses
     {
         Child = child
     };
 }
コード例 #33
0
        public static object Evaluate(FormulaTree formula)
        {
            if (formula == null) return null;

            return formula.IsNumber() ? (object)formula.EvaluateNumber() : formula.EvaluateLogic();
        }
コード例 #34
0
 public static FormulaNodeRound CreateRoundNode(FormulaTree child)
 {
     return new FormulaNodeRound
     {
         Child = child
     };
 }
コード例 #35
0
 public static FormulaNodeRandom CreateRandomNode(FormulaTree firstChild, FormulaTree secondChild)
 {
     return new FormulaNodeRandom
     {
         FirstChild = firstChild,
         SecondChild = secondChild
     };
 }
コード例 #36
0
 public static FormulaNodeLess CreateLessNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return new FormulaNodeLess
     {
         LeftChild = leftChild,
         RightChild = rightChild
     };
 }
コード例 #37
0
 public static FormulaNodeAbs CreateAbsNode(FormulaTree child)
 {
     return new FormulaNodeAbs
     {
         Child = child
     };
 }
コード例 #38
0
 public static FormulaNodeNotEquals CreateNotEqualsNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return new FormulaNodeNotEquals
     {
         LeftChild = leftChild,
         RightChild = rightChild
     };
 }
コード例 #39
0
 public static FormulaNodeArctan CreateArctanNode(FormulaTree child)
 {
     return new FormulaNodeArctan
     {
         Child = child
     };
 }
コード例 #40
0
 public static FormulaNodeLog CreateLogNode(FormulaTree child)
 {
     return new FormulaNodeLog
     {
         Child = child
     };
 }
コード例 #41
0
 public static double EvaluateNumber(FormulaTree formula)
 {
     return formula == null ? 0 : formula.EvaluateNumber();
 }
コード例 #42
0
 public static FormulaNodeExp CreateExpNode(FormulaTree child)
 {
     return new FormulaNodeExp
     {
         Child = child
     };
 }
コード例 #43
0
 public static FormulaNodeModulo CreateModuloNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return new FormulaNodeModulo
     {
         LeftChild = leftChild,
         RightChild = rightChild
     };
 }
コード例 #44
0
 public static FormulaNodeGreaterEqual CreateGreaterEqualNode(FormulaTree leftChild, FormulaTree rightChild)
 {
     return new FormulaNodeGreaterEqual
     {
         LeftChild = leftChild,
         RightChild = rightChild
     };
 }
コード例 #45
0
 protected override bool TestEquals(FormulaTree other)
 {
     return TestEquals((UnaryFormulaTree) other);
 }
コード例 #46
0
 public static FormulaNodeSqrt CreateSqrtNode(FormulaTree child)
 {
     return new FormulaNodeSqrt
     {
         Child = child
     };
 }
コード例 #47
0
 public static FormulaNodeMax CreateMaxNode(FormulaTree firstChild, FormulaTree secondChild)
 {
     return new FormulaNodeMax
     {
         FirstChild = firstChild,
         SecondChild = secondChild
     };
 }
コード例 #48
0
 protected override bool TestEquals(FormulaTree other)
 {
     return(TestEquals((BinaryFormulaTree)other));
 }
コード例 #49
0
 public SemanticsErrorException(FormulaTree node, string message) : base(message)
 {
     Node = node;
 }
コード例 #50
0
 public static FormulaNodeSin CreateSinNode(FormulaTree child)
 {
     return new FormulaNodeSin
     {
         Child = child
     };
 }
コード例 #51
0
 private static FormulaTree RemoveParentheses(FormulaTree node)
 {
     while (true)
     {
         var parenthesesNode = node as FormulaNodeParentheses;
         if (parenthesesNode == null) return node;
         node = parenthesesNode.Child;
     }
 }
コード例 #52
0
 protected override bool TestEquals(FormulaTree other)
 {
     return(TestEquals((ConstantFormulaTree)other));
 }
コード例 #53
0
     public static IEnumerable<IFormulaToken> Tokenize(FormulaTree formula)
     {
         if (formula == null) return null;
 
         return formula.Tokenize();
     }
コード例 #54
0
 public static bool EvaluateLogic(FormulaTree formula)
 {
     return formula != null && formula.EvaluateLogic();
 }