public virtual void Remove(T t)
 {
     StackSet.Remove(t);
 }
        public void RemoveNode(Id nodeId, bool connectParentsWithChilds, bool removeEdges = true)
        {
            // e.g. A -> B --> C, B is removed

            IGraphNode graphNode = _nodes.GetById(nodeId);

            if (graphNode == null)
            {
                // node doesn't exists
                throw new MrpRunException($"Given node ({graphNode}) doesn't exists in graph.");
            }

            // holds A
            GraphNodes predecessors = graphNode.GetPredecessors();
            // holds C
            GraphNodes successors = graphNode.GetSuccessors();

            if (connectParentsWithChilds)
            {
                foreach (var predecessor in predecessors)
                {
                    // predecessor is A

                    // remove edge A -> B
                    predecessor.RemoveSuccessor(graphNode);
                    // add edge A -> C
                    predecessor.AddSuccessors(successors);
                }

                foreach (var successor in successors)
                {
                    // successor is C

                    // remove edge B -> C
                    successor.RemovePredecessor(graphNode);
                    // add edge A -> C
                    successor.AddPredecessors(predecessors);
                }
            }
            else if (removeEdges)
            {
                foreach (var predecessor in predecessors)
                {
                    // predecessor is A

                    // remove edge A -> B
                    predecessor.RemoveSuccessor(graphNode);
                }

                foreach (var successor in successors)
                {
                    // successor is C

                    // remove edge B -> C
                    successor.RemovePredecessor(graphNode);
                }
            }

            // remove node
            _nodes.Remove(graphNode);
        }
 public void RemovePredecessor(IGraphNode node)
 {
     _predecessors.Remove(node);
 }
Ejemplo n.º 4
0
 public void PurchaseOrderDelete(T_PurchaseOrder purchaseOrder)
 {
     _purchaseOrders.Remove(purchaseOrder);
 }
 public void RemoveSuccessor(IGraphNode node)
 {
     _successors.Remove(node);
 }