kplato

KPlato::Task Class Reference

#include <kpttask.h>

Inheritance diagram for KPlato::Task:
KPlato::Node

Public Member Functions

 Task (Node *parent=0)
 Task (Task &task, Node *parent=0)
virtual int type () const
Duration * getExpectedDuration ()
Duration * getRandomDuration ()
ResourceGroupRequest * resourceGroupRequest (ResourceGroup *group) const
void clearResourceRequests ()
void addRequest (ResourceGroup *group, int numResources)
void addRequest (ResourceGroupRequest *request)
void takeRequest (ResourceGroupRequest *request)
int units () const
int workUnits () const
void makeAppointments ()
void calcResourceOverbooked ()
void setConstraint (Node::ConstraintType type)
virtual bool load (TQDomElement &element, Project &project)
virtual void save (TQDomElement &element) const
virtual void saveAppointments (TQDomElement &element, long id) const
virtual EffortCostMap plannedEffortCostPrDay (const TQDate &start, const TQDate &end) const
virtual Duration plannedEffort ()
virtual Duration plannedEffort (const TQDate &date)
virtual Duration plannedEffortTo (const TQDate &date)
virtual Duration actualEffort ()
virtual Duration actualEffort (const TQDate &date)
virtual Duration actualEffortTo (const TQDate &date)
virtual double plannedCost ()
virtual double plannedCost (const TQDate &)
virtual double plannedCostTo (const TQDate &)
virtual double actualCost ()
virtual double actualCost (const TQDate &)
virtual double actualCostTo (const TQDate &)
double effortPerformanceIndex (const TQDate &date, bool *error=0)
double costPerformanceIndex (const TQDate &date, bool *error=0)
void initiateCalculation (Schedule &sch)
void initiateCalculationLists (TQPtrList< Node > &startnodes, TQPtrList< Node > &endnodes, TQPtrList< Node > &summarytasks)
DateTime calculateForward (int use)
DateTime calculateBackward (int use)
DateTime scheduleForward (const DateTime &earliest, int use)
DateTime scheduleBackward (const DateTime &latest, int use)
void adjustSummarytask ()
Duration calcDuration (const DateTime &time, const Duration &effort, bool backward)
void clearProxyRelations ()
void addParentProxyRelations (TQPtrList< Relation > &list)
void addChildProxyRelations (TQPtrList< Relation > &list)
void addParentProxyRelation (Node *node, const Relation *rel)
void addChildProxyRelation (Node *node, const Relation *rel)
bool isEndNode () const
bool isStartNode () const
virtual DateTime workStartTime () const
virtual DateTime workEndTime () const
Duration positiveFloat ()
Duration negativeFloat ()
Duration freeFloat ()
Duration startFloat ()
Duration finishFloat ()
virtual bool isCritical ()
virtual bool calcCriticalPath (bool fromEnd)
virtual void setCurrentSchedule (long id)
virtual bool effortMetError () const
struct Progress & progress ()
void printDebug (bool children, TQCString indent)
Public Member Functions inherited from KPlato::Node
 Node (Node *parent=0)
 Node (Node &node, Node *parent=0)
