![]() ![]() ![]() ![]() Gravitybox Schedule Primer
Page 85
1998-2004 Gravitybox Software LLC
Chapter 8
Conflicts
In scheduling, conflicts are a part of life. There will be many times when conflicts are
unavoidable. There may even be times when they are desirable. In any case, no
schedule would be complete without some sort of conflict handling.
What is a Conflict?
GbSchedule has a read-only collection named Conflicts.
The developer may not add any elements to the collection
nor may he remove any. When ScheduleItems are added to
a schedule, they may or may not conflict with other appointments on the schedule. After
an insert, the newly added object is checked, to verify whether it conflicts with any other
objects in the ScheduleItems collection. If it does, it is added to the Conflicts collection.
Any time that one of the appointments properties StartDate, Room, StartTime, or
Length is changed, the Conflicts collection is rechecked to determine whether the
appointment should be added or removed from the Conflicts collection. Only items that
should be in the Conflicts collection will be there. Since a change of any of many display
properties (IsEvent, Length, Room, StartDate, and StartTime) on an appointment could
cause the appointment to potentially conflict with another appointment, the
ScheduleItems collection must be checked for Conflicts after these property changes. If
the properties of a particular appointment are changed, the effect might not only
influence this appointment but others as well, since it takes at least two appointments to
conflict.
The Conflicts collection is located on the ScheduleItems collection object. It has no
properties and only a few methods. Its methods are defined in Table 8.1. There is only a
minimal amount of functionality needed, for this collection. Even though minimal, this
functionality still serves the needed purpose. The collection is actually a collection of
conflict groups. Each group object holds a collection of appointments. Each
ScheduleItem is in exactly one group. If there are no conflicts there will be one group for
each ScheduleItem. If there are N ScheduleItems, there are also N groups in the
Conflicts collection, when there are no conflicts. If there are ScheduleItems that conflict
with each another, they will be in the same conflict group. A group signifies a block of
appointments such that occupy a contiguous block of schedule space. All of the
appointments may not conflict with all others, but together as a group there is no free
space from the groups starting boundary to its end.
Table 8.1
Conflicts Collection Definition
Count
This method returns the number of objects in the Conflicts
collection. This number will be between 0 and N, where N is
Quick Tip
A conflict occurs when two or more
appointments share the same
scheduled space.
|