AnalyticsOptions#

Selects which analytics a ScheduleResult carries. Set it as the Analytics property of SolveOptions, PreviewOptions or AnalyzeOptions. Each of those properties defaults to new AnalyticsOptions(), which requests nothing.

Declaration#

namespace Plen;

public sealed class AnalyticsOptions : IDeepCloneable<AnalyticsOptions>, IEquatable<AnalyticsOptions>

Constructors#

AnalyticsOptions()#

public AnalyticsOptions()

Creates options with both flags false.

Properties#

Property Type Default Description
Slack bool false true fills Analytics.Slack with the total and free slack of each task.
CriticalPath bool 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. Check Analytics.Status before reading its fields.

Methods#

DeepClone#

public AnalyticsOptions DeepClone()

Returns a copy with the same Slack and CriticalPath.

Equals#

public bool Equals(AnalyticsOptions? other)

Value equality: two instances are equal when Slack and CriticalPath are equal. GetHashCode uses the same fields.

ToString#

public override string ToString()

Returns a debug rendering of the fields, e.g. AnalyticsOptions { Slack: true, CriticalPath: false }.

Example#

using Plen;

// `project` already holds solved data.
static Analytics? CriticalPathOf(Project project)
{
    var options = new AnalyzeOptions
    {
        Analytics = new AnalyticsOptions { CriticalPath = true, Slack = true },
    };
    return project.Analyze(null, options).Analytics;
}