Exemplo n.º 1
0
            /// <summary>
            /// Convenience method to check if all connected children are accepted.
            /// </summary>
            /// <param name="children">The children we want to adopt.</param>
            /// <returns>Returns if the connector will accept the children.</returns>
            public bool AcceptsChildren(Connector conn)
            {
                List <Type> children = new List <Type>(conn.ChildCount);

                for (int i = 0; i < conn.ChildCount; ++i)
                {
                    BaseNode node = conn.GetChild(i);

                    // if the owner itself is part of the list we ignore him
                    if (node == Owner)
                    {
                        continue;
                    }

                    children.Add(node.GetType());
                }

                return(AcceptsChildren(children));
            }
Exemplo n.º 2
0
            /// <summary>
            /// Checks if a node can be adopted by this one.
            /// </summary>
            /// <param name="child">The node we want to adopt.</param>
            /// <returns>Returns true if this node can adopt the given child.</returns>
            public bool CanAdoptNode(BaseNode child)
            {
                Connector connector = (child != null && child.ParentConnector != null) ? GetConnector(child.ParentConnector.Identifier) : null;

                return((connector != null) ? connector.AcceptsChild(child.GetType()) : false);
            }
 /// <summary>
 /// Checks if a node can be adopted by this one.
 /// </summary>
 /// <param name="child">The node we want to adopt.</param>
 /// <returns>Returns true if this node can adopt the given child.</returns>
 public bool CanAdoptNode(BaseNode child)
 {
     Connector connector = (child != null && child.ParentConnector != null) ? GetConnector(child.ParentConnector.Identifier) : null;
     return (connector != null) ? connector.AcceptsChild(child.GetType()) : false;
 }