using NodeNetwork.ViewModels;
namespace NodeNetwork.Toolkit.Group
{
///
/// Facilitates connections between nodes outside and inside a group.
/// This is performed by having inputs on the group node (in the supernet) that map to outputs on (mostly) the EntranceNode in the subnet.
/// Likewise, outputs of the group node map to inputs on (mostly) the ExitNode in the subnet.
///
public abstract class NodeGroupIOBinding
{
///
/// Node in the parent network that represents the group.
///
public NodeViewModel GroupNode { get; }
///
/// Inlet node in the subnet.
/// Although this generally contains only outputs, this may contain inputs if their orientation is flipped.
///
public NodeViewModel EntranceNode { get; }
///
/// Outlet node in the subnet.
/// Although this generally contains only outputs, this may contain inputs if their orientation is flipped.
///
public NodeViewModel ExitNode { get; }
///
/// Parent network that contains the GroupNode.
///
public NetworkViewModel SuperNetwork => GroupNode.Parent;
///
/// Child network, contained in SuperNetwork, that contains the group member nodes (like the EntranceNode and ExitNode).
///
public NetworkViewModel SubNetwork => ExitNode.Parent;
public NodeGroupIOBinding(NodeViewModel groupNode, NodeViewModel entranceNode, NodeViewModel exitNode)
{
GroupNode = groupNode;
EntranceNode = entranceNode;
ExitNode = exitNode;
}
///
/// Given the output in the subnet, return the corresponding input on the groupnode in the supernet.
///
public abstract NodeInputViewModel GetGroupNodeInput(NodeOutputViewModel subnetInlet);
///
/// Given the input on the group node in the supernet, return the corresponding output in the subnet.
///
public abstract NodeOutputViewModel GetSubnetInlet(NodeInputViewModel entranceInput);
///
/// Given the output on the group node in the supernet, return the corresponding input in the subnet.
///
public abstract NodeInputViewModel GetSubnetOutlet(NodeOutputViewModel groupNodeOutput);
///
/// Given the input in the subnet, return the corresponding output on the groupnode in the supernet.
///
public abstract NodeOutputViewModel GetGroupNodeOutput(NodeInputViewModel subnetOutlet);
///
/// Create and add a new input to the group node, along with a corresponding output in the subnet (e.g. on the entrance node).
///
/// Output viewmodel that should match the new input on the group node.
///
public abstract NodeInputViewModel AddNewGroupNodeInput(NodeOutputViewModel candidateOutput);
///
/// Create and add a new input to the group node, along with a corresponding output in the subnet (e.g. on the entrance node).
///
/// Input viewmodel that should match the new output that is added to the subnet.
public abstract NodeOutputViewModel AddNewSubnetInlet(NodeInputViewModel candidateInput);
///
/// Create and add a new output to the group node, along with a corresponding input in the subnet (e.g. on the exit node).
///
/// Input viewmodel that should match the new output on the group node.
public abstract NodeOutputViewModel AddNewGroupNodeOutput(NodeInputViewModel candidateInput);
///
/// Create and add a new output to the group node, along with a corresponding input in the subnet (e.g. on the exit node).
///
/// Output viewmodel that should match the new input that is added to the subnet.
public abstract NodeInputViewModel AddNewSubnetOutlet(NodeOutputViewModel candidateOutput);
}
}