IBM
Contents Index Previous Next



Reusing Packages


When developing the version of the DemonGame that has all features, you create a package AdvancedFeatures that contains the additional features and that will reuse the package BasicFeatures.

What You will Learn

The Package AdvancedFeatures

  1. Create the package AdvancedFeatures in a similar fashion as the package BasicFeatures (see Figure 168).
    • You should now have two package structures in the Organizer, BasicFeatures and AdvancedFeatures.

The package AdvancedFeatures must do the following:

  1. Use the package BasicFeatures.
  2. Add the declarations of the new signals.
  3. Add references to the process types JackpotGame, etc.
  4. Add a reference to a block type AdvancedGameBlock (which inherits the block type BasicGameBlock and in turn refers to a redefined process type Main).
  5. Save the package diagram on the file advancedfeatures.sun

Figure 173 : The package AdvancedFeatures

Block Type AdvancedGameBlock

The diagram contains a reference to a REDEFINED process type Main, and a dashed instantiation symbol Main.

Figure 174 : Block type AdvancedGameBlock

Redefined Process Type Main

The REDEFINED process type Main inherits implicitly from the -VIRTUAL process type Main in the package BasicFeatures, and adds the code to receive the signals that command the new features.

Figure 175 : The redefined process type Main

Creating the System AdvancedDemonGame

Creating the system is now fairly simple.

  1. Add a New SDL system in the Organizer. Say you name the system AdvancedDemonGame and save it as demongameadvanced.ssy
  2. With the SDL Editor, Copy the contents of the system -BasicDemonGame and Paste them into the new system.
  3. Have the system USE AdvancedFeatures in addition to -BasicFeatures.
  4. Change the reference from the block type BasicGameBlock to -AdvancedGameBlock.
  5. Update the signal list C1 with the new signals JackpotGame, etc. The system is now complete. Analyze it and simulate it if you find it meaningful.

Figure 176 : The system AdvancedDemonGame


http://www.ibm.com/rational
Contents Index Previous Next