AnalyzeOptions#

Options for Project#analyze. They select which analytics the returned ScheduleResult carries. new AnalyzeOptions() requests no analytics.

Declaration#

public class AnalyzeOptions extends ValueRecord implements DeepCloneable<AnalyzeOptions>

Set the field with the fluent setter: new AnalyzeOptions().withAnalytics(new AnalyticsOptions().withSlack(true)).

Constructors#

AnalyzeOptions()#

public AnalyzeOptions()

Creates options with analytics at its default.

Fields#

Field Type Default Description
analytics AnalyticsOptions new AnalyticsOptions() (no analytics) Requests critical path and slack. Fills ScheduleResult.analytics.

analytics#

public AnalyticsOptions analytics = new AnalyticsOptions();

Turns on AnalyticsOptions.slack and AnalyticsOptions.criticalPath. With both flags false (the default), ScheduleResult.analytics is null. With either flag set, it holds an Analytics value. Check its status before reading the data.

Methods#

withAnalytics#

public AnalyzeOptions withAnalytics(AnalyticsOptions value)

Assigns analytics and returns this instance for chaining.

Returns - this AnalyzeOptions.

deepClone#

public AnalyzeOptions deepClone()

Returns a copy that doesn't share the analytics object with this instance.

Returns - a new AnalyzeOptions with the same values.

copy#

public AnalyzeOptions copy()

Returns a shallow copy. The copy shares the analytics object with this instance.

Returns - a new AnalyzeOptions with the same field value.

equals, hashCode, toString#

public boolean equals(Object other)
public int hashCode()
public String toString()

Inherited from ValueRecord. Two AnalyzeOptions are equal when their analytics values are equal. toString() lists the field.

Example#

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

public class AnalyzeOptionsExample {
  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"))));

    AnalyzeOptions options = new AnalyzeOptions()
        .withAnalytics(new AnalyticsOptions().withSlack(true).withCriticalPath(true));

    ScheduleResult result = new Project().analyze(data, options);
    System.out.println(result.analytics);
  }
}