LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
Event.m
1classdef Event
2 % A generic 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 class;
13 prob;
14 state; % state information when the event occurs (optional)
15 t; % timestamp when the event occurs (optional)
16 job; % job id (optional)
17 end
18
19 methods
20 function self = Event(event, node, class, prob, state, t, job)
21 % SELF = EVENT(EVENT, NODE, CLASS, PROB, STATE, TIMESTAMP, JOB)
22
23 self.node = node;
24 self.event = event;
25 self.class = class;
26 if nargin <4
27 prob = NaN;
28 end
29 self.prob = prob;
30 if nargin <5
31 state = []; % local state of the node or environment transition
32 end
33 self.state = state;
34 if nargin <6
35 t = NaN; % timestamp
36 end
37 self.t = t;
38 if nargin <7
39 job = NaN; % timestamp
40 end
41 self.job = job;
42 end
43
44 function print(self)
45 % PRINT()
46 if isnan(self.t)
47 line_printf('(%s: node: %d, class: %d)',EventType.toText(self.event),self.node,self.class);
48 else
49 if isnan(self.job)
50 line_printf('(%s: node: %d, class: %d, time: %d)',EventType.toText(self.event),self.node,self.class,self.t);
51 else
52 line_printf('(%s: node: %d, class: %d, job: %d, time: %d)',EventType.toText(self.event),self.node,self.class,self.job,self.t);
53 end
54 end
55 end
56 end
57
58
59end