private void AddNode(object o, EventArgs args) { BasicNode node = new BasicNode (Convert.ToInt32 (entries[0].Text), Convert.ToInt32 (entries[1].Text), 0); simulatorInterface.Nodes.AddNode (node); MainWindow.NodeStore.AppendValues (node.NodeId, node.TimeSlice); this.Destroy (); }
/// <summary> /// Used to create a copy of an existing node /// </summary> /// <param name="N"> /// A <see cref="BasicNode"/> /// </param> public BasicNode(BasicNode N) { this.NodeId = N.NodeId; this.TimeSlice = N.TimeSlice; this.Status = N.Status; this.ActualTimeSlice = N.ActualTimeSlice; this.LastScheduled = N.LastScheduled; this.Override = N.Override; }
/// <summary> /// Used to add a node to the list. /// </summary> /// <param name="node"> /// A <see cref="BasicNode"/> /// </param> /// <returns> /// A <see cref="System.Boolean"/> /// </returns> public bool AddNode(BasicNode node) { bool result = true; if (this.Nodes.Count == 0) { this.MaxNodeId = 0; } if (!(this.Nodes.Contains (node))) { this.MaxNodeId++; node.NodeId = this.MaxNodeId; this.Nodes.Add (node); } else { result = false; } return result; }
/// <summary> /// Removes the specified node from the list /// </summary> /// <param name="node"> /// A <see cref="BasicNode"/> /// </param> /// <returns> /// A <see cref="System.Boolean"/> /// </returns> public bool RemoveNode(BasicNode node) { bool result = true; if (this.Nodes.Contains (node)) { if (node.NodeId == this.MaxNodeId) { this.MaxNodeId--; } this.Nodes.Remove (node); result = true; } else { result = false; } return result; }