Example #1
0
 public void Link(params LinkDef[] def)
 {
     foreach (var d in def)
     {
         Clay.Connect(this, d.Clay, d.ConnectPoint, d.ConnectPoint);
     }
 }
Example #2
0
 public override void Disconnect(Clay withClay, object atConnectPoint)
 {
     if (_contacts.ContainsKey(atConnectPoint) && _contacts[atConnectPoint] == withClay)
     {
         _contacts.Remove(atConnectPoint);
     }
 }
Example #3
0
        public override void Connect(Clay withClay, object atConnectPoint)
        {
            var agr = (Agreement as SAgreement);

            if (agr._links.ContainsKey(atConnectPoint))
            {
                agr._links[atConnectPoint].Link(new LinkDef(withClay, atConnectPoint));
                base.Connect(withClay, atConnectPoint);
            }
        }
Example #4
0
 public object this[object cp] {
     get {
         return(myClay.Recall(cp));
     }
     set {
         if (myClay._contacts.ContainsKey(cp))
         {
             Clay.Vibrate(myClay._contacts[cp], cp, value, myClay);
         }
     }
 }
Example #5
0
        public override void Connect(Clay withClay, object atConnectPoint)
        {
            if (withClay is Conduit)
            {
                var c = _contacts.FirstOrDefault(x => x.Clay == withClay);
                if (c != null)
                {
                    return;
                }
            }

            _contacts.Add(new Contact(withClay, atConnectPoint));
        }
Example #6
0
        protected override void OnSignal(Clay fromClay, object atConnectPoint, object signal)
        {
            var valid = _contacts.Contains(new Contact(fromClay, atConnectPoint));

            if (valid)
            {
                foreach (var c in _contacts)
                {
                    if (!c.ConnectPoint.Equals(atConnectPoint) || c.Clay != fromClay)
                    {
                        if ((Agreement as CAgreement).ParallelTrx)
                        {
                            Task.Run(() => Clay.Vibrate(c.Clay, c.ConnectPoint, signal, this));
                        }
                        else
                        {
                            Clay.Vibrate(c.Clay, c.ConnectPoint, signal, this);
                        }
                    }
                }
            }
        }
Example #7
0
        protected override void OnSignal(Clay fromClay, object atConnectPoint, object signal)
        {
            if (++_one == 1)
            {
                OnInit();
            }
            lock (_locker)
            {
                if (_contacts.ContainsKey(atConnectPoint) &&
                    _contacts[atConnectPoint] == fromClay && IsValidSensorPoint(atConnectPoint))
                {
                    SetSignal(atConnectPoint, signal);
                    if (IsAllSignalsReady())
                    {
                        if ((Agreement as RAgreement).IsStaged)
                        {
                            _collected.Clear();
                        }

                        OnResponse(atConnectPoint);
                    }
                }
            }
        }
Example #8
0
 public Contact(Clay clay, object connectPoint)
 {
     Clay         = clay;
     ConnectPoint = connectPoint;
 }
Example #9
0
 public static void Connect(Clay clay1, Clay clay2, object atCp1, object atCp2 = null)
 {
     clay1.Connect(clay2, atCp1);
     clay2.Connect(clay1, atCp2 == null ? atCp1 : atCp2);
 }
Example #10
0
 internal static void Vibrate(Clay clay, object atConnectPoint, object signal, Clay srcClay)
 {
     clay.OnSignal(srcClay, atConnectPoint, signal);
 }
Example #11
0
 protected abstract void OnSignal(Clay fromClay, object atConnectPoint, object signal);
Example #12
0
 public abstract void Disconnect(Clay withClay, object atConnectPoint);
Example #13
0
 public LinkDef(Clay clay, object cp)
 {
     Clay         = clay;
     ConnectPoint = cp;
 }
Example #14
0
 public override void Connect(Clay withClay, object atConnectPoint)
 {
     _contacts[atConnectPoint] = withClay;
 }
Example #15
0
 public void Link(LinkDef def)
 {
     Clay.Connect(this, def.Clay, def.ConnectPoint, def.ConnectPoint);
 }
Example #16
0
 public override void Disconnect(Clay withClay, object atConnectPoint)
 {
     _contacts.Remove(new Contact(withClay, atConnectPoint));
 }