コード例 #1
0
        private void RestoreDetachedPort()
        {
            if (m_DetachedFromInputPort)
            {
                m_Edge.input = m_DetachedPort;

                m_DetachedPort.Connect(m_Edge);
            }
            else
            {
                m_Edge.output = m_DetachedPort;

                m_DetachedPort.Connect(m_Edge);
            }
        }
コード例 #2
0
        public T ConnectTo <T>(Port other) where T : Edge, new()
        {
            if (other == null)
            {
                throw new ArgumentNullException("Port.ConnectTo<T>() other argument is null");
            }

            if (other.direction == this.direction)
            {
                throw new ArgumentException("Cannot connect two ports with the same direction");
            }

            var edge = new T();

            edge.output = direction == Direction.Output ? this : other;
            edge.input  = direction == Direction.Input ? this : other;

            this.Connect(edge);
            other.Connect(edge);

            return(edge);
        }