Project#solve#
Schedules a Project and accepts the scheduled dates as its baseline. Pass a ProjectData to load a project, or null to reschedule after apply. The other read-only calls (preview, evaluate, suggestAssignments and the rest) need a solved project.
For a one-shot run that keeps no state, use Engine.schedule.
Signature#
public ScheduleResult
Synchronous and CPU-only. Changes the project's state. Not synchronized: serialize calls on one instance.
Parameters#
| Name | Type | Description |
|---|---|---|
data |
ProjectData |
Replacement data, or null to schedule the current state |
options |
SolveOptions |
Subtree, analytics and reporting switches. Must not be null |
Behavior#
- A non-null
datais deep-copied, validated, installed, scheduled and accepted. The previous data is discarded. Later changes to the caller'sProjectDataobject don't reach the project.ProjectOptions.validationdecides whether invalid data is rejected or repaired. nullschedules the current state when it has unsolved edits. When the project is already solved with equaloptions,solvereturns the same cached result object without scheduling again. The cache key is the wholeSolveOptionsvalue, compared by value.
Tasks touched by successful apply calls since the last solve appear in updates as direct updates, even when the planner leaves them where the edit put them. A cyclic project returns unchanged dates and keeps those tasks pending.
The result's baselineId names the accepted baseline. It changes only when the data or the dates change, so solving an unchanged state keeps it.
Returns#
The ScheduleResult. The project keeps it as its cached result and shares it with later calls and copies. Treat it as read-only, or call deepClone() before changing it.
Errors#
All exceptions are unchecked.
| Error | When |
|---|---|
InputException |
A non-null data fails validation. The previous state and cached result are kept. |
ProjectException with code == ProjectError.NEEDS_RESYNC |
data is null after an apply rejected an operation and no solve(data, …) followed |
NullPointerException |
options is null |
Example#
Load a project, commit an edit and reschedule it.
;
;
Related#
SolveOptions- subtree, analytics and reporting switchesScheduleResult- the accepted dates it returnsProjectData- the snapshot it loadsEngine.schedule- the stateless one-shot alternative- Scheduling a project - loading, rescheduling and the cached result