LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
Join.m
1classdef Join < Station
2 % Task synchronization node for fork-join models
3 %
4 % Combines parallel sibling tasks created by Fork nodes, waiting until all arrive.
5 %
6 % Copyright (c) 2012-2026, Imperial College London
7 % All rights reserved.
8
9 properties
10 joinStrategy;
11 joinOf;
12 end
13
14 methods
15 %Constructor
16 function self = Join(model, name, fork)
17 % JOIN Create a Join node instance
18 %
19 % @brief Creates a Join node for synchronizing parallel tasks
20 % @param model Network model to add the join node to
21 % @param name String identifier for the join node
22 % @param fork Optional Fork node this join synchronizes with
23 % @return self Join instance configured for task synchronization
24 %
25 % The constructor creates a Join node with appropriate joiners,
26 % dispatchers, and service tunnels. If a fork parameter is provided,
27 % the join is associated with that specific fork node.
28
29 self@Station(name);
30 if model.isMatlabNative()
31 if(model ~= 0)
32 classes = model.getClasses();
33 self.input = Joiner(classes);
34 self.output = Dispatcher(classes);
35 self.server = ServiceTunnel();
36 self.dropRule = [];
37 self.numberOfServers = Inf;
38 self.setModel(model);
39 if nargin >= 3 && ~isempty(fork)
40 self.joinOf = fork;
41 else
42 self.joinOf = [];
43 end
44 model.addNode(self);
45 end
46 elseif model.isJavaNative()
47 self.setModel(model);
48 if nargin >= 3 && ~isempty(fork)
49 self.obj = jline.lang.nodes.Join(model.obj, name, fork.obj);
50 else
51 self.obj = jline.lang.nodes.Join(model.obj, name);
52 end
53 self.index = model.obj.getNodeIndex(self.obj);
54 end
55 % if ~exist('joinstrategy','var')
56 % joinstrategy = JoinStrategy.STD;
57 % end
58 % setStrategy(joinstrategy);
59 end
60 end
61
62 methods
63 function self = setStrategy(self, class, strategy)
64 % SELF = SETSTRATEGY(CLASS, STRATEGY)
65
66 self.input.setStrategy(class,strategy);
67 end
68
69 function self = setRequired(self, class, njobs)
70 % SELF = SETREQUIRED(CLASS, NJOBS)
71
72 self.input.setRequired(class,njobs);
73 end
74
75 function self = setProbRouting(self, class, destination, probability)
76 % SELF = SETPROBROUTING(CLASS, DESTINATION, PROBABILITY)
77
78 setRouting(self, class, RoutingStrategy.PROB, destination, probability);
79 end
80
81 function summary(self)
82 % SUMMARY()
83
84 line_printf('\nNode: <strong>%s</strong>',self.getName);
85 for r=1:length(self.output.outputStrategy)
86 classes = self.model.getClasses();
87 line_printf('Routing %s: %s\n', classes{r}.name, self.output.outputStrategy{r}{2});
88 end
89 end
90
91 end
92
93end
Definition mmt.m:93