1classdef Host < LayeredNetworkElement
2 % A hardware server in a LayeredNetwork.
4 % Copyright (c) 2012-2026, Imperial College London
10 scheduling; %char: ps, fcfs, inf, ref
13 tasks = []; %list of tasks
18 %
public methods, including constructor
21 function self = Host(model, name, multiplicity, scheduling, quantum, speedFactor)
22 % self = HOST(MODEL, NAME, MULTIPLICITY, SCHEDULING, QUANTUM, SPEEDFACTOR)
24 if nargin<2 %~exist(
'name',
'var')
25 line_error(mfilename,'Constructor requires to specify at least a name.');
27 self@LayeredNetworkElement(name);
29 if nargin<3 %~exist('multiplicity','var')
32 if nargin<4 %~exist('scheduling','var')
33 scheduling = SchedStrategy.PS;
35 if nargin<5 %~exist('quantum','var')
38 if nargin<6 %~exist('speedFactor','var')
42 self.multiplicity = multiplicity;
43 self.scheduling = SchedStrategy.toText(scheduling);
44 self.quantum = quantum;
45 self.speedFactor = speedFactor;
47 if isa(model,'LayeredNetwork')
48 model.hosts{end+1} = self;
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);
57 function self=setReplication(self, replication)
58 self.replication = replication;
63 function self = addTask(self, newTask)
64 % self = ADDTASK(self, NEWTASK)
65 self.tasks = [self.tasks; newTask];
66 newTask.parent = self;