-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMetrix.pas
More file actions
66 lines (57 loc) · 1.53 KB
/
Metrix.pas
File metadata and controls
66 lines (57 loc) · 1.53 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
54
55
56
57
58
59
60
61
62
63
64
65
66
unit Metrix;
interface
uses UsesUnit;
procedure mtrJilb(node: ptRec; var metrRes: tMetrixRec);
procedure mtrGran(node: ptRec; var absGarn: integer);
procedure mtrCalcGranichnuy(node: ptRec);
implementation
procedure mtrJilb(node: ptRec; var metrRes: tMetrixRec);
var count: integer;
begin
if node<>nil
then begin
if (node^.fConstr in CONDITION_CONSTR)
then inc(metrRes.fCond);
metrRes.fOper:=metrRes.fOper+node^.fAmount;
if (node^.fConstr <> c_modul)
then inc(metrRes.fOper);
if (metrRes.fLevel < node^.fLevel)
then metrRes.fLevel:=node^.fLevel;
for count:=0 to Length(node^.fInternal)-1
do mtrJilb(node^.fInternal[count], metrRes);
end;
end;
procedure mtrGran(node: ptRec; var absGarn: integer);
var count: integer;
begin
if node<>nil
then begin
for count:=0 to Length(node^.fInternal)-1
do
mtrGran(node^.fInternal[count], absGarn);
absGarn:=absGarn+node^.fGran+node^.fAmount;
end;
end;
function mtrCalcEveryGran(node: ptRec): integer;
var count: integer;
begin
result:=0;
if node<>nil
then begin
for count:=0 to Length(node^.fInternal)-1
do
result:=result+mtrCalcEveryGran(node^.fInternal[count]);
result:=result+node^.fAmount;
if (node^.fConstr = c_modul)
then result:=0;
inc(result);
node^.fGran:=result;
if (node^.fConstr in [c_precycle, c_postcycle])
then inc(node^.fGran);
end;
end;
procedure mtrCalcGranichnuy(node: ptRec);
begin
mtrCalcEveryGran(node);
end;
end.