1classdef Forker < OutputSection
2 % An output section forking jobs into sibling tasks
4 % Copyright (c) 2012-2026, Imperial College London
13 function self = Forker(customerClasses)
14 % SELF = FORKER(CUSTOMERCLASSES)
16 self@OutputSection(
'Forker');
17 self.tasksPerLink = 1.0;
18 initDispatcherJobClasses(self, customerClasses);
22 methods (Access =
'private')
23 function initDispatcherJobClasses(self, customerClasses)
24 % INITDISPATCHERJOBCLASSES(CUSTOMERCLASSES)
26 for i = 1 : length(customerClasses)
27 self.outputStrategy{i} = {customerClasses{i}.name, RoutingStrategy.RAND};
32 methods(Access =
protected)
33 % Override copyElement method:
34 function clone = copyElement(self)
35 % CLONE = COPYELEMENT()
37 % Make a shallow copy of all properties
38 clone = copyElement@Copyable(self);
39 % Make a deep copy of each
object
40 for i = 1 : length(self.outputStrategy)
41 if ishandle(clone.outputStrategy{i}{1})
42 %
this is a problem
if one modifies the
classes in the
43 % model because the one below
is not an handle so it
44 % will not be modified
45 clone.outputStrategy{i}{1} = self.outputStrategy{i}{1}.copy;