///  <summary>
        /// Check if the given port is a valid connection.
        /// An error message will be set if the connection is not valid.
        /// </summary>
        /// <param name="other">Check if this port is a valid connectionPort.</param>
        /// <param name="error">The error message if it's not a valid connection.</param>
        /// <returns>Returns true if the given port is a valid connectionPort.</returns>
        bool IsValidConnection(ConnectionPort other, out string error)
        {
            if (node == other.node)
            {
                error = "Cannot connect to the same node.";
                return(false);
            }

            if (ArrayUtility.Contains(m_connectedPorts, other))
            {
                error = "This Port is already connected with the given.";
                return(false);
            }

            if (direction == other.direction)
            {
                error = "Cannot connect to the same port direction: [" + direction + " -> " + other.direction + "].";
                return(false);
            }

            if (m_capacity == Capacity.Single && hasConnections)
            {
                error = "The port [" + name + "] can only have one connection.";
                return(false);
            }

            if (m_allowedConnections.Length > 0)
            {
                bool isAllowedType = false;
                foreach (string typeName in m_allowedConnections)
                {
                    Type type = Type.GetType(typeName);

                    if (other.node.GetType() == type || other.node.GetType().IsSubclassOf(type))
                    {
                        isAllowedType = true;
                        break;
                    }
                }

                if (!isAllowedType)
                {
                    error = "[" + other.name + "] is not an allowed node";
                    return(false);
                }
            }

            if (!node.IsValidConnection(this, other, out error))
            {
                return(false);
            }

            error = "";
            return(true);
        }
 /// <summary>
 /// Returns true if the node parameter exists in this controller.
 /// </summary>
 internal bool ContainsNodeParameter(NodeParameter parameter)
 {
     return(ArrayUtility.Contains(m_nodeParameters, parameter));
 }
 /// <summary>
 /// Returns true if the exposed parameter exists in this controller.
 /// </summary>
 internal bool ContainsExposedParameter(ExposedParameter parameter)
 {
     return(ArrayUtility.Contains(m_exposedParameters, parameter));
 }