예제 #1
0
 public void DoClock(Context context, int hour)
 {
     if (hour < 9 || 17 <= hour)
     {
         context.ChangeState(NightState.GetInstance());
     }
     else if (9 <= hour && hour < 12 || 13 <= hour && hour < 17)
     {
         context.ChangeState(DayState.GetInstance());
     }
 }
예제 #2
0
 public void DoClock(Context context, int hour)
 {
     if (hour < 9 || 17 <= hour)
     {
         context.ChangeState(NightState.GetInstance());
     }
     else if (12 <= hour && hour < 13)
     {
         context.ChangeState(NoonState.GetInstance());
     }
 }