| 1 |
/* |
| 2 |
* task.h - TaskJuggler |
| 3 |
* |
| 4 |
* Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 |
| 5 |
* Chris Schlaeger <[email protected]> |
| 6 |
* SPDX-FileCopyrightText: 2011 Dag Andersen <[email protected]> |
| 7 |
* |
| 8 |
* This program is free software; you can redistribute it and/or modify |
| 9 |
* it under the terms of version 2 of the GNU General Public License as |
| 10 |
* published by the Free Software Foundation. |
| 11 |
* |
| 12 |
* $Id$ |
| 13 |
*/ |
| 14 |
|
| 15 |
#ifndef _Task_h_ |
| 16 |
#define _Task_h_ |
| 17 |
|
| 18 |
#include "plantj_export.h" |
| 19 |
|
| 20 |
// #include <config.h> |
| 21 |
|
| 22 |
#include <stdarg.h> |
| 23 |
|
| 24 |
#include <QDomDocument> |
| 25 |
|
| 26 |
#include "debug.h" |
| 27 |
#include "TaskList.h" |
| 28 |
#include "TaskScenario.h" |
| 29 |
#include "ShiftSelectionList.h" |
| 30 |
#include "LoopDetectorInfo.h" |
| 31 |
#include "TaskDependency.h" |
| 32 |
// #include "Journal.h" |
| 33 |
|
| 34 |
class QDomElement; |
| 35 |
class QDomDocument; |
| 36 |
|
| 37 |
namespace TJ |
| 38 |
{ |
| 39 |
|
| 40 |
class Project; |
| 41 |
class Resource; |
| 42 |
// class Account; |
| 43 |
class Shift; |
| 44 |
class ShiftSelection; |
| 45 |
class TaskList; |
| 46 |
class Allocation; |
| 47 |
class Interval; |
| 48 |
|
| 49 |
/** |
| 50 |
* This class stores all task related information and provides methods to |
| 51 |
* manipulate them. It provides fundamental functions like the scheduler. |
| 52 |
* |
| 53 |
* @short The class that holds all task related information. |
| 54 |
* @see Resource |
| 55 |
* @see CoreAttributes |
| 56 |
* @author Chris Schlaeger <[email protected]> |
| 57 |
*/ |
| 58 |
class PLANTJ_EXPORT Task : public CoreAttributes |
| 59 |
{ |
| 60 |
friend int TaskList::compareItemsLevel(CoreAttributes*, CoreAttributes*, |
| 61 |
int); |
| 62 |
|
| 63 |
public: |
| 64 |
Task(Project* prj, const QString& id_, const QString& n, Task* p, |
| 65 |
const QString& f, int l); |
| 66 |
~Task() override; |
| 67 |
|
| 68 |
CAType getType() const override { return CA_Task; } |
| 69 |
|
| 70 |
Task* getParent() const { return static_cast<Task*>(parent); } |
| 71 |
|
| 72 |
TaskListIterator getSubListIterator() const |
| 73 |
{ |
| 74 |
return TaskListIterator(*sub); |
| 75 |
} |
| 76 |
|
| 77 |
enum SchedulingInfo { ASAP, ALAP }; |
| 78 |
|
| 79 |
void inheritValues(); |
| 80 |
|
| 81 |
void setProjectId(const QString& i) { projectId = i; } |
| 82 |
const QString& getProjectId() const { return projectId; } |
| 83 |
|
| 84 |
void setNote(const QString& d) { note = d; } |
| 85 |
const QString& getNote() const { return note; } |
| 86 |
|
| 87 |
// void addJournalEntry(JournalEntry* entry); |
| 88 |
|
| 89 |
// bool hasJournal() const { return !journal.isEmpty(); } |
| 90 |
|
| 91 |
// Journal::Iterator getJournalIterator() const; |
| 92 |
|
| 93 |
void setReference(const QString& r, const QString& l) |
| 94 |
{ |
| 95 |
ref = r; |
| 96 |
refLabel = l; |
| 97 |
} |
| 98 |
const QString& getReference() const { return ref; } |
| 99 |
const QString& getReferenceLabel() const { return refLabel; } |
| 100 |
|
| 101 |
void setScheduling(SchedulingInfo si) { scheduling = si; } |
| 102 |
SchedulingInfo getScheduling() const { return scheduling; } |
| 103 |
|
| 104 |
void setPriority(int p) { priority = p; } |
| 105 |
int getPriority() const { return priority; } |
| 106 |
|
| 107 |
void setResponsible(Resource* r) { responsible = r; } |
| 108 |
Resource* getResponsible() const { return responsible; } |
| 109 |
|
| 110 |
void setMilestone(bool ms = true) { milestone = ms; } |
| 111 |
bool isMilestone() const { return milestone; } |
| 112 |
|
| 113 |
// // // void setAccount(Account* a) { account = a; } |
| 114 |
// // // Account* getAccount() const { return account; } |
| 115 |
|
| 116 |
TaskDependency* addDepends(const QString& id); |
| 117 |
QList<TaskDependency*> getDepends() const |
| 118 |
{ |
| 119 |
return depends; |
| 120 |
} |
| 121 |
QListIterator<TaskDependency*> getDependsIterator() const |
| 122 |
{ |
| 123 |
return QListIterator<TaskDependency*>(depends); |
| 124 |
} |
| 125 |
TaskDependency* addPrecedes(const QString& id); |
| 126 |
QList<TaskDependency*> getPrecedes() const |
| 127 |
{ |
| 128 |
return precedes; |
| 129 |
} |
| 130 |
QListIterator<TaskDependency*> getPrecedesIterator() const |
| 131 |
{ |
| 132 |
return QListIterator<TaskDependency*>(precedes); |
| 133 |
} |
| 134 |
|
| 135 |
/// Add working time defined in @p shift for interval @p i |
| 136 |
bool addShift(const Interval& i, Shift* s); |
| 137 |
/// Return true if @p slot is defined as working time |
| 138 |
/// Falls back to project definitions if no shifts has been defined for this task |
| 139 |
bool isWorkingTime(const Interval &slot) const; |
| 140 |
|
| 141 |
void addAllocation(Allocation* a) { allocations.append(a); } |
| 142 |
void purgeAllocations() { allocations.clear(); } |
| 143 |
QListIterator<Allocation*> getAllocationIterator() const |
| 144 |
{ |
| 145 |
return QListIterator<Allocation*>(allocations); |
| 146 |
} |
| 147 |
|
| 148 |
TaskListIterator getPreviousIterator() const |
| 149 |
{ |
| 150 |
return TaskListIterator(previous); |
| 151 |
} |
| 152 |
bool hasPrevious() const { return !previous.isEmpty(); } |
| 153 |
|
| 154 |
TaskListIterator getFollowersIterator() const |
| 155 |
{ |
| 156 |
return TaskListIterator(followers); |
| 157 |
} |
| 158 |
bool hasFollowers() const { return !followers.isEmpty(); } |
| 159 |
|
| 160 |
bool hasPrevious(const Task* t) { return previous.indexOf(const_cast<Task*>(t)) != -1; } |
| 161 |
bool hasFollower(const Task* t) { return followers.indexOf(const_cast<Task*>(t)) != -1; } |
| 162 |
|
| 163 |
// The following group of functions operates only on scenario variables. |
| 164 |
void setSpecifiedStart(int sc, time_t s) |
| 165 |
{ |
| 166 |
scenarios[sc].specifiedStart = s; |
| 167 |
//qDebug()<<"Task::setSpecifiedStart:"<<id<<":"<<sc<<s<<scenarios[sc].specifiedStart; |
| 168 |
} |
| 169 |
time_t getSpecifiedStart(int sc) const |
| 170 |
{ |
| 171 |
return scenarios[sc].specifiedStart; |
| 172 |
} |
| 173 |
void setStart(int sc, time_t s) { scenarios[sc].start = s; } |
| 174 |
time_t getStart(int sc) const { return scenarios[sc].start; } |
| 175 |
|
| 176 |
void setSpecifiedEnd(int sc, time_t s) |
| 177 |
{ |
| 178 |
scenarios[sc].specifiedEnd = s; |
| 179 |
} |
| 180 |
void setEnd(int sc, time_t s) { scenarios[sc].end = s; } |
| 181 |
time_t getEnd(int sc) const { return scenarios[sc].end; } |
| 182 |
|
| 183 |
void setSpecifiedPeriod(int sc, const Interval& iv) |
| 184 |
{ |
| 185 |
scenarios[sc].specifiedStart = iv.getStart(); |
| 186 |
scenarios[sc].specifiedEnd = iv.getEnd(); |
| 187 |
} |
| 188 |
|
| 189 |
time_t getStartBufferEnd(int sc) const |
| 190 |
{ |
| 191 |
return scenarios[sc].startBufferEnd; |
| 192 |
} |
| 193 |
time_t getEndBufferStart(int sc) const |
| 194 |
{ |
| 195 |
return scenarios[sc].endBufferStart; |
| 196 |
} |
| 197 |
|
| 198 |
void setMinStart(int sc, time_t s) { scenarios[sc].minStart = s; } |
| 199 |
time_t getMinStart(int sc) const { return scenarios[sc].minStart; } |
| 200 |
|
| 201 |
void setMaxStart(int sc, time_t s) { scenarios[sc].maxStart = s; } |
| 202 |
time_t getMaxStart(int sc) const { return scenarios[sc].maxStart; } |
| 203 |
|
| 204 |
void setMinEnd(int sc, time_t e) { scenarios[sc].minEnd = e; } |
| 205 |
time_t getMinEnd(int sc) const { return scenarios[sc].minEnd; } |
| 206 |
|
| 207 |
void setMaxEnd(int sc, time_t e) { scenarios[sc].maxEnd = e; } |
| 208 |
time_t getMaxEnd(int sc) const { return scenarios[sc].maxEnd; } |
| 209 |
|
| 210 |
void setLength(int sc, double days) { scenarios[sc].length = days; } |
| 211 |
double getLength(int sc) const { return scenarios[sc].length; } |
| 212 |
|
| 213 |
void setEffort(int sc, double e) { scenarios[sc].effort = e; } |
| 214 |
double getEffort(int sc) const { return scenarios[sc].effort; } |
| 215 |
|
| 216 |
void setDuration(int sc, double d) { scenarios[sc].duration = d; } |
| 217 |
double getDuration(int sc) const { return scenarios[sc].duration; } |
| 218 |
|
| 219 |
bool isStartOk(int sc) const |
| 220 |
{ |
| 221 |
return scenarios[sc].isStartOk(); |
| 222 |
} |
| 223 |
bool isEndOk(int sc) const |
| 224 |
{ |
| 225 |
return scenarios[sc].isEndOk(); |
| 226 |
} |
| 227 |
|
| 228 |
bool isBuffer(int sc, const Interval& iv) const; |
| 229 |
|
| 230 |
void setComplete(int sc, double c) { scenarios[sc].reportedCompletion = c; } |
| 231 |
double getComplete(int sc) const |
| 232 |
{ |
| 233 |
return scenarios[sc].reportedCompletion; |
| 234 |
} |
| 235 |
|
| 236 |
void setStatusNote(int sc, const QString& d) |
| 237 |
{ |
| 238 |
scenarios[sc].statusNote = d; |
| 239 |
} |
| 240 |
const QString& getStatusNote(int sc) const |
| 241 |
{ |
| 242 |
return scenarios[sc].statusNote; |
| 243 |
} |
| 244 |
|
| 245 |
void setStartBuffer(int sc, double p) { scenarios[sc].startBuffer = p; } |
| 246 |
double getStartBuffer(int sc) const { return scenarios[sc].startBuffer; } |
| 247 |
|
| 248 |
void setEndBuffer(int sc, double p) { scenarios[sc]. endBuffer = p; } |
| 249 |
double getEndBuffer(int sc) const { return scenarios[sc].endBuffer; } |
| 250 |
|
| 251 |
void setStartCredit(int sc, double c) { scenarios[sc].startCredit = c; } |
| 252 |
double getStartCredit(int sc) const { return scenarios[sc].startCredit; } |
| 253 |
|
| 254 |
void setEndCredit(int sc, double c) { scenarios[sc].endCredit = c; } |
| 255 |
double getEndCredit(int sc) const { return scenarios[sc].endCredit; } |
| 256 |
|
| 257 |
double getCalcEffort(int sc) const; |
| 258 |
double getCalcDuration(int sc) const; |
| 259 |
|
| 260 |
// double getCredits(int sc, const Interval& period, AccountType acctType, |
| 261 |
// const Resource* resource = 0, bool recursive = true) |
| 262 |
// const; |
| 263 |
|
| 264 |
bool isActive(int sc, const Interval& period) const; |
| 265 |
TaskStatus getStatus(int sc) const { return scenarios[sc].status; } |
| 266 |
QString getStatusText(int sc) const; |
| 267 |
|
| 268 |
QString getSchedulingText() const; |
| 269 |
|
| 270 |
bool isCompleted(int sc, time_t date) const; |
| 271 |
void calcCompletionDegree(int sc); |
| 272 |
void calcContainerCompletionDegree(int sc, time_t now); |
| 273 |
double getCompletionDegree(int sc) const; |
| 274 |
double getCalcedCompletionDegree(int sc) const; |
| 275 |
TaskStatus getCompletionStatus(int sc) const |
| 276 |
{ |
| 277 |
return scenarios[sc].status; |
| 278 |
} |
| 279 |
double getCompletedLoad(int sc) const; |
| 280 |
double getRemainingLoad(int sc) const; |
| 281 |
|
| 282 |
double getLoad(int sc, const Interval& period, const Resource* resource = nullptr) |
| 283 |
const; |
| 284 |
long getAllocatedTime(int sc, const Interval& period, |
| 285 |
const Resource* resource = nullptr) const; |
| 286 |
double getAllocatedTimeLoad(int sc, const Interval& period, |
| 287 |
const Resource* resource = nullptr) const; |
| 288 |
|
| 289 |
void addBookedResource(int sc, Resource* r) |
| 290 |
{ |
| 291 |
if (scenarios[sc].bookedResources.indexOf((CoreAttributes*) r) == -1) |
| 292 |
scenarios[sc].bookedResources.inSort((CoreAttributes*) r); |
| 293 |
} |
| 294 |
bool isBookedResource(int sc, const Resource* r) const |
| 295 |
{ |
| 296 |
return scenarios[sc].bookedResources.indexOf((CoreAttributes*) r) != -1; |
| 297 |
} |
| 298 |
ResourceListIterator getBookedResourcesIterator(int sc) const |
| 299 |
{ |
| 300 |
return ResourceListIterator(scenarios[sc].bookedResources); |
| 301 |
} |
| 302 |
ResourceList getBookedResources(int sc) const |
| 303 |
{ |
| 304 |
return scenarios[sc].bookedResources; |
| 305 |
} |
| 306 |
void setSpecifiedScheduled(int sc, bool ps) |
| 307 |
{ |
| 308 |
scenarios[sc].specifiedScheduled = ps; |
| 309 |
} |
| 310 |
void setScheduled(int sc, bool ps) { scenarios[sc].scheduled = ps; } |
| 311 |
bool getScheduled(int sc) const { return scenarios[sc].scheduled; } |
| 312 |
|
| 313 |
bool isDutyOf(int sc, const Resource* r) const |
| 314 |
{ |
| 315 |
return scenarios[sc].isDutyOf(r); |
| 316 |
} |
| 317 |
|
| 318 |
void overlayScenario(int base, int sc); |
| 319 |
void prepareScenario(int sc); |
| 320 |
void finishScenario(int sc); |
| 321 |
void computeCriticalness(int sc); |
| 322 |
double getCriticalness(int sc) const { return scenarios[sc].criticalness; } |
| 323 |
void checkAndMarkCriticalPath(int sc, double minSlack, time_t maxEnd); |
| 324 |
|
| 325 |
double computePathCriticalness(int sc); |
| 326 |
double getPathCriticalness(int sc) const |
| 327 |
{ |
| 328 |
return scenarios[sc].pathCriticalness; |
| 329 |
} |
| 330 |
|
| 331 |
bool isOnCriticalPath(int sc, bool leavesOnly = true) const |
| 332 |
{ |
| 333 |
if (!isLeaf() && leavesOnly) |
| 334 |
return false; |
| 335 |
|
| 336 |
return scenarios[sc].isOnCriticalPath; |
| 337 |
} |
| 338 |
|
| 339 |
bool hasCriticalLinkTo(int sc, const Task* t) const |
| 340 |
{ |
| 341 |
return scenarios[sc].criticalLinks.contains(const_cast<Task*>(t)); |
| 342 |
} |
| 343 |
|
| 344 |
/** |
| 345 |
* @retval true if itself or one of its subtasks (recursively) is on the critical path |
| 346 |
* @retval false otherwise. |
| 347 |
*/ |
| 348 |
bool isOrHasDescendantOnCriticalPath(int sc) const; |
| 349 |
|
| 350 |
bool isContainer() const { return !sub->isEmpty(); } |
| 351 |
|
| 352 |
bool xRef(QMap<QString, Task*>& hash); |
| 353 |
void implicitXRef(); |
| 354 |
void sortAllocations(); |
| 355 |
void saveSpecifiedBookedResources(); |
| 356 |
QString resolveId(QString relId); |
| 357 |
|
| 358 |
bool preScheduleOk(int sc); |
| 359 |
bool scheduleOk(int sc) const; |
| 360 |
/** |
| 361 |
* Checks for loops in task interdependencies starting with the current |
| 362 |
* task. |
| 363 |
* @param chkedTaskList The list of already checked tasks. Will be appended |
| 364 |
* to. |
| 365 |
* @retval true if a loop was detected. |
| 366 |
* @retval false otherwise. |
| 367 |
*/ |
| 368 |
bool loopDetector(LDIList& chkedTaskList) const; |
| 369 |
bool checkDetermination(int sc) const; |
| 370 |
void computeBuffers(); |
| 371 |
time_t nextSlot(time_t slotDuration) const; |
| 372 |
bool isReadyForScheduling() const; |
| 373 |
bool schedule(int sc, time_t& reqStart, time_t duration); |
| 374 |
void propagateInitialValues(int sc); |
| 375 |
void setRunaway(); |
| 376 |
bool isRunaway() const; |
| 377 |
|
| 378 |
bool isSubTask(const Task* t) const; |
| 379 |
|
| 380 |
bool isSchedulingDone() const { return schedulingDone; } |
| 381 |
|
| 382 |
void errorMessage(const QString& msg) const; |
| 383 |
void warningMessage(const QString& msg) const; |
| 384 |
|
| 385 |
QDomElement xmlElement(QDomDocument& doc, bool absId = true); |
| 386 |
|
| 387 |
TaskList getSuccessors() const { return successors; } |
| 388 |
TaskList getPredecessors() const { return predecessors; } |
| 389 |
|
| 390 |
bool hasAlapPredecessor() const; |
| 391 |
|
| 392 |
private: |
| 393 |
friend class Project; |
| 394 |
void propagateStart(int sc, time_t date); |
| 395 |
void propagateEnd(int sc, time_t date); |
| 396 |
/** |
| 397 |
* Checks for loops in task interdependencies starting with the current |
| 398 |
* task under ASAP or ALAP scheduling. |
| 399 |
* @param ckedTaskList The list of already checked tasks. Will be appended |
| 400 |
* to. |
| 401 |
* @retval true if a loop was detected. |
| 402 |
* @retval false otherwise. |
| 403 |
*/ |
| 404 |
bool loopDetection(LDIList& list, LDIList& chkedTaskList, bool atEnd, |
| 405 |
bool fromOutside) const; |
| 406 |
bool checkPathForLoops(LDIList& list, bool atEnd) const; |
| 407 |
bool scheduleContainer(int sc); |
| 408 |
Task* subFirst() { return nullptr/*(Task*) sub->first()*/; } |
| 409 |
Task* subNext() { return nullptr/*(Task*) sub->next()*/; } |
| 410 |
/// Returns the availability of @p resource and its required resources (if any) |
| 411 |
int isAvailable(Allocation *allocation, Resource *resource, time_t slot) const; |
| 412 |
/// Book resource @p r if it (and its required resources) is available |
| 413 |
bool bookResource(Allocation *allocation, Resource* r, time_t day, time_t duration, |
| 414 |
int& slotsToLimit, int& availability); |
| 415 |
void bookResources(int sc, time_t day, time_t duration); |
| 416 |
void addBookedResource(Resource* r) |
| 417 |
{ |
| 418 |
if (bookedResources.indexOf((CoreAttributes*) r) == -1) |
| 419 |
bookedResources.inSort((CoreAttributes*) r); |
| 420 |
} |
| 421 |
QList<Resource*> createCandidateList(int sc, time_t date, Allocation* a); |
| 422 |
time_t earliestStart(int sc) const; |
| 423 |
time_t latestEnd(int sc) const; |
| 424 |
|
| 425 |
bool startCanBeDetermined(LDIList& list, int sc) const; |
| 426 |
bool endCanBeDetermined(LDIList& list, int sc) const; |
| 427 |
|
| 428 |
bool hasStartDependency(int sc) const; |
| 429 |
bool hasEndDependency(int sc) const; |
| 430 |
|
| 431 |
bool hasStartDependency() const; |
| 432 |
bool hasEndDependency() const; |
| 433 |
|
| 434 |
bool analyzePath(int sc, double minSlack, time_t pathStart, long busyTime, |
| 435 |
long worstMinSlackTime, long& checked, long& found); |
| 436 |
void collectTransientFollowers(TaskList& list); |
| 437 |
|
| 438 |
bool countMilestones(int sc, time_t now, int& totalMilestones, |
| 439 |
int& completedMilestones, |
| 440 |
int& reportedCompletedMilestones); |
| 441 |
bool sumUpEffort(int sc, time_t now, double& totalEffort, |
| 442 |
double& completedEffort, |
| 443 |
double& reportedCompletedEffort); |
| 444 |
|
| 445 |
/// A longer description of the task. |
| 446 |
QString note; |
| 447 |
|
| 448 |
/// List of notes with a date attached. |
| 449 |
// Journal journal; |
| 450 |
|
| 451 |
/// A reference to an external document |
| 452 |
QString ref; |
| 453 |
|
| 454 |
/// A label used instead of the reference |
| 455 |
QString refLabel; |
| 456 |
|
| 457 |
/** |
| 458 |
* The dependencies of the task are stored twice. depends and precedes |
| 459 |
* store the information specified in the project file. For convenience we |
| 460 |
* also store the backward dependency together with the specified |
| 461 |
* dependencies in predecessors and successors. |
| 462 |
*/ |
| 463 |
QList<TaskDependency*> depends; |
| 464 |
|
| 465 |
/// @see depends |
| 466 |
QList<TaskDependency*> precedes; |
| 467 |
|
| 468 |
/** |
| 469 |
* A list of tasks that must precede this task. |
| 470 |
*/ |
| 471 |
TaskList predecessors; |
| 472 |
|
| 473 |
/** |
| 474 |
* A list of tasks that must follow this task. |
| 475 |
*/ |
| 476 |
TaskList successors; |
| 477 |
|
| 478 |
/** |
| 479 |
* A list of all tasks that precede this task. It's the combination of |
| 480 |
* depends and predecessors. This is redundant information but stored for |
| 481 |
* convenience. Interdependent tasks are linked in a doubly linked list. |
| 482 |
*/ |
| 483 |
TaskList previous; |
| 484 |
|
| 485 |
/** |
| 486 |
* A list of all tasks that follow this task. It's the combination of |
| 487 |
* precedes and successors. This is redundant information but stored for |
| 488 |
* convenience. Interdependent tasks are linked in a doubly linked list. |
| 489 |
*/ |
| 490 |
TaskList followers; |
| 491 |
|
| 492 |
/** |
| 493 |
* The ID of the project this task belongs to. This is only |
| 494 |
* meaningful if multiple projects are joined to create a big |
| 495 |
* project. */ |
| 496 |
QString projectId; |
| 497 |
|
| 498 |
/// True if the task is a milestone. |
| 499 |
bool milestone; |
| 500 |
|
| 501 |
/** |
| 502 |
* The priority is used during scheduling. The higher the priority |
| 503 |
* the more likely the task will get the requested resources. */ |
| 504 |
int priority; |
| 505 |
|
| 506 |
/// The scheduling policy of the task. |
| 507 |
SchedulingInfo scheduling; |
| 508 |
|
| 509 |
/// ID of responsible resource. |
| 510 |
Resource* responsible; |
| 511 |
|
| 512 |
/// Tasks may only be worked on during the specified shifts. |
| 513 |
/// Also defines the working time of length tasks |
| 514 |
ShiftSelectionList shifts; |
| 515 |
|
| 516 |
/// List of resource allocations requested by the task |
| 517 |
QList<Allocation*> allocations; |
| 518 |
|
| 519 |
/// Account where the credits of the task are credited to. |
| 520 |
// Account* account; |
| 521 |
|
| 522 |
TaskScenario* scenarios; |
| 523 |
|
| 524 |
/* The following group of variables store values generated during a |
| 525 |
* scheduler run. They might be initialized by other values and/or |
| 526 |
* they might contain results of the scheduling run. But they should |
| 527 |
* never be initialized directly or read out directly. They should have |
| 528 |
* corresponding scenario variables. The get/set interface functions |
| 529 |
* should only access the scenario variables. */ |
| 530 |
|
| 531 |
/// Day when the task should start |
| 532 |
time_t start; |
| 533 |
|
| 534 |
/// Day when the task should end |
| 535 |
time_t end; |
| 536 |
|
| 537 |
/// Length in working days |
| 538 |
double length; |
| 539 |
|
| 540 |
/// Effort (in man days) needed to complete the task |
| 541 |
double effort; |
| 542 |
|
| 543 |
/// Duration in calendar days |
| 544 |
double duration; |
| 545 |
|
| 546 |
/// The already completed effort in a scheduler run. |
| 547 |
double doneEffort; |
| 548 |
|
| 549 |
/// The already completed length in a scheduler run. |
| 550 |
double doneLength; |
| 551 |
|
| 552 |
/// The already completed duration in a scheduler run. |
| 553 |
double doneDuration; |
| 554 |
|
| 555 |
/** |
| 556 |
* Set to true when the first time slots have with resource usage |
| 557 |
* have been allocated. */ |
| 558 |
bool workStarted; |
| 559 |
|
| 560 |
/** |
| 561 |
* Since the full time slot might not be available we need to |
| 562 |
* store the tentative start of a task in a separate |
| 563 |
* variable. Storing the information in 'start' would mark the |
| 564 |
* task as fully scheduled which might not yet be the case. */ |
| 565 |
time_t tentativeStart; |
| 566 |
|
| 567 |
/** |
| 568 |
* Since the full time slot might not be available we need to |
| 569 |
* store the tentative end of a task in a separate |
| 570 |
* variable. Storing the information in 'end' would mark the task |
| 571 |
* as fully scheduled which might not yet be the case. */ |
| 572 |
time_t tentativeEnd; |
| 573 |
|
| 574 |
/** |
| 575 |
* Depending on the scheduling policy the tasks need to be scheduled |
| 576 |
* from one end the other in a continuous way. No timeslot may be |
| 577 |
* scheduled twice. This variable stores information about the last |
| 578 |
* allocation, so we can make sure the next slot is exactly adjacent |
| 579 |
* the previous one. */ |
| 580 |
time_t lastSlot; |
| 581 |
|
| 582 |
/// This variable is set to true when the task has been scheduled. |
| 583 |
bool schedulingDone; |
| 584 |
|
| 585 |
/** This flag is set when the task does not fit into the project time |
| 586 |
* frame. */ |
| 587 |
bool runAway; |
| 588 |
|
| 589 |
/// A list of all the resources booked for this task. |
| 590 |
ResourceList bookedResources; |
| 591 |
} ; |
| 592 |
|
| 593 |
} // namespace TJ |
| 594 |
|
| 595 |
PLANTJ_EXPORT QDebug operator<<(QDebug dbg, const TJ::Task* t); |
| 596 |
PLANTJ_EXPORT QDebug operator<<(QDebug dbg, const TJ::Task& t); |
| 597 |
|
| 598 |
#endif |
| 599 |
|