User Tools

Site Tools


v070:layout

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
v070:layout [2018/10/05 19:55]
djnemeth [Limitations]
v070:layout [2018/10/08 09:08] (current)
djnemeth [Execution]
Line 1: Line 1:
-====== Diagram Language ​Guide for version 0.7.0 ======+====== Diagram Language ​Description ​for version 0.7.0 ======
  
-In txtUML, class and state machine diagrams can be defined to visualize model structure and behavior. ​To express ​test cases for expected communication, sequence diagrams ​can be used.+In txtUML, class and state machine diagrams can be defined to visualize model structure and behavior. ​Moreover, ​test cases for expected communication can also be specified in the form of sequence diagrams.
  
 ===== Class and State Machine Diagrams ===== ===== Class and State Machine Diagrams =====
Line 14: Line 14:
 This class must contain an inner class definition, inheriting from ''​Layout''​. The actual layout constraints can be written as annotations on this inner class. This class must contain an inner class definition, inheriting from ''​Layout''​. The actual layout constraints can be written as annotations on this inner class.
  
-<​code>​+<​code ​java>
 class MyDiagram extends ClassDiagram { class MyDiagram extends ClassDiagram {
   // layout constraints as annotations   // layout constraints as annotations
Line 38: Line 38:
 Example: Model contains these classes: **A**, **B** and **C**. Example: Model contains these classes: **A**, **B** and **C**.
 {{ :​v020:​examplesimplediagram.png?​200|}} {{ :​v020:​examplesimplediagram.png?​200|}}
-<​code>​+<​code ​java>
 class MyClassDiagram extends ClassDiagram { class MyClassDiagram extends ClassDiagram {
   @North(val = A.class, from = B.class)   @North(val = A.class, from = B.class)
Line 47: Line 47:
 </​code>​ </​code>​
 Example: The class **A** contains these states: **Init**, **Disabled** and **Active**. Example: The class **A** contains these states: **Init**, **Disabled** and **Active**.
-<​code>​+<​code ​java>
 class MyStateDiagram extends StateMachineDiagram<​A>​ { class MyStateDiagram extends StateMachineDiagram<​A>​ {
   @Left(val = Init.class, from = Disabled.class)   @Left(val = Init.class, from = Disabled.class)
Line 67: Line 67:
  
 Example: Model contains these classes: **C**, **E**, **D**, **O**, **R**, **S1** and **S2**. Example: Model contains these classes: **C**, **E**, **D**, **O**, **R**, **S1** and **S2**.
-<​code>​+<​code ​java>
 class MyDiagram extends ClassDiagram { class MyDiagram extends ClassDiagram {
   @Row({R.class,​ E.class, D.class})   @Row({R.class,​ E.class, D.class})
Line 86: Line 86:
 Example: Model contains these classes: **A** and **B**. Model contains these links: **L** (A - B) and **R** (A - A). Example: Model contains these classes: **A** and **B**. Model contains these links: **L** (A - B) and **R** (A - A).
 {{ :​v020:​examplelinkdiagram.png?​150|}} {{ :​v020:​examplelinkdiagram.png?​150|}}
-<​code>​+<​code ​java>
 class MyDiagram extends ClassDiagram { class MyDiagram extends ClassDiagram {
   @North(val = L.class, from = A.class)   @North(val = L.class, from = A.class)
Line 102: Line 102:
 A group can be specified by defining a class inheriting either from ''​NodeGroup''​ or from ''​LinkGroup''​. The elements of the group can be specified with the ''​@Contains''​ annotation. A group can contain model elements of the corresponding type or other groups containing elements of the corresponding type. A group can be specified by defining a class inheriting either from ''​NodeGroup''​ or from ''​LinkGroup''​. The elements of the group can be specified with the ''​@Contains''​ annotation. A group can contain model elements of the corresponding type or other groups containing elements of the corresponding type.
  
-<​code>​+<​code ​java>
   @Contains({A.class,​ B.class})   @Contains({A.class,​ B.class})
   class NG1 extends NodeGroup {}   class NG1 extends NodeGroup {}
 </​code>​ </​code>​
  
-<​code>​+<​code ​java>
   @Contains({L.class,​ J.class})   @Contains({L.class,​ J.class})
   class LG1 extends LinkGroup {}   class LG1 extends LinkGroup {}
Line 114: Line 114:
 If the given group is a ''​NodeGroup'',​ the annotation ''​@Alignment''​ can be used to set the alignment of its elements, using items of enum //​hu.elte.txtuml.layout.lang.AlignmentType//,​ i.e. ''​TopToBottom'',​ ''​BottomToTop'',​ ''​RightToLeft''​ or ''​LeftToRight''​. If the given group is a ''​NodeGroup'',​ the annotation ''​@Alignment''​ can be used to set the alignment of its elements, using items of enum //​hu.elte.txtuml.layout.lang.AlignmentType//,​ i.e. ''​TopToBottom'',​ ''​BottomToTop'',​ ''​RightToLeft''​ or ''​LeftToRight''​.
  
-<​code>​+<​code ​java>
   @Contains({NG1.class,​ C.class})   @Contains({NG1.class,​ C.class})
   @Alignment(AlignmentType.TopToBottom)   @Alignment(AlignmentType.TopToBottom)
Line 132: Line 132:
  
 Example: Model contains these classes: **A**, **B**, **C** and **D**. Example: Model contains these classes: **A**, **B**, **C** and **D**.
-<​code>​+<​code ​java>
 class MyDiagram extends ClassDiagram { class MyDiagram extends ClassDiagram {
   @Contains({C.class,​ D.class})   @Contains({C.class,​ D.class})
Line 147: Line 147:
  
 Example: Example:
-<​code>​+<​code ​java>
   class MyPhantom extends Phantom {}   class MyPhantom extends Phantom {}
   //...   //...
Line 164: Line 164:
  
 Example: Model contains these classes: **A** and **B**. Example: Model contains these classes: **A** and **B**.
-<​code>​+<​code ​java>
 class MyDiagram extends ClassDiagram { class MyDiagram extends ClassDiagram {
   @Show(A.class)   @Show(A.class)
Line 178: Line 178:
  
 Example: Model contains these classes: **A** and **B**. Example: Model contains these classes: **A** and **B**.
-<​code>​+<​code ​java>
 class MyDiagram extends ClassDiagram { class MyDiagram extends ClassDiagram {
   @Spacing(0.6)   @Spacing(0.6)
Line 195: Line 195:
  
 ==== General structure ==== ==== General structure ====
-A sequence diagram description is a Java class inheriting from class ''​SequenceDiagram''​+A sequence diagram description is a Java class inheriting from class [[http://​txtuml.inf.elte.hu/​releases/​txtuml-v070/​api/​java/​hu/​elte/​txtuml/​api/​model/​seqdiag/​SequenceDiagram.html|SequenceDiagram]]
  
 Lifelines can be defined as class members in a diagram description. To give an ordering between them on the generated diagram, the ''​Position''​ annotation can be used.  Lifelines can be defined as class members in a diagram description. To give an ordering between them on the generated diagram, the ''​Position''​ annotation can be used. 
Line 208: Line 208:
  
   * ''​Sequence.send(from,​ msg, to)'':​ **from** is expected to send a message to **to** which is equal to **msg**.   * ''​Sequence.send(from,​ msg, to)'':​ **from** is expected to send a message to **to** which is equal to **msg**.
-  * ''​Sequence.fromActor(msg,​ to)'':​ **msg** should be sent to **to** by an actor.+  * ''​Sequence.fromActor(msg,​ to)'':​ **msg** should be sent to **to** by an actor. Reaching this call, the sequence diagram executor actually sends the message to the target.
   * ''​Sequence.assertState(obj,​ s)'':​ immediately after the target of the most recent ''​Sequence.send''​ or ''​Sequence.fromActor''​ call has received the message, **obj** is in state **s** (also see [[v070:​layout#​Condition evaluation during execution]]).   * ''​Sequence.assertState(obj,​ s)'':​ immediately after the target of the most recent ''​Sequence.send''​ or ''​Sequence.fromActor''​ call has received the message, **obj** is in state **s** (also see [[v070:​layout#​Condition evaluation during execution]]).
  
Line 240: Line 240:
  
 ==== Execution ==== ==== Execution ====
-The execution of the diagram can be configured by setting the execution mode. For this purpose, the ''​ExecutionMode''​ annotation ​of the ''​run''​ method ​can be used.+The execution of the diagram can be configured by setting the execution mode. For this purpose, the ''​ExecutionMode''​ annotation ​can be used on the ''​run''​ method .
  
-Regardless of the chosen mode, the entire messaging defined in ''​run''​ should ​happen ​in the model during the execution. ''​ExecMode.STRICT''​ does not allow any other communication,​ while ''​ExecMode.LENIENT''​ does.+Regardless of the chosen mode, the entire messaging defined in ''​run''​ should ​occur in the model during the execution. ''​ExecMode.STRICT''​ does not allow any other communication,​ while ''​ExecMode.LENIENT''​ does.
  
 === Condition evaluation during execution === === Condition evaluation during execution ===
v070/layout.1538762142.txt.gz ยท Last modified: 2018/10/05 19:55 by djnemeth