LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
ModeEvent.m
1classdef ModeEvent
2 % A mode event occurring in a Network.
3 %
4 % Object of the Event class are not passed by handle.
5 %
6 % Copyright (c) 2012-2026, Imperial College London
7 % All rights reserved.
8
9 properties
10 node;
11 event;
12 mode;
13 weight;
14 prob;
15 state; % state information when the event occurs (optional)
16 t; % timestamp when the event occurs (optional)
17 job; % job id (optional)
18 end
19
20 methods
21 function self = ModeEvent(event, node, mode, weight, prob, state, t, job)
22 % SELF = MODEEVENT(EVENT, NODE, MODE, WEIGHT, PROB, STATE, TIMESTAMP, JOB)
23
24 self.node = node;
25 self.event = event;
26 self.mode = mode;
27 if nargin <4
28 weight = 1;
29 end
30 self.weight = weight;
31 if nargin <5
32 prob = NaN;
33 end
34 self.prob = prob;
35 if nargin <6
36 state = []; % local state of the node or environment transition
37 end
38 self.state = state;
39 if nargin <7
40 t = NaN; % timestamp
41 end
42 self.t = t;
43 if nargin <8
44 job = NaN; % timestamp
45 end
46 self.job = job;
47 end
48
49 function print(self)
50 % PRINT()
51 if isnan(self.t)
52 line_printf('(%s: node: %d, mode: %d)',EventType.toText(self.event),self.node,self.mode);
53 else
54 if isnan(self.job)
55 line_printf('(%s: node: %d, mode: %d, time: %d)',EventType.toText(self.event),self.node,self.mode,self.t);
56 else
57 line_printf('(%s: node: %d, mode: %d, job: %d, time: %d)',EventType.toText(self.event),self.node,self.mode,self.job,self.t);
58 end
59 end
60 end
61 end
62
63
64end