Changeset 3965 for trunk/examples/complements/complements.lgt
- Timestamp:
- 12/14/07 09:51:08 (13 months ago)
- Files:
-
- 1 modified
-
trunk/examples/complements/complements.lgt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/complements/complements.lgt
r3954 r3965 16 16 complements(employee)). 17 17 18 :- initialization(define_events(before, employee, _, _, employee)). % implies that the category must be loaded *after* 19 % the object due to the define_events/5 goal 18 % add a simple logging functionality by defining a "before" event and 19 % the corresponding event handler (implies that the category must be 20 % loaded *after* the object due to the define_events/5 goal): 21 22 :- initialization(define_events(before, employee, _, _, employee)). 23 20 24 before(_, Message, Sender) :- 21 25 write('Received message '), writeq(Message), write(' from '), writeq(Sender), nl. 22 26 23 :- public(predicates/0).27 % add a new method to the object: 24 28 25 predicates :- % list only public predicates26 this(This), 27 setof(Predicate, This::current_predicate(Predicate), Predicates),28 write(Predicates), nl.29 :- public(predicates/1). 30 31 predicates(Predicates) :- 32 setof(Predicate, ::current_predicate(Predicate), Predicates). 29 33 30 34 :- end_category.
