AnalyticsOptions#

Selects which analytics a ScheduleResult carries. Create one with new AnalyticsOptions(), set flags with the fluent withX setters, and pass it as the analytics field of SolveOptions, PreviewOptions or AnalyzeOptions. Each of those fields defaults to new AnalyticsOptions(), which requests nothing.

Declaration#

public class AnalyticsOptions extends ValueRecord implements DeepCloneable<AnalyticsOptions>

Constructors#

AnalyticsOptions()#

public AnalyticsOptions()

Creates options with both flags false.

Fields#

Field Type Default Description
slack boolean false true fills Analytics.slack with the total and free slack of each task.
criticalPath boolean false true fills Analytics.criticalPath with the critical tasks and links.

With both flags false, ScheduleResult.analytics is null. With either flag set, ScheduleResult.analytics is set, and a field whose flag is false stays null. Check Analytics.status before reading the fields.

Methods#

withSlack#

public AnalyticsOptions withSlack(boolean value)

Sets slack and returns this instance for chaining.

Parameters

Name Type Description
value boolean true to request slack

Returns - this AnalyticsOptions.

withCriticalPath#

public AnalyticsOptions withCriticalPath(boolean value)

Sets criticalPath and returns this instance for chaining.

Parameters

Name Type Description
value boolean true to request the critical path

Returns - this AnalyticsOptions.

deepClone#

public AnalyticsOptions deepClone()

Returns a copy with the same slack and criticalPath.

Returns - a new AnalyticsOptions.

copy#

public AnalyticsOptions copy()

Returns a shallow copy. AnalyticsOptions holds only boolean fields, so the result is the same as deepClone().

Returns - a new AnalyticsOptions.

equals, hashCode, toString#

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

Inherited from ValueRecord. Two AnalyticsOptions are equal when slack and criticalPath are equal. toString() lists the fields, e.g. AnalyticsOptions{slack=true, criticalPath=false}.

Example#

// `project` already holds solved data.
AnalyzeOptions options = new AnalyzeOptions()
    .withAnalytics(new AnalyticsOptions().withCriticalPath(true).withSlack(true));

Analytics analytics = project.analyze(null, options).analytics;