Beispiel #1
0
 public void Update(ILampSwitchCentral s)
 {
     if (s.GetState().CurrentState)
     {
         Console.WriteLine("LampSwitch " + _id + ": On");
     }
     else
     {
         Console.WriteLine("LampSwitch " + _id + ": Off");
     }
 }
Beispiel #2
0
        public static ILampSwitchSupplier CreateProductFromFactory(string fac, ILampSwitchCentral lampSwitchCentral)
        {
            if (fac.Equals("C1"))
            {
                return(new ConcreteSwitch1(_id++, lampSwitchCentral));
            }
            if (fac.Equals("C2"))
            {
                return(new ConcreteSwitch2(_id++, lampSwitchCentral));
            }

            return(null);
        }
Beispiel #3
0
 public ConcreteSwitch2(int id, ILampSwitchCentral c) : base(id, c)
 {
 }
Beispiel #4
0
 public AbstractSwitch(int id, ILampSwitchCentral c)
 {
     Id          = id;
     LampCentral = c;
 }