Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 4de7c20b553c89b49001fbcb70da6aeb368e6c13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Create a state machine</title>
<link href="book.css" rel="stylesheet" type="text/css">
<meta content="DocBook XSL Stylesheets V1.75.1" name="generator">
<link rel="home" href="index.html" title="eTrice User Guide">
<link rel="up" href="TutorialHelloWorldforJava.html" title="Tutorial HelloWorld for Java">
<link rel="prev" href="Createanewmodelfromscratch.html" title="Create a new model from scratch">
<link rel="next" href="Buildandrunthemodel.html" title="Build and run the model">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<h1 xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">Create a state machine</h1>
<div class="section" title="Create a state machine">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both">
<a name="Createastatemachine"></a>Create a state machine</h2>
</div>
</div>
</div>
<p>We will implement the Hello World code on the initial transition of the 
				<span class="emphasis"><em>HelloWorldTop</em></span> actor. Therefore open the state machine editor by right clicking the 
				<span class="emphasis"><em>HelloWorldTop</em></span> actor in the outline view and select 
				<span class="emphasis"><em>Edit Behavior</em></span>.
			</p>
<p>
				
</p>
<div class="mediaobject">
<img src="images/015-HelloWorld03.png"></div>
<p>
			
</p>
<p>The state machine editor will be opened. Drag and drop an 
				<span class="emphasis"><em>Initial Point</em></span> from the tool box to the diagram into the top level state. Drag and drop a 
				<span class="emphasis"><em>State</em></span> from the tool box to the diagram. Confirm the dialogue with 
				<span class="emphasis"><em>ok</em></span>. Select the 
				<span class="emphasis"><em>Transition</em></span> in the tool box and draw the transition from the 
				<span class="emphasis"><em>Initial Point</em></span> to the State. Open the transition dialogue by double clicking the transition arrow and fill in the action code.
			</p>
<div class="literallayout">
<p>
<code class="code">System.out.println("Hello&nbsp;World&nbsp;!");<br>

</code>
</p>
</div>
<p>The result should look like this:</p>
<p>
				
</p>
<div class="mediaobject">
<img src="images/015-HelloWorld04.png"></div>
<p>
			
</p>
<p>Save the diagram and inspect the model file. Note that the textual representation was created after saving the diagram.</p>
<p>
				
</p>
<div class="mediaobject">
<img src="images/015-HelloWorld05.png"></div>
<p>
			
</p>
</div>
</body>
</html>

Back to the top