Debian Codegraph @

src/plugins/schedulers/tj/taskjuggler/TaskScenario.h

raw
1 /*
2 * TaskScenario.h - TaskJuggler
3 *
4 * SPDX-FileCopyrightText: 2002 Chris Schlaeger <[email protected]>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
9 *
10 * $Id$
11 */
12
13 #ifndef _TaskScenario_h_
14 #define _TaskScenario_h_
15
16 #include <time.h>
17
18 #include "ResourceList.h"
19
20 namespace TJ
21 {
22
23 class Task;
24 class Resource;
25
26 class TaskScenario
27 {
28 friend class Task;
29 friend class TaskList;
30 public:
31 TaskScenario();
32 ~TaskScenario() { }
33
34 void setStart(time_t s) { start = s; }
35 void setEnd(time_t e) { end = e; }
36 void setMaxEnd(time_t e) { maxEnd = e; }
37 void setMinEnd(time_t e) { minEnd = e; }
38 void setMaxStart(time_t s) { maxStart = s; }
39 void setMinStart(time_t s) { minStart = s; }
40
41 bool isStartOk() const
42 {
43 return !((minStart > 0 && minStart > start) ||
44 (maxStart > 0 && start > maxStart));
45 }
46 bool isEndOk() const
47 {
48 return !((minEnd > 0 && (end < minEnd)) ||
49 (maxEnd > 0 && (end > maxEnd)));
50 }
51
52 void calcCompletionDegree(time_t now);
53
54 bool isDutyOf(const Resource* r) const;
55
56 ResourceListIterator getBookedResourcesIterator() const
57 {
58 return ResourceListIterator(bookedResources);
59 }
60
61 private:
62 /// Pointer to the corresponding task.
63 Task* task;
64
65 /// Index of the scenario
66 int index;
67
68 /// Time the user has specified as a start time.
69 time_t specifiedStart;
70
71 /// Time the user has specified as an end time.
72 time_t specifiedEnd;
73
74 /// Time when the task starts
75 time_t start;
76
77 /// Time when the task ends
78 time_t end;
79
80 /// Earliest day when the task should start
81 time_t minStart;
82
83 /// Latest day when the task should start
84 time_t maxStart;
85
86 /// Earliest day when the task should end
87 time_t minEnd;
88
89 /// Latest day when the task should end
90 time_t maxEnd;
91
92 /* Specifies how many percent the task start can be delayed but still
93 * finish in time if all goes well. This value is for documentation
94 * purposes only. It is not used for task scheduling. */
95 double startBuffer;
96
97 /* Specifies how many percent the task can be finished earlier if
98 * all goes well. This value is for documentation purposes only. It is
99 * not used for task scheduling. */
100 double endBuffer;
101
102 /// Time when the start buffer ends.
103 time_t startBufferEnd;
104
105 /// Time when the end buffer starts.
106 time_t endBufferStart;
107
108 /// The duration of the task (in calendar days).
109 double duration;
110
111 /// The length of the task (in working days).
112 double length;
113
114 /// The effort of the task (in resource-days).
115 double effort;
116
117 /// Amount that is credited to the account at the start date.
118 double startCredit;
119
120 /// Amount that is credited to the account at the end date.
121 double endCredit;
122
123 /** Measure for the likelihood that the tasks gets the allocated
124 * resources. */
125 double criticalness;
126
127 /** Measure for the criticalness of the task chain. This value is computed
128 * prior to scheduling. It's in fact used to improve the scheduling
129 * result. But it should not be confused with the critical path of the
130 * final result. */
131 double pathCriticalness;
132
133 /** Contrary to the previous criticalness related values this is the
134 * result of the post-scheduling analysis. */
135 bool isOnCriticalPath;
136
137 /// User specified percentage of completion of the task
138 double reportedCompletion;
139
140 /* Container tasks can have an indirect reported completion. This is based
141 * on reported completions and calculated completions of their subtasks.
142 * This value is only valid for container tasks. */
143 double containerCompletion;
144
145 /// Calculated completion degree
146 double completionDegree;
147
148 /// Status that the task is in (according to 'now' date)
149 TaskStatus status;
150
151 /// A longer description of the task status.
152 QString statusNote;
153
154 /**
155 * true if the user has specified the task for the scenario as already
156 * fully scheduled.
157 */
158 bool specifiedScheduled;
159
160 /// true if the task has been completely scheduled.
161 bool scheduled;
162
163 /**
164 * This following variables are used to cache the result whether or not
165 * the start/end of this task can be determined. They are determined once
166 * and possible the value is used later on as the determination of once
167 * task can depend on another task.
168 */
169 bool startCanBeDetermined;
170 bool endCanBeDetermined;
171
172 /// List of specified booked resources.
173 ResourceList specifiedBookedResources;
174
175 /// List of booked resources.
176 ResourceList bookedResources;
177
178 /**
179 * This list stores pointers to the task that have been found to be
180 * critical followers.
181 */
182 QList<Task*> criticalLinks;
183 } ;
184
185 } // namespace TJ
186
187 #endif