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; }
internal void ChangeState(ILampState newState) { _state = newState; _state.OnEnter(this); }
public Lamp(string name) { Name = name; _state = new LampOffState(); _numOfTimesTurnedOn = 0; }
public void SetLampState(ILampState lampState) { LampState = lampState; }