Chapter 8. Practical Hints

Table of Contents

Defining a network with the help of ReactionNetImpl

This chapter contains some hints for using yWays and helps you to avoid some pittfals.

Defining a network with the help of ReactionNetImpl

With the help of class ReactionNetImpl you can create your own instance of ReactionNet.

First you have to create instances of CompoundImpl to represent the compounds in your network. Add all instances of CompoundImpl which are main-product or main-substrat in one ore more reaction to the ReactionNet instance with the method addCompund().

Warning

Each compound that you add in this way to the network will be returned by the compounds() method and will therefore define a node in the diagram. Make sure that you add each instance of CompoundImpl only once and to create only one instance of CompoundImpl for each main-compound in the network.

To create a reaction, first store the products and substrats of the reaction in a Collection. Create an instance of ReactionImpl with these collections as argument. With the methods addCoProducts() and addCoSubstrat() co-compounds can be added.

Warning

Each instance of Compound that you add in this way to the network will be returned by the cocompounds() method and will therefore define a node in the diagram. For this reason ReactionNetImpl supports for the moment only co-compounds which are connected to exactly one reaction. So make sure that you create always a new instance of CompoundImpl before you add it this way to a reaction.

To define a catalyst for a recation, simply create an instance of CompoundImpl and add it via the addCatalyst() method to the reaction. Finally you just have to add the reaction to the network with the addReaction() metthod.