bool setId (TQString id)
TQString id () const
virtual Node * projectNode ()
virtual bool load (TQDomElement &)
virtual void saveRelations (TQDomElement &element) const
Node * getParent () const
void setParent (Node *newParent)
const TQPtrList< Node > & childNodeIterator () const
int numChildren () const
virtual void addChildNode (Node *node, Node *after=0)
virtual void insertChildNode (unsigned int index, Node *node)
void delChildNode (Node *node, bool remove=true)
void delChildNode (int number, bool remove=true)
Node * getChildNode (int number)
const Node * getChildNode (int number) const
int findChildNode (Node *node)
int numDependChildNodes () const
virtual void addDependChildNode (Node *node, Relation::Type p=Relation::FinishStart)
virtual void addDependChildNode (Node *node, Relation::Type p, Duration lag)
virtual bool addDependChildNode (Relation *relation)
virtual void insertDependChildNode (unsigned int index, Node *node, Relation::Type p=Relation::FinishStart)
void delDependChildNode (Node *node, bool remove=false)
void delDependChildNode (Relation *rel, bool remove=false)
void delDependChildNode (int number, bool remove=false)
Relation * getDependChildNode (int number)
TQPtrList< Relation > & dependChildNodes ()
void takeDependChildNode (Relation *rel)
int numDependParentNodes () const
virtual void addDependParentNode (Node *node, Relation::Type p=Relation::FinishStart)
virtual void addDependParentNode (Node *node, Relation::Type p, Duration lag)
virtual bool addDependParentNode (Relation *relation)
virtual void insertDependParentNode (unsigned int index, Node *node, Relation::Type p=Relation::FinishStart)
void delDependParentNode (Node *node, bool remove=false)
void delDependParentNode (Relation *rel, bool remove=false)
void delDependParentNode (int number, bool remove=false)
Relation * getDependParentNode (int number)
TQPtrList< Relation > & dependParentNodes ()
void takeDependParentNode (Relation *rel)
bool isParentOf (Node *node)
bool isDependChildOf (Node *node)
Relation * findParentRelation (Node *node)
Relation * findChildRelation (Node *node)
Relation * findRelation (Node *node)
void setStartTime (DateTime startTime)
virtual DateTime startTime () const
const TQDate & startDate () const
void setEndTime (DateTime endTime)
virtual DateTime endTime () const
const TQDate & endDate () const
void setEffort (Effort *e)
Effort * effort () const
Duration * getDelay ()
DateTime getEarliestStart () const
void setEarliestStart (const DateTime &dt)
DateTime getLatestFinish () const
void setLatestFinish (const DateTime &dt)
TQString & name ()
TQString & leader ()
TQString & description ()
const TQString & name () const
const TQString & leader () const
const TQString & description () const
void setName (const TQString &n)
void setLeader (const TQString &l)
void setDescription (const TQString &d)
void setConstraint (TQString &type)
int constraint () const
TQString constraintToString () const
virtual void setConstraintStartTime (TQDateTime time)
virtual void setConstraintEndTime (TQDateTime time)
virtual DateTime constraintStartTime () const
virtual DateTime constraintEndTime () const
virtual DateTime startNotEarlier () const
virtual DateTime finishNotLater () const
virtual DateTime mustStartOn () const
virtual DateTime mustFinishOn () const
virtual ResourceGroupRequest * resourceRequest (ResourceGroup *) const
bool resourceError () const
virtual bool resourceOverbooked () const
virtual TQStringList overbookedResources () const
bool resourceNotAvailable () const
virtual bool schedulingError () const
bool notScheduled () const
double effortPerformanceIndex (const TQDate &, bool *)
double costPerformanceIndex (const TQDate &, bool *)
virtual void resetVisited ()
void propagateEarliestStart (DateTime &time)
void propagateLatestFinish (DateTime &time)
void moveEarliestStart (DateTime &time)
void moveLatestFinish (DateTime &time)
virtual Duration summarytaskDurationForward (const DateTime &)
virtual DateTime summarytaskEarliestStart ()
virtual Duration summarytaskDurationBackward (const DateTime &)
virtual DateTime summarytaskLatestFinish ()
const Duration & duration ()
Duration duration (const DateTime &time, int use, bool backward)
Node * siblingBefore ()
Node * childBefore (Node *node)
Node * siblingAfter ()
Node * childAfter (Node *node)
bool moveChildUp (Node *node)
bool moveChildDown (Node *node)
bool legalToLink (Node *node)
virtual bool legalToLink (Node *, Node *)
TQPtrList< Appointment > appointments ()
virtual bool addAppointment (Appointment *appointment)
virtual bool addAppointment (Appointment *appointment, Schedule &main)
virtual void addAppointment (ResourceSchedule *resource, DateTime &start, DateTime &end, double load=100)
virtual Node * findNode () const
virtual Node * findNode (const TQString &id) const
virtual bool removeId ()
virtual bool removeId (const TQString &id)
virtual void insertId (const TQString &id)
virtual void insertId (const TQString &id, const Node *node)
void setWorkStartTime (const DateTime &dt)
void setWorkEndTime (const DateTime &dt)
virtual bool isCritical () const
virtual bool inCriticalPath () const
virtual int level ()
virtual void generateWBS (int count, WBSDefinition &def, TQString wbs=TQString())
TQString wbs () const
double startupCost () const
void setStartupCost (double cost)
Account * startupAccount () const
void setStartupAccount (Account *acc)
double shutdownCost () const
void setShutdownCost (double cost)
Account * shutdownAccount () const
void setShutdownAccount (Account *acc)
Account * runningAccount () const
void setRunningAccount (Account *acc)
Schedule * currentSchedule () const
void setCurrentSchedulePtr (Schedule *schedule)
TQIntDict< Schedule > & schedules ()
Schedule * findSchedule (const TQString name, const Schedule::Type type) const
Schedule * findSchedule (const Schedule::Type type) const
Schedule * findSchedule (long id) const
void takeSchedule (const Schedule *schedule)
void addSchedule (Schedule *schedule)
Schedule * createSchedule (TQString name, Schedule::Type type, long id)
Schedule * createSchedule (Schedule *parent)
void setScheduleDeleted (long id, bool onoff)
virtual void setParentSchedule (Schedule *sch)
DateTime startTime ()
DateTime endTime ()

