math - Implementing function trees in C# -
Imagine that you have a number of nodes that can be either operator nodes ( Unary or binary operators), or terminal nodes (static). I have just started putting a finger on the keyboard and I have a small snag I have a And here I am with my problem. Can I now create a separate square for each closest function? Do I have a Alternatively, I can leave it only on binary and unit operators and pass it in a representative which evaluates the evaluation of the node, depending on the value of its hair nodes. But then there really is nothing that can be prevented from inserting all kinds of crazy stuff from the reporter, completely dismantling the full concept of being an operator. Note: Yes I have realized that there are only a few operators (+ - * / ^ â ????), and these sins / cos are actually < Strong> function . But for the purpose of this project, we can assume that it is an operator how will you create it in C #? Why do not you look at work? This is an existing model of (and the entire .NET language) in C #. Here you have been implemented using Linq.Expressions (you can see how it manages operators, signs, cognizes etc ...) < / Html> node interface,
operator: node ,
BinaryOperator: Operator ,
UnaryOperator: operator and
created Terminal: node build.
SinOperator: UnaryOperator and
CosApterator: aun ary operator and
AddOperator: BinaryOperator and so on?
var sinOperator = New UnaryOperator (childNode, Representative) {return mathematics.sine (childNode.GetValue ());});
Comments
Post a Comment