/// <summary> /// Интегрирование /// </summary> private void TestRationalFunctions() { var numerator = new Polynom(new List <Monom> { new Monom(4, new List <int> { 4 }), new Monom(8, new List <int> { 3 }), new Monom(0, new List <int> { 2 }), new Monom(-3, new List <int> { 1 }), new Monom(-3, new List <int> { 0 }) }); var denominator = new Polynom(new List <Monom> { new Monom(1, new List <int> { 3 }), new Monom(2, new List <int> { 2 }), new Monom(1, new List <int> { 1 }), new Monom(0) }); var rationalFunction = new RationalFunction(numerator, denominator); TBNumerator.Text = numerator.SimplifyPolynom().ToString(); TBDenominator.Text = denominator.SimplifyPolynom().ToString(); var division = new List <Monom>(); var simplifiedRationalFunction = rationalFunction.Simplify(out division); TBIntegralNumerator.Text = (simplifiedRationalFunction as RationalFunction).numerator.SimplifyPolynom().ToString(); TBIntegralDenominator.Text = (simplifiedRationalFunction as RationalFunction).denominator.SimplifyPolynom().ToString(); }
public SingleMission(RationalFunction function, string name) { this.function = function; Name = name; Type = "Single"; }
public ComposedMission Add(RationalFunction function) { functions += function; return(this); }
protected void OnTreeViewGlobalKeyPress(object o, KeyPressEventArgs args) { TreeView tv = (TreeView)o; TreeStore tm = (TreeStore)tv.Model; TreeIter root; TreeIter ti; TreePath tp; tm.GetIterFirst(out root); TreeViewColumn tvc; tv.GetCursor(out tp, out tvc); tm.GetIter(out ti, tp); int level = tm.GetPath(ti).Depth; AbstractData dat; if (1 == level) // Project level { dat = GPrj; } else if (2 == tm.GetPath(ti).Depth) // Groups, like Tasks { switch ((string)tm.GetValue(ti, 0)) { case "StateMachines": dat = GPrj.StateMachines; if (args.Event.Key == Gdk.Key.KP_Add) { StateMachine sm = new StateMachine(); this.GPrj.StateMachines.Add(sm); ti = tm.AppendValues(TIstatemachines, sm.name); tp = tm.GetPath(ti); tv.ExpandToPath(tp); tv.SetCursor(tp, tvc, true); //esm.LoadData (sm); } else { } break; case "Tasks": dat = GPrj.Tasks; if (args.Event.Key == Gdk.Key.KP_Add) { Task tsk = new Task(); this.GPrj.Tasks.Add(tsk); ti = tm.AppendValues(TItasks, tsk.name); tp = tm.GetPath(ti); tv.ExpandToPath(tp); tv.SetCursor(tp, tvc, true); //etsk.LoadData (tsk); } else { } break; case "Processes": dat = GPrj.Processes; if (args.Event.Key == Gdk.Key.KP_Add) { Process prc = new Process(); this.GPrj.Processes.Add(prc); ti = tm.AppendValues(TIprocesses, prc.name); tp = tm.GetPath(ti); tv.ExpandToPath(tp); tv.SetCursor(tp, tvc, true); //eprc.LoadData (prc); } else { } break; case "Messages": dat = GPrj.Messages; if (args.Event.Key == Gdk.Key.KP_Add) { Message msg = new Message(); this.GPrj.Messages.Add(msg); ti = tm.AppendValues(TImessages, msg.name); tp = tm.GetPath(ti); tv.ExpandToPath(tp); tv.SetCursor(tp, tvc, true); //emsg.LoadData (msg); } else { } break; case "CompuMethods": dat = GPrj.CompuMethods; if (args.Event.Key == Gdk.Key.KP_Add) { CompuMethod cpmd; int resp = SelectCompuMethodToCreate(this); if (1 == resp) { cpmd = new RationalFunction(); } else if (2 == resp) { cpmd = new VerbalTable(); } else { return; } this.GPrj.CompuMethods.Add(cpmd); ti = tm.AppendValues(TIcompumethods, cpmd.name); tp = tm.GetPath(ti); tv.ExpandToPath(tp); tv.SetCursor(tp, tvc, true); //ecpmd.LoadData (cpmd); } else { } break; case "Units": dat = GPrj.Units; if (args.Event.Key == Gdk.Key.KP_Add) { EasyOS.Unit unt = new EasyOS.Unit(); this.GPrj.Units.Add(unt); ti = tm.AppendValues(TIunits, unt.name); tp = tm.GetPath(ti); tv.ExpandToPath(tp); tv.SetCursor(tp, tvc, true); //eunt.LoadData (unt); } else { } break; default: break; } this.statusBarLabel1.Text = tp.ToString(); } else if (3 == level) // Item, like Task { TreeIter tiL2; tm.IterParent(out tiL2, ti); this.alignFrmEditor.Remove(this.alignFrmEditor.Child); string itemName = (string)tm.GetValue(ti, 0); switch ((string)tm.GetValue(tiL2, 0)) { case "StateMachines": StateMachine sm = this.GPrj.StateMachines.FindWithName(itemName); if (args.Event.Key == Gdk.Key.KP_Add) { sm = new StateMachine(); this.GPrj.StateMachines.Add(sm); ti = tm.AppendValues(TIstatemachines, sm.name); tp = tm.GetPath(ti); tv.SetCursor(tp, tvc, true); //esm.LoadData (sm); } else if (args.Event.Key == Gdk.Key.KP_Subtract) { this.GPrj.StateMachines.Remove(sm); tm.Remove(ref ti); } else { } break; case "Tasks": Task tsk = this.GPrj.Tasks.FindWithName(itemName); if (args.Event.Key == Gdk.Key.KP_Add) { tsk = new Task(); this.GPrj.Tasks.Add(tsk); ti = tm.AppendValues(TItasks, tsk.name); tp = tm.GetPath(ti); tv.SetCursor(tp, tvc, true); //etsk.LoadData (tsk); } else if (args.Event.Key == Gdk.Key.KP_Subtract) { this.GPrj.Tasks.Remove(tsk); tm.Remove(ref ti); } else { } break; case "Processes": Process prc = this.GPrj.Processes.FindWithName(itemName); if (args.Event.Key == Gdk.Key.KP_Add) { prc = new Process(); this.GPrj.Processes.Add(prc); ti = tm.AppendValues(TIprocesses, prc.name); tp = tm.GetPath(ti); tv.SetCursor(tp, tvc, true); //eprc.LoadData (prc); } else if (args.Event.Key == Gdk.Key.KP_Subtract) { this.GPrj.Processes.Remove(prc); tm.Remove(ref ti); } else { } break; case "Messages": Message msg = this.GPrj.Messages.FindWithName(itemName); if (args.Event.Key == Gdk.Key.KP_Add) { msg = new Message(); this.GPrj.Messages.Add(msg); ti = tm.AppendValues(TImessages, msg.name); tp = tm.GetPath(ti); tv.SetCursor(tp, tvc, true); //emsg.LoadData (msg); } else if (args.Event.Key == Gdk.Key.KP_Subtract) { this.GPrj.Messages.Remove(msg); tm.Remove(ref ti); } else { } break; case "CompuMethods": CompuMethod cpmd = this.GPrj.CompuMethods.FindWithName(itemName); if (args.Event.Key == Gdk.Key.KP_Add) { int resp = SelectCompuMethodToCreate(this); if (1 == resp) { cpmd = new RationalFunction(); } else if (2 == resp) { cpmd = new VerbalTable(); } else { return; } this.GPrj.CompuMethods.Add(cpmd); ti = tm.AppendValues(TIcompumethods, cpmd.name); tp = tm.GetPath(ti); tv.SetCursor(tp, tvc, true); //ecpmd.LoadData (cpmd); } else if (args.Event.Key == Gdk.Key.KP_Subtract) { this.GPrj.CompuMethods.Remove(cpmd); tm.Remove(ref ti); } else { } break; case "Units": EasyOS.Unit unt = this.GPrj.Units.FindWithName(itemName); if (args.Event.Key == Gdk.Key.KP_Add) { unt = new EasyOS.Unit(); this.GPrj.Units.Add(unt); ti = tm.AppendValues(TIunits, unt.name); tp = tm.GetPath(ti); tv.SetCursor(tp, tvc, true); //eunt.LoadData (unt); } else if (args.Event.Key == Gdk.Key.KP_Subtract) { this.GPrj.Units.Remove(unt); tm.Remove(ref ti); } else { } break; default: this.alignFrmEditor.Child = egrp; break; } this.statusBarLabel1.Text = tp.ToString(); } else { } }