|
Methods of classes can be manipulated by working
with in the Properties Dialog of the desired class.
- Double click the desired class in the class diagram to
bring up its Properties Dialog.
- Click on the "Methods" tab.
- To add a new method click on "New" below the methods list.
- To create a constructor, select "constructor from the drop
list.
- To create a regular method, select "user method" form the drop
list.
- Replace the name of the methods with the desired name.
- Type in the return type or select it from the drop
list.
- If the method has parameters, click the "Parameters" tab.
- Select "New" from below the parameters list
- Replace the name with the desired name.
- Type in the parameter type or select it from the drop
list.
- Comment the method by selecting the "Comment" tab.
- Commenting the individual parameters does not always work
properly. To get around this, follow this
procedure:
- Click on the "Comment" as if you were commenting the entire
method.
- Click on the small yellow box at the upper left corner of the
comments window. This will bring up the annotations
editor.
- The original method comments may be lost at this stage
unfortunately.
- Click on the "Synchronize" button and the available parameters
will appear.
- Fill out the text areas for the individual parameters' comments
and the main method's comments in the annotation editor.
- To edit the body of the method, select a method and then click the
"Body" button and an editor will appear with only the body of that
method. Click on "Signature" to return to viewing all
the methods.
- Automatic code generation for the initialization of instance
variables with a constructor is possible:
- Select the constructor
- Click on the "Body" button.
- While holding Ctrl key, select the variable that need to be
initialized through the constructor.
- SB will generate code to take those variables as inputs to the
constructor and will write the code to set them. Do not
modify this code by hand. To alter it, change the
variables being initalized.
- Click the "Signature" button to return to viewing all the
methods.
- To change the order in which the variables are called in the
constructor input, change the order in which they appear in the class
diagram by clicking the up and down arrows next to the Parameters
tab.
|