Overview of search services

 

Introduction

In order to carry out searches in Objecteering using the J language, a number of services belonging to the JSearch metaclass must be used.  The JSearch metaclass is used not only to memorize search parameters, but also to run searches and get related results.

 

The following diagram (Figure 11) illustrates the different metaclasses used.

 

Figure 11. Class diagram of the different metaclasses used in search operations

 

The following example of code provides an illustration of code used to run the search mechanism:

 

// Initialization of the structure encapsulated in a

J session (obligatory)

 

JSearch objecteeringSearch = Jsearch.new;

sessionBegin ("search", true) ; // Launch of a J session

 

// Initialization of obligatory parameters

objecteeringSearch.initObject (this) ;

 

// The search is run from the element selected

//(for example, Package)

// The Class string is searched for

objecteeringSearch.setexpression ("Class") ;

 

// Running the search

objecteeringSearch.runSearch () ;

 

// Simple display of results:

objecteeringSearch.resultsJResultSearch

   {

      // The result is displayed in textual form.

      StdOut.write (getSymbol(), NL) ;

   }

 

// All results are deleted in Objecteering

objecteeringSearch.eraseAllResults () ;

 

// The search is deleted

objecteeringSearch.delete ;

 

// End of the J session

sessionEnd () ;