Package com.projity.pm.task

Examples of com.projity.pm.task.Task


   * 3) The CP is modified and the project has ALAP tasks.  In which case, after both forward and backward passes are perfomed, a third pass sets current dates
   * @param startTask
   */
  private void fastCalc(Task startTask) {
    lastInstance =this;
    Task beginSentinel = getBeginSentinel(isForward());
    Task endSentinel = getEndSentinel(isForward());

    long firstBoundary = isForward() ? project.getStartConstraint() : -project.getEnd();
    boolean hasReverseScheduledTasks = predecessorTaskList.hasReverseScheduledTasks();

    context = new TaskSchedule.CalculationContext();
    context.stateCount = getNextCalculationStateCount();
    context.honorRequiredDates = isHonorRequiredDates();
    context.forward = isForward();
    context.boundary = firstBoundary;
    context.sentinel = endSentinel;
    context.earlyOnly = false;
    context.assign = false;
    context.scheduleType = isForward() ? TaskSchedule.EARLY : TaskSchedule.LATE;;
    context.pass = 0;
    boolean affectsCriticalPath = (startTask == beginSentinel) || startTask.getSchedule(context.scheduleType).affectsCriticalPath(context);
   
    boolean worstCase = affectsCriticalPath && hasReverseScheduledTasks;
    context.earlyOnly = worstCase;
    context.assign = true;
    context.pass = 1;
    criticalPathJustChanged = affectsCriticalPath;
    doPass(startTask,context); // always assign in first pass.  Dates may change in third pass
   
    if (affectsCriticalPath) {
      context.stateCount = getNextCalculationStateCount(); // backward pass treats next increment
      context.sentinel = endSentinel;
      long secondBoundary = -endSentinel.getSchedule(context.scheduleType).getBegin(); // sent bounds of end sentinel for backward pass
      context.boundary = secondBoundary;
      context.sentinel = beginSentinel;
      context.forward = !context.forward;
      context.assign = false;
      context.scheduleType = -context.scheduleType;
View Full Code Here


    }

    PredecessorTaskList.TaskReference taskReference;
    boolean forward = context.forward;
    ListIterator i = forward ? predecessorTaskList.listIterator() : predecessorTaskList.reverseIterator();
    Task task;
    TaskSchedule schedule;

//    int count = 0;
//    long z = System.currentTimeMillis();
    boolean projectForward = project.isForward();
    while (forward ? i.hasNext() : i.hasPrevious()) {
      taskReference = (PredecessorTaskList.TaskReference)(forward ? i.next() : i.previous());
      traceTask = task = taskReference.getTask();
      context.taskReferenceType = taskReference.getType();
      schedule = task.getSchedule(context.scheduleType);
      if (!forward)
        context.taskReferenceType = -taskReference.getType();
       
      if (task.isReverseScheduled()) {//  reverse scheduled must always be calculated
        schedule.invalidate();
        task.setCalculationStateCount(context.stateCount);
      }
      if (task.getCalculationStateCount() >= context.stateCount) {
        schedule.calcDates(context);
        if (context.assign && (projectForward || !task.isWbsParent())) { // in reverse scheduling, I see some parents have 0 or 1 as their dates. This is a workaround.
          if (schedule.getBegin() != 0L && !isSentinel(task))
            earliestStart = Math.min(earliestStart, schedule.getStart());
          if (schedule.getEnd() != 0 && !isSentinel(task))
            latestFinish = Math.max(latestFinish, schedule.getFinish());
        }
View Full Code Here

      return;
    }
    if (objectEvent.getSource() == this)
      return;
    Object changedObject = objectEvent.getObject();
    Task task = null;
    if (changedObject instanceof Task) {
      if (objectEvent.isCreate()) {
        predecessorTaskList
            .arrangeTask((Task) changedObject);
        return; // let the hierarchy event that follow run the CP
      } else if (objectEvent.isDelete()) {
        Task removedTask = (Task) changedObject;
        predecessorTaskList.removeTask(removedTask);
        reset(); // Fix of bug 91 31/8/05.  This ensures the ancestors of this task that are no longer parents will be replaced as single entries in pred list
      } else if (objectEvent.isUpdate()) {
        task = (Task)changedObject;
        Field field = objectEvent.getField();
        if (field != null && !fieldUpdater.inputContains(field))
          return;
        if (field == constraintTypeField) {
          reset();
          task.invalidateSchedules();
          task.markTaskAsNeedingRecalculation();
        }
      }
      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
        SubProj sub = (SubProj)successor;
        if (sub.isSubprojectOpen())
          sub.getSubproject().markAllTasksAsNeedingRecalculation(true);
      }
      successor.invalidateSchedules();
      successor.markTaskAsNeedingRecalculation();
     
//      The line below fixes a bug with nested parents of the sort pred->grand par sib1->sib2. Of course, it means most of the code above is redundant (except for subproject stuff)
      project.markAllTasksAsNeedingRecalculation(true);
      calculate(true,null); // Run both passes, since the CP might be modified and it's hard to tell if so
    } else if (changedObject == project) { // if whole project changed, such
View Full Code Here

   
    // mark all tasks without preds or without succs as dirty
    // the purpose of this is to handle cases where a task that determines the project bounds is deleted.
   
    Iterator i = startSentinel.getSuccessorList().iterator();
    Task task;
    while (i.hasNext()) {
      task = ((Task)((Dependency)i.next()).getTask(false));
      task.invalidateSchedules();
      task.markTaskAsNeedingRecalculation();
    }

    i = finishSentinel.getPredecessorList().iterator();
    while (i.hasNext()) {
      task = ((Task)((Dependency)i.next()).getTask(true));
      task.invalidateSchedules();
      task.markTaskAsNeedingRecalculation();
    }
   
  }
View Full Code Here

    boolean m = !getMarkerStatus();
    subproject.setMarkerStatus(m);
    subproject.markTaskAsNeedingRecalculation();
    Iterator j = ((SubProj)subproject).getSubproject().getTasks().iterator();
    while (j.hasNext()) {
      Task task = (Task)j.next();
      task.setMarkerStatus(m);
      task.markTaskAsNeedingRecalculation();

    }
   
    removeTask(subproject); // remove existing one
    arrangeSingleTask(subproject); // add it back - it will become a parent
View Full Code Here

    void arrangeTask(Task task) {
        if (task.isReverseScheduled())
      numberOfReverseScheduledTasks++;
      task.setMarkerStatus(markerStatus);
        TaskReference previousTaskReference;
      Task previousTask;
        // go thru in reverse order inserting after first predecessor or parent encountered
        ListIterator i = list.listIterator();
        TaskReference taskReference = new TaskReference(task);
        while (i.hasNext()) {
          previousTaskReference = (TaskReference)i.next();
View Full Code Here

  int getCalculationStateCount() {
    return calculationStateCount;
  }

  boolean addAll(Collection tasks) {
    Task task;
    list.clear();
    toggleMarkerStatus();
    Iterator i = tasks.iterator();
    while (i.hasNext()) {
      task = (Task)i.next();
      task.arrangeTask(list,markerStatus,0);
        if (task.isReverseScheduled())
        numberOfReverseScheduledTasks++;
    }
    return true;
  }
View Full Code Here

TOP

Related Classes of com.projity.pm.task.Task

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.