LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
Logger.m
1classdef Logger < Node
2 % A node where jobs are logged upon passage.
3 %
4 % Copyright (c) 2012-2026, Imperial College London
5 % All rights reserved.
6
7 properties
8 fileName;
9 filePath;
10 schedPolicy;
11 schedStrategy;
12 cap;
13 end
14
15 properties (Access=private)
16 wantStartTime;
17 wantLoggerName;
18 wantTimestamp;
19 wantJobID;
20 wantJobClass;
21 wantTimeSameClass;
22 wantTimeAnyClass;
23 end
24
25 methods
26 %Constructor
27 function self = Logger(model, name, logFileName)
28 % SELF = LOGGER(MODEL, NAME, LOGFILENAME)
29
30 self@Node(name);
31 if model.isMatlabNative()
32 [~,fileName,fileExt] = fileparts(logFileName);
33 self.fileName = sprintf('%s%s',fileName,fileExt);
34 if isempty(model.getLogPath)
35 line_error(mfilename,'To instantiate a Logger, first use setLogPath method on the Network object to define the global path to save logs.');
36 else
37 self.filePath = model.getLogPath;
38 end
39 classes = model.getClasses();
40 self.input = Buffer(classes);
41 self.output = Dispatcher(classes);
42 self.cap = Inf;
43 self.schedPolicy = SchedStrategyType.NP;
44 self.schedStrategy = SchedStrategy.FCFS;
45 self.server = LogTunnel();
46 self.setStartTime(false);
47 self.setLoggerName(false);
48 self.setTimestamp(true);
49 self.setJobID(true);
50 self.setJobClass(true);
51 self.setTimeSameClass(false);
52 self.setTimeAnyClass(false);
53 self.setModel(model);
54 self.model.addNode(self);
55 elseif model.isJavaNative()
56 self.setModel(model);
57 self.obj = jline.lang.nodes.Logger(model.obj, name, logFileName);
58 self.index = model.obj.getNodeIndex(self.obj);
59 end
60 end
61
62 function ret = getStartTime(self)
63 % RET = GETSTARTTIME()
64
65 ret = self.wantStartTime;
66 end
67 function ret = getLoggerName(self)
68 % RET = GETLOGGERNAME()
69
70 ret = self.wantLoggerName;
71 end
72 function ret = getTimestamp(self)
73 % RET = GETTIMESTAMP()
74
75 ret = self.wantTimestamp;
76 end
77 function ret = getJobID(self)
78 % RET = GETJOBID()
79
80 ret = self.wantJobID;
81 end
82 function ret = getJobClass(self)
83 % RET = GETJOBCLASS()
84
85 ret = self.wantJobClass;
86 end
87 function ret = getTimeSameClass(self)
88 % RET = GETTIMESAMECLASS()
89
90 ret = self.wantTimeSameClass;
91 end
92 function ret = getTimeAnyClass(self)
93 % RET = GETTIMEANYCLASS()
94
95 ret = self.wantTimeAnyClass;
96 end
97
98 function setStartTime(self, bool)
99 % SETSTARTTIME(BOOL)
100
101 if bool
102 self.wantStartTime = 'true';
103 else
104 self.wantStartTime = 'false';
105 end
106 end
107
108 function setTimestamp(self, bool)
109 % SETTIMESTAMP(BOOL)
110
111 if bool
112 self.wantTimestamp = 'true';
113 else
114 self.wantTimestamp = 'false';
115 end
116 end
117
118 function setLoggerName(self, bool)
119 % SETLOGGERNAME(BOOL)
120
121 if bool
122 self.wantLoggerName = 'true';
123 else
124 self.wantLoggerName = 'false';
125 end
126 end
127
128 function setTimeSameClass(self, bool)
129 % SETTIMESAMECLASS(BOOL)
130
131 if bool
132 self.wantTimeSameClass = 'true';
133 else
134 self.wantTimeSameClass = 'false';
135 end
136 end
137
138 function setTimeAnyClass(self, bool)
139 % SETTIMEANYCLASS(BOOL)
140
141 if bool
142 self.wantTimeAnyClass = 'true';
143 else
144 self.wantTimeAnyClass = 'false';
145 end
146 end
147
148 function setJobID(self, bool)
149 % SETJOBID(BOOL)
150
151 if bool
152 self.wantJobID = 'true';
153 else
154 self.wantJobID = 'false';
155 end
156 end
157
158 function setJobClass(self, bool)
159 % SETJOBCLASS(BOOL)
160
161 if bool
162 self.wantJobClass = 'true';
163 else
164 self.wantJobClass = 'false';
165 end
166 end
167
168 function setProbRouting(self, class, destination, probability)
169 % SETPROBROUTING(CLASS, DESTINATION, PROBABILITY)
170
171 setRouting(self, class, RoutingStrategy.PROB, destination, probability);
172 end
173
174 end
175end
Definition mmt.m:92