Skip to content

Commit

Permalink
Adapts the GT Java section to the fixed implementation + fixed code s…
Browse files Browse the repository at this point in the history
…tyle in the TeX document
  • Loading branch information
maxkratz committed Jun 24, 2023
1 parent d374cc4 commit 010c3cc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 38 deletions.
3 changes: 3 additions & 0 deletions tutorial-doc/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,6 @@ TSWLatexianTemp*
TUDthesis.pdf
logo/tud_logo.pdf
LaTeX2e+Proceedings+Templates+download/

emoflon-tutorial.pdf

57 changes: 19 additions & 38 deletions tutorial-doc/chapters/gt.tex
Original file line number Diff line number Diff line change
Expand Up @@ -697,45 +697,33 @@ \subsection{Java implementation of the ruleset}

12\hspace{1.5cm}\textcolor{Tan}{hospitalrules}.validateHospital();

13\hspace{1cm}\textcolor{Purple}{try} \{
13\hspace{1.5cm}persistModel(HospitalValidator.hospitalFilePath, \textcolor{Tan}{hospitalrules}\textcolor{blue}{api});

14\hspace{1.5cm}\textcolor{Tan}{hospitalrules}.\textcolor{blue}{api}.getModel().getResources().get(0).save(null);
14\hspace{1.5cm}\textcolor{Tan}{hospitalrules}.\textcolor{blue}{api}.terminate();

15\hspace{1cm}\}
15\hspace{1.0cm}\}

16\hspace{1cm}\textcolor{Purple}{catch} (IOException e) \{
16\hspace{1.0cm}\textcolor{Purple}{public void} createHospital() \{

17\hspace{1.5cm}// TODO Auto-generated catch block
17\hspace{1.5cm}\textcolor{blue}{api}.hospital().apply();

18\hspace{1.5cm}\textcolor{Tan}{e}.printStackTrace();
18\hspace{1.5cm}\textcolor{blue}{api}.reception().apply();

19\hspace{1cm}\}
19\hspace{1.5cm}\textcolor{Purple}{for}(\textcolor{Purple}{int} \textcolor{Tan}{i}=0; \textcolor{Tan}{i}<4; \textcolor{Tan}{i}++) \{

20\hspace{1cm}\textcolor{Tan}{hospitalrules}.\textcolor{blue}{api}.terminate();
20\hspace{2.0cm}\textcolor{blue}{api}.department(i+2, 4).apply();

21\hspace{0.5cm}\}
21\hspace{1.5cm}\}

22\hspace{0.5cm}\textcolor{Purple}{public void} createHospital() \{
22\hspace{1.5cm}\textcolor{Purple}{for}(\textcolor{Purple}{int} \textcolor{Tan}{i}=0; \textcolor{Tan}{i}<16; \textcolor{Tan}{i}++) \{

23\hspace{1cm}\textcolor{blue}{api}.hospital().apply();
23\hspace{2.0cm}\textcolor{blue}{api}.room(4, Carelevel.get(\textcolor{blue}{rnd}.nextInt(3))).apply();

24\hspace{1cm}\textcolor{blue}{api}.reception().apply();
24\hspace{1.5cm}\}

25\hspace{1cm}\textcolor{Purple}{for}(\textcolor{Purple}{int} \textcolor{Tan}{i}=0; \textcolor{Tan}{i}<4; \textcolor{Tan}{i}++) \{
25\hspace{1.5cm}…

26\hspace{1.5cm}\textcolor{blue}{api}.department(i+2, 4).apply();

27\hspace{1cm}\}

28\hspace{1cm}\textcolor{Purple}{for}(\textcolor{Purple}{int} \textcolor{Tan}{i}=0; \textcolor{Tan}{i}<16; \textcolor{Tan}{i}++) \{

29\hspace{1.5cm}\textcolor{blue}{api}.room(4, Carelevel.get(\textcolor{blue}{rnd}.nextInt(3))).apply();

30\hspace{1cm}\}

\hspace{0.7cm}…

\hspace{0.7cm}\}
26\hspace{1.0cm}\}

}

Expand All @@ -748,7 +736,7 @@ \subsection{Java implementation of the ruleset}

\textbf{Saving the project:}

Another important thing to note is happening on \textbf{line 14} where we save our hospital model. It is important to note that the hospital instance we have initialized in the \textsf{HospitalValidator} will \textbf{not be stored} anywhere. If we want to keep it for usage in the future, we have to \textbf{save it with a separate command} as we are doing it in line 14.\newline The URI \textsf{hospital.xmi} is saved in the project folder of the \textsf{HospitalTransformRules} project.\newline
Another important thing to note is happening on \textbf{line 13} where we save our hospital model. The method \textsf{persistModel(...)} is a utility method that can be found at the end of this source file. It is important to note that the hospital instance we have initialized in the \textsf{HospitalValidator} will \textbf{not be stored} anywhere. If we want to keep it for usage in the future, we have to \textbf{save it with a separate command} as we are doing it in line 13.\newline The URI \textsf{hospital.xmi} is saved in the project folder of the \textsf{HospitalTransformRules} project.\newline

\textbf{Rule application:}

Expand Down Expand Up @@ -789,26 +777,19 @@ \subsection{Java implementation of the ruleset}
You can run the java application by \textbf{right-clicking} on the \textsf{HospitalRule.java} and selecting the \textsf{Run as Java Application} option. If you look at the output in the console, and it should look like this:\newline

{\setstretch{1.2}

\textsf{10 Patients are in the hospital right now}

\textsf{10 Patients are in a room}

\textsf{One instance of a hospital has been created}

\textsf{One instance of a reception has been created}

\textsf{At least one department instance has been created}

\textsf{16 nurses are in the hospital right now and 16 nurses are busy}

\textsf{At least one doctor is in the hospital}

\textsf{4 doctors are in the hospital right now and 4 doctors are busy}
\textsf{4 doctors are in the hospital right now and 3 doctors are busy}

\textsf{At least one patient is in the hospital}

\textsf{The hospital consists of at least one room}

\textsf{10 Patients are in the hospital right now and 10 patients are in a room}\newline
\textsf{11 Patients are in the hospital right now and 11 patients are in a room}\newline

}

Expand Down

0 comments on commit 010c3cc

Please sign in to comment.