public InputConnector AddInput(string name, ReadOnlySpan <int> dimensions) { var conn = new InputConnector(name, dimensions, this); _inputConnectors.Add(conn); return(conn); }
public Connection AddConnection(InputConnector to) { var conn = _connections.FirstOrDefault(o => o.To == to); if (conn != null) { return(conn); } conn = new Connection(this, to); _connections.Add(conn); to.SetConnection(this); //if (_connections.Count > 1) // throw new InvalidOperationException(); return(conn); }
public Connection(OutputConnector from, InputConnector to) { From = from ?? throw new ArgumentNullException(nameof(from)); To = to ?? throw new ArgumentNullException(nameof(to)); }
public void RemoveConnection(InputConnector to) { _connections.RemoveAll(o => o.To == to); to.ClearConnection(); }