示例#1
0
        public Transporter(IConnector connector, Ticker ticker, int length, Rate rate, int speed)
        {
            this.connector = connector;
            this.length    = length;
            this.rate      = rate;
            this.speed     = speed;
            this.ticker    = ticker;

            if (!(connector.Downstream is IProcessor p))
            {
                throw new Exception("transporter must connect a downstream IProcessor");
            }
            filter = p.Filter;

            if (!(connector.Upstream is IBuffer i) || !(connector.Downstream is IBuffer o))
            {
                throw new Exception("transporter input and output must both be IBuffer");
            }
            input  = i;
            output = o;

            ticker.Tick       += Tick;
            connector.Deleted += Deleted;
        }
示例#2
0
 public Processor(IProcess p, Ticker t, int maxUpstream, int maxDownstream) : base(new Node(maxUpstream, maxDownstream), t, p.Filter, p.Rate)
 {
     input   = new Buffer();
     process = p;
 }
示例#3
0
 public Source(Shape shape, Rate r, Ticker t, int maxDownstream) : base(new Node(0, maxDownstream), t, Filter.AllowAll(), r)
 {
     this.shape = shape;
 }
示例#4
0
 public Sink(Score score, Filter f, Rate r, Ticker t, int maxUpstream) : base(new Node(maxUpstream, 0), t, f, r)
 {
     score.RegisterSink(this);
 }