Project#analyze#

Computes analytics over dates without scheduling them. It reads either a supplied ProjectData or the current dates of a Project, including unsolved edits. It never installs data and never changes the solved status. Works on an unsolved project.

Signature#

public ScheduleResult analyze(ProjectData data, AnalyzeOptions options)

Synchronous and CPU-only. Doesn't change the project's state. Not synchronized: serialize calls on one instance.

Parameters#

Name Type Description
data ProjectData Dates to analyze, or null for the project's current dates
options AnalyzeOptions Which analytics to compute. Must not be null

Behavior#

  • A non-null data is validated and read as is. The method doesn't install it or modify the caller's object. ProjectOptions.validation decides whether invalid data is rejected or repaired. With Validation.REPAIR, the repairs apply to a copy and appear in notes as Note.Repaired.
  • null reads the project's current dates, including edits from apply that no solve has scheduled yet.

Returns#

A ScheduleResult with cycles, notes, analytics and overallocations. Its updates and conflicts are empty, converged is true and profile is null. Its baselineId is set only for null data on a solved project with no unsolved edits.

Errors#

All exceptions are unchecked.

Error When
InputException A non-null data fails validation
NullPointerException options is null

Example#

Get the critical path of dates stored elsewhere, without scheduling them.

import java.util.List;
import org.dhtmlx.plen.*;

public class AnalyzeExample {
  public static void main(String[] args) throws Exception {
    ProjectData data = new ProjectData()
        .withTasks(List.of(
            new TaskData(Id.str("design"))
                .withStartDate(Moment.fromYmdHm(2026, 1, 5, 8, 0))
                .withDuration(2.0),
            new TaskData(Id.str("build"))
                .withStartDate(Moment.fromYmdHm(2026, 1, 7, 8, 0))
                .withDuration(3.0)))
        .withLinks(List.of(new LinkData()
            .withId(Id.str("l1"))
            .withSource(Id.str("design"))
            .withTarget(Id.str("build"))));

    Project project = new Project();
    AnalyzeOptions options = new AnalyzeOptions()
        .withAnalytics(new AnalyticsOptions().withCriticalPath(true));
    ScheduleResult result = project.analyze(data, options);

    if (result.analytics != null && result.analytics.criticalPath != null) {
      System.out.println("critical tasks: " + result.analytics.criticalPath.tasks);
    }
  }
}