Additional Inherited Members

Public Types inherited from KPlato::Node
enum  ConstraintType {
  ASAP , ALAP , MustStartOn , MustFinishOn ,
  StartNotEarlier , FinishNotLater , FixedInterval
}
enum  NodeTypes {
  Type_Node = 0 , Type_Project = 1 , Type_Subproject = 2 , Type_Task = 3 ,
  Type_Milestone = 4 , Type_Periodic = 5 , Type_Summarytask = 6
}
Protected Attributes inherited from KPlato::Node
TQPtrList< Node > m_nodes
TQPtrList< Relation > m_dependChildNodes
TQPtrList< Relation > m_dependParentNodes
Node * m_parent
TQString m_id
TQString m_name
TQString m_leader
TQString m_description
Effort * m_effort
ConstraintType m_constraint
DateTime m_constraintStartTime
DateTime m_constraintEndTime
bool m_visitedForward
bool m_visitedBackward
Duration m_durationForward
Duration m_durationBackward
TQDate m_dateOnlyStartDate
TQDate m_dateOnlyEndDate
Duration m_dateOnlyDuration
TQIntDict< Schedule > m_schedules
Schedule * m_currentSchedule
TQString m_wbs
double m_startupCost
Account * m_startupAccount
double m_shutdownCost
Account * m_shutdownAccount
Account * m_runningAccount

Detailed Description

A task in the scheduling software is represented by this class.

A task can be anything from 'build house' to 'drill hole' It will always mean an activity.

Definition at line 40 of file kpttask.h.

Constructor & Destructor Documentation

◆ Task() [1/2]

KPlato::Task::Task ( Node * parent = 0)

Definition at line 38 of file kpttask.cpp.

◆ Task() [2/2]

KPlato::Task::Task ( Task & task,
Node * parent = 0 )

Definition at line 55 of file kpttask.cpp.

◆ ~Task()

KPlato::Task::~Task ( )

Definition at line 70 of file kpttask.cpp.

Member Function Documentation

◆ actualCost() [1/2]

double KPlato::Task::actualCost ( )
virtual

Returns the actaually reported cost for this task (or subtasks).

Reimplemented from KPlato::Node.

Definition at line 486 of file kpttask.cpp.

◆ actualCost() [2/2]

double KPlato::Task::actualCost ( const TQDate & date)
virtual

Actual cost on date.

Reimplemented from KPlato::Node.

Definition at line 500 of file kpttask.cpp.

◆ actualCostTo()

double KPlato::Task::actualCostTo ( const TQDate & date)
virtual

Actual cost up to and including date.

Reimplemented from KPlato::Node.

Definition at line 514 of file kpttask.cpp.

◆ actualEffort() [1/2]

Duration KPlato::Task::actualEffort ( )
virtual

Returns the total actual effort for this task (or subtasks).

Reimplemented from KPlato::Node.

Definition at line 396 of file kpttask.cpp.

◆ actualEffort() [2/2]

Duration KPlato::Task::actualEffort ( const TQDate & date)
virtual

Returns the total actual effort for this task (or subtasks) on date.

Reimplemented from KPlato::Node.

Definition at line 415 of file kpttask.cpp.

◆ actualEffortTo()

Duration KPlato::Task::actualEffortTo ( const TQDate & date)
virtual

Returns the actual effort up to and including date.

Reimplemented from KPlato::Node.

Definition at line 430 of file kpttask.cpp.

