Logtalk 2.26.2 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1487 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
80
Logtalk/examples/lpa/timetables/forms.lgt
Normal file
80
Logtalk/examples/lpa/timetables/forms.lgt
Normal file
@@ -0,0 +1,80 @@
|
||||
|
||||
:- object(forms).
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
date is 2005/5/8,
|
||||
author is 'Example by LPA; adapted to Logtalk by Paulo Moura.',
|
||||
comment is 'General attributes & methods for all forms.']).
|
||||
|
||||
:- public(print/0).
|
||||
:- info(print/0, [
|
||||
comment is 'Print the complete timetable from the pupil viewpoint.']).
|
||||
|
||||
print :-
|
||||
nl, write('FORM TIMETABLE...'), nl, nl,
|
||||
forall(extends_object(Form, form), Form::print), nl.
|
||||
|
||||
:- end_object.
|
||||
|
||||
|
||||
:- object(form).
|
||||
|
||||
:- info([
|
||||
version is 1.0,
|
||||
date is 2005/5/8,
|
||||
author is 'Example by LPA; adapted to Logtalk by Paulo Moura.',
|
||||
comment is 'General attributes & methods for all forms.']).
|
||||
|
||||
:- public(print/0).
|
||||
:- info(print/0, [
|
||||
comment is 'Print the complete timetable from the pupil viewpoint.']).
|
||||
|
||||
:- public(print_period/1).
|
||||
:- info(print_period/1, [
|
||||
comment is 'Print the pupil timetable for a specific period.',
|
||||
argnames is ['Period']]).
|
||||
|
||||
print :-
|
||||
self(Self),
|
||||
write('FORM: '), write(Self), nl,
|
||||
forall(extends_object(Period, period), Period::print_form(Self)), nl.
|
||||
|
||||
print_period(Period) :-
|
||||
self(Self),
|
||||
timetable::filled_entry(Self, Period, Teacher, Subject),
|
||||
!,
|
||||
write(Self), write(': '),
|
||||
write(Teacher), write(' teaches '),
|
||||
write(Subject), nl.
|
||||
|
||||
print_period(_) :-
|
||||
self(Self),
|
||||
write(Self), write(': '), nl.
|
||||
|
||||
:- end_object.
|
||||
|
||||
|
||||
:- object(first_year,
|
||||
extends(form)).
|
||||
|
||||
:- end_object.
|
||||
|
||||
|
||||
:- object(second_year,
|
||||
extends(form)).
|
||||
|
||||
:- end_object.
|
||||
|
||||
|
||||
:- object(third_year,
|
||||
extends(form)).
|
||||
|
||||
:- end_object.
|
||||
|
||||
|
||||
:- object(fourth_year,
|
||||
extends(form)).
|
||||
|
||||
:- end_object.
|
||||
|
||||
Reference in New Issue
Block a user