Skip to content

Commit 234902f

Browse files
Replace single letter parameter name
Made consistent across all labs
1 parent 04d2776 commit 234902f

File tree

12 files changed

+162
-159
lines changed

12 files changed

+162
-159
lines changed

courses/ada_essentials/170_tagged_derivation/lab/tagged_derivation-in_depth/ada95/employee.adb

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,75 +11,75 @@ package body Employee is
1111
end Image;
1212

1313
procedure Set_Name
14-
(Item : in out Person_T;
14+
(This : in out Person_T;
1515
Value : Name_T) is
1616
begin
17-
Item.The_Name := Value;
17+
This.The_Name := Value;
1818
end Set_Name;
1919
function Name
20-
(Item : Person_T)
20+
(This : Person_T)
2121
return Name_T is
2222
begin
23-
return Item.The_Name;
23+
return This.The_Name;
2424
end Name;
2525

2626
procedure Set_Birth_Date
27-
(Item : in out Person_T;
27+
(This : in out Person_T;
2828
Value : Date_T) is
2929
begin
30-
Item.The_Birth_Date := Value;
30+
This.The_Birth_Date := Value;
3131
end Set_Birth_Date;
3232
function Birth_Date
33-
(Item : Person_T)
33+
(This : Person_T)
3434
return Date_T is
3535
begin
36-
return Item.The_Birth_Date;
36+
return This.The_Birth_Date;
3737
end Birth_Date;
3838

39-
procedure Print (Item : Person_T) is
39+
procedure Print (This : Person_T) is
4040
begin
41-
Put_Line ("Name: " & Name (Item));
42-
Put_Line ("Birthdate: " & Image (Birth_Date (Item)));
41+
Put_Line ("Name: " & Name (This));
42+
Put_Line ("Birthdate: " & Image (Birth_Date (This)));
4343
end Print;
4444

4545
procedure Set_Start_Date
46-
(Item : in out Employee_T;
46+
(This : in out Employee_T;
4747
Value : Date_T) is
4848
begin
49-
Item.The_Start_Date := Value;
49+
This.The_Start_Date := Value;
5050
end Set_Start_Date;
5151
function Start_Date
52-
(Item : Employee_T)
52+
(This : Employee_T)
5353
return Date_T is
5454
begin
55-
return Item.The_Start_Date;
55+
return This.The_Start_Date;
5656
end Start_Date;
5757

58-
procedure Print (Item : Employee_T) is
58+
procedure Print (This : Employee_T) is
5959
begin
60-
Print (Person_T (Item)); -- Use parent "Print"
61-
Put_Line ("Startdate: " & Image (Start_Date (Item)));
60+
Print (Person_T (This)); -- Use parent "Print"
61+
Put_Line ("Startdate: " & Image (Start_Date (This)));
6262
end Print;
6363

6464
procedure Set_Job
65-
(Item : in out Position_T;
65+
(This : in out Position_T;
6666
Value : Job_T) is
6767
begin
68-
Item.The_Job := Value;
68+
This.The_Job := Value;
6969
end Set_Job;
7070
function Job
71-
(Item : Position_T)
71+
(This : Position_T)
7272
return Job_T is
7373
begin
74-
return Item.The_Job;
74+
return This.The_Job;
7575
end Job;
7676

77-
procedure Print (Item : Position_T) is
77+
procedure Print (This : Position_T) is
7878
begin
79-
Put_Line ("Name: " & Name (Item));
80-
Put_Line ("Birthdate: " & Image (Birth_Date (Item)));
81-
Put_Line ("Startdate: " & Image (Start_Date (Item)));
82-
Put_Line ("Job: " & Job_T'Image (Job (Item)));
79+
Put_Line ("Name: " & Name (This));
80+
Put_Line ("Birthdate: " & Image (Birth_Date (This)));
81+
Put_Line ("Startdate: " & Image (Start_Date (This)));
82+
Put_Line ("Job: " & Job_T'Image (Job (This)));
8383
end Print;
8484

8585
end Employee;

courses/ada_essentials/170_tagged_derivation/lab/tagged_derivation-in_depth/ada95/employee.ads

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,36 @@ package Employee is
99
type Job_T is (Sales, Engineer, Bookkeeping);
1010

1111
procedure Set_Name
12-
(Item : in out Person_T;
12+
(This : in out Person_T;
1313
Value : Name_T);
1414
function Name
15-
(Item : Person_T)
15+
(This : Person_T)
1616
return Name_T;
1717
procedure Set_Birth_Date
18-
(Item : in out Person_T;
18+
(This : in out Person_T;
1919
Value : Date_T);
2020
function Birth_Date
21-
(Item : Person_T)
21+
(This : Person_T)
2222
return Date_T;
23-
procedure Print (Item : Person_T);
23+
procedure Print (This : Person_T);
2424

2525
type Employee_T is new Person_T with private;
2626
procedure Set_Start_Date
27-
(Item : in out Employee_T;
27+
(This : in out Employee_T;
2828
Value : Date_T);
2929
function Start_Date
30-
(Item : Employee_T)
30+
(This : Employee_T)
3131
return Date_T;
32-
procedure Print (Item : Employee_T);
32+
procedure Print (This : Employee_T);
3333

3434
type Position_T is new Employee_T with private;
3535
procedure Set_Job
36-
(Item : in out Position_T;
36+
(This : in out Position_T;
3737
Value : Job_T);
3838
function Job
39-
(Item : Position_T)
39+
(This : Position_T)
4040
return Job_T;
41-
procedure Print (Item : Position_T);
41+
procedure Print (This : Position_T);
4242

4343
private
4444
type Person_T is tagged record

courses/ada_essentials/170_tagged_derivation/lab/tagged_derivation-in_depth/answer/employee.adb

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,56 @@ package body Employee is
55
function Image (Date : Date_T) return String is
66
(Date.Year'Image & " -" & Date.Month'Image & " -" & Date.Day'Image);
77

8-
procedure Set_Name (O : in out Person_T;
8+
procedure Set_Name (This : in out Person_T;
99
Value : Name_T) is
1010
begin
11-
O.The_Name := Value;
11+
This.The_Name := Value;
1212
end Set_Name;
13-
function Name (O : Person_T) return Name_T is (O.The_Name);
13+
function Name (This : Person_T) return Name_T is (This.The_Name);
1414

15-
procedure Set_Birth_Date (O : in out Person_T;
15+
procedure Set_Birth_Date (This : in out Person_T;
1616
Value : Date_T) is
1717
begin
18-
O.The_Birth_Date := Value;
18+
This.The_Birth_Date := Value;
1919
end Set_Birth_Date;
20-
function Birth_Date (O : Person_T) return Date_T is (O.The_Birth_Date);
20+
function Birth_Date (This : Person_T) return Date_T is
21+
(This.The_Birth_Date);
2122

22-
procedure Print (O : Person_T) is
23+
procedure Print (This : Person_T) is
2324
begin
24-
Put_Line ("Name: " & O.Name);
25-
Put_Line ("Birthdate: " & Image (O.Birth_Date));
25+
Put_Line ("Name: " & This.Name);
26+
Put_Line ("Birthdate: " & Image (This.Birth_Date));
2627
end Print;
2728

28-
not overriding procedure Set_Start_Date (O : in out Employee_T;
29+
not overriding procedure Set_Start_Date (This : in out Employee_T;
2930
Value : Date_T) is
3031
begin
31-
O.The_Start_Date := Value;
32+
This.The_Start_Date := Value;
3233
end Set_Start_Date;
33-
not overriding function Start_Date (O : Employee_T) return Date_T is
34-
(O.The_Start_Date);
34+
not overriding function Start_Date (This : Employee_T) return Date_T is
35+
(This.The_Start_Date);
3536

36-
overriding procedure Print (O : Employee_T) is
37+
overriding procedure Print (This : Employee_T) is
3738
begin
38-
Print (Person_T (O)); -- Use parent "Print"
39-
Put_Line ("Startdate: " & Image (O.Start_Date));
39+
Print (Person_T (This)); -- Use parent "Print"
40+
Put_Line ("Startdate: " & Image (This.Start_Date));
4041
end Print;
4142

4243
--Types_Body
43-
not overriding procedure Set_Job (O : in out Position_T;
44+
not overriding procedure Set_Job (This : in out Position_T;
4445
Value : Job_T) is
4546
begin
46-
O.The_Job := Value;
47+
This.The_Job := Value;
4748
end Set_Job;
48-
not overriding function Job (O : Position_T) return Job_T is (O.The_Job);
49+
not overriding function Job (This : Position_T) return Job_T is
50+
(This.The_Job);
4951

50-
overriding procedure Print (O : Position_T) is
52+
overriding procedure Print (This : Position_T) is
5153
begin
52-
Put_Line ("Name: " & O.Name);
53-
Put_Line ("Birthdate: " & Image (O.Birth_Date));
54-
Put_Line ("Startdate: " & Image (O.Start_Date));
55-
Put_Line ("Job: " & O.Job'Image);
54+
Put_Line ("Name: " & This.Name);
55+
Put_Line ("Birthdate: " & Image (This.Birth_Date));
56+
Put_Line ("Startdate: " & Image (This.Start_Date));
57+
Put_Line ("Job: " & This.Job'Image);
5658
end Print;
5759

5860
end Employee;

courses/ada_essentials/170_tagged_derivation/lab/tagged_derivation-in_depth/answer/employee.ads

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ package Employee is
88
end record;
99
type Job_T is (Sales, Engineer, Bookkeeping);
1010

11-
procedure Set_Name (O : in out Person_T;
11+
procedure Set_Name (This : in out Person_T;
1212
Value : Name_T);
13-
function Name (O : Person_T) return Name_T;
14-
procedure Set_Birth_Date (O : in out Person_T;
13+
function Name (This : Person_T) return Name_T;
14+
procedure Set_Birth_Date (This : in out Person_T;
1515
Value : Date_T);
16-
function Birth_Date (O : Person_T) return Date_T;
17-
procedure Print (O : Person_T);
16+
function Birth_Date (This : Person_T) return Date_T;
17+
procedure Print (This : Person_T);
1818

1919
type Employee_T is new Person_T with private;
20-
not overriding procedure Set_Start_Date (O : in out Employee_T;
20+
not overriding procedure Set_Start_Date (This : in out Employee_T;
2121
Value : Date_T);
22-
not overriding function Start_Date (O : Employee_T) return Date_T;
23-
overriding procedure Print (O : Employee_T);
22+
not overriding function Start_Date (This : Employee_T) return Date_T;
23+
overriding procedure Print (This : Employee_T);
2424

2525
type Position_T is new Employee_T with private;
26-
not overriding procedure Set_Job (O : in out Position_T;
26+
not overriding procedure Set_Job (This : in out Position_T;
2727
Value : Job_T);
28-
not overriding function Job (O : Position_T) return Job_T;
29-
overriding procedure Print (O : Position_T);
28+
not overriding function Job (This : Position_T) return Job_T;
29+
overriding procedure Print (This : Position_T);
3030

3131
private
3232
type Person_T is tagged record

courses/ada_essentials/170_tagged_derivation/lab/tagged_derivation-in_depth/prompt/employee.adb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
package body Employee is
22

33
procedure Set_Attribute
4-
(O : in out Person_T;
4+
(This : in out Person_T;
55
Value : String) is
66
begin
77
null;
88
end Set_Attribute;
99

1010
function Get_Attribute
11-
(O : Person_T)
11+
(This : Person_T)
1212
return String is
1313
begin
1414
return "";
1515
end Get_Attribute;
1616

17-
procedure Print (O : Person_T) is
17+
procedure Print (This : Person_T) is
1818
begin
1919
null;
2020
end Print;

courses/ada_essentials/170_tagged_derivation/lab/tagged_derivation-in_depth/prompt/employee.ads

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ package Employee is
44
-- create primitive subprograms to set/get attributes for Person_T and
55
-- to print the contents of Person_T
66
procedure Set_Attribute
7-
(O : in out Person_T;
7+
(This : in out Person_T;
88
Value : String);
99
function Get_Attribute
10-
(O : Person_T)
10+
(This : Person_T)
1111
return String;
12-
procedure Print (O : Person_T);
12+
procedure Print (This : Person_T);
1313

1414
-- Create a new type Employee_T based on Person with some
1515
-- additional attributes

0 commit comments

Comments
 (0)