-
Notifications
You must be signed in to change notification settings - Fork 0
/
aifl2.1.pl
23 lines (21 loc) · 962 Bytes
/
aifl2.1.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class('Vehicle').
class('EnginePoweredVehicle').
class('HumanPoweredVehicle').
class('Car').
class('Bus').
class('Bicycle').
inherits('EnginePoweredVehicle','Vehicle').
inherits('HumanPoweredVehicle','Vehicle').
inherits('Car','EnginePoweredVehicle').
inherits('Bus','EnginePoweredVehicle').
inherits('Bicycle','HumanPoweredVehicle').
memberVariable('numberOfSeats',protected,int,'Vehicle').
memberVariable('engineCapacity',public,int,'EnginePoweredVehicle').
memberVariable('fuelConsumption',protected,float,'EnginePoweredVehicle').
memberVariable('nameOfOwner',private,'java.lang.String','Car').
memberVariable('nameOfOwnerCompany',private,'java.lang.String','Bus').
memberVariable('numberOfGears',public,int,'Bicycle').
brother(X,Y) :- inherits(X,Z),inherits(Y,Z),not(X=Y).
ancestor(X,Y) :- inherits(X,Y);inherits(X,Z),ancestor(Z,Y).
descendant(X,Y) :- ancestor(Y,X).
containsPublicMemberVariables(X) :- memberVariable(_,public,_,X).