Esempio n. 1
0
 public static SleepMover getSleepMover()
 {
     if (s == null)
     {
         s = new SleepMover();
     }
     return(s);
 }
Esempio n. 2
0
        //end of calcWakeTime
        private void changeActiveState(DateTime currTime)
        {
            mLog.Debug("inside change active state");
            if (this.IsAsleep == true)
            {
                mLog.Debug("must be asleep");
                mLog.Debug("Waketime is " + this.WakeupTime.Date.ToShortDateString() + " " + this.WakeupTime.TimeOfDay.ToString());

                mLog.Debug("curr time is " + currTime.Date.ToShortDateString() + " " + currTime.TimeOfDay.ToString());
                if ((this.WakeupTime.Date < currTime.Date) || (this.WakeupTime.Date <= currTime.Date && this.WakeupTime.TimeOfDay <= currTime.TimeOfDay))
                {
                    this.IsAsleep = false;
                    mLog.Debug("time to wake up, I am going home = " + this.goingHome.ToString());
                    //Sunday, February 24, 2008
                    //had issues when going home, would stop to sleep and then
                    //forget he was going home
                    if (this.goingHome)
                    {
                        this.myMover = new DirectedMover();
                    }
                    else
                    {
                        this.myMover = RandomWCMover.getRandomWCMover();
                    }
                    mLog.Debug("my new mover is a type of " + this.myMover.GetType().ToString());
                    calcSleepTime();
                }
            }
            else
            {
                mLog.Debug("must be awake");
                mLog.Debug("Sleep time is " + this.SleepTime.Date.ToShortDateString() + " " + this.SleepTime.TimeOfDay.ToString());
                mLog.Debug("curr time is " + currTime.Date.ToShortDateString() + " " + currTime.TimeOfDay.ToString());
                if ((this.SleepTime.Date < currTime.Date) || (this.SleepTime.Date <= currTime.Date && this.SleepTime.TimeOfDay <= currTime.TimeOfDay))
                {
                    this.IsAsleep = true;
                    this.myMover  = SleepMover.getSleepMover();
                    mLog.Debug("time to go to sleep");
                    calcWakeTime();
                }
            }
        }