Package com.projity.grouping.core.summaries

Examples of com.projity.grouping.core.summaries.DivisionSummaryVisitor


  /**
   * Return a closure that will compute the percent complete using weighted values
   * @return
   */
  public static DivisionSummaryVisitor percentCompleteClosureInstance(final boolean nodeBased) {
    return new DivisionSummaryVisitor(nodeBased) {
      public double getNumerator(Object impl) {
        if (impl instanceof Schedule) {
          Schedule schedule = ((Schedule)impl);
          return schedule.getPercentComplete() * Duration.millis(schedule.getDuration());
        }
 
View Full Code Here


/**
* Percent complete is calculated based on assignments
*/
  public double getPercentComplete() {
    boolean parent = isWbsParent();
    DivisionSummaryVisitor divisionClosure = ScheduleUtil.percentCompleteClosureInstance(parent);
    Project proj = (Project) (getMasterDocument() == null ? getProject() : getMasterDocument());
    NodeModel nodeModel = proj.getTaskOutline();
    if (isWbsParent()) {
      try {
         LeafWalker.recursivelyTreatBranch(nodeModel,this, divisionClosure);
      } catch (NullPointerException n ){
        ErrorLogger.logOnce("getPercentComplete","getPercentComplete() Task: " + this + " Project " + project,n);
        return 0// better this than crashing
      }
    } else {
      CollectionUtils.forAllDo(((NormalTask)this).getAssignments(),divisionClosure);
    }
    double val = divisionClosure.getValue();
    if (val >=COMPLETE_THRESHOLD) // adjust for rounding
      val = 1.0D;
    return val;
  }
View Full Code Here

TOP

Related Classes of com.projity.grouping.core.summaries.DivisionSummaryVisitor

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.