Ejemplo n.º 1
0
        internal void InternalRemoveNodeConnectionRequest(PointerDCN <T> typedTargetNode, ConnectionDirection direction)
        {
            switch (direction)
            {
            case ConnectionDirection.To:
                connectedToNodesList.Remove(typedTargetNode);
                break;

            case ConnectionDirection.From:
                connectedFromNodesList.Remove(typedTargetNode);
                break;

            case ConnectionDirection.Both:
                connectedToNodesList.Remove(typedTargetNode);
                connectedFromNodesList.Remove(typedTargetNode);
                break;

            case ConnectionDirection.Any:
                connectedToNodesList.Remove(typedTargetNode);
                connectedFromNodesList.Remove(typedTargetNode);
                break;

            default:
                throw new NonExistentEnumCaseException <ConnectionDirection>(); //ncrunch: no coverage
            }
        }
Ejemplo n.º 2
0
        private void AddConnectionWith(PointerDCN <T> typedNode, ConnectionDirection direction)
        {
            Helpers <T> .Verify_AddConnectionWith_ConditionsAreSatisfied(typedNode, this);

            this.InternalAddNodeConnectionRequest(typedNode, direction);
            typedNode.InternalAddNodeConnectionRequest(this, direction.Invert());
        }
Ejemplo n.º 3
0
        private void RemoveConnectionWith(PointerDCN <T> typedNode, ConnectionDirection direction)
        {
            if (Helpers <T> .CheckWhether_RemoveConnectionWith_IsNeeded(typedNode, this))
            {
                return;
            }

            this.InternalRemoveNodeConnectionRequest(typedNode, direction);
            typedNode.InternalRemoveNodeConnectionRequest(this, direction.Invert());
        }
Ejemplo n.º 4
0
        internal void InternalAddNodeConnectionRequest(PointerDCN <T> typedTargetNode, ConnectionDirection direction)
        {
            switch (direction)
            {
            case ConnectionDirection.To:
                if (!connectedToNodesList.Contains(typedTargetNode))
                {
                    connectedToNodesList.Add(typedTargetNode);
                }
                break;

            case ConnectionDirection.From:
                if (!connectedFromNodesList.Contains(typedTargetNode))
                {
                    connectedFromNodesList.Add(typedTargetNode);
                }
                break;

            case ConnectionDirection.Both:
                if (!connectedToNodesList.Contains(typedTargetNode))
                {
                    connectedToNodesList.Add(typedTargetNode);
                }
                if (!connectedFromNodesList.Contains(typedTargetNode))
                {
                    connectedFromNodesList.Add(typedTargetNode);
                }
                break;

            case ConnectionDirection.Any:
                throw new InvalidOperationException("May not specify 'Any' Connection Direction when adding a new Connection.");

            default:
                throw new NonExistentEnumCaseException <ConnectionDirection>(); //ncrunch: no coverage
            }
        }
Ejemplo n.º 5
0
 internal void InternalAddNodeRequest(PointerDCN <T> targetNode)
 {
     pointerNodes.Add(targetNode);
 }
Ejemplo n.º 6
0
        //void IDirectedConnectedNodeCollection<T>.AddNodeWithConnectionsToFrom(IDirectedConnectedNode<T> newNode, IEnumerable<IDirectedConnectedNode<T>> connectToNodes, IEnumerable<IDirectedConnectedNode<T>> connectFromNodes)
        //{
        //  (this as IDirectedConnectedNodeCollection<T>).AddNode(newNode);

        //  foreach( PointerDCN<T> toNode in connectToNodes)
        //  { (this as IDirectedConnectedNodeCollection<T>).ConnectNodesDirected(newNode, toNode); }

        //  foreach( PointerDCN<T> fromNode in connectFromNodes)
        //  { (this as IDirectedConnectedNodeCollection<T>).ConnectNodesDirected(fromNode, newNode); }
        //}

        //void IDirectedConnectedNodeCollection<T>.AddNodeWithConnectionsToFrom(IDirectedConnectedNode<T> newNode, IDirectedConnectedNode<T> connectToNode, IEnumerable<IDirectedConnectedNode<T>> connectFromNodes)
        //{
        //  (this as IDirectedConnectedNodeCollection<T>).AddNodeWithConnectionsToFrom(newNode, new[]{connectToNode}, connectFromNodes);
        //}

        //void IDirectedConnectedNodeCollection<T>.AddNodeWithConnectionsToFrom(IDirectedConnectedNode<T> newNode, IEnumerable<IDirectedConnectedNode<T>> connectToNodes, IDirectedConnectedNode<T> connectFromNode)
        //{
        //  (this as IDirectedConnectedNodeCollection<T>).AddNodeWithConnectionsToFrom(newNode, connectToNodes, new[]{connectFromNode});
        //}

        //void IDirectedConnectedNodeCollection<T>.AddNodeWithConnectionsToFrom(IDirectedConnectedNode<T> newNode, IDirectedConnectedNode<T> connectToNode, IDirectedConnectedNode<T> connectFromNode)
        //{
        //  (this as IDirectedConnectedNodeCollection<T>).AddNodeWithConnectionsToFrom(newNode, new[]{connectToNode}, new[]{connectFromNode});
        //}
        #endregion

        #region Internal Methods For Local-Only operations. No verification.
        internal void InternalRemoveNodeRequest(PointerDCN <T> targetNode)
        {
            pointerNodes.Remove(targetNode);
        }