-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathLinkInfo.m
More file actions
55 lines (53 loc) · 1.42 KB
/
Copy pathLinkInfo.m
File metadata and controls
55 lines (53 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
%this is the link class.
%Written by: Behnaz Arzani
classdef LinkInfo
properties
score_ = 0;
numSeen_ = 0;
numHadRetransmit_ = 0;
source_ = nan;
dest_ = nan;
failed_=false;
connInfo= ConnectionInfo;
dropRate_ = 0;
vigilScore_=0;
reCountVigil=0;
end
methods
function obj=setSource(obj,source)
obj.source_=source;
end
function obj=setDest(obj,dest)
obj.dest_=dest;
end
function obj=addFailed(obj)
obj.numHadRetransmit_=obj.numHadRetransmit_+1;
obj.numSeen_=obj.numSeen_+1;
end
function obj=addSuccess(obj)
obj.numSeen_=obj.numSeen_+1;
end
function obj=markAsFailed(obj)
obj.failed_=true;
end
function obj=computeScore(obj)
if obj.numSeen_==0
return;
end
if obj.connInfo.Sample
obj.numSeen_=(obj.numSeen_-obj.numHadRetransmit_)*100/15.0+...
obj.numHadRetransmit_;
end
obj.score_ = obj.numHadRetransmit_*1.0/obj.numSeen_;
end
function res=eq(obj,comp)
res=true;
if obj.source_~=comp.source_
res=false;
else if obj.dest_~=comp.dest_
res=false;
end
end
end
end
end