public override int CalculateState(Person person, State newState, StateTriggers triggers, int day)
        {
            if (triggers.WorkedOnPreviousDay)
            {
                return(person.State.PossibleFutureWorkDayCount - 1);
            }

            return(CalculatePossibleFutureWorkDayCount(person, day));
        }
Example #2
0
        public void RefreshState(Person person, int day)
        {
            var triggers = new StateTriggers(person, day);
            var newState = new State();

            _refreshState(person, newState, triggers, day);

            person.State = newState;
        }
Example #3
0
        public override int CalculateState(Person person, State newState, StateTriggers triggers, int day)
        {
            if (person.Assignments.LatestRound.TryGetValue(day - 1, out var assignment))
            {
                return(person.State.TotalWorkTime + assignment.Shift.Duration);
            }

            return(person.State.TotalWorkTime);
        }
        public override int CalculateState(Person person, State newState, StateTriggers triggers, int day)
        {
            if (!_calendar.IsMonday(day))
            {
                return(person.State.WorkedWeekendCount);
            }

            return(WorkedOnWeekendInThisRound(person, day)
                ? person.State.WorkedWeekendCount + 1
                : person.State.WorkedWeekendCount);
        }
        public override bool CalculateState(Person person, State newState, StateTriggers triggers, int day)
        {
            if (person.State.WorkedOnWeeked)
            {
                return(true);
            }

            return(_calendar.IsSunday(day) || _calendar.IsMonday(day)
                ? person.Assignments.LatestRound.ContainsKey(day - 1)
                : person.State.WorkedOnWeeked);
        }
 object IStateCalculator.CalculateState(Person person, State newState, StateTriggers triggers, int day) => CalculateState(person, newState, triggers, day);
 public abstract T CalculateState(Person person, State newState, StateTriggers triggers, int day);
        public override Dictionary <Shift, int> CalculateState(Person person, State newState, StateTriggers triggers, int day)
        {
            if (!person.Assignments.LatestRound.TryGetValue(day - 1, out var previousAssignment))
            {
                return(person.State.ShiftWorkedCount);
            }

            person.State.ShiftWorkedCount.TryGetValue(previousAssignment.Shift, out var shiftWorkedCount);
            person.State.ShiftWorkedCount[previousAssignment.Shift] = shiftWorkedCount + 1;

            return(person.State.ShiftWorkedCount);
        }
Example #9
0
 public override int CalculateState(Person person, State newState, StateTriggers triggers, int day)
 {
     return(person.Assignments.AllRounds.ContainsKey(day - 1)
         ? person.State.ConsecutiveWorkDayCount + 1
         : 0);
 }
 public override int CalculateState(Person person, State newState, StateTriggers triggers, int day)
 {
     return(triggers.WorkedOnPreviousDay
         ? 0
         : person.State.ConsecutiveDayOffCount + 1);
 }