Pool#
The workers that SkillLayer.slots may put on tasks. Each worker is a project resource with its skills. Create one with new Pool(), fill it with withWorkers(...), and pass it to SkillLayer.slots together with the requirements.
Declaration#
Constructors#
Pool()#
public
Creates an empty pool: workers is an empty Vec.
Fields#
workers#
public Vec workers ;
The order is the preference order: a slot's allowed list keeps the workers in pool order, and that order breaks ties between equally scored candidates.
Each worker must name a resource of the project, and a resource can appear only once. SkillLayer.slots and SkillLayer.validatePool check this and throw MatchException.Invalid with a pool.workers[i]… path; see Errors.
Methods#
withWorkers#
public Pool
public Pool
Sets workers and returns this pool. The Vec overload stores the given list itself. The Collection overload copies the elements into a new Vec, so List.of(...) works; null sets the field to null.
deepClone#
public Pool
Returns a deep copy. The workers list and every Worker in it are copied, so nothing is shared with the original.
copy#
public Pool
Returns a shallow copy. The copy holds the same workers list as the original.
equals, hashCode, toString#
Inherited from ValueRecord. Two pools are equal when workers holds equal workers in the same order. toString() returns Pool{workers=[…]}.
Example#
Three workers. ann comes first, so she's preferred over bob when both fit a slot equally well.
;
;
Related#
Worker- one worker in the poolSkillLayer.slots- the call that reads the poolRequirement- what each task needs from the poolMatchException- thrown for an invalid pool- Skills and requirements - building a pool of workers