F:/KPlato/koffice/kplato/kpttask.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 Thomas Zander zander@kde.org
00003    Copyright (C) 2004 Dag Andersen <danders@get2net.dk>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KPTTASK_H
00022 #define KPTTASK_H
00023 
00024 #include "kptnode.h"
00025 #include "kptduration.h"
00026 #include "kptresource.h"
00027 
00028 #include <QList>
00029 
00030 namespace KPlato
00031 {
00032 
00033 class DateTime;
00034 
00040 class Task : public Node {
00041 public:
00042     Task(Node *parent = 0);
00043     Task(Task &task, Node *parent = 0);
00044     ~Task();
00045 
00047     virtual int type() const;
00048 
00053     Duration *getExpectedDuration();
00054 
00060     Duration *getRandomDuration();
00061 
00066     ResourceGroupRequest *resourceGroupRequest(ResourceGroup *group) const;
00067     void clearResourceRequests();
00068     void addRequest(ResourceGroup *group, int numResources);
00069     void addRequest(ResourceGroupRequest *request);
00070     void takeRequest(ResourceGroupRequest *request);
00071     int units() const;
00072     int workUnits() const;
00073     void makeAppointments();
00078     void calcResourceOverbooked();
00079     
00080     void setConstraint(Node::ConstraintType type);
00081 
00083     virtual bool load(QDomElement &element, Project &project);
00085     virtual void save(QDomElement &element) const;
00087     virtual void saveAppointments(QDomElement &element, long id) const;
00092     virtual EffortCostMap plannedEffortCostPrDay(const QDate &start, const QDate &end) const;
00093     
00095     virtual Duration plannedEffort();
00097     virtual Duration plannedEffort(const QDate &date);
00099     virtual Duration plannedEffortTo(const QDate &date);
00100     
00102     virtual Duration actualEffort();
00104     virtual Duration actualEffort(const QDate &date);
00106     virtual Duration actualEffortTo(const QDate &date);
00107     
00111     virtual double plannedCost();
00113     virtual double plannedCost(const QDate &/*date*/);
00115     virtual double plannedCostTo(const QDate &/*date*/);
00116     
00120     virtual double actualCost();
00122     virtual double actualCost(const QDate &/*date*/);
00124     virtual double actualCostTo(const QDate &/*date*/);
00125 
00127     double effortPerformanceIndex(const QDate &date, bool *error=0);
00129     double costPerformanceIndex(const QDate &date, bool *error=0);
00130     
00131     void initiateCalculation(Schedule &sch);
00137     void initiateCalculationLists(QList<Node*> &startnodes, QList<Node*> &endnodes, QList<Node*> &summarytasks);
00145     DateTime calculateForward(int use);
00153     DateTime calculateBackward(int use);
00163     DateTime scheduleForward(const DateTime &earliest, int use);
00173     DateTime scheduleBackward(const DateTime &latest, int use);
00174     
00179     void adjustSummarytask();
00180     
00184     Duration calcDuration(const DateTime &time, const Duration &effort, bool backward);
00185 
00186     // Proxy relations are relations to/from summarytasks. 
00187     // These relations are distrubuted to the relevant tasks before calculation.
00188     void clearProxyRelations();
00189     void addParentProxyRelations(QList<Relation*> &list);
00190     void addChildProxyRelations(QList<Relation*> &list);
00191     void addParentProxyRelation(Node *node, const Relation *rel);
00192     void addChildProxyRelation(Node *node, const Relation *rel);
00193     
00195     bool isEndNode() const;
00197     bool isStartNode() const;
00198     
00205     virtual DateTime workStartTime() const;
00206     
00213     virtual DateTime workEndTime() const;
00214     
00220     Duration positiveFloat();
00225     Duration negativeFloat() { return Duration(); }
00230     Duration freeFloat() { return Duration(); }
00234     Duration startFloat() { return Duration(); }
00240     Duration finishFloat() { return Duration(); }
00241     
00243     virtual bool isCritical() const;
00245     virtual bool calcCriticalPath(bool fromEnd);
00246     
00248     virtual void setCurrentSchedule(long id);
00249     
00250     virtual bool effortMetError() const;
00251     
00252     struct Progress {
00253         Progress() { started = finished = false; percentFinished = 0; }
00254         bool operator==(struct Progress &p) {
00255             return started == p.started && finished == p.finished &&
00256                    startTime == p.startTime && finishTime == p.finishTime &&
00257                    percentFinished == p.percentFinished &&
00258                    remainingEffort == p.remainingEffort &&
00259                    totalPerformed == p.totalPerformed;
00260         }
00261         bool operator!=(struct Progress &p) { return !(*this == p); }
00262         struct Progress &operator=(struct Progress &p) {
00263             started = p.started; finished = p.finished;
00264             startTime = p.startTime; finishTime = p.finishTime;
00265             percentFinished = p.percentFinished;
00266             remainingEffort = p.remainingEffort;
00267             totalPerformed = p.totalPerformed;
00268             return *this;
00269         }
00270         bool started, finished;
00271         DateTime startTime, finishTime;
00272         int percentFinished;
00273         Duration remainingEffort;
00274         Duration totalPerformed;        
00275     };
00276     struct Progress &progress() { return m_progress; }
00277     
00278 private:
00279     DateTime calculateSuccessors(const QList<Relation*> &list, int use);
00280     DateTime calculatePredeccessors(const QList<Relation*> &list, int use);
00281     DateTime scheduleSuccessors(const QList<Relation*> &list, int use);
00282     DateTime schedulePredeccessors(const QList<Relation*> &list, int use);
00283     
00284     DateTime workStartAfter(const DateTime &dt);
00285     DateTime workFinishBefore(const DateTime &dt);
00286 
00287 private:
00288     QList<ResourceGroup*> m_resource;
00289 
00290     ResourceRequestCollection *m_requests;
00291  
00292     QList<Relation*> m_parentProxyRelations;
00293     QList<Relation*> m_childProxyRelations;
00294       
00295     struct Progress m_progress;
00296     
00297 #ifndef NDEBUG
00298 public:
00299     void printDebug(bool children, QByteArray indent);
00300 #endif
00301 
00302 };
00303 
00304 }  //KPlato namespace
00305 
00306 #endif

Généré le Wed Nov 22 23:40:58 2006 pour KPlato par  doxygen 1.5.1-p1