2 * TaskDependency.cpp - TaskJuggler
4 * Copyright (c) 2001, 2002, 2003, 2004 by Chris Schlaeger <cs@kde.org>
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.
13 #include "TaskDependency.h"
21 TaskDependency::TaskDependency(QString tri, int maxScenarios) :
24 gapDuration(new long[maxScenarios]),
25 gapLength(new long[maxScenarios])
27 for (int sc = 0; sc < maxScenarios; ++sc)
28 gapDuration[sc] = gapLength[sc] = (sc == 0 ? 0 : -1);
31 TaskDependency::~TaskDependency()
33 delete [] gapDuration;
38 TaskDependency::getGapDuration(int sc) const
42 if (gapDuration[sc] >= 0)
43 return gapDuration[sc];
44 Project* p = taskRef->getProject();
45 Scenario* parent = p->getScenario(sc)->getParent();
47 sc = p->getScenarioIndex(parent->getId()) - 1;
52 TaskDependency::getGapLength(int sc) const
56 if (gapLength[sc] >= 0)
58 Project* p = taskRef->getProject();
59 Scenario* parent = p->getScenario(sc)->getParent();
61 sc = p->getScenarioIndex(parent->getId()) - 1;