Пример #1
0
 /// <summary>
 ///   Инициализация нового экземпляра часов.
 ///   В начальный момент номер тика равен нулю, часы приостановлены.
 /// </summary>
 public BaseClock () {
     this.TickLength = 0;
     this.CurrentTick = 0;
     this.IsSuspended = false;
     this.tick_handlers = new Dictionary <ulong, IList <ulong>> ();
     this.cond_handlers = new Dictionary <Func <bool>, ulong> ();
     this.all_handlers = new Dictionary <ulong, ClockAction> ();
     this.id_gen = new UniqueIdGenerator ();
     this.syncRoot = new object ();
     this.startTime = new DateTime (1970, 1, 1, 0, 0, 0);
     this.disposed = false;
 }
Пример #2
0
        private void PrepareToSave()
        {
            this.engines = new Dictionary <ulong, IDeviceEngine> ();
            this.id_engines = new UniqueIdGenerator ();
            this.modules = new Dictionary <ulong, IModule> ();
            this.id_modules = new UniqueIdGenerator ();

            foreach (var device in this.devices.Values.Where (d => !this.engines.Values.Contains (d.Engine)))
                this.engines.Add (this.id_engines.GetNext (), device.Engine);

            foreach (var module in from engine in this.engines.Values
                                   from module in engine.Modules
                                   where !this.modules.Values.Contains (module)
                                   select module)
                this.modules.Add (this.id_modules.GetNext (), module);
        }
Пример #3
0
 private void InitializeGenerators()
 {
     this.id_devices = new UniqueIdGenerator (this.devices.Keys);
     this.id_interfaces = new UniqueIdGenerator (this.interfaces.Keys);
     this.id_backbones = new UniqueIdGenerator (this.backbones.Keys);
     this.id_modules = new UniqueIdGenerator (this.modules.Keys);
     this.id_engines = new UniqueIdGenerator (this.engines.Keys);
 }