/***************************************************************** 
  cond.pl 

*****************************************************************/

all_preconditions_satisfied(Process, Instance) :- 

   dyn(agenda(process(Instance, Process/_PID, _Status, _Priority, 
               _Begin_time/_End_time, _Time_cost, 
               _Header, 
               _P_Trigger, Precond, _Action, _Postcond))), 

   test_all_cond(Precond).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

all_postconditions_satisfied(Process, Instance) :- 

   dyn(agenda(process(Instance, Process/_PID, _Status, _Priority, 
               _Begin_time/_End_time, _Time_cost, 
               _Header, 
               _P_Trigger, _Precond, _Action, Postcond))), 

   test_all_cond(Postcond).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
test_all_cond([]). 

test_all_cond([X| Rest]) :-
   test_cond(X),
   test_all_cond(Rest). 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

test_cond(exist(X)) :-
   dyn(X). 

test_cond(not_exist(X)) :-
   \+ dyn(X). 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


