Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Operation Behavior

This topic illustrates how to elaborate a method's function in a diagram. The Behavior page of the Operations dialog enables you to enter free text to describe the functionality of an operation. Use pseudo-code, structured English or just a brief description.

You can also use the Behavior page to formally describe a method or State action and have the text appear under the method/action name in a diagram.

Access    Project Browser Operation context menu | Operation Properties | Behavior

Topics

Images

Topic

Detail

See also

DiagramBehavior

 

State Operations - Behaviour

A State's do, entry and exit operations optionally refer to other behaviors such as Activities, Interactions or Operations.

Click on the Element button to display the Select Behavior dialog, and locate and select the required behavior.

Select <Item> Dialog

OpBehavePB
opbehaveact

 

Associate with Behaviour

A Class operation can be associated with a behavior elsewhere in the model; to do this:

1.Display the operation's Properties dialog..
2.Select the Behavior page, click on the Element button and select the required behavior from the Select Behavior dialog; the behavior displays in the Behavior field.

The operation is then set as the specification of the associated behavior.

In behavioral code generation, the behavior of the associated behavioral element is generated as the operation's code; in the illustration on the left, Op1 is associated with the Activity Activity.

 

 

 

 

 

 

Generate From Behavioral Models

 

Example Code

The generated code for Op1 is as follows:

package Package;

public class Container {

 public Container(){

 }

 

 public void finalize() throws Throwable {

 }

 

 public void op1(){

 /*Activity element(Activity1)'s behavior 
rendered operation(op1)'s code*/

         //Action1;

         if (cond1)

         {

                 //Action2;

         }

         else

         {

                 //Action3;

         }

         //Action4;

 }

 /*Activity element(Activity1)
not rendered*/

 public void Activity2()

 {

         // behavior is a Activity

 }

 

 public void Interaction()

 {

         // behavior is a Interaction

 }

}//end Container
 

 

 

Learn more