OSDN Git Service

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