1function self = removeClass(self,
jobclass)
2% SELF = REMOVECLASS(SELF, CLASS)
4% Remove the specified CLASS from the model. Each node drops its own
5% per-
class configuration through Node.removeJobClass and its overrides
6% (service, capacity, arrival,
class switching), mirroring
7% Network.removeClass in the JAR and Network.remove_class in python.
9% Copyright (c) 2012-2026, Imperial College London
12% Resolve the
class on THIS model: a caller holding the class object of
13% another model (ModelAdapter.removeClass works on a copy, whose class
14% objects are distinct) must still resolve, hence the lookup by name.
15target = self.getClassByName(jobclass.name);
16if isempty(target) || (isobject(target) && isnan(target.index))
20if hasSingleClass(self)
21 line_error(mfilename,'The network has a single class, it cannot be removed from the model.');
25remaining = setdiff(1:length(self.classes), r);
27for i=1:length(self.nodes)
28 self.
nodes{i}.removeJobClass(target);
31self.classes = self.classes(remaining);
32% The
class-switching mask cached by link()
is (K x K): leaving it at the
33% old size makes getRoutingMatrix return chains over classes that no longer
34% exist, and refreshRoutingMatrix then indexes sn.refstat out of range
35% instead of reporting a model error.
36if ~isempty(self.csMatrix)
37 self.csMatrix = self.csMatrix(remaining, remaining);
39self.reset(true); % require a complete re-initialization including state