Esempio n. 1
0
        public void Unregister(ICFU cfu)
        {
            var toRemove = ChildCollection.Where(x => x.Value.Equals(cfu)).Select(x => x.Key).ToList(); //ToList required, as we remove from the source

            foreach (var key in toRemove)
            {
                ChildCollection.Remove(key);
            }

            machine.UnregisterAsAChildOf(this, cfu);
        }
Esempio n. 2
0
        public void Register(ICFU cfu, NumberRegistrationPoint <int> registrationPoint)
        {
            var isRegistered = ChildCollection.Where(x => x.Value.Equals(cfu)).Select(x => x.Key).ToList();

            if (isRegistered.Count != 0)
            {
                throw new RegistrationException("Can't register the same CFU twice.");
            }
            else if (ChildCollection.ContainsKey(registrationPoint.Address))
            {
                throw new RegistrationException("The specified registration point is already in use.");
            }

            ChildCollection.Add(registrationPoint.Address, cfu);
            machine.RegisterAsAChildOf(this, cfu, registrationPoint);
            cfu.ConnectedCpu = this;
        }
Esempio n. 3
0
 public IEnumerable <NumberRegistrationPoint <int> > GetRegistrationPoints(ICFU cfu)
 {
     return(ChildCollection.Keys.Select(x => new NumberRegistrationPoint <int>(x)));
 }