◆ addChildProxyRelation()

void KPlato::Task::addChildProxyRelation ( Node * node,
const Relation * rel )
virtual

Reimplemented from KPlato::Node.

Definition at line 1352 of file kpttask.cpp.

◆ addChildProxyRelations()

void KPlato::Task::addChildProxyRelations ( TQPtrList< Relation > & list)
virtual

Reimplemented from KPlato::Node.

Definition at line 1315 of file kpttask.cpp.

◆ addParentProxyRelation()

void KPlato::Task::addParentProxyRelation ( Node * node,
const Relation * rel )
virtual

Reimplemented from KPlato::Node.

Definition at line 1337 of file kpttask.cpp.

◆ addParentProxyRelations()

void KPlato::Task::addParentProxyRelations ( TQPtrList< Relation > & list)
virtual

Reimplemented from KPlato::Node.

Definition at line 1293 of file kpttask.cpp.

◆ addRequest() [1/2]

void KPlato::Task::addRequest ( ResourceGroup * group,
int numResources )

Definition at line 109 of file kpttask.cpp.

◆ addRequest() [2/2]

void KPlato::Task::addRequest ( ResourceGroupRequest * request)

Definition at line 113 of file kpttask.cpp.

◆ adjustSummarytask()

void KPlato::Task::adjustSummarytask ( )
virtual

Summarytasks (with milestones) need special treatment because milestones are always 'glued' to their predecessors.

Implements KPlato::Node.

Definition at line 1240 of file kpttask.cpp.

◆ calcCriticalPath()

bool KPlato::Task::calcCriticalPath ( bool fromEnd)
virtual

Calculate critical path.

Reimplemented from KPlato::Node.

Definition at line 1464 of file kpttask.cpp.

◆ calcDuration()

Duration KPlato::Task::calcDuration ( const DateTime & time,
const Duration & effort,
bool backward )
virtual

Return the duration calculated on bases of the requested resources.

Reimplemented from KPlato::Node.

Definition at line 1262 of file kpttask.cpp.

◆ calcResourceOverbooked()

void KPlato::Task::calcResourceOverbooked ( )
virtual

Calculates if the assigned resource is overbooked within the duration of this task.

Reimplemented from KPlato::Node.

Definition at line 161 of file kpttask.cpp.

◆ calculateBackward()

DateTime KPlato::Task::calculateBackward ( int use)
virtual

Calculates ref m_durationBackward from ref latestFinish and returns the resulting start time, which will be used as the predecessors ref latestFinish.

Parameters
useCalculate using expected-, optimistic- or pessimistic estimate.

Implements KPlato::Node.

Definition at line 752 of file kpttask.cpp.

◆ calculateForward()

DateTime KPlato::Task::calculateForward ( int use)
virtual

Calculates ref m_durationForward from ref earliestStart and returns the resulting end time, which will be used as the succesors ref earliestStart.

Parameters
useCalculate using expected-, optimistic- or pessimistic estimate.

Implements KPlato::Node.

Definition at line 625 of file kpttask.cpp.

◆ clearProxyRelations()

void KPlato::Task::clearProxyRelations ( )
virtual

Reimplemented from KPlato::Node.

Definition at line 1288 of file kpttask.cpp.

◆ clearResourceRequests()

void KPlato::Task::clearResourceRequests ( )

Definition at line 104 of file kpttask.cpp.

◆ costPerformanceIndex()

double KPlato::Task::costPerformanceIndex ( const TQDate & date,
bool * error = 0 )

Cost performance index.

Definition at line 544 of file kpttask.cpp.

◆ effortMetError()

bool KPlato::Task::effortMetError ( ) const
virtual

Definition at line 1520 of file kpttask.cpp.

◆ effortPerformanceIndex()

double KPlato::Task::effortPerformanceIndex ( const TQDate & date,
bool * error = 0 )

Effort based performance index.

Definition at line 529 of file kpttask.cpp.

◆ finishFloat()

Duration KPlato::Task::finishFloat ( )
inline

Return the duration the task has at its finish before a successor task starts.

This is the difference between the start time of the successor and the finish time of this task.

Definition at line 240 of file kpttask.h.

◆ freeFloat()

Duration KPlato::Task::freeFloat ( )
inline

Return the duration by which an activity can be delayed or extended without affecting the start of any succeeding activity.

