Skip to content

Commit

Permalink
[567644] Adds an EEnum example to the tutorial
Browse files Browse the repository at this point in the history
Change-Id: I11b554133a6acad8cc231c8da48c722868364b0a
Signed-off-by: Zoltan Ujhelyi <[email protected]>
  • Loading branch information
ujhelyiz committed Dec 8, 2020
1 parent ed4daac commit c3fc21b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ pattern emptyIpAddress(host: HostInstance) {
}
// end::emptyIpAddress[]

// tag::runningApplication[]
pattern runningApplication(application : ApplicationInstance) {
ApplicationInstance.state(application, AppState::Running);
}
// end::runningApplication[]

// tag::sameIpAddress[]
pattern sameIpAddress(host1 : HostInstance, host2 : HostInstance, commonIp : java String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ include::../../../../../org.eclipse.viatra.documentation.example/src/org/eclipse
----
+

. List all application instances that are running
* Similar to integer, numeric and boolean literals, you can refer to EMF enumerations as constants. This pattern uses the EEnum literal `AppState::Running` instead of a variable.
+
[[vql-runningapplication]]
[source,vql,indent=0]
----
include::../../../../../org.eclipse.viatra.documentation.example/src/org/eclipse/viatra/documentation/example/queries/CPSQueries.vql[tag=runningApplication]
----
+

. List all `HostInstance`-`HostInstance` pairs that share a common IP address
* This pattern is more complex, as it has three parameters and three constraints. The first two describe similar type constraints we have seen. The pattern also compares the values of variables `host1` and `host2` with each other using the `!=` (_not equal_) operator (The `==` operator is also available).
+
Expand Down

0 comments on commit c3fc21b

Please sign in to comment.