Package com.projity.pm.dependency

Examples of com.projity.pm.dependency.Dependency


          setEnd(0);
      }
      return;
    }

    Dependency dependency;
   
    if (list.isEmpty()) {
      if (!task.isExternal() && task != context.sentinel) { // When the task is the sentinel, do nothing, otherwise find dependency and update it
        dependency = (Dependency) context.sentinel.getDependencyList(forward).find(forward,task); // find sentinel's dependency concerning this task
       
        if (dependency != null) { // tasks in a subproject won't have a sentinel dependency
          dependency.calcDependencyDate(forward,newBegin,newEnd,false); // calculate it to store off value
          context.sentinel.setCalculationStateCount(context.stateCount); // need to process successor(predecessor) later on in pass
          context.sentinel.getSchedule(type).setDependencyDate(needsCalculation); //sentinel needs dependencies calculated - I assume more than one
        }
      }
    } else {
//      Go Thru Successors (Predecessors) and calculate a dependency date for them and mark them for further treatment.  There is an optimization here:
//      If the successor(pred) task only has one predecessor(succ), then just set its dependency date instead of calculating it.  This avoids reprocessing
//      the predecessor(successor) list of that task later on.  Since in most cases, a task has only one predecessor, this saves time.
      for (Iterator d = list.iterator(); d.hasNext();) {
        Task dependencyTask;
        TaskSchedule dependencyTaskSchedule;
       
        dependency = (Dependency) d.next();
        if (dependency.isDisabled())
          continue;
        dependencyTask = (Task) dependency.getTask(!forward);        // get the successor(pred) task
        dependencyTaskSchedule = dependencyTask.getSchedule(type);
        // if this task is the only predecessor(successor) for the successor(predecessor) task, avoid long calculation and just calculate the date, otherwise
        // flag the task for later calculation
        long dependencyCount = dependencyTask.getDependencyList(forward).size();

        long dep = newBegin; // by default (if no preds for example)
        if (dependencyCount > 0) {
          boolean useSooner = !dependencyTask.isWbsParent() && dependencyTask.hasDuration();
          dep = dependency.calcDependencyDate(forward,newBegin,newEnd,useSooner); // calculate it and store off value
          if (dependencyCount > 1) // can't just set date directly because more than one
            dep = needsCalculation; // it will need to be calculated later
        }
        dependencyTaskSchedule.setDependencyDate(dep);
        dependencyTask.setCalculationStateCount(context.stateCount); // need to process successor(predecessor) later on in pass
View Full Code Here


* Calculate the date which predecessors(successors) push this task to start by looping thru all of its predecesors(succ) and choosing the max value
* @return max date
*/
  long calcDependencyDate() {
    long result = 0;
    Dependency dependency;
    long current;
    Collection list = task.getDependencyList(forward);
    for (Iterator i = list.iterator(); i.hasNext();) {
      dependency = (Dependency) i.next();
      if (dependency.isDisabled())
        continue;
      current = dependency.getDate(forward);
      if (result == 0)
        result = current;
      else
        result = Math.max(result,current);
    }
View Full Code Here

      }
      calculate(true,task);

    } else if (changedObject instanceof Dependency) { // dependency added or
                              // removed
      Dependency dependency = (Dependency) changedObject;
      if (!dependency.refersToDocument(project))
        return;
      if (!objectEvent.isUpdate()) {
        reset(); // refresh predecssor list - the whold thing may change drastically no matter what the link because of parents
      }
      task = (Task)dependency.getPredecessor();
      Task successor = (Task) dependency.getSuccessor(); // the successor needs to be scheduled
     
      // to fix a bug, I am invalidating both early and late schedules
      task.invalidateSchedules();
      task.markTaskAsNeedingRecalculation();
      if (successor.isSubproject()) { // special case for subprojects - need to reset all
View Full Code Here

 
  private void treatOpenedTask(Task externalTask, Task realTask, boolean opening) {
    externalTask.setExternal(!opening);
    if (opening) {
      Iterator i = externalTask.getSuccessorList().iterator();
      Dependency dep;
      realTask.invalidateSchedules();
      while (i.hasNext()) {
        dep = (Dependency)i.next();
        dep.fireDeleteEvent(this);
        dep.replace(realTask, true);
        try {
          dep.testValid(false);
        } catch (InvalidAssociationException e) {
          dep.setDisabled(true);
          DependencyService.warnCircularCrossProjectLinkMessage(dep.getPredecessor(), dep.getSuccessor());
        }
        realTask.getSuccessorList().add(dep);
        // to fix a bug, I am invalidating both early and late schedules
//       
//        successor.invalidateSchedules();
//        successor.markTaskAsDirty();

        dep.fireCreateEvent(this);
      }
//      System.out.println("removing external task " + externalTask + " from project " + externalTask.getProject());
      externalTask.getProject().removeExternal(externalTask);
      if (externalTask.liesInSubproject()) {
//        System.out.println("alo removing external task " + externalTask + " from project " + externalTask.getRootProject());
View Full Code Here

    // Arrange my parent

    // Arrange my predecessors
    Iterator i = getPredecessorList().iterator();
    Task predecessor;
    Dependency dep;

    Task parent = getWbsParentTask();
    if (parent != null) {
      parent.arrangeTask(addTo,markerStatus,depth+1);
    }
    //May 2 2008. this seems to be right place for setting marker status
    // If it is after adding this task below, you can get into an endless loop
    // If it is put at the top, you can get into situations where the PARENT_END is added before all children are added
    this.markerStatus = markerStatus;

    while (i.hasNext()) {
      dep = (Dependency)i.next();
      if (dep.isDisabled())
        continue;
      predecessor = (Task) dep.getPredecessor();
      predecessor.arrangeTask(addTo,markerStatus,depth+1);
      predecessor.arrangeChildren(addTo,markerStatus,depth);
    }

View Full Code Here

    if (taskNames != null)
      taskNames += (getId() +": " + getName() + '\n');


    Task predecessor;
    Dependency dep;

    Collection children;
    Iterator i;

    i = getPredecessorList().iterator();
    while (i.hasNext()) {
      dep = (Dependency)i.next();
      if (dep.isDisabled())
        continue;
      predecessor = (Task)dep.getPredecessor(); // I depend on my predecessors
      if (predecessor.dependsOn(other,me,set,taskNames == null ? null : taskNames + "Pred-"))
        return true;
    }


    //parent
    Task parent = getWbsParentTask();
    if (other.getWbsParentTask() != parent) { // only do parents if they are different
//      if (!this.isAncestorOrDescendent(other))
      if (parent != null) {
  //      if ( !other.wbsDescendentOf(parent))
          if (parent.dependsOn(other,me,set,taskNames == null? null: taskNames + "Parent- " ))
            return true;

      }
    }

    children = getWbsChildrenNodes();
    Task child;
    Object current;
    Iterator j;


    // I depend on my children's preds
    if (children != null) {
      i = children.iterator();
      while (i.hasNext()) {
        current = ((Node)i.next()).getImpl();
        if (! (current instanceof Task))
          continue;
        child = (Task)current;

        j = child.getPredecessorList().iterator();
        while (j.hasNext()) {
          dep = (Dependency)j.next();
          if (dep.isDisabled())
            continue;
          predecessor = (Task)dep.getPredecessor(); // I depend on my predecessors
          if (predecessor.wbsDescendentOf(this)) {// skip if already belongs to parent thru an ancestry relation
            continue;
          }

          if (predecessor.dependsOn(other,me,set,taskNames == null ? null : taskNames + "pred-child " + child.getId()))
View Full Code Here

   * @param duration
   * @return
   */
  public long getFreeSlack() {
    long least = getTotalSlack(); // free slack is at most the total slack
    Dependency dependency;
    for (Iterator i = getSuccessorList().iterator(); i
        .hasNext();) {
      dependency = (Dependency) i.next();
      least = Math.min(least, calcFreeSlack(dependency));
    }
View Full Code Here



        Color oldColor=g2.getColor();
        Stroke oldStroke = g2.getStroke();
        Dependency dep = dependency.getDependency();
        if (dep.isDisabled()) g2.setStroke(DISABLED_LINK_STROKE);
        if (dep.isCrossProject()) g2.setColor(/*dep.isDirty()?Color.ORANGE:*/EXTERNAL_LINK_COLOR);
        else g2.setColor(/*dep.isDirty()?Color.RED:*/format.getMiddle().getColor());
        g2.draw(path);

      //}
      if (format.getStart()==null&&format.getEnd()==null) return;
View Full Code Here

TOP

Related Classes of com.projity.pm.dependency.Dependency

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.