Skip to content

Commit

Permalink
Modified SchedulingActivityDirective providing updated of and copyOf …
Browse files Browse the repository at this point in the history
…methods. Also add a type method returning the AcitivityType of the directive. Changes used in PrioritySolver, MissingActivityTemplateConflict and goals
  • Loading branch information
jmdelfa authored and dandelany committed Jun 7, 2024
1 parent 485846a commit 52ceee2
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,15 @@ public static SchedulingActivityDirective of(ActivityType type, Duration startOf
parameters, topParent, anchorId, anchoredToStart);
}

private static SchedulingActivityDirective of(SchedulingActivityDirectiveId id, ActivityType type, Duration startOffset, Duration duration, Map<String, SerializedValue> parameters, SchedulingActivityDirectiveId topParent, SchedulingActivityDirectiveId anchorId, boolean anchoredToStart) {
public static SchedulingActivityDirective of(
SchedulingActivityDirectiveId id,
ActivityType type,
Duration startOffset,
Duration duration,
Map<String, SerializedValue> parameters,
SchedulingActivityDirectiveId topParent,
SchedulingActivityDirectiveId anchorId,
boolean anchoredToStart) {
return new SchedulingActivityDirective(
id,
type,
Expand All @@ -124,6 +132,18 @@ public static SchedulingActivityDirective copyOf(SchedulingActivityDirective act
activityInstance.anchoredToStart);
}

public static SchedulingActivityDirective copyOf(SchedulingActivityDirective activityInstance, SchedulingActivityDirectiveId anchorId, boolean anchoredToStart, Duration startOffset){
return SchedulingActivityDirective.of(
activityInstance.id,
activityInstance.type,
startOffset,
activityInstance.duration,
new HashMap<>(activityInstance.arguments),
activityInstance.topParent,
anchorId,
anchoredToStart);
}

/**
* Scheduler Activity Directives generated from the Plan have their ID set to the negative of the ActivityDirectiveId
*/
Expand Down

0 comments on commit 52ceee2

Please sign in to comment.