26.12.2013 Views

AI - a Guide to Intelligent Systems.pdf - Member of EEPIS

AI - a Guide to Intelligent Systems.pdf - Member of EEPIS

AI - a Guide to Intelligent Systems.pdf - Member of EEPIS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

METHODS AND DEMONS<br />

143<br />

Figure 5.7<br />

Input display for the request selection<br />

The input display for the request selection is shown in Figure 5.7. The data on<br />

the display change depending on which business is selected.<br />

The class Action Data, shown in Figure 5.8, is used <strong>to</strong> control the input display.<br />

The user can move <strong>to</strong> the next, previous, first or last request in the list <strong>of</strong> requests<br />

and examine the business data. The WHEN CHANGED methods here allow us <strong>to</strong><br />

advance through a list <strong>of</strong> requests. Note that all attributes in Figure 5.8 are<br />

declared as simple [S]. Simple attributes can assume either a value <strong>of</strong> TRUE or<br />

FALSE. Let us examine the WHEN CHANGED method attached <strong>to</strong> the attribute<br />

Go<strong>to</strong> Next.<br />

How does this method work?<br />

In Level5 Object, any method begins with the reserved words WHEN CHANGED<br />

or WHEN NEEDED, which are followed by the reserved word BEGIN and a series<br />

<strong>of</strong> commands <strong>to</strong> be executed. The reserved word END completes a method. To<br />

refer <strong>to</strong> a particular attribute in a method, we must specify the class name as well<br />

as the attribute name. The syntax is:<br />

OF <br />

For example, the statement Go<strong>to</strong> Next OF Action Data refers <strong>to</strong> the attribute Go<strong>to</strong><br />

Next <strong>of</strong> the class Action Data.<br />

The Next pushbut<strong>to</strong>n on the input display is attached <strong>to</strong> the attribute Go<strong>to</strong><br />

Next <strong>of</strong> the class Action Data. When we select this pushbut<strong>to</strong>n at run time, the<br />

attribute Go<strong>to</strong> Next receives a value <strong>of</strong> TRUE, causing the WHEN CHANGED<br />

method attached <strong>to</strong> it <strong>to</strong> execute. The method’s first command assigns the

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

Saved successfully!

Ooh no, something went wrong!