LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
Host.m
1classdef Host < LayeredNetworkElement
2 % A hardware server in a LayeredNetwork.
3 %
4 % Copyright (c) 2012-2026, Imperial College London
5 % All rights reserved.
6
7 properties
8 multiplicity; %int
9 replication; %int
10 scheduling; %char: ps, fcfs, inf, ref
11 quantum; %double
12 speedFactor; %double
13 tasks = []; %list of tasks
14 ID; %int
15 end
16
17 methods
18 %public methods, including constructor
19
20 %constructor
21 function self = Host(model, name, multiplicity, scheduling, quantum, speedFactor)
22 % self = HOST(MODEL, NAME, MULTIPLICITY, SCHEDULING, QUANTUM, SPEEDFACTOR)
23
24 if nargin<2 %~exist('name','var')
25 line_error(mfilename,'Constructor requires to specify at least a name.');
26 end
27 self@LayeredNetworkElement(name);
28
29 if nargin<3 %~exist('multiplicity','var')
30 multiplicity = 1;
31 end
32 if nargin<4 %~exist('scheduling','var')
33 scheduling = SchedStrategy.PS;
34 end
35 if nargin<5 %~exist('quantum','var')
36 quantum = 0.001;
37 end
38 if nargin<6 %~exist('speedFactor','var')
39 speedFactor = 1;
40 end
41 self.replication = 1;
42 self.multiplicity = multiplicity;
43 self.scheduling = SchedStrategy.toText(scheduling);
44 self.quantum = quantum;
45 self.speedFactor = speedFactor;
46
47 if isa(model,'LayeredNetwork')
48 model.hosts{end+1} = self;
49 self.model = model;
50 elseif isa(model,'JLayeredNetwork')
51 % JLayeredNetwork support would go here if it exists
52 self.obj = jline.lang.layered.Host(model.obj, name, multiplicity, scheduling, quantum, speedFactor);
53 model.addHost(self);
54 end
55 end
56
57 function self=setReplication(self, replication)
58 self.replication = replication;
59 end
60
61
62 %addTask
63 function self = addTask(self, newTask)
64 % self = ADDTASK(self, NEWTASK)
65 self.tasks = [self.tasks; newTask];
66 newTask.parent = self;
67 end
68
69 end
70
71end