This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
v050:language [2016/07/28 10:51] ndj94 [Ports and connectors] |
v050:language [2017/01/20 11:00] (current) gregobalu [Classes] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Language Guide for version 0.5.0 ==== | + | ===== Language Guide for versions 0.5.0 and 0.5.1 ==== |
txtUML models can be written using two different syntaxes: | txtUML models can be written using two different syntaxes: | ||
Line 8: | Line 8: | ||
==== Model ==== | ==== Model ==== | ||
- | Starting from version 0.3.0, txtUML models can be split into separate files. The model itself is represented by a package marked as a model. | + | txtUML models can be split into separate files. The model itself is represented by a package marked as a model. |
In XtxtUML, this marking is done in a ''model-info.xtxtuml'' file of the following form: | In XtxtUML, this marking is done in a ''model-info.xtxtuml'' file of the following form: | ||
- | <code> | + | <code xtxtuml> |
// XtxtUML: | // XtxtUML: | ||
model-package example.x.model as "ExampleModel"; | model-package example.x.model as "ExampleModel"; | ||
Line 41: | Line 41: | ||
==== Classes ==== | ==== Classes ==== | ||
- | <code> | + | <code xtxtuml> |
// XtxtUML: | // XtxtUML: | ||
// Must be defined inside the package representing the model. | // Must be defined inside the package representing the model. | ||
Line 63: | Line 63: | ||
Additionally in //XtxtUML//, in case of an empty class definition, the curly braces can be replaced by a semicolon. That is, the following class definitions are semantically equivalent: | Additionally in //XtxtUML//, in case of an empty class definition, the curly braces can be replaced by a semicolon. That is, the following class definitions are semantically equivalent: | ||
- | <code> | + | <code xtxtuml> |
// XtxtUML: | // XtxtUML: | ||
class ExampleClass {} | class ExampleClass {} | ||
</code> | </code> | ||
- | <code> | + | <code xtxtuml> |
// XtxtUML: | // XtxtUML: | ||
class ExampleClass; | class ExampleClass; | ||
Line 77: | Line 77: | ||
In txtUML, the attributes of classes can only have primitive types. References to instances of model classes must be held with the use of associations. | In txtUML, the attributes of classes can only have primitive types. References to instances of model classes must be held with the use of associations. | ||
- | <code> | + | <code xtxtuml> |
// XtxtUML: | // XtxtUML: | ||
class ExampleClass { | class ExampleClass { | ||
Line 97: | Line 97: | ||
=== Operations === | === Operations === | ||
- | <code> | + | <code xtxtuml> |
// XtxtUML: | // XtxtUML: | ||
class ExampleClass { | class ExampleClass { | ||
Line 300: | Line 300: | ||
</code> | </code> | ||
- | === Bahavior ports === | + | === Behavior ports === |
If a signal arrives to a port from the outside, it is either processed by the state machine of the class or routed to another object. In the first case the port is called //behavior port//, and is defined as follows: | If a signal arrives to a port from the outside, it is either processed by the state machine of the class or routed to another object. In the first case the port is called //behavior port//, and is defined as follows: |