Definition at line 230 of file kpttask.h.

◆ getExpectedDuration()

Duration * KPlato::Task::getExpectedDuration ( )
virtual

Returns the (previously) calculated duration.

The caller must delete returned object.

Implements KPlato::Node.

Definition at line 88 of file kpttask.cpp.

◆ getRandomDuration()

Duration * KPlato::Task::getRandomDuration ( )
virtual

Instead of using the expected duration, generate a random value using the Distribution of each Task.

This can be used for Monte-Carlo estimation of Project duration.

Implements KPlato::Node.

Definition at line 94 of file kpttask.cpp.

◆ initiateCalculation()

void KPlato::Task::initiateCalculation ( Schedule & sch)
virtual

Reimplemented from KPlato::Node.

Definition at line 558 of file kpttask.cpp.

◆ initiateCalculationLists()

void KPlato::Task::initiateCalculationLists ( TQPtrList< Node > & startnodes,
TQPtrList< Node > & endnodes,
TQPtrList< Node > & summarytasks )
virtual

Sets up the lists used for calculation.

This includes adding summarytasks relations to subtasks and lists for start- and endnodes.

Implements KPlato::Node.

Definition at line 569 of file kpttask.cpp.

◆ isCritical()

bool KPlato::Task::isCritical ( )
virtual

A task is critical if there is no positive float.

Definition at line 1456 of file kpttask.cpp.

◆ isEndNode()

bool KPlato::Task::isEndNode ( ) const
virtual

Check if this node has any dependent child nodes.

Reimplemented from KPlato::Node.

Definition at line 1367 of file kpttask.cpp.

◆ isStartNode()

bool KPlato::Task::isStartNode ( ) const
virtual

Check if this node has any dependent parent nodes.

Reimplemented from KPlato::Node.

Definition at line 1380 of file kpttask.cpp.

◆ load()

bool KPlato::Task::load ( TQDomElement & element,
Project & project )
virtual

Load from document.

Reimplemented from KPlato::Node.

Definition at line 172 of file kpttask.cpp.

◆ makeAppointments()

void KPlato::Task::makeAppointments ( )
virtual

Reimplemented from KPlato::Node.

Definition at line 141 of file kpttask.cpp.

◆ negativeFloat()

Duration KPlato::Task::negativeFloat ( )
inline

Return the duration by which the duration of an activity or path has to be reduced in order to fullfill a timing constraint.

Definition at line 225 of file kpttask.h.

◆ plannedCost() [1/2]

double KPlato::Task::plannedCost ( )
virtual

Returns the total planned cost for this task (or subtasks).

Reimplemented from KPlato::Node.

Definition at line 444 of file kpttask.cpp.

◆ plannedCost() [2/2]

double KPlato::Task::plannedCost ( const TQDate & date)
virtual

Planned cost on date.

Reimplemented from KPlato::Node.

Definition at line 458 of file kpttask.cpp.

◆ plannedCostTo()

double KPlato::Task::plannedCostTo ( const TQDate & date)
virtual

Planned cost up to and including date.

Reimplemented from KPlato::Node.

Definition at line 472 of file kpttask.cpp.

◆ plannedEffort() [1/2]

Duration KPlato::Task::plannedEffort ( )
virtual

Returns the total planned effort for this task (or subtasks).

Reimplemented from KPlato::Node.

Definition at line 351 of file kpttask.cpp.

◆ plannedEffort() [2/2]

Duration KPlato::Task::plannedEffort ( const TQDate & date)
virtual

Returns the total planned effort for this task (or subtasks) on date.

Reimplemented from KPlato::Node.

Definition at line 366 of file kpttask.cpp.

◆ plannedEffortCostPrDay()

EffortCostMap KPlato::Task::plannedEffortCostPrDay ( const TQDate & start,
const TQDate & end ) const
virtual

Returns a list of planned effort and cost for this task for the interval start, end inclusive.

Implements KPlato::Node.

Definition at line 342 of file kpttask.cpp.

◆ plannedEffortTo()

Duration KPlato::Task::plannedEffortTo ( const TQDate & date)
virtual

Returns the planned effort up to and including date.

Reimplemented from KPlato::Node.

Definition at line 381 of file kpttask.cpp.

◆ positiveFloat()

Duration KPlato::Task::positiveFloat ( )

