Пример #1
0
bool
ShiftSelectionList::insert(ShiftSelection* s)
{
    for (ShiftSelectionList::Iterator ssli(*this); ssli.hasNext();)
        if (ssli.next()->getPeriod().overlaps(s->getPeriod()))
            return false;
    append(s);
    return true;
}
Пример #2
0
bool
ShiftSelectionList::isVacationDay(time_t day) const
{
    for (ShiftSelectionList::Iterator ssli(*this);
         ssli.hasNext() && day <= ssli.peekNext()->getPeriod().getEnd();)
        if (ssli.next()->isVacationDay(day))
            return true;
    return false;
}
bool
ShiftSelectionList::insert(ShiftSelection* s)
{
    for (ShiftSelectionList::Iterator ssli(*this); *ssli != 0; ++ssli)
        if ((*ssli)->getPeriod().overlaps(s->getPeriod()))
            return false;
    append(s);
    return true;
}
bool
ShiftSelectionList::isVacationDay(time_t day) const
{
    for (ShiftSelectionList::Iterator ssli(*this);
         *ssli != 0 && day <= (*ssli)->getPeriod().getEnd(); ++ssli)
        if ((*ssli)->isVacationDay(day))
            return true;
    return false;
}
bool
ShiftSelectionList::isOnShift(const Interval& iv) const
{
    /* Check whether any of the defined shift intervals contains the interval
     * 'iv'. If not return true. If it does, check whether the interval 'iv'
     * lies within the specified working hours. */
    for (ShiftSelectionList::Iterator ssli(*this); *ssli != 0; ++ssli)
        if ((*ssli)->getPeriod().contains(iv))
           return (*ssli)->getShift()->isOnShift(iv);
    return true;
}
Пример #6
0
bool
ShiftSelectionList::isOnShift(const Interval& iv) const
{
    /* Check whether any of the defined shift intervals contains the interval
     * 'iv'. If not return true. If it does, check whether the interval 'iv'
     * lies within the specified working hours. */
    for (ShiftSelectionList::Iterator ssli(*this); ssli.hasNext();) {
        ShiftSelection *s = ssli.next();
        if (s->getPeriod().contains(iv))
           return s->getShift()->isOnShift(iv);
    }
    return true;
}