24.11.2014 Views

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

flex Expert System Toolkit - LPIS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7. Knowledge Specification Language 95<br />

if A > B then A<br />

else B .<br />

function fibonacci( N ) =<br />

if N > 1<br />

then fibonacci( N-1 ) + fibonacci( N-2 )<br />

else 1 .<br />

Launches<br />

A launch is a procedure which can be attached to frames and is<br />

automatically invoked whenever a new instance of that frame is created. Its<br />

primary use is in setting up the initial characteristics of frame instances.<br />

The directives associated with a launch are executed immediately after the<br />

instance is created.<br />

A launch can be tailored such that it fires only under certain circumstances.<br />

The general format of a launch is as follows.<br />

launch launch_name<br />

when Instance is a new Frame<br />

and condition(s)<br />

then directive(s) .<br />

launch launch_name<br />

when Instance is a new instance of Frame<br />

and condition(s)<br />

then directive(s) .<br />

The conditions are optional.<br />

Examples<br />

This first example will simply display a message each time a new instance of<br />

carrier is created.<br />

launch pick_up_new_carrier_bag<br />

when Bag is a new instance of carrier<br />

then write( 'I need another carrier bag ' )<br />

and write( Bag )<br />

and nl .<br />

The next example executes the female_enrolment_questions<br />

procedure each time a new instance of student is created who is female.<br />

launch female_enrolment<br />

when Person is a new student<br />

and female( Person )<br />

then female_enrolment_questions( Person ) .<br />

<strong>flex</strong> toolkit

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!