Return the duration that an activity's start can be delayed without affecting the project completion date.

An activity with positive float is not on the critical path.

Definition at line 1425 of file kpttask.cpp.

◆ printDebug()

void KPlato::Task::printDebug ( bool children,
TQCString indent )
virtual

Reimplemented from KPlato::Node.

Definition at line 1528 of file kpttask.cpp.

◆ progress()

struct Progress & KPlato::Task::progress ( )
inline

Definition at line 276 of file kpttask.h.

◆ resourceGroupRequest()

ResourceGroupRequest * KPlato::Task::resourceGroupRequest ( ResourceGroup * group) const

Return the resource request made to group (There should be only one).

Definition at line 98 of file kpttask.cpp.

◆ save()

void KPlato::Task::save ( TQDomElement & element) const
virtual

Save to document.

Implements KPlato::Node.

Definition at line 281 of file kpttask.cpp.

◆ saveAppointments()

void KPlato::Task::saveAppointments ( TQDomElement & element,
long id ) const
virtual

Save appointments for schedule with id.

Reimplemented from KPlato::Node.

Definition at line 330 of file kpttask.cpp.

◆ scheduleBackward()

DateTime KPlato::Task::scheduleBackward ( const DateTime & latest,
int use )
virtual

Schedules the task within the limits of earliestStart and latestFinish.

Calculates ref m_startTime, ref m_endTime and ref m_duration, Assumes ref calculateForward() and ref calculateBackward() has been run.

Parameters
latestThe task is not scheduled to end later than this
useCalculate using expected-, optimistic- or pessimistic estimate.
Returns
The tasks starttime which can be used for scheduling the predeccessor.

Implements KPlato::Node.

Definition at line 1074 of file kpttask.cpp.

◆ scheduleForward()

DateTime KPlato::Task::scheduleForward ( const DateTime & earliest,
int use )
virtual

Schedules the task within the limits of earliestStart and latestFinish.

Calculates ref m_startTime, ref m_endTime and ref m_duration, Assumes ref calculateForward() and ref calculateBackward() has been run.

Parameters
earliestThe task is not scheduled to start earlier than this
useCalculate using expected-, optimistic- or pessimistic estimate.
Returns
The tasks endtime which can be used for scheduling the successor.

Implements KPlato::Node.

Definition at line 879 of file kpttask.cpp.

◆ setConstraint()

void KPlato::Task::setConstraint ( Node::ConstraintType type)
virtual

Reimplemented from KPlato::Node.

Definition at line 167 of file kpttask.cpp.

◆ setCurrentSchedule()

void KPlato::Task::setCurrentSchedule ( long id)
virtual

Set current schedule to schedule with identity id, for me nd my children.

Reimplemented from KPlato::Node.

Definition at line 1515 of file kpttask.cpp.

◆ startFloat()

Duration KPlato::Task::startFloat ( )
inline

Return the duration from Early Start to Late Start.

Definition at line 234 of file kpttask.h.

◆ takeRequest()

void KPlato::Task::takeRequest ( ResourceGroupRequest * request)

Definition at line 119 of file kpttask.cpp.

◆ type()

int KPlato::Task::type ( ) const
virtual

Return task type. Can be Type_Task, Type_Summarytask ot Type_Milestone.

Implements KPlato::Node.

Definition at line 74 of file kpttask.cpp.

◆ units()

int KPlato::Task::units ( ) const

Definition at line 129 of file kpttask.cpp.

◆ workEndTime()

DateTime KPlato::Task::workEndTime ( ) const
virtual

Return the time when work can actually finish on this task.

This will be the time assigned resources can end work in accordance with their calendar, or if no resources have been assigned, the scheduled endtime is used.

Reimplemented from KPlato::Node.

Definition at line 1404 of file kpttask.cpp.

◆ workStartTime()

DateTime KPlato::Task::workStartTime ( ) const
virtual

Return the time when work can actually start on this task.

This will be the time assigned resources can start work in accordance with their calendar, or if no resources have been assigned, the scheduled starttime is used.

Reimplemented from KPlato::Node.

Definition at line 1396 of file kpttask.cpp.

◆ workUnits()

int KPlato::Task::workUnits ( ) const

Definition at line 135 of file kpttask.cpp.


The documentation for this class was generated from the following files: