com.prozima.pengine
Class ScheduleNode

java.lang.Object
  extended by com.prozima.pengine.ScheduleNode
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
Activity, Milestone

public abstract class ScheduleNode
extends java.lang.Object
implements java.lang.Cloneable

Represents the state of a node in a schedule. Activities and milestones are both types of schedule node and share many behaviours in common.


Nested Class Summary
static class ScheduleNode.PredecessorType
          Specifies the type of predecessor in a relationship.
static class ScheduleNode.Scheduling
          Specifies if an schedule node should be scheduled ASAP or ALAP within its constraints and relationships.
 
Constructor Summary
ScheduleNode()
           
 
Method Summary
 boolean addRelationship(Relationship.RelationshipType inRelType, ScheduleNode.PredecessorType inPredType, int inID)
          Define a new relationship this node has with a predecessor.
 ScheduleNode clone()
           
 java.lang.Integer getAncestorID()
          Retrieve the ancestor ID of the schedule node.
 Constraint getConstraint()
          Get the constraint for this schedule node.
 int getCumulativeEffort()
          Retrieve the total effort required for this schedule node (if it has effort) and all its predecessor nodes.
 int getCumulativeEffortWorked()
          Retrieve the Cumulative Effort worked for this schedule node.
 java.lang.Integer getID()
          Retrieve the ID of the schedule node.
 java.lang.String getName()
          Retrieve the name of the schedule node.
 java.lang.Integer getProjectID()
          Retrieve the ID of the parent project.
 java.util.List<java.lang.Integer> getRelationships(Relationship.RelationshipType inRelType, ScheduleNode.PredecessorType inPredType)
          Get a List of the IDs of all the schedule nodes which have the specified type of relationship with this schedule node.
 java.lang.Integer getScheduleID()
          Retrieve the ID of the parent schedule.
 ScheduleNode.Scheduling getSchedulingPref()
          Get the Scheduling Preference for this task.
 boolean removeRelationship(Relationship.RelationshipType inRelType, int inPredID)
          Remove a predecessor relationship for the schedule node.
 boolean setAncestorID(int inID)
          Set the ancestor ID of the schedule node.
 boolean setConstraint(Constraint inConstraint)
          Attaches a new Constraint to this ScheduleNode.
 boolean setID(int inID)
          Set the ID of the schedule node.
 boolean setName(java.lang.String inName)
          Set the name of the schedule node.
 boolean setProjectID(int inID)
          Store the ID of the parent project.
 boolean setScheduleID(int inID)
          Store the ID of the parent schedule.
 boolean setSchedulingPref(ScheduleNode.Scheduling inPref)
          Set the scheduling preference for the ScheduleNode.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScheduleNode

public ScheduleNode()
Method Detail

addRelationship

public boolean addRelationship(Relationship.RelationshipType inRelType,
                               ScheduleNode.PredecessorType inPredType,
                               int inID)
Define a new relationship this node has with a predecessor.

Parameters:
inRelType - Type of relationship. Cannot be null.
inPredType - Type of predecessor. Cannot be null and the value ScheduleNode.PredecessorType.ALL is not valid when creating a relationship.
inID - ID of the predecessor node.
Returns:
true if relationship was created, otherwise false.

clone

public ScheduleNode clone()
                   throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

getAncestorID

public java.lang.Integer getAncestorID()
Retrieve the ancestor ID of the schedule node.

Returns:
ID of ancestor node or null if it has no ancestor node.
See Also:
setAncestorID(int)

getConstraint

public Constraint getConstraint()
Get the constraint for this schedule node.

Returns:
A Constraint or null if there is no constraint.

getCumulativeEffort

public int getCumulativeEffort()
Retrieve the total effort required for this schedule node (if it has effort) and all its predecessor nodes. Allows a meaningful effort value to be calculated for milestones.

Returns:
Cumulative effort in [minutes] of this node and all its predecessors.

getCumulativeEffortWorked

public int getCumulativeEffortWorked()
Retrieve the Cumulative Effort worked for this schedule node.

Returns:
Effort worked to date in [minutes] towards this node and all its predecessors.

getID

public java.lang.Integer getID()
Retrieve the ID of the schedule node.

Returns:
ID of the schedule node or null if no ID has been set.
See Also:
setID(int)

getName

public java.lang.String getName()
Retrieve the name of the schedule node.

Returns:
String containing the name of the schedule node. null may be returned if no name has been set.

getProjectID

public java.lang.Integer getProjectID()
Retrieve the ID of the parent project.

Returns:
ID of a project or null if not set.

getRelationships

public java.util.List<java.lang.Integer> getRelationships(Relationship.RelationshipType inRelType,
                                                          ScheduleNode.PredecessorType inPredType)
Get a List of the IDs of all the schedule nodes which have the specified type of relationship with this schedule node. The returned list identifies all the predecessor nodes.

Parameters:
inRelType - Relationship type.
inPredType - Types of predecessors.
Returns:
A list of schedule node IDs.

getScheduleID

public java.lang.Integer getScheduleID()
Retrieve the ID of the parent schedule.

Returns:
ID of a schedule or null if its not set.

getSchedulingPref

public ScheduleNode.Scheduling getSchedulingPref()
Get the Scheduling Preference for this task.

Returns:
The schedule preference.

removeRelationship

public boolean removeRelationship(Relationship.RelationshipType inRelType,
                                  int inPredID)
Remove a predecessor relationship for the schedule node.

Parameters:
inRelType - The type of relationship to the predecessor.
inPredID - The ID of the predecessor node.
Returns:
true if the relationship was found and removed.

setAncestorID

public boolean setAncestorID(int inID)
Set the ancestor ID of the schedule node. No need to call this method if the schedule node has no ancestor, thats the default.

Parameters:
inID - of ancestor schedule node. Must be zero or positive integer.
Returns:
true if ID was valid, otherwise false. TODO Impose constraints on ID values.

setConstraint

public boolean setConstraint(Constraint inConstraint)
Attaches a new Constraint to this ScheduleNode. This can specify various constraints on the scheduling of a schedule node.

Parameters:
inConstraint - A valid new constraint. null is not permitted.
Returns:
true if the constraint object was set correctly, otherwise false.

setID

public boolean setID(int inID)
Set the ID of the schedule node.

Returns:
Always returns true.

setName

public boolean setName(java.lang.String inName)
Set the name of the schedule node.

Returns:
true if the name was not null and contains characters, otherwise false.

setProjectID

public boolean setProjectID(int inID)
Store the ID of the parent project.

Returns:
true if new ID was valid, otherwise false.

setScheduleID

public boolean setScheduleID(int inID)
Store the ID of the parent schedule.

Returns:
true if new ID was valid, otherwise false.

setSchedulingPref

public boolean setSchedulingPref(ScheduleNode.Scheduling inPref)
Set the scheduling preference for the ScheduleNode.

Parameters:
inPref - Scheduling preference. Cannot be null.
Returns:
Always returns true.
See Also:
ScheduleNode.Scheduling

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object