Пример #1
0
        /// コンストラクタ
        public Gear(IGearHolder holder)
        {
            _holder        = holder;
            _childGearList = new List <Gear>();
            _diffuser      = new Diffuser(this);

            _phase = GearPhase.Create;

            _preparationDispatcher = new GearDispatcher(AddBehavior.MethodType.addTail, true, new PosInfos());
            _startDispatcher       = new GearDispatcher(AddBehavior.MethodType.addTail, true, new PosInfos());
            _endDispatcher         = new GearDispatcher(AddBehavior.MethodType.addHead, true, new PosInfos());
        }
Пример #2
0
 private void Dispose(bool isDisposing)
 {
     if (!_disposed)
     {
         if (isDisposing)
         {
             _holder = null;
             _parent = null;
             _instanceClassDictionary.Clear();
         }
         _disposed = true;
     }
 }
Пример #3
0
 /// クラス名で指定したインスタンスを取得(親にさかのぼりながら探索する)
 private T GetWithClassName <T>(string className, Diffuser startDiffuser, PosInfos pos)
 {
     if (_instanceClassDictionary.ContainsKey(className))
     {
         /// 自分がそのクラスのインスタンスを保持していれば返す
         return((T)_instanceClassDictionary[className]);
     }
     else
     {
         /// ないので親に聞いてみる
         if (_parent == null)
         {
             /// 親なしなので見つからない
             throw new Exception(string.Format("指定されたクラス{0}は{1}のDiffuserに登録されていません。;pos={2}", className, startDiffuser._holder, pos));
         }
         return(_parent.GetWithClassName <T>(className, startDiffuser, pos));
     }
 }
Пример #4
0
 /// 親のdiffuserの登録
 public void SetParent(Diffuser parent)
 {
     _parent = parent;
 }
Пример #5
0
 /// コンストラクタ
 public Diffuser(object holder)
 {
     _holder = holder;
     _parent = null;
     _instanceClassDictionary = new Dictionary <string, object>();
 }