public FORNode(Node init, ContentNode<bool> decider, Node iter, List<Node> fornodes) : base() { InitNode = init; Decider = decider; Iteration = iter; ForNodes = fornodes; }
public override void Clean() { base.Clean(); InitNode.Clean(); InitNode = null; Decider.Clean(); Decider = null; Iteration.Clean(); Iteration = null; foreach (var n in ForNodes) { n.Clean(); } ForNodes.Clear(); }
public void Add(Node n) { InnerNodes.Add(n); }
public static Node GenLogicNode(LogicOperator logop, Node left, Node right) { Type l = left.ContentType; Type r = right.ContentType; if (l == typeof(int)) { if (r == typeof(int)) return new LogicNode<int, int>(logop, (ContentNode<int>)left, (ContentNode<int>)right); } if (l == typeof(double)) { if (r == typeof(double)) { return new LogicNode<double, double>(logop, (ContentNode<double>)left, (ContentNode<double>)right); } } if (l == typeof(bool)) { if (r == typeof(bool)) { return new LogicNode<bool, bool>(logop, (ContentNode<bool>)left, (ContentNode<bool>)right); } } return null; }
public static Node GenMathNode(MathNodeOperator op, Node left, Node right) { Type l = left.ContentType; Type r = right.ContentType; if (l == typeof(int)) { if (r == typeof(int)) return new MathNode<int,int>(op, (ContentNode<int>)left, (ContentNode<int>)right); else if (r == typeof(double)) { Console.WriteLine("Warning implicit conversion int to double!"); return new MathNode<double, double>(op, new CastNode<double, int>((ContentNode<int>)left), (ContentNode<double>)right); } } else if (l == typeof(double)) { if (r == typeof(int)) { Console.WriteLine("Warning implicit conversion int to double!"); return new MathNode<double, double>(op, (ContentNode<double>)left, new CastNode<double, int>((ContentNode<int>)right)); } else if (r == typeof(double)) return new MathNode<double, double>(op, (ContentNode<double>)left, (ContentNode<double>)right); } if (l == typeof(string)) { if (r == typeof(int)) return new MathNode<string, int>(op, (ContentNode<string>)left, (ContentNode<int>)right); else if (r == typeof(double)) return new MathNode<string, double>(op, (ContentNode<string>)left, (ContentNode<double>)right); } return null; }
protected static void Thread_1_Handle() { State_1 = ScriptThreadState.Waiting; while (true) { //Warte bis ein object an den Thread übergeben wird while (Thread_1_Obj == null) Thread.Sleep(1); State_1 = ScriptThreadState.Running; Function local = null; lock (Thread_1_Obj) { local = Thread_1_Obj; } Thread_1_LocalNode = local.GetFunctionNode(new List<Node>(), true); Thread_1_LocalNode.ScriptThreadID = 1; bool b = false; try { Thread_1_LocalNode.Evaluate(out b); } catch(Exception ex) { if (ex.GetType() == typeof(ParserException)) { Console.WriteLine(ex.Message); if (Thread_1_ParserException != null) { Thread_1_ParserException( (ParserException) ex); } Thread_1_ParserException -= Thread_1_ParserException; } } Thread_1_LocalNode.Clean(); local.Clear(); lock (Thread_1_Obj) { Thread_1_Obj = null; } State_1 = ScriptThreadState.Waiting; //Warte am ende 1ms Thread.Sleep(1); } }