-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabrica.pl
32 lines (28 loc) · 960 Bytes
/
fabrica.pl
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
/*******************
* Definition of the frame 'fabrica'
********************/
def_fabrica:-
new_frame(fabrica),
new_slot(fabrica,nome),
new_slot(fabrica,cidade),
new_slot(fabrica,cap_max),
new_slot(fabrica,total_produtos_stock).
/*********************
* Definition of the demon on the slot 'total_produtos_stock'
**********************/
def_Stock_Control:-
new_demon(fabrica,total_produtos_stock,control_Factory_Stock,if_write,before,side_effect).
/*******************
* Adds stock to the factory given a quanitity
********************/
add_Factory_Stock(Quantity):-
get_value(fabrica, total_produtos_stock, S),
S1 is Quantity + S,
new_value(fabrica,total_produtos_stock,S1).
/*********************
*Decreases the stock of the factory by a given Quantity
**********************/
decrease_Factory_Stock(Quantity):-
get_value(fabrica,total_produtos_stock,S),
S1 is Quantity - S,
new_value(fabrica,total_produtos_stock,S1).