Beispiel #1
0
        public OutputConnector AddOutput(string name, ReadOnlySpan <int> dimensions)
        {
            var conn = new OutputConnector(name, dimensions, this);

            _outputConnectors.Add(conn);
            return(conn);
        }
Beispiel #2
0
        public Connection SetConnection(OutputConnector from)
        {
            if (!from.Dimensions.SequenceEqual(Dimensions))
            {
                throw new InvalidOperationException("Dimensions must be equal.");
            }

            if (Connection != null)
            {
                if (Connection.From == from)
                {
                    return(Connection);
                }
                else
                {
                    ClearConnection();
                }
            }

            Connection = new Connection(from, this);
            from.AddConnection(this);
            return(Connection);
        }
Beispiel #3
0
 public Connection(OutputConnector from, InputConnector to)
 {
     From = from ?? throw new ArgumentNullException(nameof(from));
     To   = to ?? throw new ArgumentNullException(nameof(to));
 }