public static IEnumerable <IEdgeModel> GetConnectedEdges(IPortNodeModel self) { var graphModel = self.GraphModel; if (graphModel != null) { return(self.Ports.SelectMany(p => graphModel.GetEdgesConnections(p))); } return(Enumerable.Empty <IEdgeModel>()); }
/// <summary> /// Retrieves the ports of a node that satisfy the requested direction and type. /// </summary> /// <param name="self">The node for which to get the input ports.</param> /// <param name="direction">The direction of the ports to retrieve.</param> /// <param name="portType">The type of the ports to retrieve.</param> /// <returns>The input ports of the node that satisfy the requested direction and type.</returns> public static IEnumerable <IPortModel> GetPorts(this IPortNodeModel self, PortDirection direction, PortType portType) { return(self.Ports.Where(p => (p.Direction & direction) == direction && p.PortType == portType)); }