Candidate#
One alternative edit to score: an id and the SchedulingChanges to try. Create it with new Candidate() and the fluent setters, and pass a list of candidates to Project#evaluate or Project#evaluateWith.
Declaration#
;
Constructors#
Candidate()#
public
Creates a candidate with id and changes set to null. Set both before passing it to evaluate.
Fields#
| Field | Type | Default | Description |
|---|---|---|---|
id |
Id |
null |
Label for the candidate. Copied unchanged into CandidateResult.id. Uniqueness isn't checked. |
changes |
SchedulingChanges |
null |
Edits to apply to the copy before scheduling it. Required: evaluate throws NullPointerException when it's null. An empty new SchedulingChanges() scores the plan as it is. |
For how a stale changes.baselineId or a rejected operation in changes is reported, see Project#evaluate and CandidateResult.error.
Methods#
withId, withChanges#
public Candidate
public Candidate
Each setter assigns its field and returns this instance.
Returns: this Candidate.
deepClone#
public Candidate
Returns a new candidate with the same id and a deep copy of changes. Nothing in the change set is shared with the original.
Returns: a new Candidate.
Errors: NullPointerException when changes is null.
copy#
public Candidate
Returns a shallow copy: the new candidate holds the same id and changes objects.
Returns: a new Candidate.
equals, hashCode, toString#
public boolean
public int
public String
Inherited from ValueRecord. Two candidates are equal when id and changes are equal. toString() prints both fields, for logging.
Example#
Score two ways to staff task 1: assign dev1 or assign dev2.
;
;
;
Related#
Project#evaluate- the call that scores a list of candidatesCandidateResult- the score returned for each candidateSchedulingChanges- the change set a candidate carries- Evaluating alternatives - building candidates and committing the winner