1classdef Replayer < Distribution
2 % Empirical time series from a trace
4 % Copyright (c) 2012-2026, Imperial College London
14 function self = Replayer(data)
15 self@Distribution(
'Replayer',1,[0,Inf]);
16 if ischar(data) % interpret as
string
17 % SELF = REPLAYER(FILENAME)
19 if exist(fileName,
'file') == 2
20 dirStruct = dir(fileName);
21 fileName = [dirStruct.folder,filesep,dirStruct.name];
23 line_error(mfilename,
'The file cannot be located, use the full file path.');
25 setParam(self, 1,
'fileName', fileName);
27 % Create Java
object after file validation with validated path
28 self.obj = jline.lang.processes.Replayer(fileName);
32 % Create Java
object directly with array data
33 self.obj = jline.lang.processes.Replayer(data);
40 fileName = self.getParam(1).paramValue;
41 self.data = load(fileName);
42 self.data = self.data(:);
52 function rate = getRate(self)
53 rate = 1 / self.getMean;
56 function ex = getMean(self)
59 % Get distribution mean
66 function SCV = getSCV(self)
69 % Get distribution squared coefficient of variation (SCV = variance / mean^2)
73 SCV = var(self.data)/mean(self.data)^2;
76 function SKEW = getSkewness(self)
77 % SKEW = GETSKEWNESS()
79 % Get distribution skewness
83 SKEW = skewness(self.data,0); % ,0 ensures Apache Commons equivalence in Java
86 function distr = fitExp(self)
89 distr = Exp.fitMean(self.getMean);
92 function distr = fitAPH(self)
94 distr = APH.fit(self.getMean, self.getSCV, self.getSkewness);
95 distr.obj = self.obj.fitAPH();
98 function distr = fitCoxian(self)
100 distr = Cox2.fit(self.getMean, self.getSCV, self.getSkewness);
104 function X = sample(self)
106 self.cursample = self.cursample + 1;
107 X = self.data(self.cursample);
110 function L = evalLST(self, s)
112 % Evaluate the Laplace-Stieltjes transform of the distribution function at t
113 if isempty(self.data)
116 L = mean(exp(-s*self.data));