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

Operations Dialog - Behavior

This topic illustrates how to elaborate a method's function in a diagram. The Behavior tab 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 tab to formally describe a method or State action and have the text appear under the method/action name in a diagram.

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. Use the (  ...  ) (browse) button to invoke the Select <Item> 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. Display the operation's Properties dialog, select the Behavior tab, click on the (  ...  )  (browse) button and select the required behavior from the Select Element dialog. The behavior is set in the Behavior field, and 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 following illustration, Op1 is associated with the Activity Activity.

 

 

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 as 
         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: