public void SetLampMode(int lampIndex, ILampState lampMode)
        {
            if (lampIndex < 0 || lampIndex > (TotalLampsCount - 1))
            {
                throw new ArgumentOutOfRangeException("lampIndex");
            }

            if (lampMode != LampModes.LAMP_OFF && lampMode != LampModes.LAMP_YELLOW && lampMode != LampModes.LAMP_RED)
            {
                throw new ArgumentOutOfRangeException("lampMode");
            }

            _lamps[lampIndex] = lampMode;
        }
Exemple #2
0
 internal void ChangeState(ILampState newState)
 {
     _state = newState;
     _state.OnEnter(this);
 }
Exemple #3
0
 public Lamp(string name)
 {
     Name   = name;
     _state = new LampOffState();
     _numOfTimesTurnedOn = 0;
 }
Exemple #4
0
 public void SetLampState(ILampState lampState)
 {
     LampState = lampState;
 }