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 self.joinOf = fork;
40 model.addNode(self);
41 end
42 elseif model.isJavaNative()
43 self.setModel(model);
44 if nargin >= 3 && ~isempty(fork)
45 self.obj = jline.lang.nodes.Join(model.obj, name, fork.obj);
46 else
47 self.obj = jline.lang.nodes.Join(model.obj, name);
48 end
49 self.index = model.obj.getNodeIndex(self.obj);
50 end
51 % if ~exist('joinstrategy','var')
52 % joinstrategy = JoinStrategy.STD;
53 % end
54 % setStrategy(joinstrategy);
55 end
56 end
57
58 methods
59 function self = setStrategy(self, class, strategy)
60 % SELF = SETSTRATEGY(CLASS, STRATEGY)
61
62 self.input.setStrategy(class,strategy);
63 end
64
65 function self = setRequired(self, class, njobs)
66 % SELF = SETREQUIRED(CLASS, NJOBS)
67
68 self.input.setRequired(class,njobs);
69 end
70
71 function self = setProbRouting(self, class, destination, probability)
72 % SELF = SETPROBROUTING(CLASS, DESTINATION, PROBABILITY)
73
74 setRouting(self, class, RoutingStrategy.PROB, destination, probability);
75 end
76
77 function summary(self)
78 % SUMMARY()
79
80 line_printf('\nNode: <strong>%s</strong>',self.getName);
81 for r=1:length(self.output.outputStrategy)
82 classes = self.model.getClasses();
83 line_printf('Routing %s: %s\n', classes{r}.name, self.output.outputStrategy{r}{2});
84 end
85 end
86
87 end
88
89end
Definition mmt.m:92