From 4c68ab2124ef18a330f534d27a939cb95a84a5d5 Mon Sep 17 00:00:00 2001 From: Koltai Kadosa Date: Tue, 10 Nov 2020 13:08:53 +0100 Subject: [PATCH] Using viarta gradle plugin to sidestep conflict of multiple versions of the UML EPackage in the editor. GH-12 --- .../.gitignore | 1 + ...tternlanguage.emf.EMFPatternLanguage.prefs | 4 +- .../build.gradle | 7 + .../gradle/wrapper/gradle-wrapper.jar | Bin 54727 -> 55616 bytes .../gradle/wrapper/gradle-wrapper.properties | 2 +- com.incquerylabs.magicdraw.benchmark/gradlew | 18 +- .../gradlew.bat | 18 +- .../settings.gradle | 33 +- .../.ParentState.java._trace | Bin 8535 -> 0 bytes .../.TransitiveSubstatesWithCheck.java._trace | Bin 8553 -> 0 bytes .../benchmark/incrementalqueries/.gitignore | 1 - .../IncrementalQueries.java | 86 -- .../incrementalqueries/ParentState.java | 717 ----------- .../TransitiveSubstatesWithCheck.java | 710 ----------- .../TransitiveSubstatesWithCheck2.java | 742 ----------- .../TransitiveSubstatesWithCheck3.java | 710 ----------- .../magicdraw/benchmark/queries/.gitignore | 1 - .../queries/APerformanceQueries.java | 361 ------ .../benchmark/queries/Activitites.java | 942 -------------- .../queries/ActorGeneralization.java | 708 ----------- .../queries/AllBenchMarkedQueries.java | 634 ---------- .../queries/AlphabeticalDependencies.java | 735 ----------- .../benchmark/queries/AssociationClasses.java | 705 ----------- .../magicdraw/benchmark/queries/Blocks.java | 564 --------- .../queries/BlocksOrRequirements.java | 565 --------- .../BlocksOrRequirementsOrConstraints.java | 577 --------- .../queries/CircularDependencies.java | 550 --------- .../magicdraw/benchmark/queries/Classes.java | 547 -------- .../queries/ComplexNameOfElements.java | 750 ----------- .../benchmark/queries/Dependencies.java | 717 ----------- .../benchmark/queries/DependencyChains.java | 717 ----------- .../queries/ElementsWithShortNames.java | 586 --------- .../queries/IncomingTransitions.java | 709 ----------- ...ansitionWithTriggerEffectEventNoGuard.java | 1098 ----------------- .../benchmark/queries/NamedElement.java | 711 ----------- .../queries/NamesOfDependencyEndpoints.java | 942 -------------- .../benchmark/queries/NonBlockClasses.java | 549 --------- .../benchmark/queries/NumberOfSubregions.java | 710 ----------- .../queries/NumberOfTransitiveSubstates.java | 710 ----------- .../benchmark/queries/ParentState.java | 717 ----------- .../benchmark/queries/Requirements.java | 564 --------- .../queries/StateWithMostSubstates.java | 566 --------- .../StatesWithMoreIncomingTransitions.java | 582 --------- .../queries/StatesWithShortNames.java | 600 --------- .../benchmark/queries/Subregions.java | 737 ----------- .../TransitionPointingOutOfCompState.java | 951 -------------- .../queries/TransitiveSubstates.java | 704 ----------- .../queries/TransitiveSubstatesWithCheck.java | 710 ----------- .../TransitiveSubstatesWithCheck2.java | 742 ----------- .../TransitiveSubstatesWithCheck3.java | 710 ----------- .../benchmark/queries/Variables.java | 709 ----------- .../benchmark/queries/WarmUpQueries.java | 86 -- .../internal/APerformanceQueriesAll.java | 132 -- .../queries/internal/ConstraintBlocks.java | 146 --- .../queries/internal/TransitionWithGuard.java | 138 --- 55 files changed, 62 insertions(+), 26869 deletions(-) delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/.ParentState.java._trace delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/.TransitiveSubstatesWithCheck.java._trace delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/.gitignore delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/IncrementalQueries.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/ParentState.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/TransitiveSubstatesWithCheck.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/TransitiveSubstatesWithCheck2.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/TransitiveSubstatesWithCheck3.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/.gitignore delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Activitites.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ActorGeneralization.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/AllBenchMarkedQueries.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/AlphabeticalDependencies.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/AssociationClasses.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Blocks.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/BlocksOrRequirements.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/BlocksOrRequirementsOrConstraints.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/CircularDependencies.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Classes.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ComplexNameOfElements.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Dependencies.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/DependencyChains.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ElementsWithShortNames.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/IncomingTransitions.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/LoopTransitionWithTriggerEffectEventNoGuard.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NamedElement.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NamesOfDependencyEndpoints.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NonBlockClasses.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NumberOfSubregions.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NumberOfTransitiveSubstates.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ParentState.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Requirements.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/StateWithMostSubstates.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/StatesWithMoreIncomingTransitions.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/StatesWithShortNames.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Subregions.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitionPointingOutOfCompState.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstates.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstatesWithCheck.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstatesWithCheck2.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstatesWithCheck3.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Variables.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/WarmUpQueries.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/internal/APerformanceQueriesAll.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/internal/ConstraintBlocks.java delete mode 100644 com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/internal/TransitionWithGuard.java diff --git a/com.incquerylabs.magicdraw.benchmark/.gitignore b/com.incquerylabs.magicdraw.benchmark/.gitignore index 3c9acd5..098d82a 100644 --- a/com.incquerylabs.magicdraw.benchmark/.gitignore +++ b/com.incquerylabs.magicdraw.benchmark/.gitignore @@ -2,3 +2,4 @@ /target/ /build/ /.gradle/ +/src/generated/vql \ No newline at end of file diff --git a/com.incquerylabs.magicdraw.benchmark/.settings/org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguage.prefs b/com.incquerylabs.magicdraw.benchmark/.settings/org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguage.prefs index d42f248..277afa8 100644 --- a/com.incquerylabs.magicdraw.benchmark/.settings/org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguage.prefs +++ b/com.incquerylabs.magicdraw.benchmark/.settings/org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguage.prefs @@ -1,5 +1,5 @@ BuilderConfiguration.is_project_specific=true -autobuilding=true +autobuilding=false eclipse.preferences.version=1 generateEclipseExtensions=false generateGeneratedAnnotation=false @@ -9,6 +9,7 @@ generateMatchers=NESTED_CLASS generateSuppressWarnings=true generatedAnnotationComment= includeDateInGenerated=false +org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguage.useProjectSettings=true outlet.DEFAULT_OUTPUT.cleanDirectory=false outlet.DEFAULT_OUTPUT.cleanupDerived=false outlet.DEFAULT_OUTPUT.createDirectory=true @@ -27,4 +28,3 @@ outlet.DEFAULT_OUTPUT.sourceFolder.xtend-gen.ignore= outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder= targetJavaVersion=JAVA5 useJavaCompilerCompliance=true - diff --git a/com.incquerylabs.magicdraw.benchmark/build.gradle b/com.incquerylabs.magicdraw.benchmark/build.gradle index f76949e..9f27e36 100644 --- a/com.incquerylabs.magicdraw.benchmark/build.gradle +++ b/com.incquerylabs.magicdraw.benchmark/build.gradle @@ -5,6 +5,7 @@ import java.util.zip.ZipFile plugins { id "org.xtext.xtend" version "2.0.2" + id "viatra-gradle-plugin" version "2.5.0-SNAPSHOT" } xtext.version = xtextVersion @@ -29,6 +30,12 @@ String[] classpathLibraries = [ // Apply the java-library plugin to add support for Java Library +vql { + packageClassNames('com.nomagic.uml2.ext.magicdraw.metadata.UMLPackage') + inputDirectory.set(file('src/main/java')) + outputDirectory.set(file('src/generated/vql')) +} + apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'java' diff --git a/com.incquerylabs.magicdraw.benchmark/gradle/wrapper/gradle-wrapper.jar b/com.incquerylabs.magicdraw.benchmark/gradle/wrapper/gradle-wrapper.jar index 27768f1bbac3ce2d055b20d521f12da78d331e8e..5c2d1cf016b3885f6930543d57b744ea8c220a1a 100644 GIT binary patch literal 55616 zcmafaW0WS*vSoFbZJS-TZP!<}ZQEV8ZQHihW!tvx>6!c9%-lQoy;&DmfdT@8fB*sl68LLCKtKQ283+jS?^Q-bNq|NIAW8=eB==8_)^)r*{C^$z z{u;{v?IMYnO`JhmPq7|LA_@Iz75S9h~8`iX>QrjrmMeu{>hn4U;+$dor zz+`T8Q0f}p^Ao)LsYq74!W*)&dTnv}E8;7H*Zetclpo2zf_f>9>HT8;`O^F8;M%l@ z57Z8dk34kG-~Wg7n48qF2xwPp;SOUpd1}9Moir5$VSyf4gF)Mp-?`wO3;2x9gYj59oFwG>?Leva43@e(z{mjm0b*@OAYLC`O9q|s+FQLOE z!+*Y;%_0(6Sr<(cxE0c=lS&-FGBFGWd_R<5$vwHRJG=tB&Mi8@hq_U7@IMyVyKkOo6wgR(<% zQw1O!nnQl3T9QJ)Vh=(`cZM{nsEKChjbJhx@UQH+G>6p z;beBQ1L!3Zl>^&*?cSZjy$B3(1=Zyn~>@`!j%5v7IBRt6X`O)yDpVLS^9EqmHxBcisVG$TRwiip#ViN|4( zYn!Av841_Z@Ys=T7w#>RT&iXvNgDq3*d?$N(SznG^wR`x{%w<6^qj&|g})La;iD?`M=p>99p><39r9+e z`dNhQ&tol5)P#;x8{tT47i*blMHaDKqJs8!Pi*F{#)9%USFxTVMfMOy{mp2ZrLR40 z2a9?TJgFyqgx~|j0eA6SegKVk@|Pd|_6P$HvwTrLTK)Re`~%kg8o9`EAE1oAiY5Jgo=H}0*D?tSCn^=SIN~fvv453Ia(<1|s07aTVVtsRxY6+tT3589iQdi^ zC92D$ewm9O6FA*u*{Fe_=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>2M^g&}8aqRMLsJ`v zKg-)o(NK;KkDXJE$Vk#uu}m<50hY($5JrPfegL@uAi$a!@b@cVWFSE8{saxMynhvd zeA|m6BcdokBOxnF_wq5-PEz_G2dNYR*N>n2v;0tv{lCX#1Y{*dMHCciWkg>h{CMI& z#DK$oe=13Uduu!6zj6NfFaLQ0pzrgi(h9i$@x;I7`TvRPM?3s1dw|_DFZ@zegQ2EkaMuG);0K#VBkx@L2FKXctA7p1M18C7eG#cU*w+v0pAT5R{=){ z6M)vTss2ytl9vpTX9%P4KN2ki5-$+^g&`TxKL5b*$8_u^+_Ws+awY&~5O6X41#S=R zAK?J?HMTRfx0ePa^ft8mPa1`n@Sef+2-<+A+yXk%7Do{YcZfz$pP&&u9G*TUkz*>Ea!13xj~O}zpPCis7< z9S{%}%Rk}$x^}s)^o`1Z4gvzK9RNM@r{W?0OEhU~yOF zUgk6Z$$}~Kzgd3W3@`J({=^gojN-rO^p{hQzhr@ZS>u;k7k{FYs{IoE-$we29E>la zUnaf#2@S0IPtbo&f%g*iW%ih#sPKjW{qujlqyLyo<|W_{fFD-&qx{Gh^Rrk10RPm! zKSI!6KKwF!%+H5Y|NiiQ5_tUgx!_Cqml;8R!jqf)t#1E;|DAQjOQM&m{y&LEEdECH zr~3aFjsKVMFXicf!s}c86a0&*@=Ms4s_Z{uyR82S_Rn61mzXaFfPZ3^IQ|pnA4h2a z+sOD*YWF8A-ClCOlbkmnsV{sb0pj|D?i-{%tD2_+s;C4ZfEoFT;d?l2Cm9ZIVCU*FR~dykvP9 zkNT5^H2$|){v4h9lHg@D;7nG1l$KQBfPCNf(vH#;U{?hOAlcu2S z|E6^R%?tCNI{(M#@@J>X51-4=ati?aZyuPpQlNl!(2v+fMxgfqf6Ke>AAkKnZ|KqV diff --git a/com.incquerylabs.magicdraw.benchmark/gradle/wrapper/gradle-wrapper.properties b/com.incquerylabs.magicdraw.benchmark/gradle/wrapper/gradle-wrapper.properties index b33419d..be52383 100644 --- a/com.incquerylabs.magicdraw.benchmark/gradle/wrapper/gradle-wrapper.properties +++ b/com.incquerylabs.magicdraw.benchmark/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip diff --git a/com.incquerylabs.magicdraw.benchmark/gradlew b/com.incquerylabs.magicdraw.benchmark/gradlew index cccdd3d..8e25e6c 100755 --- a/com.incquerylabs.magicdraw.benchmark/gradlew +++ b/com.incquerylabs.magicdraw.benchmark/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/com.incquerylabs.magicdraw.benchmark/gradlew.bat b/com.incquerylabs.magicdraw.benchmark/gradlew.bat index f955316..9618d8d 100644 --- a/com.incquerylabs.magicdraw.benchmark/gradlew.bat +++ b/com.incquerylabs.magicdraw.benchmark/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/com.incquerylabs.magicdraw.benchmark/settings.gradle b/com.incquerylabs.magicdraw.benchmark/settings.gradle index f7265b1..4e5cfeb 100644 --- a/com.incquerylabs.magicdraw.benchmark/settings.gradle +++ b/com.incquerylabs.magicdraw.benchmark/settings.gradle @@ -1,18 +1,19 @@ -/* - * This settings file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * In a single project build this file can be empty or even removed. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user guide at https://docs.gradle.org/4.3/userguide/multi_project_builds.html - */ - -/* -// To declare projects as part of a multi-project build use the 'include' method -include 'shared' -include 'api' -include 'services:webservice' -*/ +pluginManagement { + repositories { + gradlePluginPortal() + mavenCentral() + maven { + url("https://repo.eclipse.org/content/groups/viatra/") + } + maven { + url "https://build.incquerylabs.com/nexus/repository/gradle-plugins" + credentials { + username = "$nexusUsername" + password = "$nexusPassword" + } + } + mavenLocal() + } +} rootProject.name = 'com.incquerylabs.magicdraw.benchmark' diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/.ParentState.java._trace b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/.ParentState.java._trace deleted file mode 100644 index 121bc0508f6a92591067931ff42e139978b22f5b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8535 zcmZXZdvsLQ6~=QjGxz2-fzAXl2(2y)MX08NmR3;qIRO%q%p}tU5|R*@nY=RzfyCGl z8xGVrVnt9XVts(t#}ak5U9DCtv|Y87B5kFuw53WdRK-@Tm139Lo;iD;xo2+w+`s#s z@7w#_duMVoIXO82%MxGxvBh7`$z^TuhrD7dCz@Q_U)D2_Tz5^!`q5N8F;vzc@9Igm zua93_mgpErcK65E_oW5vJNi2YhU2NUu%~0FY?+HuU8jbq$<2L5uSvkJ%DbW)dRb{}k1f5jip$mccS9_-V0h!58_x zZPr%gxT9-3-D2d-G^mDZseh$J>Cf3_ZACr_>ROEyodQh|frx5SZhKCyL9hpZbY_4g z)Kqki;{o#~5WtO!Zh$RN3tur@U7}q#+fq_1CA8+|Fx5C|^mct+)mC(eqpzz;qq|F~ z#z~_OX}zkg=%Yb>T}@g$5k7zhXmNWo2=)}Ho$0`GSS}?rY3(I`0@!5je6Qf@;w(Yk zMEDh~f_68>Ae2%kQ`(@-O{tS92r#8?zOJc_x&?N&;PgW1gl_48dsX*OTh^Vrw(8F1 z>sswqY_5E&dLbnRxLL6;+p_M}wG~@5LDy=tVmGiCVE{HrfqENrat(q_Ik9{5U@feb z66!Lx$4>yqh&}0e1m7*r798{newCjksIP_l;5yjowqX!V_1CWmNXd0>8}%*u1h9?z z_Au4BS@pfPSzGmkj;_^a)&Cp52bzd=m&@XhW!!YTWRK^K7%W z8a^G=wc7B8@53!{Bi!PK8U#aq4Tl}L32rh%j}{TY(B;+8FJHXdT@!;)=gZ>(xD9S| zO_p~$9xyP00J;7I+Tjk^Zn(OHT3de1fo-tOaQ#aj0W?`L7dFFPu+ud$2$`&?48h%S zw`;PZxrhLnyvRyn7d&8?xI~-$)`5HBUc=;1MFh~K@eNo555dE(i9yJu@k2lCfjz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?jIe}y+>(sG4? z&`6?1MN*Xhp+zs-#QOOP9?vZEi8Y(xafzB0!Y1RF!hYVOROsXr@r6Z_q<u%OjgomGKETsQ4&8KeYB3QqN_Mfid_BL$FftG> z3y9=ch!620(`aix5pA^F@k$;k%$Br2P=1(S%fFGy@`?5b*i{mZD};Bk<8{83Z&WHB z-|<1ABpaoO!aAKrTyT*w$`vlr!*@&Srjd&>9UYxUqRhH8`9#RNXF8k3ckuLa zLVxTUNE`LcDI}3L>iObCB4pHC$1dl0bN4utD-5KKdfN&~q>XxeCKDl}zHdO1@8rf0 zF~UH&%rE-x3y??~^*vPRCHpkd)*r(XzKicRhV63^8s&;qV4@W5a<@Mff$jWT{6S-x zfpD2mq>>K5pWiP_wv1lQNQhYNpXk>S@-us zGk=snVOSd|V=V&wG5(loeM6y_Y%3GAvDvc2TY IBqC`2KT<}1r2qf` diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/.TransitiveSubstatesWithCheck.java._trace b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/.TransitiveSubstatesWithCheck.java._trace deleted file mode 100644 index 63a529fcc89db9bf37fdf0d23a28259f2f61ca3a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8553 zcmZ9Rd2|$27RFQQ?y7DQ!qT1KmZ7oD=*Xr=MGuO;_cBHTF`a}Y5X?d+=_UzTNdl1= z@>oWRisFC@3?QH^qM$^b8Jz)KMunq@8_3``$Z{+H@cC;zl+!1Lsh4s<)vAH%X1T|*j9NFT}NJ^W0CUe3BA=s7a7uWMH2w4?e)bb`|C6sm37u-mG zvF-Ef*pwSduI-<{d)i1c$&!G@h4~-q0!)f`$p3N(*4QJgWsu2avJf0e6A@ftpRU$g zc#t7$-HaH%I7DtGw+j827h3wub+y*QR|I73xAX<1iiAnn3~6qAQgYZPkii|U@}NY9 zsx=&-aS#I7sPGG9Jt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(!f?T<)<00AXw(+?U^1FNu&0QQ=DXsB+_~@xtXnD>y(V`HUgt$-hS_3AzC9ua@qUj zF}9vPsxGq;EOYU8@ru~MHV9EX(Wwk1Xw&{D3oaBl$B+|M$$1fh_f2r0sid!#sv!|JP ROp@bwF43Lj{&XZ@{eQuozaRhr diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/.gitignore b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/.gitignore deleted file mode 100644 index 4a5335e..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*._trace \ No newline at end of file diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/IncrementalQueries.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/IncrementalQueries.java deleted file mode 100644 index 01a153c..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/IncrementalQueries.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/incrementalqueries/IncrementalQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.incrementalqueries; - -import com.incquerylabs.magicdraw.benchmark.incrementalqueries.ParentState; -import com.incquerylabs.magicdraw.benchmark.incrementalqueries.TransitiveSubstatesWithCheck; -import com.incquerylabs.magicdraw.benchmark.incrementalqueries.TransitiveSubstatesWithCheck2; -import com.incquerylabs.magicdraw.benchmark.incrementalqueries.TransitiveSubstatesWithCheck3; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in IncrementalQueries.vql. - * - *

Use the static instance as any {@link interface org.eclipse.viatra.query.runtime.api.IQueryGroup}, to conveniently prepare - * a VIATRA Query engine for matching all patterns originally defined in file IncrementalQueries.vql, - * in order to achieve better performance than one-by-one on-demand matcher initialization. - * - *

From package com.incquerylabs.magicdraw.benchmark.incrementalqueries, the group contains the definition of the following patterns:

    - *
  • parentState
  • - *
  • transitiveSubstatesWithCheck
  • - *
  • transitiveSubstatesWithCheck2
  • - *
  • transitiveSubstatesWithCheck3
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class IncrementalQueries extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static IncrementalQueries instance() { - if (INSTANCE == null) { - INSTANCE = new IncrementalQueries(); - } - return INSTANCE; - } - - private static IncrementalQueries INSTANCE; - - private IncrementalQueries() { - querySpecifications.add(ParentState.instance()); - querySpecifications.add(TransitiveSubstatesWithCheck.instance()); - querySpecifications.add(TransitiveSubstatesWithCheck2.instance()); - querySpecifications.add(TransitiveSubstatesWithCheck3.instance()); - } - - public ParentState getParentState() { - return ParentState.instance(); - } - - public ParentState.Matcher getParentState(final ViatraQueryEngine engine) { - return ParentState.Matcher.on(engine); - } - - public TransitiveSubstatesWithCheck getTransitiveSubstatesWithCheck() { - return TransitiveSubstatesWithCheck.instance(); - } - - public TransitiveSubstatesWithCheck.Matcher getTransitiveSubstatesWithCheck(final ViatraQueryEngine engine) { - return TransitiveSubstatesWithCheck.Matcher.on(engine); - } - - public TransitiveSubstatesWithCheck2 getTransitiveSubstatesWithCheck2() { - return TransitiveSubstatesWithCheck2.instance(); - } - - public TransitiveSubstatesWithCheck2.Matcher getTransitiveSubstatesWithCheck2(final ViatraQueryEngine engine) { - return TransitiveSubstatesWithCheck2.Matcher.on(engine); - } - - public TransitiveSubstatesWithCheck3 getTransitiveSubstatesWithCheck3() { - return TransitiveSubstatesWithCheck3.instance(); - } - - public TransitiveSubstatesWithCheck3.Matcher getTransitiveSubstatesWithCheck3(final ViatraQueryEngine engine) { - return TransitiveSubstatesWithCheck3.Matcher.on(engine); - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/ParentState.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/ParentState.java deleted file mode 100644 index d3e0e76..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/ParentState.java +++ /dev/null @@ -1,717 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/incrementalqueries/IncrementalQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.incrementalqueries; - -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Simple pattern for transitive closures marked incremental.
- *          
- *         incremental pattern parentState(state : State, parentState : State) {
- *         	State.region(parentState, subregion);
- *         	Region.subvertex(subregion, state);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class ParentState extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.incrementalqueries.parentState pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private State fParentState; - - private static List parameterNames = makeImmutableList("state", "parentState"); - - private Match(final State pState, final State pParentState) { - this.fState = pState; - this.fParentState = pParentState; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - case "parentState": return this.fParentState; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - case 1: return this.fParentState; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - public State getParentState() { - return this.fParentState; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - if ("parentState".equals(parameterName) ) { - this.fParentState = (State) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - public void setParentState(final State pParentState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fParentState = pParentState; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.incrementalqueries.parentState"; - } - - @Override - public List parameterNames() { - return ParentState.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState, fParentState}; - } - - @Override - public ParentState.Match toImmutable() { - return isMutable() ? newMatch(fState, fParentState) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState) + ", "); - result.append("\"parentState\"=" + prettyPrintValue(fParentState)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState, fParentState); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof ParentState.Match)) { - ParentState.Match other = (ParentState.Match) obj; - return Objects.equals(fState, other.fState) && Objects.equals(fParentState, other.fParentState); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public ParentState specification() { - return ParentState.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static ParentState.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static ParentState.Match newMutableMatch(final State pState, final State pParentState) { - return new Mutable(pState, pParentState); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return the (partial) match object. - * - */ - public static ParentState.Match newMatch(final State pState, final State pParentState) { - return new Immutable(pState, pParentState); - } - - private static final class Mutable extends ParentState.Match { - Mutable(final State pState, final State pParentState) { - super(pState, pParentState); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends ParentState.Match { - Immutable(final State pState, final State pParentState) { - super(pState, pParentState); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.incrementalqueries.parentState pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Simple pattern for transitive closures marked incremental.
-   *  
-   * incremental pattern parentState(state : State, parentState : State) {
-   * 	State.region(parentState, subregion);
-   * 	Region.subvertex(subregion, state);
-   * }
-   * 
- * - * @see Match - * @see ParentState - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static ParentState.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static ParentState.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final int POSITION_PARENTSTATE = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ParentState.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState, final State pParentState) { - return rawStreamAllMatches(new Object[]{pState, pParentState}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState, final State pParentState) { - return rawStreamAllMatches(new Object[]{pState, pParentState}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState, final State pParentState) { - return rawGetOneArbitraryMatch(new Object[]{pState, pParentState}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState, final State pParentState) { - return rawHasMatch(new Object[]{pState, pParentState}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState, final State pParentState) { - return rawCountMatches(new Object[]{pState, pParentState}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final State pParentState, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState, pParentState}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return the (partial) match object. - * - */ - public ParentState.Match newMatch(final State pState, final State pParentState) { - return ParentState.Match.newMatch(pState, pParentState); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final ParentState.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final State pParentState) { - return rawStreamAllValuesOfstate(new Object[]{null, pParentState}); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final ParentState.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final State pParentState) { - return rawStreamAllValuesOfstate(new Object[]{null, pParentState}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for parentState. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfparentState(final Object[] parameters) { - return rawStreamAllValues(POSITION_PARENTSTATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for parentState. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfparentState() { - return rawStreamAllValuesOfparentState(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for parentState. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfparentState() { - return rawStreamAllValuesOfparentState(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for parentState. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfparentState(final ParentState.Match partialMatch) { - return rawStreamAllValuesOfparentState(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for parentState. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfparentState(final State pState) { - return rawStreamAllValuesOfparentState(new Object[]{pState, null}); - } - - /** - * Retrieve the set of values that occur in matches for parentState. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfparentState(final ParentState.Match partialMatch) { - return rawStreamAllValuesOfparentState(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for parentState. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfparentState(final State pState) { - return rawStreamAllValuesOfparentState(new Object[]{pState, null}).collect(Collectors.toSet()); - } - - @Override - protected ParentState.Match tupleToMatch(final Tuple t) { - try { - return ParentState.Match.newMatch((State) t.get(POSITION_STATE), (State) t.get(POSITION_PARENTSTATE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected ParentState.Match arrayToMatch(final Object[] match) { - try { - return ParentState.Match.newMatch((State) match[POSITION_STATE], (State) match[POSITION_PARENTSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected ParentState.Match arrayToMatchMutable(final Object[] match) { - try { - return ParentState.Match.newMutableMatch((State) match[POSITION_STATE], (State) match[POSITION_PARENTSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return ParentState.instance(); - } - } - - private ParentState() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static ParentState instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected ParentState.Matcher instantiate(final ViatraQueryEngine engine) { - return ParentState.Matcher.on(engine); - } - - @Override - public ParentState.Matcher instantiate() { - return ParentState.Matcher.create(); - } - - @Override - public ParentState.Match newEmptyMatch() { - return ParentState.Match.newEmptyMatch(); - } - - @Override - public ParentState.Match newMatch(final Object... parameters) { - return ParentState.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0], (com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link ParentState} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link ParentState#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final ParentState INSTANCE = new ParentState(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final ParentState.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final PParameter parameter_parentState = new PParameter("parentState", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state, parameter_parentState); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.incrementalqueries.parentState"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state","parentState"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.DEFAULT_CACHING)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_parentState = body.getOrCreateVariableByName("parentState"); - PVariable var_subregion = body.getOrCreateVariableByName("subregion"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_parentState), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state), - new ExportedParameter(body, var_parentState, parameter_parentState) - )); - // State.region(parentState, subregion) - new TypeConstraint(body, Tuples.flatTupleOf(var_parentState), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_parentState, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State", "region"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Region"))); - new Equality(body, var__virtual_0_, var_subregion); - // Region.subvertex(subregion, state) - new TypeConstraint(body, Tuples.flatTupleOf(var_subregion), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Region"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_subregion, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Region", "subvertex"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex"))); - new Equality(body, var__virtual_1_, var_state); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/TransitiveSubstatesWithCheck.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/TransitiveSubstatesWithCheck.java deleted file mode 100644 index 528c9a8..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/TransitiveSubstatesWithCheck.java +++ /dev/null @@ -1,710 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/incrementalqueries/IncrementalQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.incrementalqueries; - -import com.incquerylabs.magicdraw.benchmark.incrementalqueries.ParentState; -import com.incquerylabs.magicdraw.benchmark.queries.StatesWithShortNames; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing a simple pattern with a check expression before the transitive closure which is an incremental pattern.
- *          
- *         pattern transitiveSubstatesWithCheck(state : State, transitiveSubstate : State) {
- *         	find statesWithShortNames(state);
- *         	find parentState+(transitiveSubstate, state); 
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class TransitiveSubstatesWithCheck extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.incrementalqueries.transitiveSubstatesWithCheck pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private State fTransitiveSubstate; - - private static List parameterNames = makeImmutableList("state", "transitiveSubstate"); - - private Match(final State pState, final State pTransitiveSubstate) { - this.fState = pState; - this.fTransitiveSubstate = pTransitiveSubstate; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - case "transitiveSubstate": return this.fTransitiveSubstate; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - case 1: return this.fTransitiveSubstate; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - public State getTransitiveSubstate() { - return this.fTransitiveSubstate; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - if ("transitiveSubstate".equals(parameterName) ) { - this.fTransitiveSubstate = (State) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - public void setTransitiveSubstate(final State pTransitiveSubstate) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTransitiveSubstate = pTransitiveSubstate; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.incrementalqueries.transitiveSubstatesWithCheck"; - } - - @Override - public List parameterNames() { - return TransitiveSubstatesWithCheck.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState, fTransitiveSubstate}; - } - - @Override - public TransitiveSubstatesWithCheck.Match toImmutable() { - return isMutable() ? newMatch(fState, fTransitiveSubstate) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState) + ", "); - result.append("\"transitiveSubstate\"=" + prettyPrintValue(fTransitiveSubstate)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState, fTransitiveSubstate); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof TransitiveSubstatesWithCheck.Match)) { - TransitiveSubstatesWithCheck.Match other = (TransitiveSubstatesWithCheck.Match) obj; - return Objects.equals(fState, other.fState) && Objects.equals(fTransitiveSubstate, other.fTransitiveSubstate); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public TransitiveSubstatesWithCheck specification() { - return TransitiveSubstatesWithCheck.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static TransitiveSubstatesWithCheck.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static TransitiveSubstatesWithCheck.Match newMutableMatch(final State pState, final State pTransitiveSubstate) { - return new Mutable(pState, pTransitiveSubstate); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the (partial) match object. - * - */ - public static TransitiveSubstatesWithCheck.Match newMatch(final State pState, final State pTransitiveSubstate) { - return new Immutable(pState, pTransitiveSubstate); - } - - private static final class Mutable extends TransitiveSubstatesWithCheck.Match { - Mutable(final State pState, final State pTransitiveSubstate) { - super(pState, pTransitiveSubstate); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends TransitiveSubstatesWithCheck.Match { - Immutable(final State pState, final State pTransitiveSubstate) { - super(pState, pTransitiveSubstate); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.incrementalqueries.transitiveSubstatesWithCheck pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing a simple pattern with a check expression before the transitive closure which is an incremental pattern.
-   *  
-   * pattern transitiveSubstatesWithCheck(state : State, transitiveSubstate : State) {
-   * 	find statesWithShortNames(state);
-   * 	find parentState+(transitiveSubstate, state); 
-   * }
-   * 
- * - * @see Match - * @see TransitiveSubstatesWithCheck - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static TransitiveSubstatesWithCheck.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static TransitiveSubstatesWithCheck.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final int POSITION_TRANSITIVESUBSTATE = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TransitiveSubstatesWithCheck.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState, final State pTransitiveSubstate) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstate}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState, final State pTransitiveSubstate) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState, final State pTransitiveSubstate) { - return rawGetOneArbitraryMatch(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState, final State pTransitiveSubstate) { - return rawHasMatch(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState, final State pTransitiveSubstate) { - return rawCountMatches(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final State pTransitiveSubstate, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState, pTransitiveSubstate}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the (partial) match object. - * - */ - public TransitiveSubstatesWithCheck.Match newMatch(final State pState, final State pTransitiveSubstate) { - return TransitiveSubstatesWithCheck.Match.newMatch(pState, pTransitiveSubstate); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final TransitiveSubstatesWithCheck.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final State pTransitiveSubstate) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstate}); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final TransitiveSubstatesWithCheck.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final State pTransitiveSubstate) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstate}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftransitiveSubstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_TRANSITIVESUBSTATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate() { - return rawStreamAllValuesOftransitiveSubstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate() { - return rawStreamAllValuesOftransitiveSubstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate(final TransitiveSubstatesWithCheck.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate(final State pState) { - return rawStreamAllValuesOftransitiveSubstate(new Object[]{pState, null}); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate(final TransitiveSubstatesWithCheck.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate(final State pState) { - return rawStreamAllValuesOftransitiveSubstate(new Object[]{pState, null}).collect(Collectors.toSet()); - } - - @Override - protected TransitiveSubstatesWithCheck.Match tupleToMatch(final Tuple t) { - try { - return TransitiveSubstatesWithCheck.Match.newMatch((State) t.get(POSITION_STATE), (State) t.get(POSITION_TRANSITIVESUBSTATE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected TransitiveSubstatesWithCheck.Match arrayToMatch(final Object[] match) { - try { - return TransitiveSubstatesWithCheck.Match.newMatch((State) match[POSITION_STATE], (State) match[POSITION_TRANSITIVESUBSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected TransitiveSubstatesWithCheck.Match arrayToMatchMutable(final Object[] match) { - try { - return TransitiveSubstatesWithCheck.Match.newMutableMatch((State) match[POSITION_STATE], (State) match[POSITION_TRANSITIVESUBSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return TransitiveSubstatesWithCheck.instance(); - } - } - - private TransitiveSubstatesWithCheck() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static TransitiveSubstatesWithCheck instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected TransitiveSubstatesWithCheck.Matcher instantiate(final ViatraQueryEngine engine) { - return TransitiveSubstatesWithCheck.Matcher.on(engine); - } - - @Override - public TransitiveSubstatesWithCheck.Matcher instantiate() { - return TransitiveSubstatesWithCheck.Matcher.create(); - } - - @Override - public TransitiveSubstatesWithCheck.Match newEmptyMatch() { - return TransitiveSubstatesWithCheck.Match.newEmptyMatch(); - } - - @Override - public TransitiveSubstatesWithCheck.Match newMatch(final Object... parameters) { - return TransitiveSubstatesWithCheck.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0], (com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link TransitiveSubstatesWithCheck} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link TransitiveSubstatesWithCheck#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final TransitiveSubstatesWithCheck INSTANCE = new TransitiveSubstatesWithCheck(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final TransitiveSubstatesWithCheck.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final PParameter parameter_transitiveSubstate = new PParameter("transitiveSubstate", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state, parameter_transitiveSubstate); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.incrementalqueries.transitiveSubstatesWithCheck"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state","transitiveSubstate"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_transitiveSubstate = body.getOrCreateVariableByName("transitiveSubstate"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_transitiveSubstate), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state), - new ExportedParameter(body, var_transitiveSubstate, parameter_transitiveSubstate) - )); - // find statesWithShortNames(state) - new PositivePatternCall(body, Tuples.flatTupleOf(var_state), StatesWithShortNames.instance().getInternalQueryRepresentation()); - // find parentState+(transitiveSubstate, state) - new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_transitiveSubstate, var_state), ParentState.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/TransitiveSubstatesWithCheck2.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/TransitiveSubstatesWithCheck2.java deleted file mode 100644 index 26b0ef8..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/TransitiveSubstatesWithCheck2.java +++ /dev/null @@ -1,742 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/incrementalqueries/IncrementalQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.incrementalqueries; - -import com.incquerylabs.magicdraw.benchmark.incrementalqueries.ParentState; -import com.incquerylabs.magicdraw.benchmark.queries.IncomingTransitions; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing a simple pattern with a check expression before the transitive closure which is an incremental pattern.
- *          
- *         pattern transitiveSubstatesWithCheck2(state : State, transitiveSubstate : State) {
- *         	transitionCount == count find incomingTransitions(_, state);
- *         	check (transitionCount {@literal >} 1);
- *         	find parentState+(transitiveSubstate, state);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class TransitiveSubstatesWithCheck2 extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.incrementalqueries.transitiveSubstatesWithCheck2 pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private State fTransitiveSubstate; - - private static List parameterNames = makeImmutableList("state", "transitiveSubstate"); - - private Match(final State pState, final State pTransitiveSubstate) { - this.fState = pState; - this.fTransitiveSubstate = pTransitiveSubstate; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - case "transitiveSubstate": return this.fTransitiveSubstate; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - case 1: return this.fTransitiveSubstate; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - public State getTransitiveSubstate() { - return this.fTransitiveSubstate; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - if ("transitiveSubstate".equals(parameterName) ) { - this.fTransitiveSubstate = (State) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - public void setTransitiveSubstate(final State pTransitiveSubstate) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTransitiveSubstate = pTransitiveSubstate; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.incrementalqueries.transitiveSubstatesWithCheck2"; - } - - @Override - public List parameterNames() { - return TransitiveSubstatesWithCheck2.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState, fTransitiveSubstate}; - } - - @Override - public TransitiveSubstatesWithCheck2.Match toImmutable() { - return isMutable() ? newMatch(fState, fTransitiveSubstate) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState) + ", "); - result.append("\"transitiveSubstate\"=" + prettyPrintValue(fTransitiveSubstate)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState, fTransitiveSubstate); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof TransitiveSubstatesWithCheck2.Match)) { - TransitiveSubstatesWithCheck2.Match other = (TransitiveSubstatesWithCheck2.Match) obj; - return Objects.equals(fState, other.fState) && Objects.equals(fTransitiveSubstate, other.fTransitiveSubstate); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public TransitiveSubstatesWithCheck2 specification() { - return TransitiveSubstatesWithCheck2.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static TransitiveSubstatesWithCheck2.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static TransitiveSubstatesWithCheck2.Match newMutableMatch(final State pState, final State pTransitiveSubstate) { - return new Mutable(pState, pTransitiveSubstate); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the (partial) match object. - * - */ - public static TransitiveSubstatesWithCheck2.Match newMatch(final State pState, final State pTransitiveSubstate) { - return new Immutable(pState, pTransitiveSubstate); - } - - private static final class Mutable extends TransitiveSubstatesWithCheck2.Match { - Mutable(final State pState, final State pTransitiveSubstate) { - super(pState, pTransitiveSubstate); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends TransitiveSubstatesWithCheck2.Match { - Immutable(final State pState, final State pTransitiveSubstate) { - super(pState, pTransitiveSubstate); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.incrementalqueries.transitiveSubstatesWithCheck2 pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing a simple pattern with a check expression before the transitive closure which is an incremental pattern.
-   *  
-   * pattern transitiveSubstatesWithCheck2(state : State, transitiveSubstate : State) {
-   * 	transitionCount == count find incomingTransitions(_, state);
-   * 	check (transitionCount {@literal >} 1);
-   * 	find parentState+(transitiveSubstate, state);
-   * }
-   * 
- * - * @see Match - * @see TransitiveSubstatesWithCheck2 - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static TransitiveSubstatesWithCheck2.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static TransitiveSubstatesWithCheck2.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final int POSITION_TRANSITIVESUBSTATE = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TransitiveSubstatesWithCheck2.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState, final State pTransitiveSubstate) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstate}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState, final State pTransitiveSubstate) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState, final State pTransitiveSubstate) { - return rawGetOneArbitraryMatch(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState, final State pTransitiveSubstate) { - return rawHasMatch(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState, final State pTransitiveSubstate) { - return rawCountMatches(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final State pTransitiveSubstate, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState, pTransitiveSubstate}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the (partial) match object. - * - */ - public TransitiveSubstatesWithCheck2.Match newMatch(final State pState, final State pTransitiveSubstate) { - return TransitiveSubstatesWithCheck2.Match.newMatch(pState, pTransitiveSubstate); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final TransitiveSubstatesWithCheck2.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final State pTransitiveSubstate) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstate}); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final TransitiveSubstatesWithCheck2.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final State pTransitiveSubstate) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstate}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftransitiveSubstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_TRANSITIVESUBSTATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate() { - return rawStreamAllValuesOftransitiveSubstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate() { - return rawStreamAllValuesOftransitiveSubstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate(final TransitiveSubstatesWithCheck2.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate(final State pState) { - return rawStreamAllValuesOftransitiveSubstate(new Object[]{pState, null}); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate(final TransitiveSubstatesWithCheck2.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate(final State pState) { - return rawStreamAllValuesOftransitiveSubstate(new Object[]{pState, null}).collect(Collectors.toSet()); - } - - @Override - protected TransitiveSubstatesWithCheck2.Match tupleToMatch(final Tuple t) { - try { - return TransitiveSubstatesWithCheck2.Match.newMatch((State) t.get(POSITION_STATE), (State) t.get(POSITION_TRANSITIVESUBSTATE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected TransitiveSubstatesWithCheck2.Match arrayToMatch(final Object[] match) { - try { - return TransitiveSubstatesWithCheck2.Match.newMatch((State) match[POSITION_STATE], (State) match[POSITION_TRANSITIVESUBSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected TransitiveSubstatesWithCheck2.Match arrayToMatchMutable(final Object[] match) { - try { - return TransitiveSubstatesWithCheck2.Match.newMutableMatch((State) match[POSITION_STATE], (State) match[POSITION_TRANSITIVESUBSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return TransitiveSubstatesWithCheck2.instance(); - } - } - - private TransitiveSubstatesWithCheck2() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static TransitiveSubstatesWithCheck2 instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected TransitiveSubstatesWithCheck2.Matcher instantiate(final ViatraQueryEngine engine) { - return TransitiveSubstatesWithCheck2.Matcher.on(engine); - } - - @Override - public TransitiveSubstatesWithCheck2.Matcher instantiate() { - return TransitiveSubstatesWithCheck2.Matcher.create(); - } - - @Override - public TransitiveSubstatesWithCheck2.Match newEmptyMatch() { - return TransitiveSubstatesWithCheck2.Match.newEmptyMatch(); - } - - @Override - public TransitiveSubstatesWithCheck2.Match newMatch(final Object... parameters) { - return TransitiveSubstatesWithCheck2.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0], (com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link TransitiveSubstatesWithCheck2} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link TransitiveSubstatesWithCheck2#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final TransitiveSubstatesWithCheck2 INSTANCE = new TransitiveSubstatesWithCheck2(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final TransitiveSubstatesWithCheck2.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final PParameter parameter_transitiveSubstate = new PParameter("transitiveSubstate", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state, parameter_transitiveSubstate); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.incrementalqueries.transitiveSubstatesWithCheck2"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state","transitiveSubstate"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_transitiveSubstate = body.getOrCreateVariableByName("transitiveSubstate"); - PVariable var_transitionCount = body.getOrCreateVariableByName("transitionCount"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_transitiveSubstate), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state), - new ExportedParameter(body, var_transitiveSubstate, parameter_transitiveSubstate) - )); - // transitionCount == count find incomingTransitions(_, state) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new PatternMatchCounter(body, Tuples.flatTupleOf(var___0_, var_state), IncomingTransitions.instance().getInternalQueryRepresentation(), var__virtual_0_); - new Equality(body, var_transitionCount, var__virtual_0_); - // check (transitionCount > 1) - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern transitiveSubstatesWithCheck2"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("transitionCount");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - Integer transitionCount = (Integer) provider.getValue("transitionCount"); - return evaluateExpression_1_1(transitionCount); - } - }, null); - // find parentState+(transitiveSubstate, state) - new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_transitiveSubstate, var_state), ParentState.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } - - private static boolean evaluateExpression_1_1(final Integer transitionCount) { - return ((transitionCount).intValue() > 1); - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/TransitiveSubstatesWithCheck3.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/TransitiveSubstatesWithCheck3.java deleted file mode 100644 index 62b3740..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/incrementalqueries/TransitiveSubstatesWithCheck3.java +++ /dev/null @@ -1,710 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/incrementalqueries/IncrementalQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.incrementalqueries; - -import com.incquerylabs.magicdraw.benchmark.incrementalqueries.ParentState; -import com.incquerylabs.magicdraw.benchmark.queries.StatesWithMoreIncomingTransitions; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing a simple pattern with a check expression before the transitive closure which is an incremental pattern.
- *          
- *         pattern transitiveSubstatesWithCheck3(state : State, transitiveSubstate : State) {
- *         	find statesWithMoreIncomingTransitions(state);
- *         	find parentState+(transitiveSubstate, state);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class TransitiveSubstatesWithCheck3 extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.incrementalqueries.transitiveSubstatesWithCheck3 pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private State fTransitiveSubstate; - - private static List parameterNames = makeImmutableList("state", "transitiveSubstate"); - - private Match(final State pState, final State pTransitiveSubstate) { - this.fState = pState; - this.fTransitiveSubstate = pTransitiveSubstate; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - case "transitiveSubstate": return this.fTransitiveSubstate; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - case 1: return this.fTransitiveSubstate; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - public State getTransitiveSubstate() { - return this.fTransitiveSubstate; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - if ("transitiveSubstate".equals(parameterName) ) { - this.fTransitiveSubstate = (State) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - public void setTransitiveSubstate(final State pTransitiveSubstate) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTransitiveSubstate = pTransitiveSubstate; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.incrementalqueries.transitiveSubstatesWithCheck3"; - } - - @Override - public List parameterNames() { - return TransitiveSubstatesWithCheck3.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState, fTransitiveSubstate}; - } - - @Override - public TransitiveSubstatesWithCheck3.Match toImmutable() { - return isMutable() ? newMatch(fState, fTransitiveSubstate) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState) + ", "); - result.append("\"transitiveSubstate\"=" + prettyPrintValue(fTransitiveSubstate)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState, fTransitiveSubstate); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof TransitiveSubstatesWithCheck3.Match)) { - TransitiveSubstatesWithCheck3.Match other = (TransitiveSubstatesWithCheck3.Match) obj; - return Objects.equals(fState, other.fState) && Objects.equals(fTransitiveSubstate, other.fTransitiveSubstate); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public TransitiveSubstatesWithCheck3 specification() { - return TransitiveSubstatesWithCheck3.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static TransitiveSubstatesWithCheck3.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static TransitiveSubstatesWithCheck3.Match newMutableMatch(final State pState, final State pTransitiveSubstate) { - return new Mutable(pState, pTransitiveSubstate); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the (partial) match object. - * - */ - public static TransitiveSubstatesWithCheck3.Match newMatch(final State pState, final State pTransitiveSubstate) { - return new Immutable(pState, pTransitiveSubstate); - } - - private static final class Mutable extends TransitiveSubstatesWithCheck3.Match { - Mutable(final State pState, final State pTransitiveSubstate) { - super(pState, pTransitiveSubstate); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends TransitiveSubstatesWithCheck3.Match { - Immutable(final State pState, final State pTransitiveSubstate) { - super(pState, pTransitiveSubstate); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.incrementalqueries.transitiveSubstatesWithCheck3 pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing a simple pattern with a check expression before the transitive closure which is an incremental pattern.
-   *  
-   * pattern transitiveSubstatesWithCheck3(state : State, transitiveSubstate : State) {
-   * 	find statesWithMoreIncomingTransitions(state);
-   * 	find parentState+(transitiveSubstate, state);
-   * }
-   * 
- * - * @see Match - * @see TransitiveSubstatesWithCheck3 - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static TransitiveSubstatesWithCheck3.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static TransitiveSubstatesWithCheck3.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final int POSITION_TRANSITIVESUBSTATE = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TransitiveSubstatesWithCheck3.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState, final State pTransitiveSubstate) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstate}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState, final State pTransitiveSubstate) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState, final State pTransitiveSubstate) { - return rawGetOneArbitraryMatch(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState, final State pTransitiveSubstate) { - return rawHasMatch(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState, final State pTransitiveSubstate) { - return rawCountMatches(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final State pTransitiveSubstate, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState, pTransitiveSubstate}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the (partial) match object. - * - */ - public TransitiveSubstatesWithCheck3.Match newMatch(final State pState, final State pTransitiveSubstate) { - return TransitiveSubstatesWithCheck3.Match.newMatch(pState, pTransitiveSubstate); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final TransitiveSubstatesWithCheck3.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final State pTransitiveSubstate) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstate}); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final TransitiveSubstatesWithCheck3.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final State pTransitiveSubstate) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstate}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftransitiveSubstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_TRANSITIVESUBSTATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate() { - return rawStreamAllValuesOftransitiveSubstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate() { - return rawStreamAllValuesOftransitiveSubstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate(final TransitiveSubstatesWithCheck3.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate(final State pState) { - return rawStreamAllValuesOftransitiveSubstate(new Object[]{pState, null}); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate(final TransitiveSubstatesWithCheck3.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate(final State pState) { - return rawStreamAllValuesOftransitiveSubstate(new Object[]{pState, null}).collect(Collectors.toSet()); - } - - @Override - protected TransitiveSubstatesWithCheck3.Match tupleToMatch(final Tuple t) { - try { - return TransitiveSubstatesWithCheck3.Match.newMatch((State) t.get(POSITION_STATE), (State) t.get(POSITION_TRANSITIVESUBSTATE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected TransitiveSubstatesWithCheck3.Match arrayToMatch(final Object[] match) { - try { - return TransitiveSubstatesWithCheck3.Match.newMatch((State) match[POSITION_STATE], (State) match[POSITION_TRANSITIVESUBSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected TransitiveSubstatesWithCheck3.Match arrayToMatchMutable(final Object[] match) { - try { - return TransitiveSubstatesWithCheck3.Match.newMutableMatch((State) match[POSITION_STATE], (State) match[POSITION_TRANSITIVESUBSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return TransitiveSubstatesWithCheck3.instance(); - } - } - - private TransitiveSubstatesWithCheck3() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static TransitiveSubstatesWithCheck3 instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected TransitiveSubstatesWithCheck3.Matcher instantiate(final ViatraQueryEngine engine) { - return TransitiveSubstatesWithCheck3.Matcher.on(engine); - } - - @Override - public TransitiveSubstatesWithCheck3.Matcher instantiate() { - return TransitiveSubstatesWithCheck3.Matcher.create(); - } - - @Override - public TransitiveSubstatesWithCheck3.Match newEmptyMatch() { - return TransitiveSubstatesWithCheck3.Match.newEmptyMatch(); - } - - @Override - public TransitiveSubstatesWithCheck3.Match newMatch(final Object... parameters) { - return TransitiveSubstatesWithCheck3.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0], (com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link TransitiveSubstatesWithCheck3} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link TransitiveSubstatesWithCheck3#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final TransitiveSubstatesWithCheck3 INSTANCE = new TransitiveSubstatesWithCheck3(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final TransitiveSubstatesWithCheck3.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final PParameter parameter_transitiveSubstate = new PParameter("transitiveSubstate", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state, parameter_transitiveSubstate); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.incrementalqueries.transitiveSubstatesWithCheck3"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state","transitiveSubstate"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_transitiveSubstate = body.getOrCreateVariableByName("transitiveSubstate"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_transitiveSubstate), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state), - new ExportedParameter(body, var_transitiveSubstate, parameter_transitiveSubstate) - )); - // find statesWithMoreIncomingTransitions(state) - new PositivePatternCall(body, Tuples.flatTupleOf(var_state), StatesWithMoreIncomingTransitions.instance().getInternalQueryRepresentation()); - // find parentState+(transitiveSubstate, state) - new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_transitiveSubstate, var_state), ParentState.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/.gitignore b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/.gitignore deleted file mode 100644 index 4a5335e..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*._trace \ No newline at end of file diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.java deleted file mode 100644 index d7db45d..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.java +++ /dev/null @@ -1,361 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.AllBenchMarkedQueries; -import com.incquerylabs.magicdraw.benchmark.queries.AlphabeticalDependencies; -import com.incquerylabs.magicdraw.benchmark.queries.Blocks; -import com.incquerylabs.magicdraw.benchmark.queries.BlocksOrRequirements; -import com.incquerylabs.magicdraw.benchmark.queries.BlocksOrRequirementsOrConstraints; -import com.incquerylabs.magicdraw.benchmark.queries.CircularDependencies; -import com.incquerylabs.magicdraw.benchmark.queries.Classes; -import com.incquerylabs.magicdraw.benchmark.queries.ComplexNameOfElements; -import com.incquerylabs.magicdraw.benchmark.queries.Dependencies; -import com.incquerylabs.magicdraw.benchmark.queries.DependencyChains; -import com.incquerylabs.magicdraw.benchmark.queries.ElementsWithShortNames; -import com.incquerylabs.magicdraw.benchmark.queries.IncomingTransitions; -import com.incquerylabs.magicdraw.benchmark.queries.LoopTransitionWithTriggerEffectEventNoGuard; -import com.incquerylabs.magicdraw.benchmark.queries.NamedElement; -import com.incquerylabs.magicdraw.benchmark.queries.NamesOfDependencyEndpoints; -import com.incquerylabs.magicdraw.benchmark.queries.NonBlockClasses; -import com.incquerylabs.magicdraw.benchmark.queries.NumberOfSubregions; -import com.incquerylabs.magicdraw.benchmark.queries.NumberOfTransitiveSubstates; -import com.incquerylabs.magicdraw.benchmark.queries.ParentState; -import com.incquerylabs.magicdraw.benchmark.queries.Requirements; -import com.incquerylabs.magicdraw.benchmark.queries.StateWithMostSubstates; -import com.incquerylabs.magicdraw.benchmark.queries.StatesWithMoreIncomingTransitions; -import com.incquerylabs.magicdraw.benchmark.queries.StatesWithShortNames; -import com.incquerylabs.magicdraw.benchmark.queries.Subregions; -import com.incquerylabs.magicdraw.benchmark.queries.TransitionPointingOutOfCompState; -import com.incquerylabs.magicdraw.benchmark.queries.TransitiveSubstates; -import com.incquerylabs.magicdraw.benchmark.queries.TransitiveSubstatesWithCheck; -import com.incquerylabs.magicdraw.benchmark.queries.TransitiveSubstatesWithCheck2; -import com.incquerylabs.magicdraw.benchmark.queries.TransitiveSubstatesWithCheck3; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in APerformanceQueries.vql. - * - *

Use the static instance as any {@link interface org.eclipse.viatra.query.runtime.api.IQueryGroup}, to conveniently prepare - * a VIATRA Query engine for matching all patterns originally defined in file APerformanceQueries.vql, - * in order to achieve better performance than one-by-one on-demand matcher initialization. - * - *

From package com.incquerylabs.magicdraw.benchmark.queries, the group contains the definition of the following patterns:

    - *
  • classes
  • - *
  • nonBlockClasses
  • - *
  • blocks
  • - *
  • requirements
  • - *
  • blocksOrRequirements
  • - *
  • blocksOrRequirementsOrConstraints
  • - *
  • namedElement
  • - *
  • complexNameOfElements
  • - *
  • dependencyChains
  • - *
  • circularDependencies
  • - *
  • dependencies
  • - *
  • namesOfDependencyEndpoints
  • - *
  • alphabeticalDependencies
  • - *
  • elementsWithShortNames
  • - *
  • transitionPointingOutOfCompState
  • - *
  • loopTransitionWithTriggerEffectEventNoGuard
  • - *
  • parentState
  • - *
  • subregions
  • - *
  • numberOfSubregions
  • - *
  • statesWithShortNames
  • - *
  • incomingTransitions
  • - *
  • transitiveSubstates
  • - *
  • transitiveSubstatesWithCheck
  • - *
  • statesWithMoreIncomingTransitions
  • - *
  • transitiveSubstatesWithCheck2
  • - *
  • transitiveSubstatesWithCheck3
  • - *
  • numberOfTransitiveSubstates
  • - *
  • stateWithMostSubstates
  • - *
  • allBenchMarkedQueries
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class APerformanceQueries extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static APerformanceQueries instance() { - if (INSTANCE == null) { - INSTANCE = new APerformanceQueries(); - } - return INSTANCE; - } - - private static APerformanceQueries INSTANCE; - - private APerformanceQueries() { - querySpecifications.add(Classes.instance()); - querySpecifications.add(NonBlockClasses.instance()); - querySpecifications.add(Blocks.instance()); - querySpecifications.add(Requirements.instance()); - querySpecifications.add(BlocksOrRequirements.instance()); - querySpecifications.add(BlocksOrRequirementsOrConstraints.instance()); - querySpecifications.add(NamedElement.instance()); - querySpecifications.add(ComplexNameOfElements.instance()); - querySpecifications.add(DependencyChains.instance()); - querySpecifications.add(CircularDependencies.instance()); - querySpecifications.add(Dependencies.instance()); - querySpecifications.add(NamesOfDependencyEndpoints.instance()); - querySpecifications.add(AlphabeticalDependencies.instance()); - querySpecifications.add(ElementsWithShortNames.instance()); - querySpecifications.add(TransitionPointingOutOfCompState.instance()); - querySpecifications.add(LoopTransitionWithTriggerEffectEventNoGuard.instance()); - querySpecifications.add(ParentState.instance()); - querySpecifications.add(Subregions.instance()); - querySpecifications.add(NumberOfSubregions.instance()); - querySpecifications.add(StatesWithShortNames.instance()); - querySpecifications.add(IncomingTransitions.instance()); - querySpecifications.add(TransitiveSubstates.instance()); - querySpecifications.add(TransitiveSubstatesWithCheck.instance()); - querySpecifications.add(StatesWithMoreIncomingTransitions.instance()); - querySpecifications.add(TransitiveSubstatesWithCheck2.instance()); - querySpecifications.add(TransitiveSubstatesWithCheck3.instance()); - querySpecifications.add(NumberOfTransitiveSubstates.instance()); - querySpecifications.add(StateWithMostSubstates.instance()); - querySpecifications.add(AllBenchMarkedQueries.instance()); - } - - public Classes getClasses() { - return Classes.instance(); - } - - public Classes.Matcher getClasses(final ViatraQueryEngine engine) { - return Classes.Matcher.on(engine); - } - - public NonBlockClasses getNonBlockClasses() { - return NonBlockClasses.instance(); - } - - public NonBlockClasses.Matcher getNonBlockClasses(final ViatraQueryEngine engine) { - return NonBlockClasses.Matcher.on(engine); - } - - public Blocks getBlocks() { - return Blocks.instance(); - } - - public Blocks.Matcher getBlocks(final ViatraQueryEngine engine) { - return Blocks.Matcher.on(engine); - } - - public Requirements getRequirements() { - return Requirements.instance(); - } - - public Requirements.Matcher getRequirements(final ViatraQueryEngine engine) { - return Requirements.Matcher.on(engine); - } - - public BlocksOrRequirements getBlocksOrRequirements() { - return BlocksOrRequirements.instance(); - } - - public BlocksOrRequirements.Matcher getBlocksOrRequirements(final ViatraQueryEngine engine) { - return BlocksOrRequirements.Matcher.on(engine); - } - - public BlocksOrRequirementsOrConstraints getBlocksOrRequirementsOrConstraints() { - return BlocksOrRequirementsOrConstraints.instance(); - } - - public BlocksOrRequirementsOrConstraints.Matcher getBlocksOrRequirementsOrConstraints(final ViatraQueryEngine engine) { - return BlocksOrRequirementsOrConstraints.Matcher.on(engine); - } - - public NamedElement getNamedElement() { - return NamedElement.instance(); - } - - public NamedElement.Matcher getNamedElement(final ViatraQueryEngine engine) { - return NamedElement.Matcher.on(engine); - } - - public ComplexNameOfElements getComplexNameOfElements() { - return ComplexNameOfElements.instance(); - } - - public ComplexNameOfElements.Matcher getComplexNameOfElements(final ViatraQueryEngine engine) { - return ComplexNameOfElements.Matcher.on(engine); - } - - public DependencyChains getDependencyChains() { - return DependencyChains.instance(); - } - - public DependencyChains.Matcher getDependencyChains(final ViatraQueryEngine engine) { - return DependencyChains.Matcher.on(engine); - } - - public CircularDependencies getCircularDependencies() { - return CircularDependencies.instance(); - } - - public CircularDependencies.Matcher getCircularDependencies(final ViatraQueryEngine engine) { - return CircularDependencies.Matcher.on(engine); - } - - public Dependencies getDependencies() { - return Dependencies.instance(); - } - - public Dependencies.Matcher getDependencies(final ViatraQueryEngine engine) { - return Dependencies.Matcher.on(engine); - } - - public NamesOfDependencyEndpoints getNamesOfDependencyEndpoints() { - return NamesOfDependencyEndpoints.instance(); - } - - public NamesOfDependencyEndpoints.Matcher getNamesOfDependencyEndpoints(final ViatraQueryEngine engine) { - return NamesOfDependencyEndpoints.Matcher.on(engine); - } - - public AlphabeticalDependencies getAlphabeticalDependencies() { - return AlphabeticalDependencies.instance(); - } - - public AlphabeticalDependencies.Matcher getAlphabeticalDependencies(final ViatraQueryEngine engine) { - return AlphabeticalDependencies.Matcher.on(engine); - } - - public ElementsWithShortNames getElementsWithShortNames() { - return ElementsWithShortNames.instance(); - } - - public ElementsWithShortNames.Matcher getElementsWithShortNames(final ViatraQueryEngine engine) { - return ElementsWithShortNames.Matcher.on(engine); - } - - public TransitionPointingOutOfCompState getTransitionPointingOutOfCompState() { - return TransitionPointingOutOfCompState.instance(); - } - - public TransitionPointingOutOfCompState.Matcher getTransitionPointingOutOfCompState(final ViatraQueryEngine engine) { - return TransitionPointingOutOfCompState.Matcher.on(engine); - } - - public LoopTransitionWithTriggerEffectEventNoGuard getLoopTransitionWithTriggerEffectEventNoGuard() { - return LoopTransitionWithTriggerEffectEventNoGuard.instance(); - } - - public LoopTransitionWithTriggerEffectEventNoGuard.Matcher getLoopTransitionWithTriggerEffectEventNoGuard(final ViatraQueryEngine engine) { - return LoopTransitionWithTriggerEffectEventNoGuard.Matcher.on(engine); - } - - public ParentState getParentState() { - return ParentState.instance(); - } - - public ParentState.Matcher getParentState(final ViatraQueryEngine engine) { - return ParentState.Matcher.on(engine); - } - - public Subregions getSubregions() { - return Subregions.instance(); - } - - public Subregions.Matcher getSubregions(final ViatraQueryEngine engine) { - return Subregions.Matcher.on(engine); - } - - public NumberOfSubregions getNumberOfSubregions() { - return NumberOfSubregions.instance(); - } - - public NumberOfSubregions.Matcher getNumberOfSubregions(final ViatraQueryEngine engine) { - return NumberOfSubregions.Matcher.on(engine); - } - - public StatesWithShortNames getStatesWithShortNames() { - return StatesWithShortNames.instance(); - } - - public StatesWithShortNames.Matcher getStatesWithShortNames(final ViatraQueryEngine engine) { - return StatesWithShortNames.Matcher.on(engine); - } - - public IncomingTransitions getIncomingTransitions() { - return IncomingTransitions.instance(); - } - - public IncomingTransitions.Matcher getIncomingTransitions(final ViatraQueryEngine engine) { - return IncomingTransitions.Matcher.on(engine); - } - - public TransitiveSubstates getTransitiveSubstates() { - return TransitiveSubstates.instance(); - } - - public TransitiveSubstates.Matcher getTransitiveSubstates(final ViatraQueryEngine engine) { - return TransitiveSubstates.Matcher.on(engine); - } - - public TransitiveSubstatesWithCheck getTransitiveSubstatesWithCheck() { - return TransitiveSubstatesWithCheck.instance(); - } - - public TransitiveSubstatesWithCheck.Matcher getTransitiveSubstatesWithCheck(final ViatraQueryEngine engine) { - return TransitiveSubstatesWithCheck.Matcher.on(engine); - } - - public StatesWithMoreIncomingTransitions getStatesWithMoreIncomingTransitions() { - return StatesWithMoreIncomingTransitions.instance(); - } - - public StatesWithMoreIncomingTransitions.Matcher getStatesWithMoreIncomingTransitions(final ViatraQueryEngine engine) { - return StatesWithMoreIncomingTransitions.Matcher.on(engine); - } - - public TransitiveSubstatesWithCheck2 getTransitiveSubstatesWithCheck2() { - return TransitiveSubstatesWithCheck2.instance(); - } - - public TransitiveSubstatesWithCheck2.Matcher getTransitiveSubstatesWithCheck2(final ViatraQueryEngine engine) { - return TransitiveSubstatesWithCheck2.Matcher.on(engine); - } - - public TransitiveSubstatesWithCheck3 getTransitiveSubstatesWithCheck3() { - return TransitiveSubstatesWithCheck3.instance(); - } - - public TransitiveSubstatesWithCheck3.Matcher getTransitiveSubstatesWithCheck3(final ViatraQueryEngine engine) { - return TransitiveSubstatesWithCheck3.Matcher.on(engine); - } - - public NumberOfTransitiveSubstates getNumberOfTransitiveSubstates() { - return NumberOfTransitiveSubstates.instance(); - } - - public NumberOfTransitiveSubstates.Matcher getNumberOfTransitiveSubstates(final ViatraQueryEngine engine) { - return NumberOfTransitiveSubstates.Matcher.on(engine); - } - - public StateWithMostSubstates getStateWithMostSubstates() { - return StateWithMostSubstates.instance(); - } - - public StateWithMostSubstates.Matcher getStateWithMostSubstates(final ViatraQueryEngine engine) { - return StateWithMostSubstates.Matcher.on(engine); - } - - public AllBenchMarkedQueries getAllBenchMarkedQueries() { - return AllBenchMarkedQueries.instance(); - } - - public AllBenchMarkedQueries.Matcher getAllBenchMarkedQueries(final ViatraQueryEngine engine) { - return AllBenchMarkedQueries.Matcher.on(engine); - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Activitites.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Activitites.java deleted file mode 100644 index fe96abf..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Activitites.java +++ /dev/null @@ -1,942 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/WarmUpQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.nomagic.uml2.ext.magicdraw.activities.mdfundamentalactivities.Activity; -import com.nomagic.uml2.ext.magicdraw.commonbehaviors.mdcommunications.Event; -import com.nomagic.uml2.ext.magicdraw.commonbehaviors.mdcommunications.Trigger; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         pattern activitites(activity : Activity, event : Event, eventName : java ^java.lang.String, trigger : Trigger) {
- *         	Activity.event(activity, event);
- *         	Event.name(event, eventName);
- *         	Event._triggerOfEvent(event, trigger);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class Activitites extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.activitites pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private Activity fActivity; - - private Event fEvent; - - private String fEventName; - - private Trigger fTrigger; - - private static List parameterNames = makeImmutableList("activity", "event", "eventName", "trigger"); - - private Match(final Activity pActivity, final Event pEvent, final String pEventName, final Trigger pTrigger) { - this.fActivity = pActivity; - this.fEvent = pEvent; - this.fEventName = pEventName; - this.fTrigger = pTrigger; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "activity": return this.fActivity; - case "event": return this.fEvent; - case "eventName": return this.fEventName; - case "trigger": return this.fTrigger; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fActivity; - case 1: return this.fEvent; - case 2: return this.fEventName; - case 3: return this.fTrigger; - default: return null; - } - } - - public Activity getActivity() { - return this.fActivity; - } - - public Event getEvent() { - return this.fEvent; - } - - public String getEventName() { - return this.fEventName; - } - - public Trigger getTrigger() { - return this.fTrigger; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("activity".equals(parameterName) ) { - this.fActivity = (Activity) newValue; - return true; - } - if ("event".equals(parameterName) ) { - this.fEvent = (Event) newValue; - return true; - } - if ("eventName".equals(parameterName) ) { - this.fEventName = (String) newValue; - return true; - } - if ("trigger".equals(parameterName) ) { - this.fTrigger = (Trigger) newValue; - return true; - } - return false; - } - - public void setActivity(final Activity pActivity) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fActivity = pActivity; - } - - public void setEvent(final Event pEvent) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fEvent = pEvent; - } - - public void setEventName(final String pEventName) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fEventName = pEventName; - } - - public void setTrigger(final Trigger pTrigger) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTrigger = pTrigger; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.activitites"; - } - - @Override - public List parameterNames() { - return Activitites.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fActivity, fEvent, fEventName, fTrigger}; - } - - @Override - public Activitites.Match toImmutable() { - return isMutable() ? newMatch(fActivity, fEvent, fEventName, fTrigger) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"activity\"=" + prettyPrintValue(fActivity) + ", "); - result.append("\"event\"=" + prettyPrintValue(fEvent) + ", "); - result.append("\"eventName\"=" + prettyPrintValue(fEventName) + ", "); - result.append("\"trigger\"=" + prettyPrintValue(fTrigger)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fActivity, fEvent, fEventName, fTrigger); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof Activitites.Match)) { - Activitites.Match other = (Activitites.Match) obj; - return Objects.equals(fActivity, other.fActivity) && Objects.equals(fEvent, other.fEvent) && Objects.equals(fEventName, other.fEventName) && Objects.equals(fTrigger, other.fTrigger); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public Activitites specification() { - return Activitites.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static Activitites.Match newEmptyMatch() { - return new Mutable(null, null, null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pActivity the fixed value of pattern parameter activity, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEventName the fixed value of pattern parameter eventName, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static Activitites.Match newMutableMatch(final Activity pActivity, final Event pEvent, final String pEventName, final Trigger pTrigger) { - return new Mutable(pActivity, pEvent, pEventName, pTrigger); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pActivity the fixed value of pattern parameter activity, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEventName the fixed value of pattern parameter eventName, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @return the (partial) match object. - * - */ - public static Activitites.Match newMatch(final Activity pActivity, final Event pEvent, final String pEventName, final Trigger pTrigger) { - return new Immutable(pActivity, pEvent, pEventName, pTrigger); - } - - private static final class Mutable extends Activitites.Match { - Mutable(final Activity pActivity, final Event pEvent, final String pEventName, final Trigger pTrigger) { - super(pActivity, pEvent, pEventName, pTrigger); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends Activitites.Match { - Immutable(final Activity pActivity, final Event pEvent, final String pEventName, final Trigger pTrigger) { - super(pActivity, pEvent, pEventName, pTrigger); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.activitites pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * pattern activitites(activity : Activity, event : Event, eventName : java ^java.lang.String, trigger : Trigger) {
-   * 	Activity.event(activity, event);
-   * 	Event.name(event, eventName);
-   * 	Event._triggerOfEvent(event, trigger);
-   * }
-   * 
- * - * @see Match - * @see Activitites - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static Activitites.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static Activitites.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_ACTIVITY = 0; - - private static final int POSITION_EVENT = 1; - - private static final int POSITION_EVENTNAME = 2; - - private static final int POSITION_TRIGGER = 3; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Activitites.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pActivity the fixed value of pattern parameter activity, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEventName the fixed value of pattern parameter eventName, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Activity pActivity, final Event pEvent, final String pEventName, final Trigger pTrigger) { - return rawStreamAllMatches(new Object[]{pActivity, pEvent, pEventName, pTrigger}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pActivity the fixed value of pattern parameter activity, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEventName the fixed value of pattern parameter eventName, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final Activity pActivity, final Event pEvent, final String pEventName, final Trigger pTrigger) { - return rawStreamAllMatches(new Object[]{pActivity, pEvent, pEventName, pTrigger}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pActivity the fixed value of pattern parameter activity, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEventName the fixed value of pattern parameter eventName, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final Activity pActivity, final Event pEvent, final String pEventName, final Trigger pTrigger) { - return rawGetOneArbitraryMatch(new Object[]{pActivity, pEvent, pEventName, pTrigger}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pActivity the fixed value of pattern parameter activity, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEventName the fixed value of pattern parameter eventName, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final Activity pActivity, final Event pEvent, final String pEventName, final Trigger pTrigger) { - return rawHasMatch(new Object[]{pActivity, pEvent, pEventName, pTrigger}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pActivity the fixed value of pattern parameter activity, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEventName the fixed value of pattern parameter eventName, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final Activity pActivity, final Event pEvent, final String pEventName, final Trigger pTrigger) { - return rawCountMatches(new Object[]{pActivity, pEvent, pEventName, pTrigger}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pActivity the fixed value of pattern parameter activity, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEventName the fixed value of pattern parameter eventName, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final Activity pActivity, final Event pEvent, final String pEventName, final Trigger pTrigger, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pActivity, pEvent, pEventName, pTrigger}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pActivity the fixed value of pattern parameter activity, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEventName the fixed value of pattern parameter eventName, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @return the (partial) match object. - * - */ - public Activitites.Match newMatch(final Activity pActivity, final Event pEvent, final String pEventName, final Trigger pTrigger) { - return Activitites.Match.newMatch(pActivity, pEvent, pEventName, pTrigger); - } - - /** - * Retrieve the set of values that occur in matches for activity. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfactivity(final Object[] parameters) { - return rawStreamAllValues(POSITION_ACTIVITY, parameters).map(Activity.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for activity. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfactivity() { - return rawStreamAllValuesOfactivity(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for activity. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfactivity() { - return rawStreamAllValuesOfactivity(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for activity. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfactivity(final Activitites.Match partialMatch) { - return rawStreamAllValuesOfactivity(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for activity. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfactivity(final Event pEvent, final String pEventName, final Trigger pTrigger) { - return rawStreamAllValuesOfactivity(new Object[]{null, pEvent, pEventName, pTrigger}); - } - - /** - * Retrieve the set of values that occur in matches for activity. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfactivity(final Activitites.Match partialMatch) { - return rawStreamAllValuesOfactivity(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for activity. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfactivity(final Event pEvent, final String pEventName, final Trigger pTrigger) { - return rawStreamAllValuesOfactivity(new Object[]{null, pEvent, pEventName, pTrigger}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for event. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfevent(final Object[] parameters) { - return rawStreamAllValues(POSITION_EVENT, parameters).map(Event.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for event. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfevent() { - return rawStreamAllValuesOfevent(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for event. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfevent() { - return rawStreamAllValuesOfevent(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for event. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfevent(final Activitites.Match partialMatch) { - return rawStreamAllValuesOfevent(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for event. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfevent(final Activity pActivity, final String pEventName, final Trigger pTrigger) { - return rawStreamAllValuesOfevent(new Object[]{pActivity, null, pEventName, pTrigger}); - } - - /** - * Retrieve the set of values that occur in matches for event. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfevent(final Activitites.Match partialMatch) { - return rawStreamAllValuesOfevent(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for event. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfevent(final Activity pActivity, final String pEventName, final Trigger pTrigger) { - return rawStreamAllValuesOfevent(new Object[]{pActivity, null, pEventName, pTrigger}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for eventName. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfeventName(final Object[] parameters) { - return rawStreamAllValues(POSITION_EVENTNAME, parameters).map(String.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for eventName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfeventName() { - return rawStreamAllValuesOfeventName(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for eventName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfeventName() { - return rawStreamAllValuesOfeventName(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for eventName. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfeventName(final Activitites.Match partialMatch) { - return rawStreamAllValuesOfeventName(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for eventName. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfeventName(final Activity pActivity, final Event pEvent, final Trigger pTrigger) { - return rawStreamAllValuesOfeventName(new Object[]{pActivity, pEvent, null, pTrigger}); - } - - /** - * Retrieve the set of values that occur in matches for eventName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfeventName(final Activitites.Match partialMatch) { - return rawStreamAllValuesOfeventName(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for eventName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfeventName(final Activity pActivity, final Event pEvent, final Trigger pTrigger) { - return rawStreamAllValuesOfeventName(new Object[]{pActivity, pEvent, null, pTrigger}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for trigger. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftrigger(final Object[] parameters) { - return rawStreamAllValues(POSITION_TRIGGER, parameters).map(Trigger.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for trigger. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftrigger() { - return rawStreamAllValuesOftrigger(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for trigger. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftrigger() { - return rawStreamAllValuesOftrigger(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for trigger. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftrigger(final Activitites.Match partialMatch) { - return rawStreamAllValuesOftrigger(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for trigger. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftrigger(final Activity pActivity, final Event pEvent, final String pEventName) { - return rawStreamAllValuesOftrigger(new Object[]{pActivity, pEvent, pEventName, null}); - } - - /** - * Retrieve the set of values that occur in matches for trigger. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftrigger(final Activitites.Match partialMatch) { - return rawStreamAllValuesOftrigger(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for trigger. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftrigger(final Activity pActivity, final Event pEvent, final String pEventName) { - return rawStreamAllValuesOftrigger(new Object[]{pActivity, pEvent, pEventName, null}).collect(Collectors.toSet()); - } - - @Override - protected Activitites.Match tupleToMatch(final Tuple t) { - try { - return Activitites.Match.newMatch((Activity) t.get(POSITION_ACTIVITY), (Event) t.get(POSITION_EVENT), (String) t.get(POSITION_EVENTNAME), (Trigger) t.get(POSITION_TRIGGER)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected Activitites.Match arrayToMatch(final Object[] match) { - try { - return Activitites.Match.newMatch((Activity) match[POSITION_ACTIVITY], (Event) match[POSITION_EVENT], (String) match[POSITION_EVENTNAME], (Trigger) match[POSITION_TRIGGER]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected Activitites.Match arrayToMatchMutable(final Object[] match) { - try { - return Activitites.Match.newMutableMatch((Activity) match[POSITION_ACTIVITY], (Event) match[POSITION_EVENT], (String) match[POSITION_EVENTNAME], (Trigger) match[POSITION_TRIGGER]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return Activitites.instance(); - } - } - - private Activitites() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static Activitites instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected Activitites.Matcher instantiate(final ViatraQueryEngine engine) { - return Activitites.Matcher.on(engine); - } - - @Override - public Activitites.Matcher instantiate() { - return Activitites.Matcher.create(); - } - - @Override - public Activitites.Match newEmptyMatch() { - return Activitites.Match.newEmptyMatch(); - } - - @Override - public Activitites.Match newMatch(final Object... parameters) { - return Activitites.Match.newMatch((com.nomagic.uml2.ext.magicdraw.activities.mdfundamentalactivities.Activity) parameters[0], (com.nomagic.uml2.ext.magicdraw.commonbehaviors.mdcommunications.Event) parameters[1], (java.lang.String) parameters[2], (com.nomagic.uml2.ext.magicdraw.commonbehaviors.mdcommunications.Trigger) parameters[3]); - } - - /** - * Inner class allowing the singleton instance of {@link Activitites} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link Activitites#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final Activitites INSTANCE = new Activitites(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final Activitites.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_activity = new PParameter("activity", "com.nomagic.uml2.ext.magicdraw.activities.mdfundamentalactivities.Activity", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Activity")), PParameterDirection.INOUT); - - private final PParameter parameter_event = new PParameter("event", "com.nomagic.uml2.ext.magicdraw.commonbehaviors.mdcommunications.Event", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Event")), PParameterDirection.INOUT); - - private final PParameter parameter_eventName = new PParameter("eventName", "java.lang.String", new JavaTransitiveInstancesKey(java.lang.String.class), PParameterDirection.INOUT); - - private final PParameter parameter_trigger = new PParameter("trigger", "com.nomagic.uml2.ext.magicdraw.commonbehaviors.mdcommunications.Trigger", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Trigger")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_activity, parameter_event, parameter_eventName, parameter_trigger); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.activitites"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("activity","event","eventName","trigger"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_activity = body.getOrCreateVariableByName("activity"); - PVariable var_event = body.getOrCreateVariableByName("event"); - PVariable var_eventName = body.getOrCreateVariableByName("eventName"); - PVariable var_trigger = body.getOrCreateVariableByName("trigger"); - new TypeConstraint(body, Tuples.flatTupleOf(var_activity), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Activity"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_event), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Event"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_eventName), new JavaTransitiveInstancesKey(java.lang.String.class)); - new TypeConstraint(body, Tuples.flatTupleOf(var_trigger), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Trigger"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_activity, parameter_activity), - new ExportedParameter(body, var_event, parameter_event), - new ExportedParameter(body, var_eventName, parameter_eventName), - new ExportedParameter(body, var_trigger, parameter_trigger) - )); - // Activity.event(activity, event) - new TypeConstraint(body, Tuples.flatTupleOf(var_activity), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Activity"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_activity, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Behavior", "event"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Event"))); - new Equality(body, var__virtual_0_, var_event); - // Event.name(event, eventName) - new TypeConstraint(body, Tuples.flatTupleOf(var_event), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Event"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_event, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_1_, var_eventName); - // Event._triggerOfEvent(event, trigger) - new TypeConstraint(body, Tuples.flatTupleOf(var_event), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Event"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_event, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Event", "_triggerOfEvent"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Trigger"))); - new Equality(body, var__virtual_2_, var_trigger); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ActorGeneralization.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ActorGeneralization.java deleted file mode 100644 index ecc2250..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ActorGeneralization.java +++ /dev/null @@ -1,708 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/WarmUpQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.nomagic.uml2.ext.magicdraw.classes.mdpowertypes.GeneralizationSet; -import com.nomagic.uml2.ext.magicdraw.mdusecases.Actor; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         pattern actorGeneralization(actor : Actor, generalActor : GeneralizationSet) {
- *         	Actor.generalization.generalizationSet(actor, generalActor);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class ActorGeneralization extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.actorGeneralization pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private Actor fActor; - - private GeneralizationSet fGeneralActor; - - private static List parameterNames = makeImmutableList("actor", "generalActor"); - - private Match(final Actor pActor, final GeneralizationSet pGeneralActor) { - this.fActor = pActor; - this.fGeneralActor = pGeneralActor; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "actor": return this.fActor; - case "generalActor": return this.fGeneralActor; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fActor; - case 1: return this.fGeneralActor; - default: return null; - } - } - - public Actor getActor() { - return this.fActor; - } - - public GeneralizationSet getGeneralActor() { - return this.fGeneralActor; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("actor".equals(parameterName) ) { - this.fActor = (Actor) newValue; - return true; - } - if ("generalActor".equals(parameterName) ) { - this.fGeneralActor = (GeneralizationSet) newValue; - return true; - } - return false; - } - - public void setActor(final Actor pActor) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fActor = pActor; - } - - public void setGeneralActor(final GeneralizationSet pGeneralActor) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fGeneralActor = pGeneralActor; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.actorGeneralization"; - } - - @Override - public List parameterNames() { - return ActorGeneralization.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fActor, fGeneralActor}; - } - - @Override - public ActorGeneralization.Match toImmutable() { - return isMutable() ? newMatch(fActor, fGeneralActor) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"actor\"=" + prettyPrintValue(fActor) + ", "); - result.append("\"generalActor\"=" + prettyPrintValue(fGeneralActor)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fActor, fGeneralActor); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof ActorGeneralization.Match)) { - ActorGeneralization.Match other = (ActorGeneralization.Match) obj; - return Objects.equals(fActor, other.fActor) && Objects.equals(fGeneralActor, other.fGeneralActor); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public ActorGeneralization specification() { - return ActorGeneralization.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static ActorGeneralization.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pActor the fixed value of pattern parameter actor, or null if not bound. - * @param pGeneralActor the fixed value of pattern parameter generalActor, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static ActorGeneralization.Match newMutableMatch(final Actor pActor, final GeneralizationSet pGeneralActor) { - return new Mutable(pActor, pGeneralActor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pActor the fixed value of pattern parameter actor, or null if not bound. - * @param pGeneralActor the fixed value of pattern parameter generalActor, or null if not bound. - * @return the (partial) match object. - * - */ - public static ActorGeneralization.Match newMatch(final Actor pActor, final GeneralizationSet pGeneralActor) { - return new Immutable(pActor, pGeneralActor); - } - - private static final class Mutable extends ActorGeneralization.Match { - Mutable(final Actor pActor, final GeneralizationSet pGeneralActor) { - super(pActor, pGeneralActor); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends ActorGeneralization.Match { - Immutable(final Actor pActor, final GeneralizationSet pGeneralActor) { - super(pActor, pGeneralActor); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.actorGeneralization pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * pattern actorGeneralization(actor : Actor, generalActor : GeneralizationSet) {
-   * 	Actor.generalization.generalizationSet(actor, generalActor);
-   * }
-   * 
- * - * @see Match - * @see ActorGeneralization - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static ActorGeneralization.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static ActorGeneralization.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_ACTOR = 0; - - private static final int POSITION_GENERALACTOR = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ActorGeneralization.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pActor the fixed value of pattern parameter actor, or null if not bound. - * @param pGeneralActor the fixed value of pattern parameter generalActor, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Actor pActor, final GeneralizationSet pGeneralActor) { - return rawStreamAllMatches(new Object[]{pActor, pGeneralActor}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pActor the fixed value of pattern parameter actor, or null if not bound. - * @param pGeneralActor the fixed value of pattern parameter generalActor, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final Actor pActor, final GeneralizationSet pGeneralActor) { - return rawStreamAllMatches(new Object[]{pActor, pGeneralActor}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pActor the fixed value of pattern parameter actor, or null if not bound. - * @param pGeneralActor the fixed value of pattern parameter generalActor, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final Actor pActor, final GeneralizationSet pGeneralActor) { - return rawGetOneArbitraryMatch(new Object[]{pActor, pGeneralActor}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pActor the fixed value of pattern parameter actor, or null if not bound. - * @param pGeneralActor the fixed value of pattern parameter generalActor, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final Actor pActor, final GeneralizationSet pGeneralActor) { - return rawHasMatch(new Object[]{pActor, pGeneralActor}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pActor the fixed value of pattern parameter actor, or null if not bound. - * @param pGeneralActor the fixed value of pattern parameter generalActor, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final Actor pActor, final GeneralizationSet pGeneralActor) { - return rawCountMatches(new Object[]{pActor, pGeneralActor}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pActor the fixed value of pattern parameter actor, or null if not bound. - * @param pGeneralActor the fixed value of pattern parameter generalActor, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final Actor pActor, final GeneralizationSet pGeneralActor, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pActor, pGeneralActor}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pActor the fixed value of pattern parameter actor, or null if not bound. - * @param pGeneralActor the fixed value of pattern parameter generalActor, or null if not bound. - * @return the (partial) match object. - * - */ - public ActorGeneralization.Match newMatch(final Actor pActor, final GeneralizationSet pGeneralActor) { - return ActorGeneralization.Match.newMatch(pActor, pGeneralActor); - } - - /** - * Retrieve the set of values that occur in matches for actor. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfactor(final Object[] parameters) { - return rawStreamAllValues(POSITION_ACTOR, parameters).map(Actor.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for actor. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfactor() { - return rawStreamAllValuesOfactor(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for actor. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfactor() { - return rawStreamAllValuesOfactor(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for actor. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfactor(final ActorGeneralization.Match partialMatch) { - return rawStreamAllValuesOfactor(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for actor. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfactor(final GeneralizationSet pGeneralActor) { - return rawStreamAllValuesOfactor(new Object[]{null, pGeneralActor}); - } - - /** - * Retrieve the set of values that occur in matches for actor. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfactor(final ActorGeneralization.Match partialMatch) { - return rawStreamAllValuesOfactor(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for actor. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfactor(final GeneralizationSet pGeneralActor) { - return rawStreamAllValuesOfactor(new Object[]{null, pGeneralActor}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for generalActor. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfgeneralActor(final Object[] parameters) { - return rawStreamAllValues(POSITION_GENERALACTOR, parameters).map(GeneralizationSet.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for generalActor. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfgeneralActor() { - return rawStreamAllValuesOfgeneralActor(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for generalActor. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfgeneralActor() { - return rawStreamAllValuesOfgeneralActor(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for generalActor. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfgeneralActor(final ActorGeneralization.Match partialMatch) { - return rawStreamAllValuesOfgeneralActor(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for generalActor. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfgeneralActor(final Actor pActor) { - return rawStreamAllValuesOfgeneralActor(new Object[]{pActor, null}); - } - - /** - * Retrieve the set of values that occur in matches for generalActor. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfgeneralActor(final ActorGeneralization.Match partialMatch) { - return rawStreamAllValuesOfgeneralActor(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for generalActor. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfgeneralActor(final Actor pActor) { - return rawStreamAllValuesOfgeneralActor(new Object[]{pActor, null}).collect(Collectors.toSet()); - } - - @Override - protected ActorGeneralization.Match tupleToMatch(final Tuple t) { - try { - return ActorGeneralization.Match.newMatch((Actor) t.get(POSITION_ACTOR), (GeneralizationSet) t.get(POSITION_GENERALACTOR)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected ActorGeneralization.Match arrayToMatch(final Object[] match) { - try { - return ActorGeneralization.Match.newMatch((Actor) match[POSITION_ACTOR], (GeneralizationSet) match[POSITION_GENERALACTOR]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected ActorGeneralization.Match arrayToMatchMutable(final Object[] match) { - try { - return ActorGeneralization.Match.newMutableMatch((Actor) match[POSITION_ACTOR], (GeneralizationSet) match[POSITION_GENERALACTOR]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return ActorGeneralization.instance(); - } - } - - private ActorGeneralization() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static ActorGeneralization instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected ActorGeneralization.Matcher instantiate(final ViatraQueryEngine engine) { - return ActorGeneralization.Matcher.on(engine); - } - - @Override - public ActorGeneralization.Matcher instantiate() { - return ActorGeneralization.Matcher.create(); - } - - @Override - public ActorGeneralization.Match newEmptyMatch() { - return ActorGeneralization.Match.newEmptyMatch(); - } - - @Override - public ActorGeneralization.Match newMatch(final Object... parameters) { - return ActorGeneralization.Match.newMatch((com.nomagic.uml2.ext.magicdraw.mdusecases.Actor) parameters[0], (com.nomagic.uml2.ext.magicdraw.classes.mdpowertypes.GeneralizationSet) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link ActorGeneralization} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link ActorGeneralization#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final ActorGeneralization INSTANCE = new ActorGeneralization(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final ActorGeneralization.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_actor = new PParameter("actor", "com.nomagic.uml2.ext.magicdraw.mdusecases.Actor", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Actor")), PParameterDirection.INOUT); - - private final PParameter parameter_generalActor = new PParameter("generalActor", "com.nomagic.uml2.ext.magicdraw.classes.mdpowertypes.GeneralizationSet", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "GeneralizationSet")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_actor, parameter_generalActor); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.actorGeneralization"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("actor","generalActor"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_actor = body.getOrCreateVariableByName("actor"); - PVariable var_generalActor = body.getOrCreateVariableByName("generalActor"); - new TypeConstraint(body, Tuples.flatTupleOf(var_actor), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Actor"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_generalActor), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "GeneralizationSet"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_actor, parameter_actor), - new ExportedParameter(body, var_generalActor, parameter_generalActor) - )); - // Actor.generalization.generalizationSet(actor, generalActor) - new TypeConstraint(body, Tuples.flatTupleOf(var_actor), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Actor"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_actor, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier", "generalization"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Generalization"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Generalization", "generalizationSet"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "GeneralizationSet"))); - new Equality(body, var__virtual_1_, var_generalActor); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/AllBenchMarkedQueries.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/AllBenchMarkedQueries.java deleted file mode 100644 index 146a77a..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/AllBenchMarkedQueries.java +++ /dev/null @@ -1,634 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.AlphabeticalDependencies; -import com.incquerylabs.magicdraw.benchmark.queries.BlocksOrRequirementsOrConstraints; -import com.incquerylabs.magicdraw.benchmark.queries.CircularDependencies; -import com.incquerylabs.magicdraw.benchmark.queries.LoopTransitionWithTriggerEffectEventNoGuard; -import com.incquerylabs.magicdraw.benchmark.queries.TransitionPointingOutOfCompState; -import com.incquerylabs.magicdraw.benchmark.queries.TransitiveSubstatesWithCheck3; -import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         pattern allBenchMarkedQueries(param : NamedElement) {
- *         	find blocksOrRequirementsOrConstraints(param);
- *         } or {
- *         	find transitiveSubstatesWithCheck3(param, _);
- *         } or {
- *         	find alphabeticalDependencies(param, _);
- *         } or {
- *         	find circularDependencies(param);
- *         } or {
- *         	find loopTransitionWithTriggerEffectEventNoGuard(param, _, _, _, _);
- *         } or {
- *         	find transitionPointingOutOfCompState(param, _, _);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class AllBenchMarkedQueries extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.allBenchMarkedQueries pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private NamedElement fParam; - - private static List parameterNames = makeImmutableList("param"); - - private Match(final NamedElement pParam) { - this.fParam = pParam; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "param": return this.fParam; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fParam; - default: return null; - } - } - - public NamedElement getParam() { - return this.fParam; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("param".equals(parameterName) ) { - this.fParam = (NamedElement) newValue; - return true; - } - return false; - } - - public void setParam(final NamedElement pParam) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fParam = pParam; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.allBenchMarkedQueries"; - } - - @Override - public List parameterNames() { - return AllBenchMarkedQueries.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fParam}; - } - - @Override - public AllBenchMarkedQueries.Match toImmutable() { - return isMutable() ? newMatch(fParam) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"param\"=" + prettyPrintValue(fParam)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fParam); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof AllBenchMarkedQueries.Match)) { - AllBenchMarkedQueries.Match other = (AllBenchMarkedQueries.Match) obj; - return Objects.equals(fParam, other.fParam); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public AllBenchMarkedQueries specification() { - return AllBenchMarkedQueries.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static AllBenchMarkedQueries.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pParam the fixed value of pattern parameter param, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static AllBenchMarkedQueries.Match newMutableMatch(final NamedElement pParam) { - return new Mutable(pParam); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pParam the fixed value of pattern parameter param, or null if not bound. - * @return the (partial) match object. - * - */ - public static AllBenchMarkedQueries.Match newMatch(final NamedElement pParam) { - return new Immutable(pParam); - } - - private static final class Mutable extends AllBenchMarkedQueries.Match { - Mutable(final NamedElement pParam) { - super(pParam); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends AllBenchMarkedQueries.Match { - Immutable(final NamedElement pParam) { - super(pParam); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.allBenchMarkedQueries pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * pattern allBenchMarkedQueries(param : NamedElement) {
-   * 	find blocksOrRequirementsOrConstraints(param);
-   * } or {
-   * 	find transitiveSubstatesWithCheck3(param, _);
-   * } or {
-   * 	find alphabeticalDependencies(param, _);
-   * } or {
-   * 	find circularDependencies(param);
-   * } or {
-   * 	find loopTransitionWithTriggerEffectEventNoGuard(param, _, _, _, _);
-   * } or {
-   * 	find transitionPointingOutOfCompState(param, _, _);
-   * }
-   * 
- * - * @see Match - * @see AllBenchMarkedQueries - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static AllBenchMarkedQueries.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static AllBenchMarkedQueries.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_PARAM = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(AllBenchMarkedQueries.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pParam the fixed value of pattern parameter param, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final NamedElement pParam) { - return rawStreamAllMatches(new Object[]{pParam}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pParam the fixed value of pattern parameter param, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final NamedElement pParam) { - return rawStreamAllMatches(new Object[]{pParam}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pParam the fixed value of pattern parameter param, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final NamedElement pParam) { - return rawGetOneArbitraryMatch(new Object[]{pParam}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pParam the fixed value of pattern parameter param, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final NamedElement pParam) { - return rawHasMatch(new Object[]{pParam}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pParam the fixed value of pattern parameter param, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final NamedElement pParam) { - return rawCountMatches(new Object[]{pParam}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pParam the fixed value of pattern parameter param, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final NamedElement pParam, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pParam}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pParam the fixed value of pattern parameter param, or null if not bound. - * @return the (partial) match object. - * - */ - public AllBenchMarkedQueries.Match newMatch(final NamedElement pParam) { - return AllBenchMarkedQueries.Match.newMatch(pParam); - } - - /** - * Retrieve the set of values that occur in matches for param. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfparam(final Object[] parameters) { - return rawStreamAllValues(POSITION_PARAM, parameters).map(NamedElement.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for param. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfparam() { - return rawStreamAllValuesOfparam(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for param. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfparam() { - return rawStreamAllValuesOfparam(emptyArray()); - } - - @Override - protected AllBenchMarkedQueries.Match tupleToMatch(final Tuple t) { - try { - return AllBenchMarkedQueries.Match.newMatch((NamedElement) t.get(POSITION_PARAM)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected AllBenchMarkedQueries.Match arrayToMatch(final Object[] match) { - try { - return AllBenchMarkedQueries.Match.newMatch((NamedElement) match[POSITION_PARAM]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected AllBenchMarkedQueries.Match arrayToMatchMutable(final Object[] match) { - try { - return AllBenchMarkedQueries.Match.newMutableMatch((NamedElement) match[POSITION_PARAM]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return AllBenchMarkedQueries.instance(); - } - } - - private AllBenchMarkedQueries() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static AllBenchMarkedQueries instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected AllBenchMarkedQueries.Matcher instantiate(final ViatraQueryEngine engine) { - return AllBenchMarkedQueries.Matcher.on(engine); - } - - @Override - public AllBenchMarkedQueries.Matcher instantiate() { - return AllBenchMarkedQueries.Matcher.create(); - } - - @Override - public AllBenchMarkedQueries.Match newEmptyMatch() { - return AllBenchMarkedQueries.Match.newEmptyMatch(); - } - - @Override - public AllBenchMarkedQueries.Match newMatch(final Object... parameters) { - return AllBenchMarkedQueries.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link AllBenchMarkedQueries} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link AllBenchMarkedQueries#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final AllBenchMarkedQueries INSTANCE = new AllBenchMarkedQueries(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final AllBenchMarkedQueries.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_param = new PParameter("param", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_param); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.allBenchMarkedQueries"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("param"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_param = body.getOrCreateVariableByName("param"); - new TypeConstraint(body, Tuples.flatTupleOf(var_param), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_param, parameter_param) - )); - // find blocksOrRequirementsOrConstraints(param) - new PositivePatternCall(body, Tuples.flatTupleOf(var_param), BlocksOrRequirementsOrConstraints.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_param = body.getOrCreateVariableByName("param"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_param), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_param, parameter_param) - )); - // find transitiveSubstatesWithCheck3(param, _) - new PositivePatternCall(body, Tuples.flatTupleOf(var_param, var___0_), TransitiveSubstatesWithCheck3.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_param = body.getOrCreateVariableByName("param"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_param), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_param, parameter_param) - )); - // find alphabeticalDependencies(param, _) - new PositivePatternCall(body, Tuples.flatTupleOf(var_param, var___0_), AlphabeticalDependencies.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_param = body.getOrCreateVariableByName("param"); - new TypeConstraint(body, Tuples.flatTupleOf(var_param), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_param, parameter_param) - )); - // find circularDependencies(param) - new PositivePatternCall(body, Tuples.flatTupleOf(var_param), CircularDependencies.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_param = body.getOrCreateVariableByName("param"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); - PVariable var___2_ = body.getOrCreateVariableByName("_<2>"); - PVariable var___3_ = body.getOrCreateVariableByName("_<3>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_param), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_param, parameter_param) - )); - // find loopTransitionWithTriggerEffectEventNoGuard(param, _, _, _, _) - new PositivePatternCall(body, Tuples.flatTupleOf(var_param, var___0_, var___1_, var___2_, var___3_), LoopTransitionWithTriggerEffectEventNoGuard.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_param = body.getOrCreateVariableByName("param"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_param), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_param, parameter_param) - )); - // find transitionPointingOutOfCompState(param, _, _) - new PositivePatternCall(body, Tuples.flatTupleOf(var_param, var___0_, var___1_), TransitionPointingOutOfCompState.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/AlphabeticalDependencies.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/AlphabeticalDependencies.java deleted file mode 100644 index f33a44d..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/AlphabeticalDependencies.java +++ /dev/null @@ -1,735 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.NamesOfDependencyEndpoints; -import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing the namesOfDependencyEndpoints pattern and filtering with a check.
- *          
- *         pattern alphabeticalDependencies(source : NamedElement, target : NamedElement) {
- *         	find namesOfDependencyEndpoints(source, sourceName, target, targetName);
- *         	check (sourceName {@literal <} targetName);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class AlphabeticalDependencies extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.alphabeticalDependencies pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private NamedElement fSource; - - private NamedElement fTarget; - - private static List parameterNames = makeImmutableList("source", "target"); - - private Match(final NamedElement pSource, final NamedElement pTarget) { - this.fSource = pSource; - this.fTarget = pTarget; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "source": return this.fSource; - case "target": return this.fTarget; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fSource; - case 1: return this.fTarget; - default: return null; - } - } - - public NamedElement getSource() { - return this.fSource; - } - - public NamedElement getTarget() { - return this.fTarget; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("source".equals(parameterName) ) { - this.fSource = (NamedElement) newValue; - return true; - } - if ("target".equals(parameterName) ) { - this.fTarget = (NamedElement) newValue; - return true; - } - return false; - } - - public void setSource(final NamedElement pSource) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fSource = pSource; - } - - public void setTarget(final NamedElement pTarget) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTarget = pTarget; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.alphabeticalDependencies"; - } - - @Override - public List parameterNames() { - return AlphabeticalDependencies.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fSource, fTarget}; - } - - @Override - public AlphabeticalDependencies.Match toImmutable() { - return isMutable() ? newMatch(fSource, fTarget) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"source\"=" + prettyPrintValue(fSource) + ", "); - result.append("\"target\"=" + prettyPrintValue(fTarget)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fSource, fTarget); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof AlphabeticalDependencies.Match)) { - AlphabeticalDependencies.Match other = (AlphabeticalDependencies.Match) obj; - return Objects.equals(fSource, other.fSource) && Objects.equals(fTarget, other.fTarget); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public AlphabeticalDependencies specification() { - return AlphabeticalDependencies.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static AlphabeticalDependencies.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static AlphabeticalDependencies.Match newMutableMatch(final NamedElement pSource, final NamedElement pTarget) { - return new Mutable(pSource, pTarget); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return the (partial) match object. - * - */ - public static AlphabeticalDependencies.Match newMatch(final NamedElement pSource, final NamedElement pTarget) { - return new Immutable(pSource, pTarget); - } - - private static final class Mutable extends AlphabeticalDependencies.Match { - Mutable(final NamedElement pSource, final NamedElement pTarget) { - super(pSource, pTarget); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends AlphabeticalDependencies.Match { - Immutable(final NamedElement pSource, final NamedElement pTarget) { - super(pSource, pTarget); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.alphabeticalDependencies pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing the namesOfDependencyEndpoints pattern and filtering with a check.
-   *  
-   * pattern alphabeticalDependencies(source : NamedElement, target : NamedElement) {
-   * 	find namesOfDependencyEndpoints(source, sourceName, target, targetName);
-   * 	check (sourceName {@literal <} targetName);
-   * }
-   * 
- * - * @see Match - * @see AlphabeticalDependencies - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static AlphabeticalDependencies.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static AlphabeticalDependencies.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_SOURCE = 0; - - private static final int POSITION_TARGET = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(AlphabeticalDependencies.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final NamedElement pSource, final NamedElement pTarget) { - return rawStreamAllMatches(new Object[]{pSource, pTarget}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final NamedElement pSource, final NamedElement pTarget) { - return rawStreamAllMatches(new Object[]{pSource, pTarget}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final NamedElement pSource, final NamedElement pTarget) { - return rawGetOneArbitraryMatch(new Object[]{pSource, pTarget}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final NamedElement pSource, final NamedElement pTarget) { - return rawHasMatch(new Object[]{pSource, pTarget}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final NamedElement pSource, final NamedElement pTarget) { - return rawCountMatches(new Object[]{pSource, pTarget}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final NamedElement pSource, final NamedElement pTarget, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pSource, pTarget}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return the (partial) match object. - * - */ - public AlphabeticalDependencies.Match newMatch(final NamedElement pSource, final NamedElement pTarget) { - return AlphabeticalDependencies.Match.newMatch(pSource, pTarget); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfsource(final Object[] parameters) { - return rawStreamAllValues(POSITION_SOURCE, parameters).map(NamedElement.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource() { - return rawStreamAllValuesOfsource(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource() { - return rawStreamAllValuesOfsource(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for source. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource(final AlphabeticalDependencies.Match partialMatch) { - return rawStreamAllValuesOfsource(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for source. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource(final NamedElement pTarget) { - return rawStreamAllValuesOfsource(new Object[]{null, pTarget}); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource(final AlphabeticalDependencies.Match partialMatch) { - return rawStreamAllValuesOfsource(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource(final NamedElement pTarget) { - return rawStreamAllValuesOfsource(new Object[]{null, pTarget}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftarget(final Object[] parameters) { - return rawStreamAllValues(POSITION_TARGET, parameters).map(NamedElement.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget() { - return rawStreamAllValuesOftarget(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget() { - return rawStreamAllValuesOftarget(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for target. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget(final AlphabeticalDependencies.Match partialMatch) { - return rawStreamAllValuesOftarget(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for target. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget(final NamedElement pSource) { - return rawStreamAllValuesOftarget(new Object[]{pSource, null}); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget(final AlphabeticalDependencies.Match partialMatch) { - return rawStreamAllValuesOftarget(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget(final NamedElement pSource) { - return rawStreamAllValuesOftarget(new Object[]{pSource, null}).collect(Collectors.toSet()); - } - - @Override - protected AlphabeticalDependencies.Match tupleToMatch(final Tuple t) { - try { - return AlphabeticalDependencies.Match.newMatch((NamedElement) t.get(POSITION_SOURCE), (NamedElement) t.get(POSITION_TARGET)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected AlphabeticalDependencies.Match arrayToMatch(final Object[] match) { - try { - return AlphabeticalDependencies.Match.newMatch((NamedElement) match[POSITION_SOURCE], (NamedElement) match[POSITION_TARGET]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected AlphabeticalDependencies.Match arrayToMatchMutable(final Object[] match) { - try { - return AlphabeticalDependencies.Match.newMutableMatch((NamedElement) match[POSITION_SOURCE], (NamedElement) match[POSITION_TARGET]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return AlphabeticalDependencies.instance(); - } - } - - private AlphabeticalDependencies() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static AlphabeticalDependencies instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected AlphabeticalDependencies.Matcher instantiate(final ViatraQueryEngine engine) { - return AlphabeticalDependencies.Matcher.on(engine); - } - - @Override - public AlphabeticalDependencies.Matcher instantiate() { - return AlphabeticalDependencies.Matcher.create(); - } - - @Override - public AlphabeticalDependencies.Match newEmptyMatch() { - return AlphabeticalDependencies.Match.newEmptyMatch(); - } - - @Override - public AlphabeticalDependencies.Match newMatch(final Object... parameters) { - return AlphabeticalDependencies.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement) parameters[0], (com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link AlphabeticalDependencies} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link AlphabeticalDependencies#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final AlphabeticalDependencies INSTANCE = new AlphabeticalDependencies(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final AlphabeticalDependencies.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_source = new PParameter("source", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement")), PParameterDirection.INOUT); - - private final PParameter parameter_target = new PParameter("target", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_source, parameter_target); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.alphabeticalDependencies"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("source","target"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_source = body.getOrCreateVariableByName("source"); - PVariable var_target = body.getOrCreateVariableByName("target"); - PVariable var_sourceName = body.getOrCreateVariableByName("sourceName"); - PVariable var_targetName = body.getOrCreateVariableByName("targetName"); - new TypeConstraint(body, Tuples.flatTupleOf(var_source), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_source, parameter_source), - new ExportedParameter(body, var_target, parameter_target) - )); - // find namesOfDependencyEndpoints(source, sourceName, target, targetName) - new PositivePatternCall(body, Tuples.flatTupleOf(var_source, var_sourceName, var_target, var_targetName), NamesOfDependencyEndpoints.instance().getInternalQueryRepresentation()); - // check (sourceName < targetName) - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern alphabeticalDependencies"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("sourceName", "targetName");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - String sourceName = (String) provider.getValue("sourceName"); - String targetName = (String) provider.getValue("targetName"); - return evaluateExpression_1_1(sourceName, targetName); - } - }, null); - bodies.add(body); - } - return bodies; - } - } - - private static boolean evaluateExpression_1_1(final String sourceName, final String targetName) { - boolean _lessThan = (sourceName.compareTo(targetName) < 0); - return _lessThan; - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/AssociationClasses.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/AssociationClasses.java deleted file mode 100644 index 0611908..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/AssociationClasses.java +++ /dev/null @@ -1,705 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/WarmUpQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.nomagic.uml2.ext.magicdraw.classes.mdassociationclasses.AssociationClass; -import com.nomagic.uml2.ext.magicdraw.mdusecases.UseCase; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         pattern associationClasses(associationClass : AssociationClass, useCase : UseCase) {
- *         	AssociationClass.ownedUseCase(associationClass, useCase);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class AssociationClasses extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.associationClasses pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private AssociationClass fAssociationClass; - - private UseCase fUseCase; - - private static List parameterNames = makeImmutableList("associationClass", "useCase"); - - private Match(final AssociationClass pAssociationClass, final UseCase pUseCase) { - this.fAssociationClass = pAssociationClass; - this.fUseCase = pUseCase; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "associationClass": return this.fAssociationClass; - case "useCase": return this.fUseCase; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fAssociationClass; - case 1: return this.fUseCase; - default: return null; - } - } - - public AssociationClass getAssociationClass() { - return this.fAssociationClass; - } - - public UseCase getUseCase() { - return this.fUseCase; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("associationClass".equals(parameterName) ) { - this.fAssociationClass = (AssociationClass) newValue; - return true; - } - if ("useCase".equals(parameterName) ) { - this.fUseCase = (UseCase) newValue; - return true; - } - return false; - } - - public void setAssociationClass(final AssociationClass pAssociationClass) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fAssociationClass = pAssociationClass; - } - - public void setUseCase(final UseCase pUseCase) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fUseCase = pUseCase; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.associationClasses"; - } - - @Override - public List parameterNames() { - return AssociationClasses.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fAssociationClass, fUseCase}; - } - - @Override - public AssociationClasses.Match toImmutable() { - return isMutable() ? newMatch(fAssociationClass, fUseCase) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"associationClass\"=" + prettyPrintValue(fAssociationClass) + ", "); - result.append("\"useCase\"=" + prettyPrintValue(fUseCase)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fAssociationClass, fUseCase); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof AssociationClasses.Match)) { - AssociationClasses.Match other = (AssociationClasses.Match) obj; - return Objects.equals(fAssociationClass, other.fAssociationClass) && Objects.equals(fUseCase, other.fUseCase); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public AssociationClasses specification() { - return AssociationClasses.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static AssociationClasses.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pAssociationClass the fixed value of pattern parameter associationClass, or null if not bound. - * @param pUseCase the fixed value of pattern parameter useCase, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static AssociationClasses.Match newMutableMatch(final AssociationClass pAssociationClass, final UseCase pUseCase) { - return new Mutable(pAssociationClass, pUseCase); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pAssociationClass the fixed value of pattern parameter associationClass, or null if not bound. - * @param pUseCase the fixed value of pattern parameter useCase, or null if not bound. - * @return the (partial) match object. - * - */ - public static AssociationClasses.Match newMatch(final AssociationClass pAssociationClass, final UseCase pUseCase) { - return new Immutable(pAssociationClass, pUseCase); - } - - private static final class Mutable extends AssociationClasses.Match { - Mutable(final AssociationClass pAssociationClass, final UseCase pUseCase) { - super(pAssociationClass, pUseCase); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends AssociationClasses.Match { - Immutable(final AssociationClass pAssociationClass, final UseCase pUseCase) { - super(pAssociationClass, pUseCase); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.associationClasses pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * pattern associationClasses(associationClass : AssociationClass, useCase : UseCase) {
-   * 	AssociationClass.ownedUseCase(associationClass, useCase);
-   * }
-   * 
- * - * @see Match - * @see AssociationClasses - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static AssociationClasses.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static AssociationClasses.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_ASSOCIATIONCLASS = 0; - - private static final int POSITION_USECASE = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(AssociationClasses.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pAssociationClass the fixed value of pattern parameter associationClass, or null if not bound. - * @param pUseCase the fixed value of pattern parameter useCase, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final AssociationClass pAssociationClass, final UseCase pUseCase) { - return rawStreamAllMatches(new Object[]{pAssociationClass, pUseCase}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pAssociationClass the fixed value of pattern parameter associationClass, or null if not bound. - * @param pUseCase the fixed value of pattern parameter useCase, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final AssociationClass pAssociationClass, final UseCase pUseCase) { - return rawStreamAllMatches(new Object[]{pAssociationClass, pUseCase}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pAssociationClass the fixed value of pattern parameter associationClass, or null if not bound. - * @param pUseCase the fixed value of pattern parameter useCase, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final AssociationClass pAssociationClass, final UseCase pUseCase) { - return rawGetOneArbitraryMatch(new Object[]{pAssociationClass, pUseCase}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pAssociationClass the fixed value of pattern parameter associationClass, or null if not bound. - * @param pUseCase the fixed value of pattern parameter useCase, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final AssociationClass pAssociationClass, final UseCase pUseCase) { - return rawHasMatch(new Object[]{pAssociationClass, pUseCase}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pAssociationClass the fixed value of pattern parameter associationClass, or null if not bound. - * @param pUseCase the fixed value of pattern parameter useCase, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final AssociationClass pAssociationClass, final UseCase pUseCase) { - return rawCountMatches(new Object[]{pAssociationClass, pUseCase}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pAssociationClass the fixed value of pattern parameter associationClass, or null if not bound. - * @param pUseCase the fixed value of pattern parameter useCase, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final AssociationClass pAssociationClass, final UseCase pUseCase, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pAssociationClass, pUseCase}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pAssociationClass the fixed value of pattern parameter associationClass, or null if not bound. - * @param pUseCase the fixed value of pattern parameter useCase, or null if not bound. - * @return the (partial) match object. - * - */ - public AssociationClasses.Match newMatch(final AssociationClass pAssociationClass, final UseCase pUseCase) { - return AssociationClasses.Match.newMatch(pAssociationClass, pUseCase); - } - - /** - * Retrieve the set of values that occur in matches for associationClass. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfassociationClass(final Object[] parameters) { - return rawStreamAllValues(POSITION_ASSOCIATIONCLASS, parameters).map(AssociationClass.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for associationClass. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfassociationClass() { - return rawStreamAllValuesOfassociationClass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for associationClass. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfassociationClass() { - return rawStreamAllValuesOfassociationClass(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for associationClass. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfassociationClass(final AssociationClasses.Match partialMatch) { - return rawStreamAllValuesOfassociationClass(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for associationClass. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfassociationClass(final UseCase pUseCase) { - return rawStreamAllValuesOfassociationClass(new Object[]{null, pUseCase}); - } - - /** - * Retrieve the set of values that occur in matches for associationClass. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfassociationClass(final AssociationClasses.Match partialMatch) { - return rawStreamAllValuesOfassociationClass(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for associationClass. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfassociationClass(final UseCase pUseCase) { - return rawStreamAllValuesOfassociationClass(new Object[]{null, pUseCase}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for useCase. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfuseCase(final Object[] parameters) { - return rawStreamAllValues(POSITION_USECASE, parameters).map(UseCase.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for useCase. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfuseCase() { - return rawStreamAllValuesOfuseCase(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for useCase. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfuseCase() { - return rawStreamAllValuesOfuseCase(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for useCase. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfuseCase(final AssociationClasses.Match partialMatch) { - return rawStreamAllValuesOfuseCase(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for useCase. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfuseCase(final AssociationClass pAssociationClass) { - return rawStreamAllValuesOfuseCase(new Object[]{pAssociationClass, null}); - } - - /** - * Retrieve the set of values that occur in matches for useCase. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfuseCase(final AssociationClasses.Match partialMatch) { - return rawStreamAllValuesOfuseCase(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for useCase. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfuseCase(final AssociationClass pAssociationClass) { - return rawStreamAllValuesOfuseCase(new Object[]{pAssociationClass, null}).collect(Collectors.toSet()); - } - - @Override - protected AssociationClasses.Match tupleToMatch(final Tuple t) { - try { - return AssociationClasses.Match.newMatch((AssociationClass) t.get(POSITION_ASSOCIATIONCLASS), (UseCase) t.get(POSITION_USECASE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected AssociationClasses.Match arrayToMatch(final Object[] match) { - try { - return AssociationClasses.Match.newMatch((AssociationClass) match[POSITION_ASSOCIATIONCLASS], (UseCase) match[POSITION_USECASE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected AssociationClasses.Match arrayToMatchMutable(final Object[] match) { - try { - return AssociationClasses.Match.newMutableMatch((AssociationClass) match[POSITION_ASSOCIATIONCLASS], (UseCase) match[POSITION_USECASE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return AssociationClasses.instance(); - } - } - - private AssociationClasses() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static AssociationClasses instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected AssociationClasses.Matcher instantiate(final ViatraQueryEngine engine) { - return AssociationClasses.Matcher.on(engine); - } - - @Override - public AssociationClasses.Matcher instantiate() { - return AssociationClasses.Matcher.create(); - } - - @Override - public AssociationClasses.Match newEmptyMatch() { - return AssociationClasses.Match.newEmptyMatch(); - } - - @Override - public AssociationClasses.Match newMatch(final Object... parameters) { - return AssociationClasses.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdassociationclasses.AssociationClass) parameters[0], (com.nomagic.uml2.ext.magicdraw.mdusecases.UseCase) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link AssociationClasses} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link AssociationClasses#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final AssociationClasses INSTANCE = new AssociationClasses(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final AssociationClasses.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_associationClass = new PParameter("associationClass", "com.nomagic.uml2.ext.magicdraw.classes.mdassociationclasses.AssociationClass", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "AssociationClass")), PParameterDirection.INOUT); - - private final PParameter parameter_useCase = new PParameter("useCase", "com.nomagic.uml2.ext.magicdraw.mdusecases.UseCase", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "UseCase")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_associationClass, parameter_useCase); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.associationClasses"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("associationClass","useCase"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_associationClass = body.getOrCreateVariableByName("associationClass"); - PVariable var_useCase = body.getOrCreateVariableByName("useCase"); - new TypeConstraint(body, Tuples.flatTupleOf(var_associationClass), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "AssociationClass"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_useCase), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "UseCase"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_associationClass, parameter_associationClass), - new ExportedParameter(body, var_useCase, parameter_useCase) - )); - // AssociationClass.ownedUseCase(associationClass, useCase) - new TypeConstraint(body, Tuples.flatTupleOf(var_associationClass), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "AssociationClass"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_associationClass, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier", "ownedUseCase"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "UseCase"))); - new Equality(body, var__virtual_0_, var_useCase); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Blocks.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Blocks.java deleted file mode 100644 index df0c55b..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Blocks.java +++ /dev/null @@ -1,564 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Querying all instances of an EClass that have a short "reference chain".
- *          
- *         pattern blocks(class : Class) {
- *             Class.appliedStereotypeInstance.classifier.name(class, "Block"); 
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class Blocks extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.blocks pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class fClass; - - private static List parameterNames = makeImmutableList("class"); - - private Match(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - this.fClass = pClass; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "class": return this.fClass; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fClass; - default: return null; - } - } - - public com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class getValueOfClass() { - return this.fClass; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("class".equals(parameterName) ) { - this.fClass = (com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) newValue; - return true; - } - return false; - } - - public void setClass(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fClass = pClass; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.blocks"; - } - - @Override - public List parameterNames() { - return Blocks.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fClass}; - } - - @Override - public Blocks.Match toImmutable() { - return isMutable() ? newMatch(fClass) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"class\"=" + prettyPrintValue(fClass)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fClass); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof Blocks.Match)) { - Blocks.Match other = (Blocks.Match) obj; - return Objects.equals(fClass, other.fClass); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public Blocks specification() { - return Blocks.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static Blocks.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static Blocks.Match newMutableMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return new Mutable(pClass); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the (partial) match object. - * - */ - public static Blocks.Match newMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return new Immutable(pClass); - } - - private static final class Mutable extends Blocks.Match { - Mutable(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - super(pClass); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends Blocks.Match { - Immutable(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - super(pClass); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.blocks pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Querying all instances of an EClass that have a short "reference chain".
-   *  
-   * pattern blocks(class : Class) {
-   *     Class.appliedStereotypeInstance.classifier.name(class, "Block"); 
-   * }
-   * 
- * - * @see Match - * @see Blocks - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static Blocks.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static Blocks.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_CLASS = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Blocks.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawStreamAllMatches(new Object[]{pClass}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawStreamAllMatches(new Object[]{pClass}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawGetOneArbitraryMatch(new Object[]{pClass}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawHasMatch(new Object[]{pClass}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawCountMatches(new Object[]{pClass}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pClass}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the (partial) match object. - * - */ - public Blocks.Match newMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return Blocks.Match.newMatch(pClass); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfclass(final Object[] parameters) { - return rawStreamAllValues(POSITION_CLASS, parameters).map(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()); - } - - @Override - protected Blocks.Match tupleToMatch(final Tuple t) { - try { - return Blocks.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) t.get(POSITION_CLASS)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected Blocks.Match arrayToMatch(final Object[] match) { - try { - return Blocks.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) match[POSITION_CLASS]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected Blocks.Match arrayToMatchMutable(final Object[] match) { - try { - return Blocks.Match.newMutableMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) match[POSITION_CLASS]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return Blocks.instance(); - } - } - - private Blocks() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static Blocks instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected Blocks.Matcher instantiate(final ViatraQueryEngine engine) { - return Blocks.Matcher.on(engine); - } - - @Override - public Blocks.Matcher instantiate() { - return Blocks.Matcher.create(); - } - - @Override - public Blocks.Match newEmptyMatch() { - return Blocks.Match.newEmptyMatch(); - } - - @Override - public Blocks.Match newMatch(final Object... parameters) { - return Blocks.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link Blocks} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link Blocks#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final Blocks INSTANCE = new Blocks(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final Blocks.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_class = new PParameter("class", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_class); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.blocks"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("class"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class) - )); - // Class.appliedStereotypeInstance.classifier.name(class, "Block") - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, "Block"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Element", "appliedStereotypeInstance"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification", "classifier"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_3_, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/BlocksOrRequirements.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/BlocksOrRequirements.java deleted file mode 100644 index 5083e1e..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/BlocksOrRequirements.java +++ /dev/null @@ -1,565 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.Blocks; -import com.incquerylabs.magicdraw.benchmark.queries.Requirements; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Disjunction of blocks and requirements.
- *          
- *         pattern blocksOrRequirements(class : Class) {
- *         	find blocks(class);
- *         } or {
- *         	find requirements(class);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class BlocksOrRequirements extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.blocksOrRequirements pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class fClass; - - private static List parameterNames = makeImmutableList("class"); - - private Match(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - this.fClass = pClass; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "class": return this.fClass; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fClass; - default: return null; - } - } - - public com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class getValueOfClass() { - return this.fClass; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("class".equals(parameterName) ) { - this.fClass = (com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) newValue; - return true; - } - return false; - } - - public void setClass(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fClass = pClass; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.blocksOrRequirements"; - } - - @Override - public List parameterNames() { - return BlocksOrRequirements.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fClass}; - } - - @Override - public BlocksOrRequirements.Match toImmutable() { - return isMutable() ? newMatch(fClass) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"class\"=" + prettyPrintValue(fClass)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fClass); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof BlocksOrRequirements.Match)) { - BlocksOrRequirements.Match other = (BlocksOrRequirements.Match) obj; - return Objects.equals(fClass, other.fClass); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public BlocksOrRequirements specification() { - return BlocksOrRequirements.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static BlocksOrRequirements.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static BlocksOrRequirements.Match newMutableMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return new Mutable(pClass); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the (partial) match object. - * - */ - public static BlocksOrRequirements.Match newMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return new Immutable(pClass); - } - - private static final class Mutable extends BlocksOrRequirements.Match { - Mutable(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - super(pClass); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends BlocksOrRequirements.Match { - Immutable(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - super(pClass); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.blocksOrRequirements pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Disjunction of blocks and requirements.
-   *  
-   * pattern blocksOrRequirements(class : Class) {
-   * 	find blocks(class);
-   * } or {
-   * 	find requirements(class);
-   * }
-   * 
- * - * @see Match - * @see BlocksOrRequirements - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static BlocksOrRequirements.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static BlocksOrRequirements.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_CLASS = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(BlocksOrRequirements.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawStreamAllMatches(new Object[]{pClass}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawStreamAllMatches(new Object[]{pClass}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawGetOneArbitraryMatch(new Object[]{pClass}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawHasMatch(new Object[]{pClass}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawCountMatches(new Object[]{pClass}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pClass}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the (partial) match object. - * - */ - public BlocksOrRequirements.Match newMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return BlocksOrRequirements.Match.newMatch(pClass); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfclass(final Object[] parameters) { - return rawStreamAllValues(POSITION_CLASS, parameters).map(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()); - } - - @Override - protected BlocksOrRequirements.Match tupleToMatch(final Tuple t) { - try { - return BlocksOrRequirements.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) t.get(POSITION_CLASS)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected BlocksOrRequirements.Match arrayToMatch(final Object[] match) { - try { - return BlocksOrRequirements.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) match[POSITION_CLASS]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected BlocksOrRequirements.Match arrayToMatchMutable(final Object[] match) { - try { - return BlocksOrRequirements.Match.newMutableMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) match[POSITION_CLASS]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return BlocksOrRequirements.instance(); - } - } - - private BlocksOrRequirements() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static BlocksOrRequirements instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected BlocksOrRequirements.Matcher instantiate(final ViatraQueryEngine engine) { - return BlocksOrRequirements.Matcher.on(engine); - } - - @Override - public BlocksOrRequirements.Matcher instantiate() { - return BlocksOrRequirements.Matcher.create(); - } - - @Override - public BlocksOrRequirements.Match newEmptyMatch() { - return BlocksOrRequirements.Match.newEmptyMatch(); - } - - @Override - public BlocksOrRequirements.Match newMatch(final Object... parameters) { - return BlocksOrRequirements.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link BlocksOrRequirements} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link BlocksOrRequirements#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final BlocksOrRequirements INSTANCE = new BlocksOrRequirements(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final BlocksOrRequirements.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_class = new PParameter("class", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_class); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.blocksOrRequirements"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("class"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class) - )); - // find blocks(class) - new PositivePatternCall(body, Tuples.flatTupleOf(var_class), Blocks.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class) - )); - // find requirements(class) - new PositivePatternCall(body, Tuples.flatTupleOf(var_class), Requirements.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/BlocksOrRequirementsOrConstraints.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/BlocksOrRequirementsOrConstraints.java deleted file mode 100644 index 2d6f435..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/BlocksOrRequirementsOrConstraints.java +++ /dev/null @@ -1,577 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.BlocksOrRequirements; -import com.incquerylabs.magicdraw.benchmark.queries.Dependencies; -import com.incquerylabs.magicdraw.benchmark.queries.internal.ConstraintBlocks; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Disjunction reusing the blocksOrRequirements and constraintBlocks patterns and the negation of dependencies.
- *          
- *         pattern blocksOrRequirementsOrConstraints(class : Class) {
- *         	find blocksOrRequirements(class);
- *         } or {
- *         	find constraintBlocks(class);
- *         	neg find dependencies(class, _);
- *         	neg find dependencies(_, class);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class BlocksOrRequirementsOrConstraints extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.blocksOrRequirementsOrConstraints pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class fClass; - - private static List parameterNames = makeImmutableList("class"); - - private Match(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - this.fClass = pClass; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "class": return this.fClass; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fClass; - default: return null; - } - } - - public com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class getValueOfClass() { - return this.fClass; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("class".equals(parameterName) ) { - this.fClass = (com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) newValue; - return true; - } - return false; - } - - public void setClass(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fClass = pClass; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.blocksOrRequirementsOrConstraints"; - } - - @Override - public List parameterNames() { - return BlocksOrRequirementsOrConstraints.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fClass}; - } - - @Override - public BlocksOrRequirementsOrConstraints.Match toImmutable() { - return isMutable() ? newMatch(fClass) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"class\"=" + prettyPrintValue(fClass)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fClass); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof BlocksOrRequirementsOrConstraints.Match)) { - BlocksOrRequirementsOrConstraints.Match other = (BlocksOrRequirementsOrConstraints.Match) obj; - return Objects.equals(fClass, other.fClass); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public BlocksOrRequirementsOrConstraints specification() { - return BlocksOrRequirementsOrConstraints.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static BlocksOrRequirementsOrConstraints.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static BlocksOrRequirementsOrConstraints.Match newMutableMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return new Mutable(pClass); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the (partial) match object. - * - */ - public static BlocksOrRequirementsOrConstraints.Match newMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return new Immutable(pClass); - } - - private static final class Mutable extends BlocksOrRequirementsOrConstraints.Match { - Mutable(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - super(pClass); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends BlocksOrRequirementsOrConstraints.Match { - Immutable(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - super(pClass); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.blocksOrRequirementsOrConstraints pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Disjunction reusing the blocksOrRequirements and constraintBlocks patterns and the negation of dependencies.
-   *  
-   * pattern blocksOrRequirementsOrConstraints(class : Class) {
-   * 	find blocksOrRequirements(class);
-   * } or {
-   * 	find constraintBlocks(class);
-   * 	neg find dependencies(class, _);
-   * 	neg find dependencies(_, class);
-   * }
-   * 
- * - * @see Match - * @see BlocksOrRequirementsOrConstraints - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static BlocksOrRequirementsOrConstraints.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static BlocksOrRequirementsOrConstraints.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_CLASS = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(BlocksOrRequirementsOrConstraints.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawStreamAllMatches(new Object[]{pClass}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawStreamAllMatches(new Object[]{pClass}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawGetOneArbitraryMatch(new Object[]{pClass}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawHasMatch(new Object[]{pClass}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawCountMatches(new Object[]{pClass}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pClass}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the (partial) match object. - * - */ - public BlocksOrRequirementsOrConstraints.Match newMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return BlocksOrRequirementsOrConstraints.Match.newMatch(pClass); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfclass(final Object[] parameters) { - return rawStreamAllValues(POSITION_CLASS, parameters).map(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()); - } - - @Override - protected BlocksOrRequirementsOrConstraints.Match tupleToMatch(final Tuple t) { - try { - return BlocksOrRequirementsOrConstraints.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) t.get(POSITION_CLASS)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected BlocksOrRequirementsOrConstraints.Match arrayToMatch(final Object[] match) { - try { - return BlocksOrRequirementsOrConstraints.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) match[POSITION_CLASS]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected BlocksOrRequirementsOrConstraints.Match arrayToMatchMutable(final Object[] match) { - try { - return BlocksOrRequirementsOrConstraints.Match.newMutableMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) match[POSITION_CLASS]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return BlocksOrRequirementsOrConstraints.instance(); - } - } - - private BlocksOrRequirementsOrConstraints() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static BlocksOrRequirementsOrConstraints instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected BlocksOrRequirementsOrConstraints.Matcher instantiate(final ViatraQueryEngine engine) { - return BlocksOrRequirementsOrConstraints.Matcher.on(engine); - } - - @Override - public BlocksOrRequirementsOrConstraints.Matcher instantiate() { - return BlocksOrRequirementsOrConstraints.Matcher.create(); - } - - @Override - public BlocksOrRequirementsOrConstraints.Match newEmptyMatch() { - return BlocksOrRequirementsOrConstraints.Match.newEmptyMatch(); - } - - @Override - public BlocksOrRequirementsOrConstraints.Match newMatch(final Object... parameters) { - return BlocksOrRequirementsOrConstraints.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link BlocksOrRequirementsOrConstraints} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link BlocksOrRequirementsOrConstraints#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final BlocksOrRequirementsOrConstraints INSTANCE = new BlocksOrRequirementsOrConstraints(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final BlocksOrRequirementsOrConstraints.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_class = new PParameter("class", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_class); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.blocksOrRequirementsOrConstraints"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("class"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class) - )); - // find blocksOrRequirements(class) - new PositivePatternCall(body, Tuples.flatTupleOf(var_class), BlocksOrRequirements.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class) - )); - // find constraintBlocks(class) - new PositivePatternCall(body, Tuples.flatTupleOf(var_class), ConstraintBlocks.instance().getInternalQueryRepresentation()); - // neg find dependencies(class, _) - new NegativePatternCall(body, Tuples.flatTupleOf(var_class, var___0_), Dependencies.instance().getInternalQueryRepresentation()); - // neg find dependencies(_, class) - new NegativePatternCall(body, Tuples.flatTupleOf(var___1_, var_class), Dependencies.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/CircularDependencies.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/CircularDependencies.java deleted file mode 100644 index fcefebe..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/CircularDependencies.java +++ /dev/null @@ -1,550 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.DependencyChains; -import com.nomagic.uml2.ext.magicdraw.classes.mddependencies.Dependency; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Pattern responsible for detecting circular dependency chains.
- *          
- *         pattern circularDependencies(dependency : Dependency) {
- *             find dependencyChains+(dependency, dependency);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class CircularDependencies extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.circularDependencies pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private Dependency fDependency; - - private static List parameterNames = makeImmutableList("dependency"); - - private Match(final Dependency pDependency) { - this.fDependency = pDependency; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "dependency": return this.fDependency; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fDependency; - default: return null; - } - } - - public Dependency getDependency() { - return this.fDependency; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("dependency".equals(parameterName) ) { - this.fDependency = (Dependency) newValue; - return true; - } - return false; - } - - public void setDependency(final Dependency pDependency) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fDependency = pDependency; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.circularDependencies"; - } - - @Override - public List parameterNames() { - return CircularDependencies.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fDependency}; - } - - @Override - public CircularDependencies.Match toImmutable() { - return isMutable() ? newMatch(fDependency) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"dependency\"=" + prettyPrintValue(fDependency)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fDependency); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof CircularDependencies.Match)) { - CircularDependencies.Match other = (CircularDependencies.Match) obj; - return Objects.equals(fDependency, other.fDependency); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public CircularDependencies specification() { - return CircularDependencies.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static CircularDependencies.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pDependency the fixed value of pattern parameter dependency, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static CircularDependencies.Match newMutableMatch(final Dependency pDependency) { - return new Mutable(pDependency); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pDependency the fixed value of pattern parameter dependency, or null if not bound. - * @return the (partial) match object. - * - */ - public static CircularDependencies.Match newMatch(final Dependency pDependency) { - return new Immutable(pDependency); - } - - private static final class Mutable extends CircularDependencies.Match { - Mutable(final Dependency pDependency) { - super(pDependency); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends CircularDependencies.Match { - Immutable(final Dependency pDependency) { - super(pDependency); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.circularDependencies pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Pattern responsible for detecting circular dependency chains.
-   *  
-   * pattern circularDependencies(dependency : Dependency) {
-   *     find dependencyChains+(dependency, dependency);
-   * }
-   * 
- * - * @see Match - * @see CircularDependencies - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static CircularDependencies.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static CircularDependencies.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_DEPENDENCY = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(CircularDependencies.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pDependency the fixed value of pattern parameter dependency, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Dependency pDependency) { - return rawStreamAllMatches(new Object[]{pDependency}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pDependency the fixed value of pattern parameter dependency, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final Dependency pDependency) { - return rawStreamAllMatches(new Object[]{pDependency}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pDependency the fixed value of pattern parameter dependency, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final Dependency pDependency) { - return rawGetOneArbitraryMatch(new Object[]{pDependency}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pDependency the fixed value of pattern parameter dependency, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final Dependency pDependency) { - return rawHasMatch(new Object[]{pDependency}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pDependency the fixed value of pattern parameter dependency, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final Dependency pDependency) { - return rawCountMatches(new Object[]{pDependency}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pDependency the fixed value of pattern parameter dependency, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final Dependency pDependency, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pDependency}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pDependency the fixed value of pattern parameter dependency, or null if not bound. - * @return the (partial) match object. - * - */ - public CircularDependencies.Match newMatch(final Dependency pDependency) { - return CircularDependencies.Match.newMatch(pDependency); - } - - /** - * Retrieve the set of values that occur in matches for dependency. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfdependency(final Object[] parameters) { - return rawStreamAllValues(POSITION_DEPENDENCY, parameters).map(Dependency.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for dependency. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfdependency() { - return rawStreamAllValuesOfdependency(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for dependency. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfdependency() { - return rawStreamAllValuesOfdependency(emptyArray()); - } - - @Override - protected CircularDependencies.Match tupleToMatch(final Tuple t) { - try { - return CircularDependencies.Match.newMatch((Dependency) t.get(POSITION_DEPENDENCY)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected CircularDependencies.Match arrayToMatch(final Object[] match) { - try { - return CircularDependencies.Match.newMatch((Dependency) match[POSITION_DEPENDENCY]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected CircularDependencies.Match arrayToMatchMutable(final Object[] match) { - try { - return CircularDependencies.Match.newMutableMatch((Dependency) match[POSITION_DEPENDENCY]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return CircularDependencies.instance(); - } - } - - private CircularDependencies() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static CircularDependencies instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected CircularDependencies.Matcher instantiate(final ViatraQueryEngine engine) { - return CircularDependencies.Matcher.on(engine); - } - - @Override - public CircularDependencies.Matcher instantiate() { - return CircularDependencies.Matcher.create(); - } - - @Override - public CircularDependencies.Match newEmptyMatch() { - return CircularDependencies.Match.newEmptyMatch(); - } - - @Override - public CircularDependencies.Match newMatch(final Object... parameters) { - return CircularDependencies.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mddependencies.Dependency) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link CircularDependencies} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link CircularDependencies#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final CircularDependencies INSTANCE = new CircularDependencies(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final CircularDependencies.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_dependency = new PParameter("dependency", "com.nomagic.uml2.ext.magicdraw.classes.mddependencies.Dependency", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_dependency); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.circularDependencies"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("dependency"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_dependency = body.getOrCreateVariableByName("dependency"); - new TypeConstraint(body, Tuples.flatTupleOf(var_dependency), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_dependency, parameter_dependency) - )); - // find dependencyChains+(dependency, dependency) - new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_dependency, var_dependency), DependencyChains.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Classes.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Classes.java deleted file mode 100644 index f3afc1a..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Classes.java +++ /dev/null @@ -1,547 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Querying all instances of an EClass. 
- *          
- *         pattern classes(class : Class) {
- *         	Class(class);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class Classes extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.classes pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class fClass; - - private static List parameterNames = makeImmutableList("class"); - - private Match(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - this.fClass = pClass; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "class": return this.fClass; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fClass; - default: return null; - } - } - - public com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class getValueOfClass() { - return this.fClass; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("class".equals(parameterName) ) { - this.fClass = (com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) newValue; - return true; - } - return false; - } - - public void setClass(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fClass = pClass; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.classes"; - } - - @Override - public List parameterNames() { - return Classes.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fClass}; - } - - @Override - public Classes.Match toImmutable() { - return isMutable() ? newMatch(fClass) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"class\"=" + prettyPrintValue(fClass)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fClass); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof Classes.Match)) { - Classes.Match other = (Classes.Match) obj; - return Objects.equals(fClass, other.fClass); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public Classes specification() { - return Classes.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static Classes.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static Classes.Match newMutableMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return new Mutable(pClass); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the (partial) match object. - * - */ - public static Classes.Match newMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return new Immutable(pClass); - } - - private static final class Mutable extends Classes.Match { - Mutable(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - super(pClass); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends Classes.Match { - Immutable(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - super(pClass); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.classes pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Querying all instances of an EClass. 
-   *  
-   * pattern classes(class : Class) {
-   * 	Class(class);
-   * }
-   * 
- * - * @see Match - * @see Classes - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static Classes.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static Classes.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_CLASS = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Classes.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawStreamAllMatches(new Object[]{pClass}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawStreamAllMatches(new Object[]{pClass}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawGetOneArbitraryMatch(new Object[]{pClass}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawHasMatch(new Object[]{pClass}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawCountMatches(new Object[]{pClass}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pClass}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the (partial) match object. - * - */ - public Classes.Match newMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return Classes.Match.newMatch(pClass); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfclass(final Object[] parameters) { - return rawStreamAllValues(POSITION_CLASS, parameters).map(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()); - } - - @Override - protected Classes.Match tupleToMatch(final Tuple t) { - try { - return Classes.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) t.get(POSITION_CLASS)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected Classes.Match arrayToMatch(final Object[] match) { - try { - return Classes.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) match[POSITION_CLASS]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected Classes.Match arrayToMatchMutable(final Object[] match) { - try { - return Classes.Match.newMutableMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) match[POSITION_CLASS]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return Classes.instance(); - } - } - - private Classes() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static Classes instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected Classes.Matcher instantiate(final ViatraQueryEngine engine) { - return Classes.Matcher.on(engine); - } - - @Override - public Classes.Matcher instantiate() { - return Classes.Matcher.create(); - } - - @Override - public Classes.Match newEmptyMatch() { - return Classes.Match.newEmptyMatch(); - } - - @Override - public Classes.Match newMatch(final Object... parameters) { - return Classes.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link Classes} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link Classes#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final Classes INSTANCE = new Classes(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final Classes.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_class = new PParameter("class", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_class); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.classes"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("class"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class) - )); - // Class(class) - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ComplexNameOfElements.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ComplexNameOfElements.java deleted file mode 100644 index 3ae7e85..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ComplexNameOfElements.java +++ /dev/null @@ -1,750 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; -import org.eclipse.xtext.xbase.lib.StringExtensions; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing namedElement and eval the names.
- *          
- *         pattern complexNameOfElements(element : NamedElement, complexName : java ^java.lang.String) {
- *         	find namedElement(element, name);
- *         	complexName == eval(name.toFirstUpper + ". "+ name.toFirstLower + "." + name.toUpperCase + "." + name.toLowerCase + "." + name.length); 
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class ComplexNameOfElements extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.complexNameOfElements pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private NamedElement fElement; - - private String fComplexName; - - private static List parameterNames = makeImmutableList("element", "complexName"); - - private Match(final NamedElement pElement, final String pComplexName) { - this.fElement = pElement; - this.fComplexName = pComplexName; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "element": return this.fElement; - case "complexName": return this.fComplexName; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fElement; - case 1: return this.fComplexName; - default: return null; - } - } - - public NamedElement getElement() { - return this.fElement; - } - - public String getComplexName() { - return this.fComplexName; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("element".equals(parameterName) ) { - this.fElement = (NamedElement) newValue; - return true; - } - if ("complexName".equals(parameterName) ) { - this.fComplexName = (String) newValue; - return true; - } - return false; - } - - public void setElement(final NamedElement pElement) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fElement = pElement; - } - - public void setComplexName(final String pComplexName) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fComplexName = pComplexName; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.complexNameOfElements"; - } - - @Override - public List parameterNames() { - return ComplexNameOfElements.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fElement, fComplexName}; - } - - @Override - public ComplexNameOfElements.Match toImmutable() { - return isMutable() ? newMatch(fElement, fComplexName) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"element\"=" + prettyPrintValue(fElement) + ", "); - result.append("\"complexName\"=" + prettyPrintValue(fComplexName)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fElement, fComplexName); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof ComplexNameOfElements.Match)) { - ComplexNameOfElements.Match other = (ComplexNameOfElements.Match) obj; - return Objects.equals(fElement, other.fElement) && Objects.equals(fComplexName, other.fComplexName); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public ComplexNameOfElements specification() { - return ComplexNameOfElements.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static ComplexNameOfElements.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pComplexName the fixed value of pattern parameter complexName, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static ComplexNameOfElements.Match newMutableMatch(final NamedElement pElement, final String pComplexName) { - return new Mutable(pElement, pComplexName); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pComplexName the fixed value of pattern parameter complexName, or null if not bound. - * @return the (partial) match object. - * - */ - public static ComplexNameOfElements.Match newMatch(final NamedElement pElement, final String pComplexName) { - return new Immutable(pElement, pComplexName); - } - - private static final class Mutable extends ComplexNameOfElements.Match { - Mutable(final NamedElement pElement, final String pComplexName) { - super(pElement, pComplexName); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends ComplexNameOfElements.Match { - Immutable(final NamedElement pElement, final String pComplexName) { - super(pElement, pComplexName); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.complexNameOfElements pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing namedElement and eval the names.
-   *  
-   * pattern complexNameOfElements(element : NamedElement, complexName : java ^java.lang.String) {
-   * 	find namedElement(element, name);
-   * 	complexName == eval(name.toFirstUpper + ". "+ name.toFirstLower + "." + name.toUpperCase + "." + name.toLowerCase + "." + name.length); 
-   * }
-   * 
- * - * @see Match - * @see ComplexNameOfElements - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static ComplexNameOfElements.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static ComplexNameOfElements.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_ELEMENT = 0; - - private static final int POSITION_COMPLEXNAME = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ComplexNameOfElements.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pComplexName the fixed value of pattern parameter complexName, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final NamedElement pElement, final String pComplexName) { - return rawStreamAllMatches(new Object[]{pElement, pComplexName}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pComplexName the fixed value of pattern parameter complexName, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final NamedElement pElement, final String pComplexName) { - return rawStreamAllMatches(new Object[]{pElement, pComplexName}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pComplexName the fixed value of pattern parameter complexName, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final NamedElement pElement, final String pComplexName) { - return rawGetOneArbitraryMatch(new Object[]{pElement, pComplexName}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pComplexName the fixed value of pattern parameter complexName, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final NamedElement pElement, final String pComplexName) { - return rawHasMatch(new Object[]{pElement, pComplexName}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pComplexName the fixed value of pattern parameter complexName, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final NamedElement pElement, final String pComplexName) { - return rawCountMatches(new Object[]{pElement, pComplexName}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pComplexName the fixed value of pattern parameter complexName, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final NamedElement pElement, final String pComplexName, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pElement, pComplexName}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pComplexName the fixed value of pattern parameter complexName, or null if not bound. - * @return the (partial) match object. - * - */ - public ComplexNameOfElements.Match newMatch(final NamedElement pElement, final String pComplexName) { - return ComplexNameOfElements.Match.newMatch(pElement, pComplexName); - } - - /** - * Retrieve the set of values that occur in matches for element. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfelement(final Object[] parameters) { - return rawStreamAllValues(POSITION_ELEMENT, parameters).map(NamedElement.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for element. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfelement() { - return rawStreamAllValuesOfelement(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for element. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfelement() { - return rawStreamAllValuesOfelement(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for element. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfelement(final ComplexNameOfElements.Match partialMatch) { - return rawStreamAllValuesOfelement(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for element. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfelement(final String pComplexName) { - return rawStreamAllValuesOfelement(new Object[]{null, pComplexName}); - } - - /** - * Retrieve the set of values that occur in matches for element. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfelement(final ComplexNameOfElements.Match partialMatch) { - return rawStreamAllValuesOfelement(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for element. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfelement(final String pComplexName) { - return rawStreamAllValuesOfelement(new Object[]{null, pComplexName}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for complexName. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfcomplexName(final Object[] parameters) { - return rawStreamAllValues(POSITION_COMPLEXNAME, parameters).map(String.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for complexName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfcomplexName() { - return rawStreamAllValuesOfcomplexName(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for complexName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfcomplexName() { - return rawStreamAllValuesOfcomplexName(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for complexName. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfcomplexName(final ComplexNameOfElements.Match partialMatch) { - return rawStreamAllValuesOfcomplexName(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for complexName. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfcomplexName(final NamedElement pElement) { - return rawStreamAllValuesOfcomplexName(new Object[]{pElement, null}); - } - - /** - * Retrieve the set of values that occur in matches for complexName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfcomplexName(final ComplexNameOfElements.Match partialMatch) { - return rawStreamAllValuesOfcomplexName(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for complexName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfcomplexName(final NamedElement pElement) { - return rawStreamAllValuesOfcomplexName(new Object[]{pElement, null}).collect(Collectors.toSet()); - } - - @Override - protected ComplexNameOfElements.Match tupleToMatch(final Tuple t) { - try { - return ComplexNameOfElements.Match.newMatch((NamedElement) t.get(POSITION_ELEMENT), (String) t.get(POSITION_COMPLEXNAME)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected ComplexNameOfElements.Match arrayToMatch(final Object[] match) { - try { - return ComplexNameOfElements.Match.newMatch((NamedElement) match[POSITION_ELEMENT], (String) match[POSITION_COMPLEXNAME]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected ComplexNameOfElements.Match arrayToMatchMutable(final Object[] match) { - try { - return ComplexNameOfElements.Match.newMutableMatch((NamedElement) match[POSITION_ELEMENT], (String) match[POSITION_COMPLEXNAME]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return ComplexNameOfElements.instance(); - } - } - - private ComplexNameOfElements() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static ComplexNameOfElements instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected ComplexNameOfElements.Matcher instantiate(final ViatraQueryEngine engine) { - return ComplexNameOfElements.Matcher.on(engine); - } - - @Override - public ComplexNameOfElements.Matcher instantiate() { - return ComplexNameOfElements.Matcher.create(); - } - - @Override - public ComplexNameOfElements.Match newEmptyMatch() { - return ComplexNameOfElements.Match.newEmptyMatch(); - } - - @Override - public ComplexNameOfElements.Match newMatch(final Object... parameters) { - return ComplexNameOfElements.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement) parameters[0], (java.lang.String) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link ComplexNameOfElements} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link ComplexNameOfElements#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final ComplexNameOfElements INSTANCE = new ComplexNameOfElements(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final ComplexNameOfElements.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_element = new PParameter("element", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement")), PParameterDirection.INOUT); - - private final PParameter parameter_complexName = new PParameter("complexName", "java.lang.String", new JavaTransitiveInstancesKey(java.lang.String.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_element, parameter_complexName); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.complexNameOfElements"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("element","complexName"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_element = body.getOrCreateVariableByName("element"); - PVariable var_complexName = body.getOrCreateVariableByName("complexName"); - PVariable var_name = body.getOrCreateVariableByName("name"); - new TypeConstraint(body, Tuples.flatTupleOf(var_element), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_complexName), new JavaTransitiveInstancesKey(java.lang.String.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_element, parameter_element), - new ExportedParameter(body, var_complexName, parameter_complexName) - )); - // find namedElement(element, name) - new PositivePatternCall(body, Tuples.flatTupleOf(var_element, var_name), com.incquerylabs.magicdraw.benchmark.queries.NamedElement.instance().getInternalQueryRepresentation()); - // complexName == eval(name.toFirstUpper + ". "+ name.toFirstLower + "." + name.toUpperCase + "." + name.toLowerCase + "." + name.length) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern complexNameOfElements"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("name");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - String name = (String) provider.getValue("name"); - return evaluateExpression_1_1(name); - } - }, var__virtual_0_ ); - new Equality(body, var_complexName, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } - - private static String evaluateExpression_1_1(final String name) { - String _firstUpper = StringExtensions.toFirstUpper(name); - String _plus = (_firstUpper + ". "); - String _firstLower = StringExtensions.toFirstLower(name); - String _plus_1 = (_plus + _firstLower); - String _plus_2 = (_plus_1 + "."); - String _upperCase = name.toUpperCase(); - String _plus_3 = (_plus_2 + _upperCase); - String _plus_4 = (_plus_3 + "."); - String _lowerCase = name.toLowerCase(); - String _plus_5 = (_plus_4 + _lowerCase); - String _plus_6 = (_plus_5 + "."); - int _length = name.length(); - String _plus_7 = (_plus_6 + Integer.valueOf(_length)); - return _plus_7; - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Dependencies.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Dependencies.java deleted file mode 100644 index af317c4..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Dependencies.java +++ /dev/null @@ -1,717 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Source and target of a dependency element.
- *          
- *         pattern dependencies(source : NamedElement, target : NamedElement) {
- *         	Dependency.supplier(dependency, target);
- *         	Dependency.client(dependency, source);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class Dependencies extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.dependencies pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private NamedElement fSource; - - private NamedElement fTarget; - - private static List parameterNames = makeImmutableList("source", "target"); - - private Match(final NamedElement pSource, final NamedElement pTarget) { - this.fSource = pSource; - this.fTarget = pTarget; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "source": return this.fSource; - case "target": return this.fTarget; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fSource; - case 1: return this.fTarget; - default: return null; - } - } - - public NamedElement getSource() { - return this.fSource; - } - - public NamedElement getTarget() { - return this.fTarget; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("source".equals(parameterName) ) { - this.fSource = (NamedElement) newValue; - return true; - } - if ("target".equals(parameterName) ) { - this.fTarget = (NamedElement) newValue; - return true; - } - return false; - } - - public void setSource(final NamedElement pSource) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fSource = pSource; - } - - public void setTarget(final NamedElement pTarget) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTarget = pTarget; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.dependencies"; - } - - @Override - public List parameterNames() { - return Dependencies.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fSource, fTarget}; - } - - @Override - public Dependencies.Match toImmutable() { - return isMutable() ? newMatch(fSource, fTarget) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"source\"=" + prettyPrintValue(fSource) + ", "); - result.append("\"target\"=" + prettyPrintValue(fTarget)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fSource, fTarget); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof Dependencies.Match)) { - Dependencies.Match other = (Dependencies.Match) obj; - return Objects.equals(fSource, other.fSource) && Objects.equals(fTarget, other.fTarget); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public Dependencies specification() { - return Dependencies.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static Dependencies.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static Dependencies.Match newMutableMatch(final NamedElement pSource, final NamedElement pTarget) { - return new Mutable(pSource, pTarget); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return the (partial) match object. - * - */ - public static Dependencies.Match newMatch(final NamedElement pSource, final NamedElement pTarget) { - return new Immutable(pSource, pTarget); - } - - private static final class Mutable extends Dependencies.Match { - Mutable(final NamedElement pSource, final NamedElement pTarget) { - super(pSource, pTarget); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends Dependencies.Match { - Immutable(final NamedElement pSource, final NamedElement pTarget) { - super(pSource, pTarget); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.dependencies pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Source and target of a dependency element.
-   *  
-   * pattern dependencies(source : NamedElement, target : NamedElement) {
-   * 	Dependency.supplier(dependency, target);
-   * 	Dependency.client(dependency, source);
-   * }
-   * 
- * - * @see Match - * @see Dependencies - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static Dependencies.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static Dependencies.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_SOURCE = 0; - - private static final int POSITION_TARGET = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Dependencies.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final NamedElement pSource, final NamedElement pTarget) { - return rawStreamAllMatches(new Object[]{pSource, pTarget}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final NamedElement pSource, final NamedElement pTarget) { - return rawStreamAllMatches(new Object[]{pSource, pTarget}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final NamedElement pSource, final NamedElement pTarget) { - return rawGetOneArbitraryMatch(new Object[]{pSource, pTarget}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final NamedElement pSource, final NamedElement pTarget) { - return rawHasMatch(new Object[]{pSource, pTarget}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final NamedElement pSource, final NamedElement pTarget) { - return rawCountMatches(new Object[]{pSource, pTarget}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final NamedElement pSource, final NamedElement pTarget, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pSource, pTarget}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return the (partial) match object. - * - */ - public Dependencies.Match newMatch(final NamedElement pSource, final NamedElement pTarget) { - return Dependencies.Match.newMatch(pSource, pTarget); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfsource(final Object[] parameters) { - return rawStreamAllValues(POSITION_SOURCE, parameters).map(NamedElement.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource() { - return rawStreamAllValuesOfsource(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource() { - return rawStreamAllValuesOfsource(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for source. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource(final Dependencies.Match partialMatch) { - return rawStreamAllValuesOfsource(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for source. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource(final NamedElement pTarget) { - return rawStreamAllValuesOfsource(new Object[]{null, pTarget}); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource(final Dependencies.Match partialMatch) { - return rawStreamAllValuesOfsource(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource(final NamedElement pTarget) { - return rawStreamAllValuesOfsource(new Object[]{null, pTarget}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftarget(final Object[] parameters) { - return rawStreamAllValues(POSITION_TARGET, parameters).map(NamedElement.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget() { - return rawStreamAllValuesOftarget(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget() { - return rawStreamAllValuesOftarget(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for target. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget(final Dependencies.Match partialMatch) { - return rawStreamAllValuesOftarget(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for target. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget(final NamedElement pSource) { - return rawStreamAllValuesOftarget(new Object[]{pSource, null}); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget(final Dependencies.Match partialMatch) { - return rawStreamAllValuesOftarget(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget(final NamedElement pSource) { - return rawStreamAllValuesOftarget(new Object[]{pSource, null}).collect(Collectors.toSet()); - } - - @Override - protected Dependencies.Match tupleToMatch(final Tuple t) { - try { - return Dependencies.Match.newMatch((NamedElement) t.get(POSITION_SOURCE), (NamedElement) t.get(POSITION_TARGET)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected Dependencies.Match arrayToMatch(final Object[] match) { - try { - return Dependencies.Match.newMatch((NamedElement) match[POSITION_SOURCE], (NamedElement) match[POSITION_TARGET]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected Dependencies.Match arrayToMatchMutable(final Object[] match) { - try { - return Dependencies.Match.newMutableMatch((NamedElement) match[POSITION_SOURCE], (NamedElement) match[POSITION_TARGET]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return Dependencies.instance(); - } - } - - private Dependencies() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static Dependencies instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected Dependencies.Matcher instantiate(final ViatraQueryEngine engine) { - return Dependencies.Matcher.on(engine); - } - - @Override - public Dependencies.Matcher instantiate() { - return Dependencies.Matcher.create(); - } - - @Override - public Dependencies.Match newEmptyMatch() { - return Dependencies.Match.newEmptyMatch(); - } - - @Override - public Dependencies.Match newMatch(final Object... parameters) { - return Dependencies.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement) parameters[0], (com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link Dependencies} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link Dependencies#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final Dependencies INSTANCE = new Dependencies(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final Dependencies.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_source = new PParameter("source", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement")), PParameterDirection.INOUT); - - private final PParameter parameter_target = new PParameter("target", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_source, parameter_target); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.dependencies"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("source","target"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_source = body.getOrCreateVariableByName("source"); - PVariable var_target = body.getOrCreateVariableByName("target"); - PVariable var_dependency = body.getOrCreateVariableByName("dependency"); - new TypeConstraint(body, Tuples.flatTupleOf(var_source), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_source, parameter_source), - new ExportedParameter(body, var_target, parameter_target) - )); - // Dependency.supplier(dependency, target) - new TypeConstraint(body, Tuples.flatTupleOf(var_dependency), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_dependency, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency", "supplier"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new Equality(body, var__virtual_0_, var_target); - // Dependency.client(dependency, source) - new TypeConstraint(body, Tuples.flatTupleOf(var_dependency), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_dependency, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency", "client"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new Equality(body, var__virtual_1_, var_source); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/DependencyChains.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/DependencyChains.java deleted file mode 100644 index 6cb8dae..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/DependencyChains.java +++ /dev/null @@ -1,717 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.nomagic.uml2.ext.magicdraw.classes.mddependencies.Dependency; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Pattern describing succession relation between two dependencies.
- *          
- *         pattern dependencyChains(source : Dependency, target : Dependency) {
- *             Dependency.supplier(source, elem);
- *             Dependency.client(target, elem);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class DependencyChains extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.dependencyChains pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private Dependency fSource; - - private Dependency fTarget; - - private static List parameterNames = makeImmutableList("source", "target"); - - private Match(final Dependency pSource, final Dependency pTarget) { - this.fSource = pSource; - this.fTarget = pTarget; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "source": return this.fSource; - case "target": return this.fTarget; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fSource; - case 1: return this.fTarget; - default: return null; - } - } - - public Dependency getSource() { - return this.fSource; - } - - public Dependency getTarget() { - return this.fTarget; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("source".equals(parameterName) ) { - this.fSource = (Dependency) newValue; - return true; - } - if ("target".equals(parameterName) ) { - this.fTarget = (Dependency) newValue; - return true; - } - return false; - } - - public void setSource(final Dependency pSource) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fSource = pSource; - } - - public void setTarget(final Dependency pTarget) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTarget = pTarget; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.dependencyChains"; - } - - @Override - public List parameterNames() { - return DependencyChains.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fSource, fTarget}; - } - - @Override - public DependencyChains.Match toImmutable() { - return isMutable() ? newMatch(fSource, fTarget) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"source\"=" + prettyPrintValue(fSource) + ", "); - result.append("\"target\"=" + prettyPrintValue(fTarget)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fSource, fTarget); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof DependencyChains.Match)) { - DependencyChains.Match other = (DependencyChains.Match) obj; - return Objects.equals(fSource, other.fSource) && Objects.equals(fTarget, other.fTarget); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public DependencyChains specification() { - return DependencyChains.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static DependencyChains.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static DependencyChains.Match newMutableMatch(final Dependency pSource, final Dependency pTarget) { - return new Mutable(pSource, pTarget); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return the (partial) match object. - * - */ - public static DependencyChains.Match newMatch(final Dependency pSource, final Dependency pTarget) { - return new Immutable(pSource, pTarget); - } - - private static final class Mutable extends DependencyChains.Match { - Mutable(final Dependency pSource, final Dependency pTarget) { - super(pSource, pTarget); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends DependencyChains.Match { - Immutable(final Dependency pSource, final Dependency pTarget) { - super(pSource, pTarget); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.dependencyChains pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Pattern describing succession relation between two dependencies.
-   *  
-   * pattern dependencyChains(source : Dependency, target : Dependency) {
-   *     Dependency.supplier(source, elem);
-   *     Dependency.client(target, elem);
-   * }
-   * 
- * - * @see Match - * @see DependencyChains - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static DependencyChains.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static DependencyChains.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_SOURCE = 0; - - private static final int POSITION_TARGET = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(DependencyChains.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Dependency pSource, final Dependency pTarget) { - return rawStreamAllMatches(new Object[]{pSource, pTarget}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final Dependency pSource, final Dependency pTarget) { - return rawStreamAllMatches(new Object[]{pSource, pTarget}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final Dependency pSource, final Dependency pTarget) { - return rawGetOneArbitraryMatch(new Object[]{pSource, pTarget}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final Dependency pSource, final Dependency pTarget) { - return rawHasMatch(new Object[]{pSource, pTarget}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final Dependency pSource, final Dependency pTarget) { - return rawCountMatches(new Object[]{pSource, pTarget}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final Dependency pSource, final Dependency pTarget, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pSource, pTarget}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @return the (partial) match object. - * - */ - public DependencyChains.Match newMatch(final Dependency pSource, final Dependency pTarget) { - return DependencyChains.Match.newMatch(pSource, pTarget); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfsource(final Object[] parameters) { - return rawStreamAllValues(POSITION_SOURCE, parameters).map(Dependency.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource() { - return rawStreamAllValuesOfsource(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource() { - return rawStreamAllValuesOfsource(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for source. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource(final DependencyChains.Match partialMatch) { - return rawStreamAllValuesOfsource(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for source. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource(final Dependency pTarget) { - return rawStreamAllValuesOfsource(new Object[]{null, pTarget}); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource(final DependencyChains.Match partialMatch) { - return rawStreamAllValuesOfsource(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource(final Dependency pTarget) { - return rawStreamAllValuesOfsource(new Object[]{null, pTarget}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftarget(final Object[] parameters) { - return rawStreamAllValues(POSITION_TARGET, parameters).map(Dependency.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget() { - return rawStreamAllValuesOftarget(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget() { - return rawStreamAllValuesOftarget(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for target. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget(final DependencyChains.Match partialMatch) { - return rawStreamAllValuesOftarget(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for target. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget(final Dependency pSource) { - return rawStreamAllValuesOftarget(new Object[]{pSource, null}); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget(final DependencyChains.Match partialMatch) { - return rawStreamAllValuesOftarget(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget(final Dependency pSource) { - return rawStreamAllValuesOftarget(new Object[]{pSource, null}).collect(Collectors.toSet()); - } - - @Override - protected DependencyChains.Match tupleToMatch(final Tuple t) { - try { - return DependencyChains.Match.newMatch((Dependency) t.get(POSITION_SOURCE), (Dependency) t.get(POSITION_TARGET)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected DependencyChains.Match arrayToMatch(final Object[] match) { - try { - return DependencyChains.Match.newMatch((Dependency) match[POSITION_SOURCE], (Dependency) match[POSITION_TARGET]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected DependencyChains.Match arrayToMatchMutable(final Object[] match) { - try { - return DependencyChains.Match.newMutableMatch((Dependency) match[POSITION_SOURCE], (Dependency) match[POSITION_TARGET]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return DependencyChains.instance(); - } - } - - private DependencyChains() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static DependencyChains instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected DependencyChains.Matcher instantiate(final ViatraQueryEngine engine) { - return DependencyChains.Matcher.on(engine); - } - - @Override - public DependencyChains.Matcher instantiate() { - return DependencyChains.Matcher.create(); - } - - @Override - public DependencyChains.Match newEmptyMatch() { - return DependencyChains.Match.newEmptyMatch(); - } - - @Override - public DependencyChains.Match newMatch(final Object... parameters) { - return DependencyChains.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mddependencies.Dependency) parameters[0], (com.nomagic.uml2.ext.magicdraw.classes.mddependencies.Dependency) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link DependencyChains} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link DependencyChains#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final DependencyChains INSTANCE = new DependencyChains(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final DependencyChains.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_source = new PParameter("source", "com.nomagic.uml2.ext.magicdraw.classes.mddependencies.Dependency", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency")), PParameterDirection.INOUT); - - private final PParameter parameter_target = new PParameter("target", "com.nomagic.uml2.ext.magicdraw.classes.mddependencies.Dependency", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_source, parameter_target); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.dependencyChains"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("source","target"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_source = body.getOrCreateVariableByName("source"); - PVariable var_target = body.getOrCreateVariableByName("target"); - PVariable var_elem = body.getOrCreateVariableByName("elem"); - new TypeConstraint(body, Tuples.flatTupleOf(var_source), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_source, parameter_source), - new ExportedParameter(body, var_target, parameter_target) - )); - // Dependency.supplier(source, elem) - new TypeConstraint(body, Tuples.flatTupleOf(var_source), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_source, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency", "supplier"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new Equality(body, var__virtual_0_, var_elem); - // Dependency.client(target, elem) - new TypeConstraint(body, Tuples.flatTupleOf(var_target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_target, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency", "client"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new Equality(body, var__virtual_1_, var_elem); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ElementsWithShortNames.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ElementsWithShortNames.java deleted file mode 100644 index ecc83c7..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ElementsWithShortNames.java +++ /dev/null @@ -1,586 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Simple filtering with a check on all instances of an EClass.
- *          
- *         pattern elementsWithShortNames(class : NamedElement) {
- *         	NamedElement.name(class, name);
- *         	check (name.length {@literal <} 10); 
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class ElementsWithShortNames extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.elementsWithShortNames pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private NamedElement fClass; - - private static List parameterNames = makeImmutableList("class"); - - private Match(final NamedElement pClass) { - this.fClass = pClass; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "class": return this.fClass; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fClass; - default: return null; - } - } - - public NamedElement getValueOfClass() { - return this.fClass; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("class".equals(parameterName) ) { - this.fClass = (NamedElement) newValue; - return true; - } - return false; - } - - public void setClass(final NamedElement pClass) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fClass = pClass; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.elementsWithShortNames"; - } - - @Override - public List parameterNames() { - return ElementsWithShortNames.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fClass}; - } - - @Override - public ElementsWithShortNames.Match toImmutable() { - return isMutable() ? newMatch(fClass) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"class\"=" + prettyPrintValue(fClass)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fClass); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof ElementsWithShortNames.Match)) { - ElementsWithShortNames.Match other = (ElementsWithShortNames.Match) obj; - return Objects.equals(fClass, other.fClass); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public ElementsWithShortNames specification() { - return ElementsWithShortNames.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static ElementsWithShortNames.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static ElementsWithShortNames.Match newMutableMatch(final NamedElement pClass) { - return new Mutable(pClass); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the (partial) match object. - * - */ - public static ElementsWithShortNames.Match newMatch(final NamedElement pClass) { - return new Immutable(pClass); - } - - private static final class Mutable extends ElementsWithShortNames.Match { - Mutable(final NamedElement pClass) { - super(pClass); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends ElementsWithShortNames.Match { - Immutable(final NamedElement pClass) { - super(pClass); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.elementsWithShortNames pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Simple filtering with a check on all instances of an EClass.
-   *  
-   * pattern elementsWithShortNames(class : NamedElement) {
-   * 	NamedElement.name(class, name);
-   * 	check (name.length {@literal <} 10); 
-   * }
-   * 
- * - * @see Match - * @see ElementsWithShortNames - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static ElementsWithShortNames.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static ElementsWithShortNames.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_CLASS = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ElementsWithShortNames.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final NamedElement pClass) { - return rawStreamAllMatches(new Object[]{pClass}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final NamedElement pClass) { - return rawStreamAllMatches(new Object[]{pClass}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final NamedElement pClass) { - return rawGetOneArbitraryMatch(new Object[]{pClass}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final NamedElement pClass) { - return rawHasMatch(new Object[]{pClass}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final NamedElement pClass) { - return rawCountMatches(new Object[]{pClass}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final NamedElement pClass, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pClass}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the (partial) match object. - * - */ - public ElementsWithShortNames.Match newMatch(final NamedElement pClass) { - return ElementsWithShortNames.Match.newMatch(pClass); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfclass(final Object[] parameters) { - return rawStreamAllValues(POSITION_CLASS, parameters).map(NamedElement.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()); - } - - @Override - protected ElementsWithShortNames.Match tupleToMatch(final Tuple t) { - try { - return ElementsWithShortNames.Match.newMatch((NamedElement) t.get(POSITION_CLASS)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected ElementsWithShortNames.Match arrayToMatch(final Object[] match) { - try { - return ElementsWithShortNames.Match.newMatch((NamedElement) match[POSITION_CLASS]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected ElementsWithShortNames.Match arrayToMatchMutable(final Object[] match) { - try { - return ElementsWithShortNames.Match.newMutableMatch((NamedElement) match[POSITION_CLASS]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return ElementsWithShortNames.instance(); - } - } - - private ElementsWithShortNames() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static ElementsWithShortNames instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected ElementsWithShortNames.Matcher instantiate(final ViatraQueryEngine engine) { - return ElementsWithShortNames.Matcher.on(engine); - } - - @Override - public ElementsWithShortNames.Matcher instantiate() { - return ElementsWithShortNames.Matcher.create(); - } - - @Override - public ElementsWithShortNames.Match newEmptyMatch() { - return ElementsWithShortNames.Match.newEmptyMatch(); - } - - @Override - public ElementsWithShortNames.Match newMatch(final Object... parameters) { - return ElementsWithShortNames.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link ElementsWithShortNames} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link ElementsWithShortNames#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final ElementsWithShortNames INSTANCE = new ElementsWithShortNames(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final ElementsWithShortNames.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_class = new PParameter("class", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_class); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.elementsWithShortNames"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("class"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - PVariable var_name = body.getOrCreateVariableByName("name"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class) - )); - // NamedElement.name(class, name) - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_0_, var_name); - // check (name.length < 10) - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern elementsWithShortNames"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("name");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - String name = (String) provider.getValue("name"); - return evaluateExpression_1_1(name); - } - }, null); - bodies.add(body); - } - return bodies; - } - } - - private static boolean evaluateExpression_1_1(final String name) { - int _length = name.length(); - boolean _lessThan = (_length < 10); - return _lessThan; - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/IncomingTransitions.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/IncomingTransitions.java deleted file mode 100644 index 1475654..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/IncomingTransitions.java +++ /dev/null @@ -1,709 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Transition; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Returns transitions with their targets. Made for reuse.
- *          
- *         pattern incomingTransitions(transition : Transition, targetState : State) {
- *         	Transition.target(transition, targetState);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class IncomingTransitions extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.incomingTransitions pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private Transition fTransition; - - private State fTargetState; - - private static List parameterNames = makeImmutableList("transition", "targetState"); - - private Match(final Transition pTransition, final State pTargetState) { - this.fTransition = pTransition; - this.fTargetState = pTargetState; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "transition": return this.fTransition; - case "targetState": return this.fTargetState; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fTransition; - case 1: return this.fTargetState; - default: return null; - } - } - - public Transition getTransition() { - return this.fTransition; - } - - public State getTargetState() { - return this.fTargetState; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("transition".equals(parameterName) ) { - this.fTransition = (Transition) newValue; - return true; - } - if ("targetState".equals(parameterName) ) { - this.fTargetState = (State) newValue; - return true; - } - return false; - } - - public void setTransition(final Transition pTransition) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTransition = pTransition; - } - - public void setTargetState(final State pTargetState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTargetState = pTargetState; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.incomingTransitions"; - } - - @Override - public List parameterNames() { - return IncomingTransitions.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fTransition, fTargetState}; - } - - @Override - public IncomingTransitions.Match toImmutable() { - return isMutable() ? newMatch(fTransition, fTargetState) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"transition\"=" + prettyPrintValue(fTransition) + ", "); - result.append("\"targetState\"=" + prettyPrintValue(fTargetState)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fTransition, fTargetState); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof IncomingTransitions.Match)) { - IncomingTransitions.Match other = (IncomingTransitions.Match) obj; - return Objects.equals(fTransition, other.fTransition) && Objects.equals(fTargetState, other.fTargetState); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public IncomingTransitions specification() { - return IncomingTransitions.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static IncomingTransitions.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTargetState the fixed value of pattern parameter targetState, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static IncomingTransitions.Match newMutableMatch(final Transition pTransition, final State pTargetState) { - return new Mutable(pTransition, pTargetState); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTargetState the fixed value of pattern parameter targetState, or null if not bound. - * @return the (partial) match object. - * - */ - public static IncomingTransitions.Match newMatch(final Transition pTransition, final State pTargetState) { - return new Immutable(pTransition, pTargetState); - } - - private static final class Mutable extends IncomingTransitions.Match { - Mutable(final Transition pTransition, final State pTargetState) { - super(pTransition, pTargetState); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends IncomingTransitions.Match { - Immutable(final Transition pTransition, final State pTargetState) { - super(pTransition, pTargetState); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.incomingTransitions pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Returns transitions with their targets. Made for reuse.
-   *  
-   * pattern incomingTransitions(transition : Transition, targetState : State) {
-   * 	Transition.target(transition, targetState);
-   * }
-   * 
- * - * @see Match - * @see IncomingTransitions - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static IncomingTransitions.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static IncomingTransitions.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_TRANSITION = 0; - - private static final int POSITION_TARGETSTATE = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(IncomingTransitions.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTargetState the fixed value of pattern parameter targetState, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Transition pTransition, final State pTargetState) { - return rawStreamAllMatches(new Object[]{pTransition, pTargetState}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTargetState the fixed value of pattern parameter targetState, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final Transition pTransition, final State pTargetState) { - return rawStreamAllMatches(new Object[]{pTransition, pTargetState}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTargetState the fixed value of pattern parameter targetState, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final Transition pTransition, final State pTargetState) { - return rawGetOneArbitraryMatch(new Object[]{pTransition, pTargetState}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTargetState the fixed value of pattern parameter targetState, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final Transition pTransition, final State pTargetState) { - return rawHasMatch(new Object[]{pTransition, pTargetState}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTargetState the fixed value of pattern parameter targetState, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final Transition pTransition, final State pTargetState) { - return rawCountMatches(new Object[]{pTransition, pTargetState}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTargetState the fixed value of pattern parameter targetState, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final Transition pTransition, final State pTargetState, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pTransition, pTargetState}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTargetState the fixed value of pattern parameter targetState, or null if not bound. - * @return the (partial) match object. - * - */ - public IncomingTransitions.Match newMatch(final Transition pTransition, final State pTargetState) { - return IncomingTransitions.Match.newMatch(pTransition, pTargetState); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftransition(final Object[] parameters) { - return rawStreamAllValues(POSITION_TRANSITION, parameters).map(Transition.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransition() { - return rawStreamAllValuesOftransition(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransition() { - return rawStreamAllValuesOftransition(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for transition. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransition(final IncomingTransitions.Match partialMatch) { - return rawStreamAllValuesOftransition(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for transition. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransition(final State pTargetState) { - return rawStreamAllValuesOftransition(new Object[]{null, pTargetState}); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransition(final IncomingTransitions.Match partialMatch) { - return rawStreamAllValuesOftransition(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransition(final State pTargetState) { - return rawStreamAllValuesOftransition(new Object[]{null, pTargetState}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for targetState. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftargetState(final Object[] parameters) { - return rawStreamAllValues(POSITION_TARGETSTATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for targetState. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftargetState() { - return rawStreamAllValuesOftargetState(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for targetState. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftargetState() { - return rawStreamAllValuesOftargetState(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for targetState. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftargetState(final IncomingTransitions.Match partialMatch) { - return rawStreamAllValuesOftargetState(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for targetState. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftargetState(final Transition pTransition) { - return rawStreamAllValuesOftargetState(new Object[]{pTransition, null}); - } - - /** - * Retrieve the set of values that occur in matches for targetState. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftargetState(final IncomingTransitions.Match partialMatch) { - return rawStreamAllValuesOftargetState(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for targetState. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftargetState(final Transition pTransition) { - return rawStreamAllValuesOftargetState(new Object[]{pTransition, null}).collect(Collectors.toSet()); - } - - @Override - protected IncomingTransitions.Match tupleToMatch(final Tuple t) { - try { - return IncomingTransitions.Match.newMatch((Transition) t.get(POSITION_TRANSITION), (State) t.get(POSITION_TARGETSTATE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected IncomingTransitions.Match arrayToMatch(final Object[] match) { - try { - return IncomingTransitions.Match.newMatch((Transition) match[POSITION_TRANSITION], (State) match[POSITION_TARGETSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected IncomingTransitions.Match arrayToMatchMutable(final Object[] match) { - try { - return IncomingTransitions.Match.newMutableMatch((Transition) match[POSITION_TRANSITION], (State) match[POSITION_TARGETSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return IncomingTransitions.instance(); - } - } - - private IncomingTransitions() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IncomingTransitions instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected IncomingTransitions.Matcher instantiate(final ViatraQueryEngine engine) { - return IncomingTransitions.Matcher.on(engine); - } - - @Override - public IncomingTransitions.Matcher instantiate() { - return IncomingTransitions.Matcher.create(); - } - - @Override - public IncomingTransitions.Match newEmptyMatch() { - return IncomingTransitions.Match.newEmptyMatch(); - } - - @Override - public IncomingTransitions.Match newMatch(final Object... parameters) { - return IncomingTransitions.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Transition) parameters[0], (com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link IncomingTransitions} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link IncomingTransitions#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final IncomingTransitions INSTANCE = new IncomingTransitions(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final IncomingTransitions.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_transition = new PParameter("transition", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Transition", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition")), PParameterDirection.INOUT); - - private final PParameter parameter_targetState = new PParameter("targetState", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_transition, parameter_targetState); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.incomingTransitions"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("transition","targetState"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_transition = body.getOrCreateVariableByName("transition"); - PVariable var_targetState = body.getOrCreateVariableByName("targetState"); - new TypeConstraint(body, Tuples.flatTupleOf(var_transition), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_targetState), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_transition, parameter_transition), - new ExportedParameter(body, var_targetState, parameter_targetState) - )); - // Transition.target(transition, targetState) - new TypeConstraint(body, Tuples.flatTupleOf(var_transition), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_transition, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition", "target"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex"))); - new Equality(body, var__virtual_0_, var_targetState); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/LoopTransitionWithTriggerEffectEventNoGuard.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/LoopTransitionWithTriggerEffectEventNoGuard.java deleted file mode 100644 index 3111071..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/LoopTransitionWithTriggerEffectEventNoGuard.java +++ /dev/null @@ -1,1098 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.internal.TransitionWithGuard; -import com.nomagic.uml2.ext.magicdraw.activities.mdfundamentalactivities.Activity; -import com.nomagic.uml2.ext.magicdraw.commonbehaviors.mdcommunications.Event; -import com.nomagic.uml2.ext.magicdraw.commonbehaviors.mdcommunications.Trigger; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Transition; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         A loop transition that
- *           - Has a trigger
- *           - Has some effect that is an activity
- *           - Has no guard
- *           - defines an event
- *           
- *          
- *         pattern loopTransitionWithTriggerEffectEventNoGuard(state : State, transition : Transition, trigger : Trigger, event : Event, effect : Activity) {
- *         	Transition.source(transition, state);
- *         	Transition.target(transition, state);
- *         	Transition.kind(transition, ::external);
- *         	Transition.trigger(transition, trigger);
- *         	Transition.effect(transition, effect);
- *         	neg find transitionWithGuard(transition, _);
- *         	Trigger.event(trigger, event);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class LoopTransitionWithTriggerEffectEventNoGuard extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.loopTransitionWithTriggerEffectEventNoGuard pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private Transition fTransition; - - private Trigger fTrigger; - - private Event fEvent; - - private Activity fEffect; - - private static List parameterNames = makeImmutableList("state", "transition", "trigger", "event", "effect"); - - private Match(final State pState, final Transition pTransition, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - this.fState = pState; - this.fTransition = pTransition; - this.fTrigger = pTrigger; - this.fEvent = pEvent; - this.fEffect = pEffect; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - case "transition": return this.fTransition; - case "trigger": return this.fTrigger; - case "event": return this.fEvent; - case "effect": return this.fEffect; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - case 1: return this.fTransition; - case 2: return this.fTrigger; - case 3: return this.fEvent; - case 4: return this.fEffect; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - public Transition getTransition() { - return this.fTransition; - } - - public Trigger getTrigger() { - return this.fTrigger; - } - - public Event getEvent() { - return this.fEvent; - } - - public Activity getEffect() { - return this.fEffect; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - if ("transition".equals(parameterName) ) { - this.fTransition = (Transition) newValue; - return true; - } - if ("trigger".equals(parameterName) ) { - this.fTrigger = (Trigger) newValue; - return true; - } - if ("event".equals(parameterName) ) { - this.fEvent = (Event) newValue; - return true; - } - if ("effect".equals(parameterName) ) { - this.fEffect = (Activity) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - public void setTransition(final Transition pTransition) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTransition = pTransition; - } - - public void setTrigger(final Trigger pTrigger) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTrigger = pTrigger; - } - - public void setEvent(final Event pEvent) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fEvent = pEvent; - } - - public void setEffect(final Activity pEffect) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fEffect = pEffect; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.loopTransitionWithTriggerEffectEventNoGuard"; - } - - @Override - public List parameterNames() { - return LoopTransitionWithTriggerEffectEventNoGuard.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState, fTransition, fTrigger, fEvent, fEffect}; - } - - @Override - public LoopTransitionWithTriggerEffectEventNoGuard.Match toImmutable() { - return isMutable() ? newMatch(fState, fTransition, fTrigger, fEvent, fEffect) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState) + ", "); - result.append("\"transition\"=" + prettyPrintValue(fTransition) + ", "); - result.append("\"trigger\"=" + prettyPrintValue(fTrigger) + ", "); - result.append("\"event\"=" + prettyPrintValue(fEvent) + ", "); - result.append("\"effect\"=" + prettyPrintValue(fEffect)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState, fTransition, fTrigger, fEvent, fEffect); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof LoopTransitionWithTriggerEffectEventNoGuard.Match)) { - LoopTransitionWithTriggerEffectEventNoGuard.Match other = (LoopTransitionWithTriggerEffectEventNoGuard.Match) obj; - return Objects.equals(fState, other.fState) && Objects.equals(fTransition, other.fTransition) && Objects.equals(fTrigger, other.fTrigger) && Objects.equals(fEvent, other.fEvent) && Objects.equals(fEffect, other.fEffect); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public LoopTransitionWithTriggerEffectEventNoGuard specification() { - return LoopTransitionWithTriggerEffectEventNoGuard.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static LoopTransitionWithTriggerEffectEventNoGuard.Match newEmptyMatch() { - return new Mutable(null, null, null, null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEffect the fixed value of pattern parameter effect, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static LoopTransitionWithTriggerEffectEventNoGuard.Match newMutableMatch(final State pState, final Transition pTransition, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - return new Mutable(pState, pTransition, pTrigger, pEvent, pEffect); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEffect the fixed value of pattern parameter effect, or null if not bound. - * @return the (partial) match object. - * - */ - public static LoopTransitionWithTriggerEffectEventNoGuard.Match newMatch(final State pState, final Transition pTransition, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - return new Immutable(pState, pTransition, pTrigger, pEvent, pEffect); - } - - private static final class Mutable extends LoopTransitionWithTriggerEffectEventNoGuard.Match { - Mutable(final State pState, final Transition pTransition, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - super(pState, pTransition, pTrigger, pEvent, pEffect); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends LoopTransitionWithTriggerEffectEventNoGuard.Match { - Immutable(final State pState, final Transition pTransition, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - super(pState, pTransition, pTrigger, pEvent, pEffect); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.loopTransitionWithTriggerEffectEventNoGuard pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * A loop transition that
-   *   - Has a trigger
-   *   - Has some effect that is an activity
-   *   - Has no guard
-   *   - defines an event
-   *   
-   *  
-   * pattern loopTransitionWithTriggerEffectEventNoGuard(state : State, transition : Transition, trigger : Trigger, event : Event, effect : Activity) {
-   * 	Transition.source(transition, state);
-   * 	Transition.target(transition, state);
-   * 	Transition.kind(transition, ::external);
-   * 	Transition.trigger(transition, trigger);
-   * 	Transition.effect(transition, effect);
-   * 	neg find transitionWithGuard(transition, _);
-   * 	Trigger.event(trigger, event);
-   * }
-   * 
- * - * @see Match - * @see LoopTransitionWithTriggerEffectEventNoGuard - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static LoopTransitionWithTriggerEffectEventNoGuard.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static LoopTransitionWithTriggerEffectEventNoGuard.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final int POSITION_TRANSITION = 1; - - private static final int POSITION_TRIGGER = 2; - - private static final int POSITION_EVENT = 3; - - private static final int POSITION_EFFECT = 4; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(LoopTransitionWithTriggerEffectEventNoGuard.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEffect the fixed value of pattern parameter effect, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState, final Transition pTransition, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - return rawStreamAllMatches(new Object[]{pState, pTransition, pTrigger, pEvent, pEffect}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEffect the fixed value of pattern parameter effect, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState, final Transition pTransition, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - return rawStreamAllMatches(new Object[]{pState, pTransition, pTrigger, pEvent, pEffect}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEffect the fixed value of pattern parameter effect, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState, final Transition pTransition, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - return rawGetOneArbitraryMatch(new Object[]{pState, pTransition, pTrigger, pEvent, pEffect}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEffect the fixed value of pattern parameter effect, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState, final Transition pTransition, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - return rawHasMatch(new Object[]{pState, pTransition, pTrigger, pEvent, pEffect}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEffect the fixed value of pattern parameter effect, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState, final Transition pTransition, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - return rawCountMatches(new Object[]{pState, pTransition, pTrigger, pEvent, pEffect}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEffect the fixed value of pattern parameter effect, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final Transition pTransition, final Trigger pTrigger, final Event pEvent, final Activity pEffect, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState, pTransition, pTrigger, pEvent, pEffect}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param pTrigger the fixed value of pattern parameter trigger, or null if not bound. - * @param pEvent the fixed value of pattern parameter event, or null if not bound. - * @param pEffect the fixed value of pattern parameter effect, or null if not bound. - * @return the (partial) match object. - * - */ - public LoopTransitionWithTriggerEffectEventNoGuard.Match newMatch(final State pState, final Transition pTransition, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - return LoopTransitionWithTriggerEffectEventNoGuard.Match.newMatch(pState, pTransition, pTrigger, pEvent, pEffect); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final LoopTransitionWithTriggerEffectEventNoGuard.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final Transition pTransition, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransition, pTrigger, pEvent, pEffect}); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final LoopTransitionWithTriggerEffectEventNoGuard.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final Transition pTransition, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransition, pTrigger, pEvent, pEffect}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftransition(final Object[] parameters) { - return rawStreamAllValues(POSITION_TRANSITION, parameters).map(Transition.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransition() { - return rawStreamAllValuesOftransition(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransition() { - return rawStreamAllValuesOftransition(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for transition. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransition(final LoopTransitionWithTriggerEffectEventNoGuard.Match partialMatch) { - return rawStreamAllValuesOftransition(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for transition. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransition(final State pState, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - return rawStreamAllValuesOftransition(new Object[]{pState, null, pTrigger, pEvent, pEffect}); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransition(final LoopTransitionWithTriggerEffectEventNoGuard.Match partialMatch) { - return rawStreamAllValuesOftransition(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransition(final State pState, final Trigger pTrigger, final Event pEvent, final Activity pEffect) { - return rawStreamAllValuesOftransition(new Object[]{pState, null, pTrigger, pEvent, pEffect}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for trigger. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftrigger(final Object[] parameters) { - return rawStreamAllValues(POSITION_TRIGGER, parameters).map(Trigger.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for trigger. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftrigger() { - return rawStreamAllValuesOftrigger(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for trigger. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftrigger() { - return rawStreamAllValuesOftrigger(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for trigger. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftrigger(final LoopTransitionWithTriggerEffectEventNoGuard.Match partialMatch) { - return rawStreamAllValuesOftrigger(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for trigger. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftrigger(final State pState, final Transition pTransition, final Event pEvent, final Activity pEffect) { - return rawStreamAllValuesOftrigger(new Object[]{pState, pTransition, null, pEvent, pEffect}); - } - - /** - * Retrieve the set of values that occur in matches for trigger. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftrigger(final LoopTransitionWithTriggerEffectEventNoGuard.Match partialMatch) { - return rawStreamAllValuesOftrigger(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for trigger. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftrigger(final State pState, final Transition pTransition, final Event pEvent, final Activity pEffect) { - return rawStreamAllValuesOftrigger(new Object[]{pState, pTransition, null, pEvent, pEffect}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for event. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfevent(final Object[] parameters) { - return rawStreamAllValues(POSITION_EVENT, parameters).map(Event.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for event. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfevent() { - return rawStreamAllValuesOfevent(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for event. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfevent() { - return rawStreamAllValuesOfevent(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for event. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfevent(final LoopTransitionWithTriggerEffectEventNoGuard.Match partialMatch) { - return rawStreamAllValuesOfevent(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for event. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfevent(final State pState, final Transition pTransition, final Trigger pTrigger, final Activity pEffect) { - return rawStreamAllValuesOfevent(new Object[]{pState, pTransition, pTrigger, null, pEffect}); - } - - /** - * Retrieve the set of values that occur in matches for event. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfevent(final LoopTransitionWithTriggerEffectEventNoGuard.Match partialMatch) { - return rawStreamAllValuesOfevent(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for event. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfevent(final State pState, final Transition pTransition, final Trigger pTrigger, final Activity pEffect) { - return rawStreamAllValuesOfevent(new Object[]{pState, pTransition, pTrigger, null, pEffect}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for effect. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfeffect(final Object[] parameters) { - return rawStreamAllValues(POSITION_EFFECT, parameters).map(Activity.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for effect. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfeffect() { - return rawStreamAllValuesOfeffect(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for effect. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfeffect() { - return rawStreamAllValuesOfeffect(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for effect. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfeffect(final LoopTransitionWithTriggerEffectEventNoGuard.Match partialMatch) { - return rawStreamAllValuesOfeffect(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for effect. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfeffect(final State pState, final Transition pTransition, final Trigger pTrigger, final Event pEvent) { - return rawStreamAllValuesOfeffect(new Object[]{pState, pTransition, pTrigger, pEvent, null}); - } - - /** - * Retrieve the set of values that occur in matches for effect. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfeffect(final LoopTransitionWithTriggerEffectEventNoGuard.Match partialMatch) { - return rawStreamAllValuesOfeffect(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for effect. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfeffect(final State pState, final Transition pTransition, final Trigger pTrigger, final Event pEvent) { - return rawStreamAllValuesOfeffect(new Object[]{pState, pTransition, pTrigger, pEvent, null}).collect(Collectors.toSet()); - } - - @Override - protected LoopTransitionWithTriggerEffectEventNoGuard.Match tupleToMatch(final Tuple t) { - try { - return LoopTransitionWithTriggerEffectEventNoGuard.Match.newMatch((State) t.get(POSITION_STATE), (Transition) t.get(POSITION_TRANSITION), (Trigger) t.get(POSITION_TRIGGER), (Event) t.get(POSITION_EVENT), (Activity) t.get(POSITION_EFFECT)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected LoopTransitionWithTriggerEffectEventNoGuard.Match arrayToMatch(final Object[] match) { - try { - return LoopTransitionWithTriggerEffectEventNoGuard.Match.newMatch((State) match[POSITION_STATE], (Transition) match[POSITION_TRANSITION], (Trigger) match[POSITION_TRIGGER], (Event) match[POSITION_EVENT], (Activity) match[POSITION_EFFECT]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected LoopTransitionWithTriggerEffectEventNoGuard.Match arrayToMatchMutable(final Object[] match) { - try { - return LoopTransitionWithTriggerEffectEventNoGuard.Match.newMutableMatch((State) match[POSITION_STATE], (Transition) match[POSITION_TRANSITION], (Trigger) match[POSITION_TRIGGER], (Event) match[POSITION_EVENT], (Activity) match[POSITION_EFFECT]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return LoopTransitionWithTriggerEffectEventNoGuard.instance(); - } - } - - private LoopTransitionWithTriggerEffectEventNoGuard() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static LoopTransitionWithTriggerEffectEventNoGuard instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected LoopTransitionWithTriggerEffectEventNoGuard.Matcher instantiate(final ViatraQueryEngine engine) { - return LoopTransitionWithTriggerEffectEventNoGuard.Matcher.on(engine); - } - - @Override - public LoopTransitionWithTriggerEffectEventNoGuard.Matcher instantiate() { - return LoopTransitionWithTriggerEffectEventNoGuard.Matcher.create(); - } - - @Override - public LoopTransitionWithTriggerEffectEventNoGuard.Match newEmptyMatch() { - return LoopTransitionWithTriggerEffectEventNoGuard.Match.newEmptyMatch(); - } - - @Override - public LoopTransitionWithTriggerEffectEventNoGuard.Match newMatch(final Object... parameters) { - return LoopTransitionWithTriggerEffectEventNoGuard.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0], (com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Transition) parameters[1], (com.nomagic.uml2.ext.magicdraw.commonbehaviors.mdcommunications.Trigger) parameters[2], (com.nomagic.uml2.ext.magicdraw.commonbehaviors.mdcommunications.Event) parameters[3], (com.nomagic.uml2.ext.magicdraw.activities.mdfundamentalactivities.Activity) parameters[4]); - } - - /** - * Inner class allowing the singleton instance of {@link LoopTransitionWithTriggerEffectEventNoGuard} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link LoopTransitionWithTriggerEffectEventNoGuard#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final LoopTransitionWithTriggerEffectEventNoGuard INSTANCE = new LoopTransitionWithTriggerEffectEventNoGuard(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final LoopTransitionWithTriggerEffectEventNoGuard.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final PParameter parameter_transition = new PParameter("transition", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Transition", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition")), PParameterDirection.INOUT); - - private final PParameter parameter_trigger = new PParameter("trigger", "com.nomagic.uml2.ext.magicdraw.commonbehaviors.mdcommunications.Trigger", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Trigger")), PParameterDirection.INOUT); - - private final PParameter parameter_event = new PParameter("event", "com.nomagic.uml2.ext.magicdraw.commonbehaviors.mdcommunications.Event", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Event")), PParameterDirection.INOUT); - - private final PParameter parameter_effect = new PParameter("effect", "com.nomagic.uml2.ext.magicdraw.activities.mdfundamentalactivities.Activity", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Activity")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state, parameter_transition, parameter_trigger, parameter_event, parameter_effect); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.loopTransitionWithTriggerEffectEventNoGuard"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state","transition","trigger","event","effect"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_transition = body.getOrCreateVariableByName("transition"); - PVariable var_trigger = body.getOrCreateVariableByName("trigger"); - PVariable var_event = body.getOrCreateVariableByName("event"); - PVariable var_effect = body.getOrCreateVariableByName("effect"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_transition), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_trigger), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Trigger"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_event), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Event"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_effect), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Activity"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state), - new ExportedParameter(body, var_transition, parameter_transition), - new ExportedParameter(body, var_trigger, parameter_trigger), - new ExportedParameter(body, var_event, parameter_event), - new ExportedParameter(body, var_effect, parameter_effect) - )); - // Transition.source(transition, state) - new TypeConstraint(body, Tuples.flatTupleOf(var_transition), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_transition, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition", "source"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex"))); - new Equality(body, var__virtual_0_, var_state); - // Transition.target(transition, state) - new TypeConstraint(body, Tuples.flatTupleOf(var_transition), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_transition, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition", "target"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex"))); - new Equality(body, var__virtual_1_, var_state); - // Transition.kind(transition, ::external) - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new ConstantValue(body, var__virtual_2_, com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.TransitionKindEnum.get("external")); - new TypeConstraint(body, Tuples.flatTupleOf(var_transition), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_transition, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition", "kind"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "TransitionKind"))); - new Equality(body, var__virtual_3_, var__virtual_2_); - // Transition.trigger(transition, trigger) - new TypeConstraint(body, Tuples.flatTupleOf(var_transition), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_transition, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition", "trigger"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Trigger"))); - new Equality(body, var__virtual_4_, var_trigger); - // Transition.effect(transition, effect) - new TypeConstraint(body, Tuples.flatTupleOf(var_transition), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - PVariable var__virtual_5_ = body.getOrCreateVariableByName(".virtual{5}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_transition, var__virtual_5_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition", "effect"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_5_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Behavior"))); - new Equality(body, var__virtual_5_, var_effect); - // neg find transitionWithGuard(transition, _) - new NegativePatternCall(body, Tuples.flatTupleOf(var_transition, var___0_), TransitionWithGuard.instance().getInternalQueryRepresentation()); - // Trigger.event(trigger, event) - new TypeConstraint(body, Tuples.flatTupleOf(var_trigger), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Trigger"))); - PVariable var__virtual_6_ = body.getOrCreateVariableByName(".virtual{6}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_trigger, var__virtual_6_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Trigger", "event"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_6_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Event"))); - new Equality(body, var__virtual_6_, var_event); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NamedElement.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NamedElement.java deleted file mode 100644 index 1218452..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NamedElement.java +++ /dev/null @@ -1,711 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Querying all instances of an EClass with an attribute. 
- *          
- *         pattern namedElement(element : NamedElement, name : java ^java.lang.String) {
- *         	NamedElement.name(element, name);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class NamedElement extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.namedElement pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement fElement; - - private String fName; - - private static List parameterNames = makeImmutableList("element", "name"); - - private Match(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement, final String pName) { - this.fElement = pElement; - this.fName = pName; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "element": return this.fElement; - case "name": return this.fName; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fElement; - case 1: return this.fName; - default: return null; - } - } - - public com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement getElement() { - return this.fElement; - } - - public String getName() { - return this.fName; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("element".equals(parameterName) ) { - this.fElement = (com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement) newValue; - return true; - } - if ("name".equals(parameterName) ) { - this.fName = (String) newValue; - return true; - } - return false; - } - - public void setElement(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fElement = pElement; - } - - public void setName(final String pName) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fName = pName; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.namedElement"; - } - - @Override - public List parameterNames() { - return NamedElement.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fElement, fName}; - } - - @Override - public NamedElement.Match toImmutable() { - return isMutable() ? newMatch(fElement, fName) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"element\"=" + prettyPrintValue(fElement) + ", "); - result.append("\"name\"=" + prettyPrintValue(fName)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fElement, fName); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof NamedElement.Match)) { - NamedElement.Match other = (NamedElement.Match) obj; - return Objects.equals(fElement, other.fElement) && Objects.equals(fName, other.fName); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public NamedElement specification() { - return NamedElement.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static NamedElement.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pName the fixed value of pattern parameter name, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static NamedElement.Match newMutableMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement, final String pName) { - return new Mutable(pElement, pName); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pName the fixed value of pattern parameter name, or null if not bound. - * @return the (partial) match object. - * - */ - public static NamedElement.Match newMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement, final String pName) { - return new Immutable(pElement, pName); - } - - private static final class Mutable extends NamedElement.Match { - Mutable(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement, final String pName) { - super(pElement, pName); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends NamedElement.Match { - Immutable(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement, final String pName) { - super(pElement, pName); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.namedElement pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Querying all instances of an EClass with an attribute. 
-   *  
-   * pattern namedElement(element : NamedElement, name : java ^java.lang.String) {
-   * 	NamedElement.name(element, name);
-   * }
-   * 
- * - * @see Match - * @see NamedElement - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static NamedElement.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static NamedElement.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_ELEMENT = 0; - - private static final int POSITION_NAME = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NamedElement.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pName the fixed value of pattern parameter name, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement, final String pName) { - return rawStreamAllMatches(new Object[]{pElement, pName}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pName the fixed value of pattern parameter name, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement, final String pName) { - return rawStreamAllMatches(new Object[]{pElement, pName}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pName the fixed value of pattern parameter name, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement, final String pName) { - return rawGetOneArbitraryMatch(new Object[]{pElement, pName}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pName the fixed value of pattern parameter name, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement, final String pName) { - return rawHasMatch(new Object[]{pElement, pName}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pName the fixed value of pattern parameter name, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement, final String pName) { - return rawCountMatches(new Object[]{pElement, pName}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pName the fixed value of pattern parameter name, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement, final String pName, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pElement, pName}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pName the fixed value of pattern parameter name, or null if not bound. - * @return the (partial) match object. - * - */ - public NamedElement.Match newMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement, final String pName) { - return NamedElement.Match.newMatch(pElement, pName); - } - - /** - * Retrieve the set of values that occur in matches for element. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfelement(final Object[] parameters) { - return rawStreamAllValues(POSITION_ELEMENT, parameters).map(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for element. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfelement() { - return rawStreamAllValuesOfelement(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for element. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfelement() { - return rawStreamAllValuesOfelement(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for element. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfelement(final NamedElement.Match partialMatch) { - return rawStreamAllValuesOfelement(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for element. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfelement(final String pName) { - return rawStreamAllValuesOfelement(new Object[]{null, pName}); - } - - /** - * Retrieve the set of values that occur in matches for element. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfelement(final NamedElement.Match partialMatch) { - return rawStreamAllValuesOfelement(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for element. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfelement(final String pName) { - return rawStreamAllValuesOfelement(new Object[]{null, pName}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for name. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfname(final Object[] parameters) { - return rawStreamAllValues(POSITION_NAME, parameters).map(String.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for name. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfname() { - return rawStreamAllValuesOfname(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for name. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfname() { - return rawStreamAllValuesOfname(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for name. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfname(final NamedElement.Match partialMatch) { - return rawStreamAllValuesOfname(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for name. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfname(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement) { - return rawStreamAllValuesOfname(new Object[]{pElement, null}); - } - - /** - * Retrieve the set of values that occur in matches for name. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfname(final NamedElement.Match partialMatch) { - return rawStreamAllValuesOfname(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for name. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfname(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement pElement) { - return rawStreamAllValuesOfname(new Object[]{pElement, null}).collect(Collectors.toSet()); - } - - @Override - protected NamedElement.Match tupleToMatch(final Tuple t) { - try { - return NamedElement.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement) t.get(POSITION_ELEMENT), (String) t.get(POSITION_NAME)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected NamedElement.Match arrayToMatch(final Object[] match) { - try { - return NamedElement.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement) match[POSITION_ELEMENT], (String) match[POSITION_NAME]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected NamedElement.Match arrayToMatchMutable(final Object[] match) { - try { - return NamedElement.Match.newMutableMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement) match[POSITION_ELEMENT], (String) match[POSITION_NAME]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return NamedElement.instance(); - } - } - - private NamedElement() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static NamedElement instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected NamedElement.Matcher instantiate(final ViatraQueryEngine engine) { - return NamedElement.Matcher.on(engine); - } - - @Override - public NamedElement.Matcher instantiate() { - return NamedElement.Matcher.create(); - } - - @Override - public NamedElement.Match newEmptyMatch() { - return NamedElement.Match.newEmptyMatch(); - } - - @Override - public NamedElement.Match newMatch(final Object... parameters) { - return NamedElement.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement) parameters[0], (java.lang.String) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link NamedElement} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link NamedElement#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final NamedElement INSTANCE = new NamedElement(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final NamedElement.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_element = new PParameter("element", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement")), PParameterDirection.INOUT); - - private final PParameter parameter_name = new PParameter("name", "java.lang.String", new JavaTransitiveInstancesKey(java.lang.String.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_element, parameter_name); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.namedElement"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("element","name"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_element = body.getOrCreateVariableByName("element"); - PVariable var_name = body.getOrCreateVariableByName("name"); - new TypeConstraint(body, Tuples.flatTupleOf(var_element), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_name), new JavaTransitiveInstancesKey(java.lang.String.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_element, parameter_element), - new ExportedParameter(body, var_name, parameter_name) - )); - // NamedElement.name(element, name) - new TypeConstraint(body, Tuples.flatTupleOf(var_element), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_element, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_0_, var_name); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NamesOfDependencyEndpoints.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NamesOfDependencyEndpoints.java deleted file mode 100644 index 07d5239..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NamesOfDependencyEndpoints.java +++ /dev/null @@ -1,942 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.Dependencies; -import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing the dependency pattern and querying simple attributes.
- *          
- *         pattern namesOfDependencyEndpoints(source : NamedElement, sourceName : java ^java.lang.String, target : NamedElement, targetName : java ^java.lang.String) {
- *         	find dependencies(source, target);
- *         	NamedElement.name(source, sourceName);
- *         	NamedElement.name(target, targetName);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class NamesOfDependencyEndpoints extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.namesOfDependencyEndpoints pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private NamedElement fSource; - - private String fSourceName; - - private NamedElement fTarget; - - private String fTargetName; - - private static List parameterNames = makeImmutableList("source", "sourceName", "target", "targetName"); - - private Match(final NamedElement pSource, final String pSourceName, final NamedElement pTarget, final String pTargetName) { - this.fSource = pSource; - this.fSourceName = pSourceName; - this.fTarget = pTarget; - this.fTargetName = pTargetName; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "source": return this.fSource; - case "sourceName": return this.fSourceName; - case "target": return this.fTarget; - case "targetName": return this.fTargetName; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fSource; - case 1: return this.fSourceName; - case 2: return this.fTarget; - case 3: return this.fTargetName; - default: return null; - } - } - - public NamedElement getSource() { - return this.fSource; - } - - public String getSourceName() { - return this.fSourceName; - } - - public NamedElement getTarget() { - return this.fTarget; - } - - public String getTargetName() { - return this.fTargetName; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("source".equals(parameterName) ) { - this.fSource = (NamedElement) newValue; - return true; - } - if ("sourceName".equals(parameterName) ) { - this.fSourceName = (String) newValue; - return true; - } - if ("target".equals(parameterName) ) { - this.fTarget = (NamedElement) newValue; - return true; - } - if ("targetName".equals(parameterName) ) { - this.fTargetName = (String) newValue; - return true; - } - return false; - } - - public void setSource(final NamedElement pSource) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fSource = pSource; - } - - public void setSourceName(final String pSourceName) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fSourceName = pSourceName; - } - - public void setTarget(final NamedElement pTarget) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTarget = pTarget; - } - - public void setTargetName(final String pTargetName) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTargetName = pTargetName; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.namesOfDependencyEndpoints"; - } - - @Override - public List parameterNames() { - return NamesOfDependencyEndpoints.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fSource, fSourceName, fTarget, fTargetName}; - } - - @Override - public NamesOfDependencyEndpoints.Match toImmutable() { - return isMutable() ? newMatch(fSource, fSourceName, fTarget, fTargetName) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"source\"=" + prettyPrintValue(fSource) + ", "); - result.append("\"sourceName\"=" + prettyPrintValue(fSourceName) + ", "); - result.append("\"target\"=" + prettyPrintValue(fTarget) + ", "); - result.append("\"targetName\"=" + prettyPrintValue(fTargetName)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fSource, fSourceName, fTarget, fTargetName); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof NamesOfDependencyEndpoints.Match)) { - NamesOfDependencyEndpoints.Match other = (NamesOfDependencyEndpoints.Match) obj; - return Objects.equals(fSource, other.fSource) && Objects.equals(fSourceName, other.fSourceName) && Objects.equals(fTarget, other.fTarget) && Objects.equals(fTargetName, other.fTargetName); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public NamesOfDependencyEndpoints specification() { - return NamesOfDependencyEndpoints.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static NamesOfDependencyEndpoints.Match newEmptyMatch() { - return new Mutable(null, null, null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pSourceName the fixed value of pattern parameter sourceName, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTargetName the fixed value of pattern parameter targetName, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static NamesOfDependencyEndpoints.Match newMutableMatch(final NamedElement pSource, final String pSourceName, final NamedElement pTarget, final String pTargetName) { - return new Mutable(pSource, pSourceName, pTarget, pTargetName); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pSourceName the fixed value of pattern parameter sourceName, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTargetName the fixed value of pattern parameter targetName, or null if not bound. - * @return the (partial) match object. - * - */ - public static NamesOfDependencyEndpoints.Match newMatch(final NamedElement pSource, final String pSourceName, final NamedElement pTarget, final String pTargetName) { - return new Immutable(pSource, pSourceName, pTarget, pTargetName); - } - - private static final class Mutable extends NamesOfDependencyEndpoints.Match { - Mutable(final NamedElement pSource, final String pSourceName, final NamedElement pTarget, final String pTargetName) { - super(pSource, pSourceName, pTarget, pTargetName); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends NamesOfDependencyEndpoints.Match { - Immutable(final NamedElement pSource, final String pSourceName, final NamedElement pTarget, final String pTargetName) { - super(pSource, pSourceName, pTarget, pTargetName); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.namesOfDependencyEndpoints pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing the dependency pattern and querying simple attributes.
-   *  
-   * pattern namesOfDependencyEndpoints(source : NamedElement, sourceName : java ^java.lang.String, target : NamedElement, targetName : java ^java.lang.String) {
-   * 	find dependencies(source, target);
-   * 	NamedElement.name(source, sourceName);
-   * 	NamedElement.name(target, targetName);
-   * }
-   * 
- * - * @see Match - * @see NamesOfDependencyEndpoints - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static NamesOfDependencyEndpoints.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static NamesOfDependencyEndpoints.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_SOURCE = 0; - - private static final int POSITION_SOURCENAME = 1; - - private static final int POSITION_TARGET = 2; - - private static final int POSITION_TARGETNAME = 3; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NamesOfDependencyEndpoints.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pSourceName the fixed value of pattern parameter sourceName, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTargetName the fixed value of pattern parameter targetName, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final NamedElement pSource, final String pSourceName, final NamedElement pTarget, final String pTargetName) { - return rawStreamAllMatches(new Object[]{pSource, pSourceName, pTarget, pTargetName}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pSourceName the fixed value of pattern parameter sourceName, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTargetName the fixed value of pattern parameter targetName, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final NamedElement pSource, final String pSourceName, final NamedElement pTarget, final String pTargetName) { - return rawStreamAllMatches(new Object[]{pSource, pSourceName, pTarget, pTargetName}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pSourceName the fixed value of pattern parameter sourceName, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTargetName the fixed value of pattern parameter targetName, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final NamedElement pSource, final String pSourceName, final NamedElement pTarget, final String pTargetName) { - return rawGetOneArbitraryMatch(new Object[]{pSource, pSourceName, pTarget, pTargetName}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pSourceName the fixed value of pattern parameter sourceName, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTargetName the fixed value of pattern parameter targetName, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final NamedElement pSource, final String pSourceName, final NamedElement pTarget, final String pTargetName) { - return rawHasMatch(new Object[]{pSource, pSourceName, pTarget, pTargetName}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pSourceName the fixed value of pattern parameter sourceName, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTargetName the fixed value of pattern parameter targetName, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final NamedElement pSource, final String pSourceName, final NamedElement pTarget, final String pTargetName) { - return rawCountMatches(new Object[]{pSource, pSourceName, pTarget, pTargetName}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pSourceName the fixed value of pattern parameter sourceName, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTargetName the fixed value of pattern parameter targetName, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final NamedElement pSource, final String pSourceName, final NamedElement pTarget, final String pTargetName, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pSource, pSourceName, pTarget, pTargetName}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pSourceName the fixed value of pattern parameter sourceName, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTargetName the fixed value of pattern parameter targetName, or null if not bound. - * @return the (partial) match object. - * - */ - public NamesOfDependencyEndpoints.Match newMatch(final NamedElement pSource, final String pSourceName, final NamedElement pTarget, final String pTargetName) { - return NamesOfDependencyEndpoints.Match.newMatch(pSource, pSourceName, pTarget, pTargetName); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfsource(final Object[] parameters) { - return rawStreamAllValues(POSITION_SOURCE, parameters).map(NamedElement.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource() { - return rawStreamAllValuesOfsource(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource() { - return rawStreamAllValuesOfsource(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for source. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource(final NamesOfDependencyEndpoints.Match partialMatch) { - return rawStreamAllValuesOfsource(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for source. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource(final String pSourceName, final NamedElement pTarget, final String pTargetName) { - return rawStreamAllValuesOfsource(new Object[]{null, pSourceName, pTarget, pTargetName}); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource(final NamesOfDependencyEndpoints.Match partialMatch) { - return rawStreamAllValuesOfsource(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource(final String pSourceName, final NamedElement pTarget, final String pTargetName) { - return rawStreamAllValuesOfsource(new Object[]{null, pSourceName, pTarget, pTargetName}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for sourceName. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfsourceName(final Object[] parameters) { - return rawStreamAllValues(POSITION_SOURCENAME, parameters).map(String.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for sourceName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsourceName() { - return rawStreamAllValuesOfsourceName(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for sourceName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsourceName() { - return rawStreamAllValuesOfsourceName(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for sourceName. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsourceName(final NamesOfDependencyEndpoints.Match partialMatch) { - return rawStreamAllValuesOfsourceName(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for sourceName. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsourceName(final NamedElement pSource, final NamedElement pTarget, final String pTargetName) { - return rawStreamAllValuesOfsourceName(new Object[]{pSource, null, pTarget, pTargetName}); - } - - /** - * Retrieve the set of values that occur in matches for sourceName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsourceName(final NamesOfDependencyEndpoints.Match partialMatch) { - return rawStreamAllValuesOfsourceName(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for sourceName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsourceName(final NamedElement pSource, final NamedElement pTarget, final String pTargetName) { - return rawStreamAllValuesOfsourceName(new Object[]{pSource, null, pTarget, pTargetName}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftarget(final Object[] parameters) { - return rawStreamAllValues(POSITION_TARGET, parameters).map(NamedElement.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget() { - return rawStreamAllValuesOftarget(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget() { - return rawStreamAllValuesOftarget(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for target. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget(final NamesOfDependencyEndpoints.Match partialMatch) { - return rawStreamAllValuesOftarget(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for target. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget(final NamedElement pSource, final String pSourceName, final String pTargetName) { - return rawStreamAllValuesOftarget(new Object[]{pSource, pSourceName, null, pTargetName}); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget(final NamesOfDependencyEndpoints.Match partialMatch) { - return rawStreamAllValuesOftarget(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget(final NamedElement pSource, final String pSourceName, final String pTargetName) { - return rawStreamAllValuesOftarget(new Object[]{pSource, pSourceName, null, pTargetName}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for targetName. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftargetName(final Object[] parameters) { - return rawStreamAllValues(POSITION_TARGETNAME, parameters).map(String.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for targetName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftargetName() { - return rawStreamAllValuesOftargetName(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for targetName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftargetName() { - return rawStreamAllValuesOftargetName(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for targetName. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftargetName(final NamesOfDependencyEndpoints.Match partialMatch) { - return rawStreamAllValuesOftargetName(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for targetName. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftargetName(final NamedElement pSource, final String pSourceName, final NamedElement pTarget) { - return rawStreamAllValuesOftargetName(new Object[]{pSource, pSourceName, pTarget, null}); - } - - /** - * Retrieve the set of values that occur in matches for targetName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftargetName(final NamesOfDependencyEndpoints.Match partialMatch) { - return rawStreamAllValuesOftargetName(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for targetName. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftargetName(final NamedElement pSource, final String pSourceName, final NamedElement pTarget) { - return rawStreamAllValuesOftargetName(new Object[]{pSource, pSourceName, pTarget, null}).collect(Collectors.toSet()); - } - - @Override - protected NamesOfDependencyEndpoints.Match tupleToMatch(final Tuple t) { - try { - return NamesOfDependencyEndpoints.Match.newMatch((NamedElement) t.get(POSITION_SOURCE), (String) t.get(POSITION_SOURCENAME), (NamedElement) t.get(POSITION_TARGET), (String) t.get(POSITION_TARGETNAME)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected NamesOfDependencyEndpoints.Match arrayToMatch(final Object[] match) { - try { - return NamesOfDependencyEndpoints.Match.newMatch((NamedElement) match[POSITION_SOURCE], (String) match[POSITION_SOURCENAME], (NamedElement) match[POSITION_TARGET], (String) match[POSITION_TARGETNAME]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected NamesOfDependencyEndpoints.Match arrayToMatchMutable(final Object[] match) { - try { - return NamesOfDependencyEndpoints.Match.newMutableMatch((NamedElement) match[POSITION_SOURCE], (String) match[POSITION_SOURCENAME], (NamedElement) match[POSITION_TARGET], (String) match[POSITION_TARGETNAME]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return NamesOfDependencyEndpoints.instance(); - } - } - - private NamesOfDependencyEndpoints() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static NamesOfDependencyEndpoints instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected NamesOfDependencyEndpoints.Matcher instantiate(final ViatraQueryEngine engine) { - return NamesOfDependencyEndpoints.Matcher.on(engine); - } - - @Override - public NamesOfDependencyEndpoints.Matcher instantiate() { - return NamesOfDependencyEndpoints.Matcher.create(); - } - - @Override - public NamesOfDependencyEndpoints.Match newEmptyMatch() { - return NamesOfDependencyEndpoints.Match.newEmptyMatch(); - } - - @Override - public NamesOfDependencyEndpoints.Match newMatch(final Object... parameters) { - return NamesOfDependencyEndpoints.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement) parameters[0], (java.lang.String) parameters[1], (com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement) parameters[2], (java.lang.String) parameters[3]); - } - - /** - * Inner class allowing the singleton instance of {@link NamesOfDependencyEndpoints} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link NamesOfDependencyEndpoints#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final NamesOfDependencyEndpoints INSTANCE = new NamesOfDependencyEndpoints(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final NamesOfDependencyEndpoints.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_source = new PParameter("source", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement")), PParameterDirection.INOUT); - - private final PParameter parameter_sourceName = new PParameter("sourceName", "java.lang.String", new JavaTransitiveInstancesKey(java.lang.String.class), PParameterDirection.INOUT); - - private final PParameter parameter_target = new PParameter("target", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement")), PParameterDirection.INOUT); - - private final PParameter parameter_targetName = new PParameter("targetName", "java.lang.String", new JavaTransitiveInstancesKey(java.lang.String.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_source, parameter_sourceName, parameter_target, parameter_targetName); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.namesOfDependencyEndpoints"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("source","sourceName","target","targetName"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_source = body.getOrCreateVariableByName("source"); - PVariable var_sourceName = body.getOrCreateVariableByName("sourceName"); - PVariable var_target = body.getOrCreateVariableByName("target"); - PVariable var_targetName = body.getOrCreateVariableByName("targetName"); - new TypeConstraint(body, Tuples.flatTupleOf(var_source), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_sourceName), new JavaTransitiveInstancesKey(java.lang.String.class)); - new TypeConstraint(body, Tuples.flatTupleOf(var_target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_targetName), new JavaTransitiveInstancesKey(java.lang.String.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_source, parameter_source), - new ExportedParameter(body, var_sourceName, parameter_sourceName), - new ExportedParameter(body, var_target, parameter_target), - new ExportedParameter(body, var_targetName, parameter_targetName) - )); - // find dependencies(source, target) - new PositivePatternCall(body, Tuples.flatTupleOf(var_source, var_target), Dependencies.instance().getInternalQueryRepresentation()); - // NamedElement.name(source, sourceName) - new TypeConstraint(body, Tuples.flatTupleOf(var_source), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_source, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_0_, var_sourceName); - // NamedElement.name(target, targetName) - new TypeConstraint(body, Tuples.flatTupleOf(var_target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_target, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_1_, var_targetName); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NonBlockClasses.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NonBlockClasses.java deleted file mode 100644 index 919b07a..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NonBlockClasses.java +++ /dev/null @@ -1,549 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.Blocks; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Querying elements that are not the specified type: single negation.
- *          
- *         pattern nonBlockClasses(class : Class) {
- *         	neg find blocks(class);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class NonBlockClasses extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.nonBlockClasses pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class fClass; - - private static List parameterNames = makeImmutableList("class"); - - private Match(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - this.fClass = pClass; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "class": return this.fClass; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fClass; - default: return null; - } - } - - public com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class getValueOfClass() { - return this.fClass; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("class".equals(parameterName) ) { - this.fClass = (com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) newValue; - return true; - } - return false; - } - - public void setClass(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fClass = pClass; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.nonBlockClasses"; - } - - @Override - public List parameterNames() { - return NonBlockClasses.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fClass}; - } - - @Override - public NonBlockClasses.Match toImmutable() { - return isMutable() ? newMatch(fClass) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"class\"=" + prettyPrintValue(fClass)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fClass); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof NonBlockClasses.Match)) { - NonBlockClasses.Match other = (NonBlockClasses.Match) obj; - return Objects.equals(fClass, other.fClass); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public NonBlockClasses specification() { - return NonBlockClasses.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static NonBlockClasses.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static NonBlockClasses.Match newMutableMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return new Mutable(pClass); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the (partial) match object. - * - */ - public static NonBlockClasses.Match newMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return new Immutable(pClass); - } - - private static final class Mutable extends NonBlockClasses.Match { - Mutable(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - super(pClass); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends NonBlockClasses.Match { - Immutable(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - super(pClass); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.nonBlockClasses pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Querying elements that are not the specified type: single negation.
-   *  
-   * pattern nonBlockClasses(class : Class) {
-   * 	neg find blocks(class);
-   * }
-   * 
- * - * @see Match - * @see NonBlockClasses - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static NonBlockClasses.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static NonBlockClasses.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_CLASS = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NonBlockClasses.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawStreamAllMatches(new Object[]{pClass}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawStreamAllMatches(new Object[]{pClass}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawGetOneArbitraryMatch(new Object[]{pClass}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawHasMatch(new Object[]{pClass}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawCountMatches(new Object[]{pClass}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pClass}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the (partial) match object. - * - */ - public NonBlockClasses.Match newMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return NonBlockClasses.Match.newMatch(pClass); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfclass(final Object[] parameters) { - return rawStreamAllValues(POSITION_CLASS, parameters).map(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()); - } - - @Override - protected NonBlockClasses.Match tupleToMatch(final Tuple t) { - try { - return NonBlockClasses.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) t.get(POSITION_CLASS)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected NonBlockClasses.Match arrayToMatch(final Object[] match) { - try { - return NonBlockClasses.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) match[POSITION_CLASS]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected NonBlockClasses.Match arrayToMatchMutable(final Object[] match) { - try { - return NonBlockClasses.Match.newMutableMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) match[POSITION_CLASS]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return NonBlockClasses.instance(); - } - } - - private NonBlockClasses() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static NonBlockClasses instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected NonBlockClasses.Matcher instantiate(final ViatraQueryEngine engine) { - return NonBlockClasses.Matcher.on(engine); - } - - @Override - public NonBlockClasses.Matcher instantiate() { - return NonBlockClasses.Matcher.create(); - } - - @Override - public NonBlockClasses.Match newEmptyMatch() { - return NonBlockClasses.Match.newEmptyMatch(); - } - - @Override - public NonBlockClasses.Match newMatch(final Object... parameters) { - return NonBlockClasses.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link NonBlockClasses} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link NonBlockClasses#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final NonBlockClasses INSTANCE = new NonBlockClasses(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final NonBlockClasses.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_class = new PParameter("class", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_class); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.nonBlockClasses"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("class"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class) - )); - // neg find blocks(class) - new NegativePatternCall(body, Tuples.flatTupleOf(var_class), Blocks.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NumberOfSubregions.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NumberOfSubregions.java deleted file mode 100644 index d107163..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NumberOfSubregions.java +++ /dev/null @@ -1,710 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.Subregions; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing a simple pattern with the "count" aggregator.
- *          
- *         pattern numberOfSubregions(state : State, regionCount : java ^java.lang.Integer) {
- *           	regionCount == count find subregions(state, _subregion);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class NumberOfSubregions extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.numberOfSubregions pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private Integer fRegionCount; - - private static List parameterNames = makeImmutableList("state", "regionCount"); - - private Match(final State pState, final Integer pRegionCount) { - this.fState = pState; - this.fRegionCount = pRegionCount; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - case "regionCount": return this.fRegionCount; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - case 1: return this.fRegionCount; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - public Integer getRegionCount() { - return this.fRegionCount; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - if ("regionCount".equals(parameterName) ) { - this.fRegionCount = (Integer) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - public void setRegionCount(final Integer pRegionCount) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fRegionCount = pRegionCount; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.numberOfSubregions"; - } - - @Override - public List parameterNames() { - return NumberOfSubregions.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState, fRegionCount}; - } - - @Override - public NumberOfSubregions.Match toImmutable() { - return isMutable() ? newMatch(fState, fRegionCount) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState) + ", "); - result.append("\"regionCount\"=" + prettyPrintValue(fRegionCount)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState, fRegionCount); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof NumberOfSubregions.Match)) { - NumberOfSubregions.Match other = (NumberOfSubregions.Match) obj; - return Objects.equals(fState, other.fState) && Objects.equals(fRegionCount, other.fRegionCount); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public NumberOfSubregions specification() { - return NumberOfSubregions.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static NumberOfSubregions.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pRegionCount the fixed value of pattern parameter regionCount, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static NumberOfSubregions.Match newMutableMatch(final State pState, final Integer pRegionCount) { - return new Mutable(pState, pRegionCount); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pRegionCount the fixed value of pattern parameter regionCount, or null if not bound. - * @return the (partial) match object. - * - */ - public static NumberOfSubregions.Match newMatch(final State pState, final Integer pRegionCount) { - return new Immutable(pState, pRegionCount); - } - - private static final class Mutable extends NumberOfSubregions.Match { - Mutable(final State pState, final Integer pRegionCount) { - super(pState, pRegionCount); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends NumberOfSubregions.Match { - Immutable(final State pState, final Integer pRegionCount) { - super(pState, pRegionCount); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.numberOfSubregions pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing a simple pattern with the "count" aggregator.
-   *  
-   * pattern numberOfSubregions(state : State, regionCount : java ^java.lang.Integer) {
-   *   	regionCount == count find subregions(state, _subregion);
-   * }
-   * 
- * - * @see Match - * @see NumberOfSubregions - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static NumberOfSubregions.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static NumberOfSubregions.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final int POSITION_REGIONCOUNT = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NumberOfSubregions.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pRegionCount the fixed value of pattern parameter regionCount, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState, final Integer pRegionCount) { - return rawStreamAllMatches(new Object[]{pState, pRegionCount}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pRegionCount the fixed value of pattern parameter regionCount, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState, final Integer pRegionCount) { - return rawStreamAllMatches(new Object[]{pState, pRegionCount}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pRegionCount the fixed value of pattern parameter regionCount, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState, final Integer pRegionCount) { - return rawGetOneArbitraryMatch(new Object[]{pState, pRegionCount}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pRegionCount the fixed value of pattern parameter regionCount, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState, final Integer pRegionCount) { - return rawHasMatch(new Object[]{pState, pRegionCount}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pRegionCount the fixed value of pattern parameter regionCount, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState, final Integer pRegionCount) { - return rawCountMatches(new Object[]{pState, pRegionCount}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pRegionCount the fixed value of pattern parameter regionCount, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final Integer pRegionCount, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState, pRegionCount}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pRegionCount the fixed value of pattern parameter regionCount, or null if not bound. - * @return the (partial) match object. - * - */ - public NumberOfSubregions.Match newMatch(final State pState, final Integer pRegionCount) { - return NumberOfSubregions.Match.newMatch(pState, pRegionCount); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final NumberOfSubregions.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final Integer pRegionCount) { - return rawStreamAllValuesOfstate(new Object[]{null, pRegionCount}); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final NumberOfSubregions.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final Integer pRegionCount) { - return rawStreamAllValuesOfstate(new Object[]{null, pRegionCount}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for regionCount. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfregionCount(final Object[] parameters) { - return rawStreamAllValues(POSITION_REGIONCOUNT, parameters).map(Integer.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for regionCount. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfregionCount() { - return rawStreamAllValuesOfregionCount(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for regionCount. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfregionCount() { - return rawStreamAllValuesOfregionCount(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for regionCount. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfregionCount(final NumberOfSubregions.Match partialMatch) { - return rawStreamAllValuesOfregionCount(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for regionCount. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfregionCount(final State pState) { - return rawStreamAllValuesOfregionCount(new Object[]{pState, null}); - } - - /** - * Retrieve the set of values that occur in matches for regionCount. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfregionCount(final NumberOfSubregions.Match partialMatch) { - return rawStreamAllValuesOfregionCount(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for regionCount. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfregionCount(final State pState) { - return rawStreamAllValuesOfregionCount(new Object[]{pState, null}).collect(Collectors.toSet()); - } - - @Override - protected NumberOfSubregions.Match tupleToMatch(final Tuple t) { - try { - return NumberOfSubregions.Match.newMatch((State) t.get(POSITION_STATE), (Integer) t.get(POSITION_REGIONCOUNT)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected NumberOfSubregions.Match arrayToMatch(final Object[] match) { - try { - return NumberOfSubregions.Match.newMatch((State) match[POSITION_STATE], (Integer) match[POSITION_REGIONCOUNT]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected NumberOfSubregions.Match arrayToMatchMutable(final Object[] match) { - try { - return NumberOfSubregions.Match.newMutableMatch((State) match[POSITION_STATE], (Integer) match[POSITION_REGIONCOUNT]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return NumberOfSubregions.instance(); - } - } - - private NumberOfSubregions() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static NumberOfSubregions instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected NumberOfSubregions.Matcher instantiate(final ViatraQueryEngine engine) { - return NumberOfSubregions.Matcher.on(engine); - } - - @Override - public NumberOfSubregions.Matcher instantiate() { - return NumberOfSubregions.Matcher.create(); - } - - @Override - public NumberOfSubregions.Match newEmptyMatch() { - return NumberOfSubregions.Match.newEmptyMatch(); - } - - @Override - public NumberOfSubregions.Match newMatch(final Object... parameters) { - return NumberOfSubregions.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0], (java.lang.Integer) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link NumberOfSubregions} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link NumberOfSubregions#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final NumberOfSubregions INSTANCE = new NumberOfSubregions(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final NumberOfSubregions.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final PParameter parameter_regionCount = new PParameter("regionCount", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state, parameter_regionCount); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.numberOfSubregions"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state","regionCount"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_regionCount = body.getOrCreateVariableByName("regionCount"); - PVariable var__subregion = body.getOrCreateVariableByName("_subregion"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_regionCount), new JavaTransitiveInstancesKey(java.lang.Integer.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state), - new ExportedParameter(body, var_regionCount, parameter_regionCount) - )); - // regionCount == count find subregions(state, _subregion) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new PatternMatchCounter(body, Tuples.flatTupleOf(var_state, var__subregion), Subregions.instance().getInternalQueryRepresentation(), var__virtual_0_); - new Equality(body, var_regionCount, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NumberOfTransitiveSubstates.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NumberOfTransitiveSubstates.java deleted file mode 100644 index cb9240a..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/NumberOfTransitiveSubstates.java +++ /dev/null @@ -1,710 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.TransitiveSubstates; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing a transitive closure pattern with the count aggregator.
- *          
- *         pattern numberOfTransitiveSubstates(state : State, transitiveSubstateCount : java ^java.lang.Integer) {
- *         	transitiveSubstateCount == count find transitiveSubstates(state, _);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class NumberOfTransitiveSubstates extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.numberOfTransitiveSubstates pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private Integer fTransitiveSubstateCount; - - private static List parameterNames = makeImmutableList("state", "transitiveSubstateCount"); - - private Match(final State pState, final Integer pTransitiveSubstateCount) { - this.fState = pState; - this.fTransitiveSubstateCount = pTransitiveSubstateCount; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - case "transitiveSubstateCount": return this.fTransitiveSubstateCount; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - case 1: return this.fTransitiveSubstateCount; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - public Integer getTransitiveSubstateCount() { - return this.fTransitiveSubstateCount; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - if ("transitiveSubstateCount".equals(parameterName) ) { - this.fTransitiveSubstateCount = (Integer) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - public void setTransitiveSubstateCount(final Integer pTransitiveSubstateCount) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTransitiveSubstateCount = pTransitiveSubstateCount; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.numberOfTransitiveSubstates"; - } - - @Override - public List parameterNames() { - return NumberOfTransitiveSubstates.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState, fTransitiveSubstateCount}; - } - - @Override - public NumberOfTransitiveSubstates.Match toImmutable() { - return isMutable() ? newMatch(fState, fTransitiveSubstateCount) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState) + ", "); - result.append("\"transitiveSubstateCount\"=" + prettyPrintValue(fTransitiveSubstateCount)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState, fTransitiveSubstateCount); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof NumberOfTransitiveSubstates.Match)) { - NumberOfTransitiveSubstates.Match other = (NumberOfTransitiveSubstates.Match) obj; - return Objects.equals(fState, other.fState) && Objects.equals(fTransitiveSubstateCount, other.fTransitiveSubstateCount); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public NumberOfTransitiveSubstates specification() { - return NumberOfTransitiveSubstates.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static NumberOfTransitiveSubstates.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstateCount the fixed value of pattern parameter transitiveSubstateCount, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static NumberOfTransitiveSubstates.Match newMutableMatch(final State pState, final Integer pTransitiveSubstateCount) { - return new Mutable(pState, pTransitiveSubstateCount); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstateCount the fixed value of pattern parameter transitiveSubstateCount, or null if not bound. - * @return the (partial) match object. - * - */ - public static NumberOfTransitiveSubstates.Match newMatch(final State pState, final Integer pTransitiveSubstateCount) { - return new Immutable(pState, pTransitiveSubstateCount); - } - - private static final class Mutable extends NumberOfTransitiveSubstates.Match { - Mutable(final State pState, final Integer pTransitiveSubstateCount) { - super(pState, pTransitiveSubstateCount); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends NumberOfTransitiveSubstates.Match { - Immutable(final State pState, final Integer pTransitiveSubstateCount) { - super(pState, pTransitiveSubstateCount); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.numberOfTransitiveSubstates pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing a transitive closure pattern with the count aggregator.
-   *  
-   * pattern numberOfTransitiveSubstates(state : State, transitiveSubstateCount : java ^java.lang.Integer) {
-   * 	transitiveSubstateCount == count find transitiveSubstates(state, _);
-   * }
-   * 
- * - * @see Match - * @see NumberOfTransitiveSubstates - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static NumberOfTransitiveSubstates.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static NumberOfTransitiveSubstates.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final int POSITION_TRANSITIVESUBSTATECOUNT = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NumberOfTransitiveSubstates.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstateCount the fixed value of pattern parameter transitiveSubstateCount, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState, final Integer pTransitiveSubstateCount) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstateCount}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstateCount the fixed value of pattern parameter transitiveSubstateCount, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState, final Integer pTransitiveSubstateCount) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstateCount}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstateCount the fixed value of pattern parameter transitiveSubstateCount, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState, final Integer pTransitiveSubstateCount) { - return rawGetOneArbitraryMatch(new Object[]{pState, pTransitiveSubstateCount}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstateCount the fixed value of pattern parameter transitiveSubstateCount, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState, final Integer pTransitiveSubstateCount) { - return rawHasMatch(new Object[]{pState, pTransitiveSubstateCount}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstateCount the fixed value of pattern parameter transitiveSubstateCount, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState, final Integer pTransitiveSubstateCount) { - return rawCountMatches(new Object[]{pState, pTransitiveSubstateCount}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstateCount the fixed value of pattern parameter transitiveSubstateCount, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final Integer pTransitiveSubstateCount, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState, pTransitiveSubstateCount}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstateCount the fixed value of pattern parameter transitiveSubstateCount, or null if not bound. - * @return the (partial) match object. - * - */ - public NumberOfTransitiveSubstates.Match newMatch(final State pState, final Integer pTransitiveSubstateCount) { - return NumberOfTransitiveSubstates.Match.newMatch(pState, pTransitiveSubstateCount); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final NumberOfTransitiveSubstates.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final Integer pTransitiveSubstateCount) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstateCount}); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final NumberOfTransitiveSubstates.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final Integer pTransitiveSubstateCount) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstateCount}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstateCount. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftransitiveSubstateCount(final Object[] parameters) { - return rawStreamAllValues(POSITION_TRANSITIVESUBSTATECOUNT, parameters).map(Integer.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstateCount. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstateCount() { - return rawStreamAllValuesOftransitiveSubstateCount(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstateCount. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstateCount() { - return rawStreamAllValuesOftransitiveSubstateCount(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstateCount. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstateCount(final NumberOfTransitiveSubstates.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstateCount(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstateCount. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstateCount(final State pState) { - return rawStreamAllValuesOftransitiveSubstateCount(new Object[]{pState, null}); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstateCount. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstateCount(final NumberOfTransitiveSubstates.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstateCount(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstateCount. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstateCount(final State pState) { - return rawStreamAllValuesOftransitiveSubstateCount(new Object[]{pState, null}).collect(Collectors.toSet()); - } - - @Override - protected NumberOfTransitiveSubstates.Match tupleToMatch(final Tuple t) { - try { - return NumberOfTransitiveSubstates.Match.newMatch((State) t.get(POSITION_STATE), (Integer) t.get(POSITION_TRANSITIVESUBSTATECOUNT)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected NumberOfTransitiveSubstates.Match arrayToMatch(final Object[] match) { - try { - return NumberOfTransitiveSubstates.Match.newMatch((State) match[POSITION_STATE], (Integer) match[POSITION_TRANSITIVESUBSTATECOUNT]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected NumberOfTransitiveSubstates.Match arrayToMatchMutable(final Object[] match) { - try { - return NumberOfTransitiveSubstates.Match.newMutableMatch((State) match[POSITION_STATE], (Integer) match[POSITION_TRANSITIVESUBSTATECOUNT]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return NumberOfTransitiveSubstates.instance(); - } - } - - private NumberOfTransitiveSubstates() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static NumberOfTransitiveSubstates instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected NumberOfTransitiveSubstates.Matcher instantiate(final ViatraQueryEngine engine) { - return NumberOfTransitiveSubstates.Matcher.on(engine); - } - - @Override - public NumberOfTransitiveSubstates.Matcher instantiate() { - return NumberOfTransitiveSubstates.Matcher.create(); - } - - @Override - public NumberOfTransitiveSubstates.Match newEmptyMatch() { - return NumberOfTransitiveSubstates.Match.newEmptyMatch(); - } - - @Override - public NumberOfTransitiveSubstates.Match newMatch(final Object... parameters) { - return NumberOfTransitiveSubstates.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0], (java.lang.Integer) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link NumberOfTransitiveSubstates} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link NumberOfTransitiveSubstates#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final NumberOfTransitiveSubstates INSTANCE = new NumberOfTransitiveSubstates(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final NumberOfTransitiveSubstates.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final PParameter parameter_transitiveSubstateCount = new PParameter("transitiveSubstateCount", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state, parameter_transitiveSubstateCount); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.numberOfTransitiveSubstates"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state","transitiveSubstateCount"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_transitiveSubstateCount = body.getOrCreateVariableByName("transitiveSubstateCount"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_transitiveSubstateCount), new JavaTransitiveInstancesKey(java.lang.Integer.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state), - new ExportedParameter(body, var_transitiveSubstateCount, parameter_transitiveSubstateCount) - )); - // transitiveSubstateCount == count find transitiveSubstates(state, _) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new PatternMatchCounter(body, Tuples.flatTupleOf(var_state, var___0_), TransitiveSubstates.instance().getInternalQueryRepresentation(), var__virtual_0_); - new Equality(body, var_transitiveSubstateCount, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ParentState.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ParentState.java deleted file mode 100644 index 07958a9..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/ParentState.java +++ /dev/null @@ -1,717 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Simple pattern for transitive closures.
- *          
- *         pattern parentState(state : State, parentState : State) {
- *         	State.region(parentState, subregion);
- *         	Region.subvertex(subregion, state);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class ParentState extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.parentState pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private State fParentState; - - private static List parameterNames = makeImmutableList("state", "parentState"); - - private Match(final State pState, final State pParentState) { - this.fState = pState; - this.fParentState = pParentState; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - case "parentState": return this.fParentState; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - case 1: return this.fParentState; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - public State getParentState() { - return this.fParentState; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - if ("parentState".equals(parameterName) ) { - this.fParentState = (State) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - public void setParentState(final State pParentState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fParentState = pParentState; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.parentState"; - } - - @Override - public List parameterNames() { - return ParentState.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState, fParentState}; - } - - @Override - public ParentState.Match toImmutable() { - return isMutable() ? newMatch(fState, fParentState) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState) + ", "); - result.append("\"parentState\"=" + prettyPrintValue(fParentState)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState, fParentState); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof ParentState.Match)) { - ParentState.Match other = (ParentState.Match) obj; - return Objects.equals(fState, other.fState) && Objects.equals(fParentState, other.fParentState); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public ParentState specification() { - return ParentState.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static ParentState.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static ParentState.Match newMutableMatch(final State pState, final State pParentState) { - return new Mutable(pState, pParentState); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return the (partial) match object. - * - */ - public static ParentState.Match newMatch(final State pState, final State pParentState) { - return new Immutable(pState, pParentState); - } - - private static final class Mutable extends ParentState.Match { - Mutable(final State pState, final State pParentState) { - super(pState, pParentState); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends ParentState.Match { - Immutable(final State pState, final State pParentState) { - super(pState, pParentState); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.parentState pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Simple pattern for transitive closures.
-   *  
-   * pattern parentState(state : State, parentState : State) {
-   * 	State.region(parentState, subregion);
-   * 	Region.subvertex(subregion, state);
-   * }
-   * 
- * - * @see Match - * @see ParentState - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static ParentState.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static ParentState.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final int POSITION_PARENTSTATE = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ParentState.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState, final State pParentState) { - return rawStreamAllMatches(new Object[]{pState, pParentState}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState, final State pParentState) { - return rawStreamAllMatches(new Object[]{pState, pParentState}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState, final State pParentState) { - return rawGetOneArbitraryMatch(new Object[]{pState, pParentState}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState, final State pParentState) { - return rawHasMatch(new Object[]{pState, pParentState}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState, final State pParentState) { - return rawCountMatches(new Object[]{pState, pParentState}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final State pParentState, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState, pParentState}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pParentState the fixed value of pattern parameter parentState, or null if not bound. - * @return the (partial) match object. - * - */ - public ParentState.Match newMatch(final State pState, final State pParentState) { - return ParentState.Match.newMatch(pState, pParentState); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final ParentState.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final State pParentState) { - return rawStreamAllValuesOfstate(new Object[]{null, pParentState}); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final ParentState.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final State pParentState) { - return rawStreamAllValuesOfstate(new Object[]{null, pParentState}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for parentState. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfparentState(final Object[] parameters) { - return rawStreamAllValues(POSITION_PARENTSTATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for parentState. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfparentState() { - return rawStreamAllValuesOfparentState(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for parentState. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfparentState() { - return rawStreamAllValuesOfparentState(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for parentState. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfparentState(final ParentState.Match partialMatch) { - return rawStreamAllValuesOfparentState(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for parentState. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfparentState(final State pState) { - return rawStreamAllValuesOfparentState(new Object[]{pState, null}); - } - - /** - * Retrieve the set of values that occur in matches for parentState. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfparentState(final ParentState.Match partialMatch) { - return rawStreamAllValuesOfparentState(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for parentState. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfparentState(final State pState) { - return rawStreamAllValuesOfparentState(new Object[]{pState, null}).collect(Collectors.toSet()); - } - - @Override - protected ParentState.Match tupleToMatch(final Tuple t) { - try { - return ParentState.Match.newMatch((State) t.get(POSITION_STATE), (State) t.get(POSITION_PARENTSTATE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected ParentState.Match arrayToMatch(final Object[] match) { - try { - return ParentState.Match.newMatch((State) match[POSITION_STATE], (State) match[POSITION_PARENTSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected ParentState.Match arrayToMatchMutable(final Object[] match) { - try { - return ParentState.Match.newMutableMatch((State) match[POSITION_STATE], (State) match[POSITION_PARENTSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return ParentState.instance(); - } - } - - private ParentState() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static ParentState instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected ParentState.Matcher instantiate(final ViatraQueryEngine engine) { - return ParentState.Matcher.on(engine); - } - - @Override - public ParentState.Matcher instantiate() { - return ParentState.Matcher.create(); - } - - @Override - public ParentState.Match newEmptyMatch() { - return ParentState.Match.newEmptyMatch(); - } - - @Override - public ParentState.Match newMatch(final Object... parameters) { - return ParentState.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0], (com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link ParentState} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link ParentState#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final ParentState INSTANCE = new ParentState(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final ParentState.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final PParameter parameter_parentState = new PParameter("parentState", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state, parameter_parentState); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.parentState"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state","parentState"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_parentState = body.getOrCreateVariableByName("parentState"); - PVariable var_subregion = body.getOrCreateVariableByName("subregion"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_parentState), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state), - new ExportedParameter(body, var_parentState, parameter_parentState) - )); - // State.region(parentState, subregion) - new TypeConstraint(body, Tuples.flatTupleOf(var_parentState), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_parentState, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State", "region"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Region"))); - new Equality(body, var__virtual_0_, var_subregion); - // Region.subvertex(subregion, state) - new TypeConstraint(body, Tuples.flatTupleOf(var_subregion), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Region"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_subregion, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Region", "subvertex"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex"))); - new Equality(body, var__virtual_1_, var_state); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Requirements.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Requirements.java deleted file mode 100644 index 4825446..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Requirements.java +++ /dev/null @@ -1,564 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Querying all instances of an EClass that have a short "reference chain".
- *          
- *         pattern requirements(class : Class) {
- *         	Class.appliedStereotypeInstance.classifier.name(class, "Requirement"); 
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class Requirements extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.requirements pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class fClass; - - private static List parameterNames = makeImmutableList("class"); - - private Match(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - this.fClass = pClass; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "class": return this.fClass; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fClass; - default: return null; - } - } - - public com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class getValueOfClass() { - return this.fClass; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("class".equals(parameterName) ) { - this.fClass = (com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) newValue; - return true; - } - return false; - } - - public void setClass(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fClass = pClass; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.requirements"; - } - - @Override - public List parameterNames() { - return Requirements.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fClass}; - } - - @Override - public Requirements.Match toImmutable() { - return isMutable() ? newMatch(fClass) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"class\"=" + prettyPrintValue(fClass)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fClass); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof Requirements.Match)) { - Requirements.Match other = (Requirements.Match) obj; - return Objects.equals(fClass, other.fClass); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public Requirements specification() { - return Requirements.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static Requirements.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static Requirements.Match newMutableMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return new Mutable(pClass); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the (partial) match object. - * - */ - public static Requirements.Match newMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return new Immutable(pClass); - } - - private static final class Mutable extends Requirements.Match { - Mutable(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - super(pClass); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends Requirements.Match { - Immutable(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - super(pClass); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.requirements pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Querying all instances of an EClass that have a short "reference chain".
-   *  
-   * pattern requirements(class : Class) {
-   * 	Class.appliedStereotypeInstance.classifier.name(class, "Requirement"); 
-   * }
-   * 
- * - * @see Match - * @see Requirements - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static Requirements.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static Requirements.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_CLASS = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Requirements.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawStreamAllMatches(new Object[]{pClass}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawStreamAllMatches(new Object[]{pClass}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawGetOneArbitraryMatch(new Object[]{pClass}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawHasMatch(new Object[]{pClass}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawCountMatches(new Object[]{pClass}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pClass}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return the (partial) match object. - * - */ - public Requirements.Match newMatch(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return Requirements.Match.newMatch(pClass); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfclass(final Object[] parameters) { - return rawStreamAllValues(POSITION_CLASS, parameters).map(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()); - } - - @Override - protected Requirements.Match tupleToMatch(final Tuple t) { - try { - return Requirements.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) t.get(POSITION_CLASS)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected Requirements.Match arrayToMatch(final Object[] match) { - try { - return Requirements.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) match[POSITION_CLASS]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected Requirements.Match arrayToMatchMutable(final Object[] match) { - try { - return Requirements.Match.newMutableMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) match[POSITION_CLASS]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return Requirements.instance(); - } - } - - private Requirements() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static Requirements instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected Requirements.Matcher instantiate(final ViatraQueryEngine engine) { - return Requirements.Matcher.on(engine); - } - - @Override - public Requirements.Matcher instantiate() { - return Requirements.Matcher.create(); - } - - @Override - public Requirements.Match newEmptyMatch() { - return Requirements.Match.newEmptyMatch(); - } - - @Override - public Requirements.Match newMatch(final Object... parameters) { - return Requirements.Match.newMatch((com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link Requirements} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link Requirements#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final Requirements INSTANCE = new Requirements(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final Requirements.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_class = new PParameter("class", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_class); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.requirements"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("class"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class) - )); - // Class.appliedStereotypeInstance.classifier.name(class, "Requirement") - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, "Requirement"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Element", "appliedStereotypeInstance"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification", "classifier"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_3_, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/StateWithMostSubstates.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/StateWithMostSubstates.java deleted file mode 100644 index 311fa78..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/StateWithMostSubstates.java +++ /dev/null @@ -1,566 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.NumberOfTransitiveSubstates; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.aggregators.max; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing a transitive closure and count aggregator pattern with the max aggregator.
- *          
- *         pattern stateWithMostSubstates(state : State) {
- *             // the number of substates of this state
- *             find numberOfTransitiveSubstates(state, count);
- *             // is the maximum from all states
- *         	count == max find numberOfTransitiveSubstates(_, #substateCount);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class StateWithMostSubstates extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.stateWithMostSubstates pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private static List parameterNames = makeImmutableList("state"); - - private Match(final State pState) { - this.fState = pState; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.stateWithMostSubstates"; - } - - @Override - public List parameterNames() { - return StateWithMostSubstates.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState}; - } - - @Override - public StateWithMostSubstates.Match toImmutable() { - return isMutable() ? newMatch(fState) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof StateWithMostSubstates.Match)) { - StateWithMostSubstates.Match other = (StateWithMostSubstates.Match) obj; - return Objects.equals(fState, other.fState); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public StateWithMostSubstates specification() { - return StateWithMostSubstates.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static StateWithMostSubstates.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static StateWithMostSubstates.Match newMutableMatch(final State pState) { - return new Mutable(pState); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return the (partial) match object. - * - */ - public static StateWithMostSubstates.Match newMatch(final State pState) { - return new Immutable(pState); - } - - private static final class Mutable extends StateWithMostSubstates.Match { - Mutable(final State pState) { - super(pState); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends StateWithMostSubstates.Match { - Immutable(final State pState) { - super(pState); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.stateWithMostSubstates pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing a transitive closure and count aggregator pattern with the max aggregator.
-   *  
-   * pattern stateWithMostSubstates(state : State) {
-   *     // the number of substates of this state
-   *     find numberOfTransitiveSubstates(state, count);
-   *     // is the maximum from all states
-   * 	count == max find numberOfTransitiveSubstates(_, #substateCount);
-   * }
-   * 
- * - * @see Match - * @see StateWithMostSubstates - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static StateWithMostSubstates.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static StateWithMostSubstates.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(StateWithMostSubstates.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState) { - return rawStreamAllMatches(new Object[]{pState}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState) { - return rawStreamAllMatches(new Object[]{pState}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState) { - return rawGetOneArbitraryMatch(new Object[]{pState}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState) { - return rawHasMatch(new Object[]{pState}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState) { - return rawCountMatches(new Object[]{pState}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return the (partial) match object. - * - */ - public StateWithMostSubstates.Match newMatch(final State pState) { - return StateWithMostSubstates.Match.newMatch(pState); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - @Override - protected StateWithMostSubstates.Match tupleToMatch(final Tuple t) { - try { - return StateWithMostSubstates.Match.newMatch((State) t.get(POSITION_STATE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected StateWithMostSubstates.Match arrayToMatch(final Object[] match) { - try { - return StateWithMostSubstates.Match.newMatch((State) match[POSITION_STATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected StateWithMostSubstates.Match arrayToMatchMutable(final Object[] match) { - try { - return StateWithMostSubstates.Match.newMutableMatch((State) match[POSITION_STATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return StateWithMostSubstates.instance(); - } - } - - private StateWithMostSubstates() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static StateWithMostSubstates instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected StateWithMostSubstates.Matcher instantiate(final ViatraQueryEngine engine) { - return StateWithMostSubstates.Matcher.on(engine); - } - - @Override - public StateWithMostSubstates.Matcher instantiate() { - return StateWithMostSubstates.Matcher.create(); - } - - @Override - public StateWithMostSubstates.Match newEmptyMatch() { - return StateWithMostSubstates.Match.newEmptyMatch(); - } - - @Override - public StateWithMostSubstates.Match newMatch(final Object... parameters) { - return StateWithMostSubstates.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link StateWithMostSubstates} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link StateWithMostSubstates#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final StateWithMostSubstates INSTANCE = new StateWithMostSubstates(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final StateWithMostSubstates.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.stateWithMostSubstates"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_count = body.getOrCreateVariableByName("count"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var__substateCount = body.getOrCreateVariableByName("#substateCount"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state) - )); - // // the number of substates of this state find numberOfTransitiveSubstates(state, count) - new PositivePatternCall(body, Tuples.flatTupleOf(var_state, var_count), NumberOfTransitiveSubstates.instance().getInternalQueryRepresentation()); - // // is the maximum from all states count == max find numberOfTransitiveSubstates(_, #substateCount) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new AggregatorConstraint(new max().getAggregatorLogic(Integer.class), body, Tuples.flatTupleOf(var___0_, var__substateCount), NumberOfTransitiveSubstates.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); - new Equality(body, var_count, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/StatesWithMoreIncomingTransitions.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/StatesWithMoreIncomingTransitions.java deleted file mode 100644 index b0e9cef..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/StatesWithMoreIncomingTransitions.java +++ /dev/null @@ -1,582 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.IncomingTransitions; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing a simple pattern with a check expression. Made for reuse.
- *          
- *         pattern statesWithMoreIncomingTransitions(state : State)  {
- *         	transitionCount == count find incomingTransitions(_, state);
- *         	check (transitionCount {@literal >} 1);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class StatesWithMoreIncomingTransitions extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.statesWithMoreIncomingTransitions pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private static List parameterNames = makeImmutableList("state"); - - private Match(final State pState) { - this.fState = pState; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.statesWithMoreIncomingTransitions"; - } - - @Override - public List parameterNames() { - return StatesWithMoreIncomingTransitions.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState}; - } - - @Override - public StatesWithMoreIncomingTransitions.Match toImmutable() { - return isMutable() ? newMatch(fState) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof StatesWithMoreIncomingTransitions.Match)) { - StatesWithMoreIncomingTransitions.Match other = (StatesWithMoreIncomingTransitions.Match) obj; - return Objects.equals(fState, other.fState); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public StatesWithMoreIncomingTransitions specification() { - return StatesWithMoreIncomingTransitions.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static StatesWithMoreIncomingTransitions.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static StatesWithMoreIncomingTransitions.Match newMutableMatch(final State pState) { - return new Mutable(pState); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return the (partial) match object. - * - */ - public static StatesWithMoreIncomingTransitions.Match newMatch(final State pState) { - return new Immutable(pState); - } - - private static final class Mutable extends StatesWithMoreIncomingTransitions.Match { - Mutable(final State pState) { - super(pState); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends StatesWithMoreIncomingTransitions.Match { - Immutable(final State pState) { - super(pState); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.statesWithMoreIncomingTransitions pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing a simple pattern with a check expression. Made for reuse.
-   *  
-   * pattern statesWithMoreIncomingTransitions(state : State)  {
-   * 	transitionCount == count find incomingTransitions(_, state);
-   * 	check (transitionCount {@literal >} 1);
-   * }
-   * 
- * - * @see Match - * @see StatesWithMoreIncomingTransitions - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static StatesWithMoreIncomingTransitions.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static StatesWithMoreIncomingTransitions.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(StatesWithMoreIncomingTransitions.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState) { - return rawStreamAllMatches(new Object[]{pState}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState) { - return rawStreamAllMatches(new Object[]{pState}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState) { - return rawGetOneArbitraryMatch(new Object[]{pState}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState) { - return rawHasMatch(new Object[]{pState}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState) { - return rawCountMatches(new Object[]{pState}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return the (partial) match object. - * - */ - public StatesWithMoreIncomingTransitions.Match newMatch(final State pState) { - return StatesWithMoreIncomingTransitions.Match.newMatch(pState); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - @Override - protected StatesWithMoreIncomingTransitions.Match tupleToMatch(final Tuple t) { - try { - return StatesWithMoreIncomingTransitions.Match.newMatch((State) t.get(POSITION_STATE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected StatesWithMoreIncomingTransitions.Match arrayToMatch(final Object[] match) { - try { - return StatesWithMoreIncomingTransitions.Match.newMatch((State) match[POSITION_STATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected StatesWithMoreIncomingTransitions.Match arrayToMatchMutable(final Object[] match) { - try { - return StatesWithMoreIncomingTransitions.Match.newMutableMatch((State) match[POSITION_STATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return StatesWithMoreIncomingTransitions.instance(); - } - } - - private StatesWithMoreIncomingTransitions() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static StatesWithMoreIncomingTransitions instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected StatesWithMoreIncomingTransitions.Matcher instantiate(final ViatraQueryEngine engine) { - return StatesWithMoreIncomingTransitions.Matcher.on(engine); - } - - @Override - public StatesWithMoreIncomingTransitions.Matcher instantiate() { - return StatesWithMoreIncomingTransitions.Matcher.create(); - } - - @Override - public StatesWithMoreIncomingTransitions.Match newEmptyMatch() { - return StatesWithMoreIncomingTransitions.Match.newEmptyMatch(); - } - - @Override - public StatesWithMoreIncomingTransitions.Match newMatch(final Object... parameters) { - return StatesWithMoreIncomingTransitions.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link StatesWithMoreIncomingTransitions} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link StatesWithMoreIncomingTransitions#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final StatesWithMoreIncomingTransitions INSTANCE = new StatesWithMoreIncomingTransitions(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final StatesWithMoreIncomingTransitions.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.statesWithMoreIncomingTransitions"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_transitionCount = body.getOrCreateVariableByName("transitionCount"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state) - )); - // transitionCount == count find incomingTransitions(_, state) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new PatternMatchCounter(body, Tuples.flatTupleOf(var___0_, var_state), IncomingTransitions.instance().getInternalQueryRepresentation(), var__virtual_0_); - new Equality(body, var_transitionCount, var__virtual_0_); - // check (transitionCount > 1) - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern statesWithMoreIncomingTransitions"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("transitionCount");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - Integer transitionCount = (Integer) provider.getValue("transitionCount"); - return evaluateExpression_1_1(transitionCount); - } - }, null); - bodies.add(body); - } - return bodies; - } - } - - private static boolean evaluateExpression_1_1(final Integer transitionCount) { - return ((transitionCount).intValue() > 1); - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/StatesWithShortNames.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/StatesWithShortNames.java deleted file mode 100644 index c9c9ba8..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/StatesWithShortNames.java +++ /dev/null @@ -1,600 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing a simple pattern with transitive closure.
- *          
- *         //pattern transitiveSubstates(state : State, transitiveSubstate : State) {	
- *         //	find parentState+(transitiveSubstate, state);
- *         //}
- *         
- *         
- *           Returns states with short names.
- *          
- *         pattern statesWithShortNames(state : State) {
- *         	State.name(state, name);
- *         	check(name.length {@literal <} 6);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class StatesWithShortNames extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.statesWithShortNames pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private static List parameterNames = makeImmutableList("state"); - - private Match(final State pState) { - this.fState = pState; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.statesWithShortNames"; - } - - @Override - public List parameterNames() { - return StatesWithShortNames.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState}; - } - - @Override - public StatesWithShortNames.Match toImmutable() { - return isMutable() ? newMatch(fState) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof StatesWithShortNames.Match)) { - StatesWithShortNames.Match other = (StatesWithShortNames.Match) obj; - return Objects.equals(fState, other.fState); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public StatesWithShortNames specification() { - return StatesWithShortNames.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static StatesWithShortNames.Match newEmptyMatch() { - return new Mutable(null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static StatesWithShortNames.Match newMutableMatch(final State pState) { - return new Mutable(pState); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return the (partial) match object. - * - */ - public static StatesWithShortNames.Match newMatch(final State pState) { - return new Immutable(pState); - } - - private static final class Mutable extends StatesWithShortNames.Match { - Mutable(final State pState) { - super(pState); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends StatesWithShortNames.Match { - Immutable(final State pState) { - super(pState); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.statesWithShortNames pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing a simple pattern with transitive closure.
-   *  
-   * //pattern transitiveSubstates(state : State, transitiveSubstate : State) {	
-   * //	find parentState+(transitiveSubstate, state);
-   * //}
-   * 
-   * 
-   *   Returns states with short names.
-   *  
-   * pattern statesWithShortNames(state : State) {
-   * 	State.name(state, name);
-   * 	check(name.length {@literal <} 6);
-   * }
-   * 
- * - * @see Match - * @see StatesWithShortNames - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static StatesWithShortNames.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static StatesWithShortNames.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(StatesWithShortNames.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState) { - return rawStreamAllMatches(new Object[]{pState}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState) { - return rawStreamAllMatches(new Object[]{pState}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState) { - return rawGetOneArbitraryMatch(new Object[]{pState}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState) { - return rawHasMatch(new Object[]{pState}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState) { - return rawCountMatches(new Object[]{pState}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @return the (partial) match object. - * - */ - public StatesWithShortNames.Match newMatch(final State pState) { - return StatesWithShortNames.Match.newMatch(pState); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - @Override - protected StatesWithShortNames.Match tupleToMatch(final Tuple t) { - try { - return StatesWithShortNames.Match.newMatch((State) t.get(POSITION_STATE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected StatesWithShortNames.Match arrayToMatch(final Object[] match) { - try { - return StatesWithShortNames.Match.newMatch((State) match[POSITION_STATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected StatesWithShortNames.Match arrayToMatchMutable(final Object[] match) { - try { - return StatesWithShortNames.Match.newMutableMatch((State) match[POSITION_STATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return StatesWithShortNames.instance(); - } - } - - private StatesWithShortNames() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static StatesWithShortNames instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected StatesWithShortNames.Matcher instantiate(final ViatraQueryEngine engine) { - return StatesWithShortNames.Matcher.on(engine); - } - - @Override - public StatesWithShortNames.Matcher instantiate() { - return StatesWithShortNames.Matcher.create(); - } - - @Override - public StatesWithShortNames.Match newEmptyMatch() { - return StatesWithShortNames.Match.newEmptyMatch(); - } - - @Override - public StatesWithShortNames.Match newMatch(final Object... parameters) { - return StatesWithShortNames.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link StatesWithShortNames} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link StatesWithShortNames#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final StatesWithShortNames INSTANCE = new StatesWithShortNames(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final StatesWithShortNames.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.statesWithShortNames"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_name = body.getOrCreateVariableByName("name"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state) - )); - // State.name(state, name) - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_0_, var_name); - // check(name.length < 6) - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern statesWithShortNames"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("name");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - String name = (String) provider.getValue("name"); - return evaluateExpression_1_1(name); - } - }, null); - bodies.add(body); - } - return bodies; - } - } - - private static boolean evaluateExpression_1_1(final String name) { - int _length = name.length(); - boolean _lessThan = (_length < 6); - return _lessThan; - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Subregions.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Subregions.java deleted file mode 100644 index 1f2f65c..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Subregions.java +++ /dev/null @@ -1,737 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Region; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Using recursion, eval and disjunction.
- *           Cannot be evaluated using local search because of recursion!
- *          
- *         //pattern qualifiedStateName(state : State, name : java ^java.lang.String) {
- *         //	find parentState(state, parentState);
- *         //    State.name(state, simpleName);
- *         //    find qualifiedStateName(parentState, parentName);
- *         //    name == eval (parentName + "." + simpleName);
- *         //} or { 
- *         //    neg find parentState(state, _);
- *         //    State.name(state, name);
- *         //}
- *         
- *         
- *           Simple pattern for aggregators.
- *          
- *         pattern subregions(state : State, subregion : Region) {
- *           	State.region(state, subregion);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class Subregions extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.subregions pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private Region fSubregion; - - private static List parameterNames = makeImmutableList("state", "subregion"); - - private Match(final State pState, final Region pSubregion) { - this.fState = pState; - this.fSubregion = pSubregion; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - case "subregion": return this.fSubregion; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - case 1: return this.fSubregion; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - public Region getSubregion() { - return this.fSubregion; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - if ("subregion".equals(parameterName) ) { - this.fSubregion = (Region) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - public void setSubregion(final Region pSubregion) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fSubregion = pSubregion; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.subregions"; - } - - @Override - public List parameterNames() { - return Subregions.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState, fSubregion}; - } - - @Override - public Subregions.Match toImmutable() { - return isMutable() ? newMatch(fState, fSubregion) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState) + ", "); - result.append("\"subregion\"=" + prettyPrintValue(fSubregion)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState, fSubregion); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof Subregions.Match)) { - Subregions.Match other = (Subregions.Match) obj; - return Objects.equals(fState, other.fState) && Objects.equals(fSubregion, other.fSubregion); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public Subregions specification() { - return Subregions.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static Subregions.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pSubregion the fixed value of pattern parameter subregion, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static Subregions.Match newMutableMatch(final State pState, final Region pSubregion) { - return new Mutable(pState, pSubregion); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pSubregion the fixed value of pattern parameter subregion, or null if not bound. - * @return the (partial) match object. - * - */ - public static Subregions.Match newMatch(final State pState, final Region pSubregion) { - return new Immutable(pState, pSubregion); - } - - private static final class Mutable extends Subregions.Match { - Mutable(final State pState, final Region pSubregion) { - super(pState, pSubregion); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends Subregions.Match { - Immutable(final State pState, final Region pSubregion) { - super(pState, pSubregion); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.subregions pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Using recursion, eval and disjunction.
-   *   Cannot be evaluated using local search because of recursion!
-   *  
-   * //pattern qualifiedStateName(state : State, name : java ^java.lang.String) {
-   * //	find parentState(state, parentState);
-   * //    State.name(state, simpleName);
-   * //    find qualifiedStateName(parentState, parentName);
-   * //    name == eval (parentName + "." + simpleName);
-   * //} or { 
-   * //    neg find parentState(state, _);
-   * //    State.name(state, name);
-   * //}
-   * 
-   * 
-   *   Simple pattern for aggregators.
-   *  
-   * pattern subregions(state : State, subregion : Region) {
-   *   	State.region(state, subregion);
-   * }
-   * 
- * - * @see Match - * @see Subregions - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static Subregions.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static Subregions.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final int POSITION_SUBREGION = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Subregions.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pSubregion the fixed value of pattern parameter subregion, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState, final Region pSubregion) { - return rawStreamAllMatches(new Object[]{pState, pSubregion}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pSubregion the fixed value of pattern parameter subregion, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState, final Region pSubregion) { - return rawStreamAllMatches(new Object[]{pState, pSubregion}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pSubregion the fixed value of pattern parameter subregion, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState, final Region pSubregion) { - return rawGetOneArbitraryMatch(new Object[]{pState, pSubregion}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pSubregion the fixed value of pattern parameter subregion, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState, final Region pSubregion) { - return rawHasMatch(new Object[]{pState, pSubregion}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pSubregion the fixed value of pattern parameter subregion, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState, final Region pSubregion) { - return rawCountMatches(new Object[]{pState, pSubregion}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pSubregion the fixed value of pattern parameter subregion, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final Region pSubregion, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState, pSubregion}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pSubregion the fixed value of pattern parameter subregion, or null if not bound. - * @return the (partial) match object. - * - */ - public Subregions.Match newMatch(final State pState, final Region pSubregion) { - return Subregions.Match.newMatch(pState, pSubregion); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final Subregions.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final Region pSubregion) { - return rawStreamAllValuesOfstate(new Object[]{null, pSubregion}); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final Subregions.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final Region pSubregion) { - return rawStreamAllValuesOfstate(new Object[]{null, pSubregion}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for subregion. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfsubregion(final Object[] parameters) { - return rawStreamAllValues(POSITION_SUBREGION, parameters).map(Region.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for subregion. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsubregion() { - return rawStreamAllValuesOfsubregion(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for subregion. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsubregion() { - return rawStreamAllValuesOfsubregion(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for subregion. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsubregion(final Subregions.Match partialMatch) { - return rawStreamAllValuesOfsubregion(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for subregion. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsubregion(final State pState) { - return rawStreamAllValuesOfsubregion(new Object[]{pState, null}); - } - - /** - * Retrieve the set of values that occur in matches for subregion. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsubregion(final Subregions.Match partialMatch) { - return rawStreamAllValuesOfsubregion(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for subregion. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsubregion(final State pState) { - return rawStreamAllValuesOfsubregion(new Object[]{pState, null}).collect(Collectors.toSet()); - } - - @Override - protected Subregions.Match tupleToMatch(final Tuple t) { - try { - return Subregions.Match.newMatch((State) t.get(POSITION_STATE), (Region) t.get(POSITION_SUBREGION)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected Subregions.Match arrayToMatch(final Object[] match) { - try { - return Subregions.Match.newMatch((State) match[POSITION_STATE], (Region) match[POSITION_SUBREGION]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected Subregions.Match arrayToMatchMutable(final Object[] match) { - try { - return Subregions.Match.newMutableMatch((State) match[POSITION_STATE], (Region) match[POSITION_SUBREGION]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return Subregions.instance(); - } - } - - private Subregions() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static Subregions instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected Subregions.Matcher instantiate(final ViatraQueryEngine engine) { - return Subregions.Matcher.on(engine); - } - - @Override - public Subregions.Matcher instantiate() { - return Subregions.Matcher.create(); - } - - @Override - public Subregions.Match newEmptyMatch() { - return Subregions.Match.newEmptyMatch(); - } - - @Override - public Subregions.Match newMatch(final Object... parameters) { - return Subregions.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0], (com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Region) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link Subregions} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link Subregions#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final Subregions INSTANCE = new Subregions(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final Subregions.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final PParameter parameter_subregion = new PParameter("subregion", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Region", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Region")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state, parameter_subregion); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.subregions"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state","subregion"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_subregion = body.getOrCreateVariableByName("subregion"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_subregion), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Region"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state), - new ExportedParameter(body, var_subregion, parameter_subregion) - )); - // State.region(state, subregion) - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State", "region"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Region"))); - new Equality(body, var__virtual_0_, var_subregion); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitionPointingOutOfCompState.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitionPointingOutOfCompState.java deleted file mode 100644 index 288ac5d..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitionPointingOutOfCompState.java +++ /dev/null @@ -1,951 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.ParentState; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Transition; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Vertex; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Cartesian product of classes.
- *          
- *         //pattern productOfClasses(lhs : Class, lhsName : java ^java.lang.String, rhs : Class, rhsName : java ^java.lang.String) {
- *         //	Class.name(lhs, lhsName);
- *         //    Class.name(rhs, rhsName);
- *         //}
- *         
- *         
- *           Cartesian product of classes and a filter using a check.
- *          
- *         //private pattern hasLongerName(lhs : Class, rhs : Class) {
- *         //    find productOfClasses(lhs, lhsName, rhs, rhsName);
- *         //    check (lhsName.length {@literal <} rhsName.length); 
- *         //}
- *         
- *         
- *           Selecting an element reusing a Cartesian product.
- *          
- *         //pattern elementWithShortestName(element : Class) {
- *         //	find requirements(element); // If this in not here, we run out of memory
- *         //	neg find hasLongerName(_, element);
- *         //}
- *         
- *         
- *           A transition that connects two states with the following properties
- *           - Source state is a member of a composite state
- *           - Target state is a member of the same state machine, however not contained in a composite state
- *           - Target state has an outgoing transition towards a final state
- *           
- *          
- *         pattern transitionPointingOutOfCompState(source : State, target : Vertex, transition : Transition) {
- *         	Transition.source(transition, source);
- *         	Transition.target(transition, target);
- *         	
- *         	//pattern for target side element
- *         	Vertex.container(target, targetRegion);
- *         	Region.stateMachine(targetRegion, _);
- *         	Vertex.outgoing(target, targetVertexTransition);
- *         	Transition.target(targetVertexTransition, finalState);
- *         	FinalState(finalState);
- *         	
- *         	//Pattern for source side element
- *         	find parentState+(source, sourceParent);
- *         	State.container.stateMachine(sourceParent, _ );
- *         	
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class TransitionPointingOutOfCompState extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.transitionPointingOutOfCompState pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fSource; - - private Vertex fTarget; - - private Transition fTransition; - - private static List parameterNames = makeImmutableList("source", "target", "transition"); - - private Match(final State pSource, final Vertex pTarget, final Transition pTransition) { - this.fSource = pSource; - this.fTarget = pTarget; - this.fTransition = pTransition; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "source": return this.fSource; - case "target": return this.fTarget; - case "transition": return this.fTransition; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fSource; - case 1: return this.fTarget; - case 2: return this.fTransition; - default: return null; - } - } - - public State getSource() { - return this.fSource; - } - - public Vertex getTarget() { - return this.fTarget; - } - - public Transition getTransition() { - return this.fTransition; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("source".equals(parameterName) ) { - this.fSource = (State) newValue; - return true; - } - if ("target".equals(parameterName) ) { - this.fTarget = (Vertex) newValue; - return true; - } - if ("transition".equals(parameterName) ) { - this.fTransition = (Transition) newValue; - return true; - } - return false; - } - - public void setSource(final State pSource) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fSource = pSource; - } - - public void setTarget(final Vertex pTarget) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTarget = pTarget; - } - - public void setTransition(final Transition pTransition) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTransition = pTransition; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.transitionPointingOutOfCompState"; - } - - @Override - public List parameterNames() { - return TransitionPointingOutOfCompState.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fSource, fTarget, fTransition}; - } - - @Override - public TransitionPointingOutOfCompState.Match toImmutable() { - return isMutable() ? newMatch(fSource, fTarget, fTransition) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"source\"=" + prettyPrintValue(fSource) + ", "); - result.append("\"target\"=" + prettyPrintValue(fTarget) + ", "); - result.append("\"transition\"=" + prettyPrintValue(fTransition)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fSource, fTarget, fTransition); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof TransitionPointingOutOfCompState.Match)) { - TransitionPointingOutOfCompState.Match other = (TransitionPointingOutOfCompState.Match) obj; - return Objects.equals(fSource, other.fSource) && Objects.equals(fTarget, other.fTarget) && Objects.equals(fTransition, other.fTransition); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public TransitionPointingOutOfCompState specification() { - return TransitionPointingOutOfCompState.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static TransitionPointingOutOfCompState.Match newEmptyMatch() { - return new Mutable(null, null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static TransitionPointingOutOfCompState.Match newMutableMatch(final State pSource, final Vertex pTarget, final Transition pTransition) { - return new Mutable(pSource, pTarget, pTransition); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @return the (partial) match object. - * - */ - public static TransitionPointingOutOfCompState.Match newMatch(final State pSource, final Vertex pTarget, final Transition pTransition) { - return new Immutable(pSource, pTarget, pTransition); - } - - private static final class Mutable extends TransitionPointingOutOfCompState.Match { - Mutable(final State pSource, final Vertex pTarget, final Transition pTransition) { - super(pSource, pTarget, pTransition); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends TransitionPointingOutOfCompState.Match { - Immutable(final State pSource, final Vertex pTarget, final Transition pTransition) { - super(pSource, pTarget, pTransition); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.transitionPointingOutOfCompState pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Cartesian product of classes.
-   *  
-   * //pattern productOfClasses(lhs : Class, lhsName : java ^java.lang.String, rhs : Class, rhsName : java ^java.lang.String) {
-   * //	Class.name(lhs, lhsName);
-   * //    Class.name(rhs, rhsName);
-   * //}
-   * 
-   * 
-   *   Cartesian product of classes and a filter using a check.
-   *  
-   * //private pattern hasLongerName(lhs : Class, rhs : Class) {
-   * //    find productOfClasses(lhs, lhsName, rhs, rhsName);
-   * //    check (lhsName.length {@literal <} rhsName.length); 
-   * //}
-   * 
-   * 
-   *   Selecting an element reusing a Cartesian product.
-   *  
-   * //pattern elementWithShortestName(element : Class) {
-   * //	find requirements(element); // If this in not here, we run out of memory
-   * //	neg find hasLongerName(_, element);
-   * //}
-   * 
-   * 
-   *   A transition that connects two states with the following properties
-   *   - Source state is a member of a composite state
-   *   - Target state is a member of the same state machine, however not contained in a composite state
-   *   - Target state has an outgoing transition towards a final state
-   *   
-   *  
-   * pattern transitionPointingOutOfCompState(source : State, target : Vertex, transition : Transition) {
-   * 	Transition.source(transition, source);
-   * 	Transition.target(transition, target);
-   * 	
-   * 	//pattern for target side element
-   * 	Vertex.container(target, targetRegion);
-   * 	Region.stateMachine(targetRegion, _);
-   * 	Vertex.outgoing(target, targetVertexTransition);
-   * 	Transition.target(targetVertexTransition, finalState);
-   * 	FinalState(finalState);
-   * 	
-   * 	//Pattern for source side element
-   * 	find parentState+(source, sourceParent);
-   * 	State.container.stateMachine(sourceParent, _ );
-   * 	
-   * }
-   * 
- * - * @see Match - * @see TransitionPointingOutOfCompState - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static TransitionPointingOutOfCompState.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static TransitionPointingOutOfCompState.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_SOURCE = 0; - - private static final int POSITION_TARGET = 1; - - private static final int POSITION_TRANSITION = 2; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TransitionPointingOutOfCompState.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pSource, final Vertex pTarget, final Transition pTransition) { - return rawStreamAllMatches(new Object[]{pSource, pTarget, pTransition}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pSource, final Vertex pTarget, final Transition pTransition) { - return rawStreamAllMatches(new Object[]{pSource, pTarget, pTransition}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pSource, final Vertex pTarget, final Transition pTransition) { - return rawGetOneArbitraryMatch(new Object[]{pSource, pTarget, pTransition}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pSource, final Vertex pTarget, final Transition pTransition) { - return rawHasMatch(new Object[]{pSource, pTarget, pTransition}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pSource, final Vertex pTarget, final Transition pTransition) { - return rawCountMatches(new Object[]{pSource, pTarget, pTransition}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pSource, final Vertex pTarget, final Transition pTransition, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pSource, pTarget, pTransition}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pSource the fixed value of pattern parameter source, or null if not bound. - * @param pTarget the fixed value of pattern parameter target, or null if not bound. - * @param pTransition the fixed value of pattern parameter transition, or null if not bound. - * @return the (partial) match object. - * - */ - public TransitionPointingOutOfCompState.Match newMatch(final State pSource, final Vertex pTarget, final Transition pTransition) { - return TransitionPointingOutOfCompState.Match.newMatch(pSource, pTarget, pTransition); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfsource(final Object[] parameters) { - return rawStreamAllValues(POSITION_SOURCE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource() { - return rawStreamAllValuesOfsource(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource() { - return rawStreamAllValuesOfsource(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for source. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource(final TransitionPointingOutOfCompState.Match partialMatch) { - return rawStreamAllValuesOfsource(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for source. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsource(final Vertex pTarget, final Transition pTransition) { - return rawStreamAllValuesOfsource(new Object[]{null, pTarget, pTransition}); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource(final TransitionPointingOutOfCompState.Match partialMatch) { - return rawStreamAllValuesOfsource(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for source. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsource(final Vertex pTarget, final Transition pTransition) { - return rawStreamAllValuesOfsource(new Object[]{null, pTarget, pTransition}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftarget(final Object[] parameters) { - return rawStreamAllValues(POSITION_TARGET, parameters).map(Vertex.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget() { - return rawStreamAllValuesOftarget(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget() { - return rawStreamAllValuesOftarget(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for target. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget(final TransitionPointingOutOfCompState.Match partialMatch) { - return rawStreamAllValuesOftarget(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for target. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftarget(final State pSource, final Transition pTransition) { - return rawStreamAllValuesOftarget(new Object[]{pSource, null, pTransition}); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget(final TransitionPointingOutOfCompState.Match partialMatch) { - return rawStreamAllValuesOftarget(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for target. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftarget(final State pSource, final Transition pTransition) { - return rawStreamAllValuesOftarget(new Object[]{pSource, null, pTransition}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftransition(final Object[] parameters) { - return rawStreamAllValues(POSITION_TRANSITION, parameters).map(Transition.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransition() { - return rawStreamAllValuesOftransition(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransition() { - return rawStreamAllValuesOftransition(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for transition. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransition(final TransitionPointingOutOfCompState.Match partialMatch) { - return rawStreamAllValuesOftransition(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for transition. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransition(final State pSource, final Vertex pTarget) { - return rawStreamAllValuesOftransition(new Object[]{pSource, pTarget, null}); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransition(final TransitionPointingOutOfCompState.Match partialMatch) { - return rawStreamAllValuesOftransition(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transition. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransition(final State pSource, final Vertex pTarget) { - return rawStreamAllValuesOftransition(new Object[]{pSource, pTarget, null}).collect(Collectors.toSet()); - } - - @Override - protected TransitionPointingOutOfCompState.Match tupleToMatch(final Tuple t) { - try { - return TransitionPointingOutOfCompState.Match.newMatch((State) t.get(POSITION_SOURCE), (Vertex) t.get(POSITION_TARGET), (Transition) t.get(POSITION_TRANSITION)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected TransitionPointingOutOfCompState.Match arrayToMatch(final Object[] match) { - try { - return TransitionPointingOutOfCompState.Match.newMatch((State) match[POSITION_SOURCE], (Vertex) match[POSITION_TARGET], (Transition) match[POSITION_TRANSITION]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected TransitionPointingOutOfCompState.Match arrayToMatchMutable(final Object[] match) { - try { - return TransitionPointingOutOfCompState.Match.newMutableMatch((State) match[POSITION_SOURCE], (Vertex) match[POSITION_TARGET], (Transition) match[POSITION_TRANSITION]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return TransitionPointingOutOfCompState.instance(); - } - } - - private TransitionPointingOutOfCompState() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static TransitionPointingOutOfCompState instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected TransitionPointingOutOfCompState.Matcher instantiate(final ViatraQueryEngine engine) { - return TransitionPointingOutOfCompState.Matcher.on(engine); - } - - @Override - public TransitionPointingOutOfCompState.Matcher instantiate() { - return TransitionPointingOutOfCompState.Matcher.create(); - } - - @Override - public TransitionPointingOutOfCompState.Match newEmptyMatch() { - return TransitionPointingOutOfCompState.Match.newEmptyMatch(); - } - - @Override - public TransitionPointingOutOfCompState.Match newMatch(final Object... parameters) { - return TransitionPointingOutOfCompState.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0], (com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Vertex) parameters[1], (com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Transition) parameters[2]); - } - - /** - * Inner class allowing the singleton instance of {@link TransitionPointingOutOfCompState} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link TransitionPointingOutOfCompState#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final TransitionPointingOutOfCompState INSTANCE = new TransitionPointingOutOfCompState(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final TransitionPointingOutOfCompState.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_source = new PParameter("source", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final PParameter parameter_target = new PParameter("target", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Vertex", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex")), PParameterDirection.INOUT); - - private final PParameter parameter_transition = new PParameter("transition", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Transition", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_source, parameter_target, parameter_transition); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.transitionPointingOutOfCompState"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("source","target","transition"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_source = body.getOrCreateVariableByName("source"); - PVariable var_target = body.getOrCreateVariableByName("target"); - PVariable var_transition = body.getOrCreateVariableByName("transition"); - PVariable var_targetRegion = body.getOrCreateVariableByName("targetRegion"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var_targetVertexTransition = body.getOrCreateVariableByName("targetVertexTransition"); - PVariable var_finalState = body.getOrCreateVariableByName("finalState"); - PVariable var_sourceParent = body.getOrCreateVariableByName("sourceParent"); - PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_source), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_transition), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_source, parameter_source), - new ExportedParameter(body, var_target, parameter_target), - new ExportedParameter(body, var_transition, parameter_transition) - )); - // Transition.source(transition, source) - new TypeConstraint(body, Tuples.flatTupleOf(var_transition), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_transition, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition", "source"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex"))); - new Equality(body, var__virtual_0_, var_source); - // Transition.target(transition, target) - new TypeConstraint(body, Tuples.flatTupleOf(var_transition), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_transition, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition", "target"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex"))); - new Equality(body, var__virtual_1_, var_target); - // //pattern for target side element Vertex.container(target, targetRegion) - new TypeConstraint(body, Tuples.flatTupleOf(var_target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_target, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex", "container"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Region"))); - new Equality(body, var__virtual_2_, var_targetRegion); - // Region.stateMachine(targetRegion, _) - new TypeConstraint(body, Tuples.flatTupleOf(var_targetRegion), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Region"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_targetRegion, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Region", "stateMachine"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "StateMachine"))); - new Equality(body, var__virtual_3_, var___0_); - // Vertex.outgoing(target, targetVertexTransition) - new TypeConstraint(body, Tuples.flatTupleOf(var_target), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex"))); - PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_target, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex", "outgoing"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - new Equality(body, var__virtual_4_, var_targetVertexTransition); - // Transition.target(targetVertexTransition, finalState) - new TypeConstraint(body, Tuples.flatTupleOf(var_targetVertexTransition), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - PVariable var__virtual_5_ = body.getOrCreateVariableByName(".virtual{5}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_targetVertexTransition, var__virtual_5_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition", "target"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_5_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex"))); - new Equality(body, var__virtual_5_, var_finalState); - // FinalState(finalState) - new TypeConstraint(body, Tuples.flatTupleOf(var_finalState), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "FinalState"))); - // //Pattern for source side element find parentState+(source, sourceParent) - new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_source, var_sourceParent), ParentState.instance().getInternalQueryRepresentation()); - // State.container.stateMachine(sourceParent, _ ) - new TypeConstraint(body, Tuples.flatTupleOf(var_sourceParent), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - PVariable var__virtual_6_ = body.getOrCreateVariableByName(".virtual{6}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_sourceParent, var__virtual_6_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Vertex", "container"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_6_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Region"))); - PVariable var__virtual_7_ = body.getOrCreateVariableByName(".virtual{7}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_6_, var__virtual_7_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Region", "stateMachine"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_7_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "StateMachine"))); - new Equality(body, var__virtual_7_, var___1_); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstates.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstates.java deleted file mode 100644 index 5696d4f..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstates.java +++ /dev/null @@ -1,704 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.ParentState; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing a simple pattern with transitive closure.
- *          
- *         pattern transitiveSubstates(state : State, transitiveSubstate : State) {
- *         	find parentState+(transitiveSubstate, state);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class TransitiveSubstates extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstates pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private State fTransitiveSubstate; - - private static List parameterNames = makeImmutableList("state", "transitiveSubstate"); - - private Match(final State pState, final State pTransitiveSubstate) { - this.fState = pState; - this.fTransitiveSubstate = pTransitiveSubstate; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - case "transitiveSubstate": return this.fTransitiveSubstate; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - case 1: return this.fTransitiveSubstate; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - public State getTransitiveSubstate() { - return this.fTransitiveSubstate; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - if ("transitiveSubstate".equals(parameterName) ) { - this.fTransitiveSubstate = (State) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - public void setTransitiveSubstate(final State pTransitiveSubstate) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTransitiveSubstate = pTransitiveSubstate; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstates"; - } - - @Override - public List parameterNames() { - return TransitiveSubstates.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState, fTransitiveSubstate}; - } - - @Override - public TransitiveSubstates.Match toImmutable() { - return isMutable() ? newMatch(fState, fTransitiveSubstate) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState) + ", "); - result.append("\"transitiveSubstate\"=" + prettyPrintValue(fTransitiveSubstate)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState, fTransitiveSubstate); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof TransitiveSubstates.Match)) { - TransitiveSubstates.Match other = (TransitiveSubstates.Match) obj; - return Objects.equals(fState, other.fState) && Objects.equals(fTransitiveSubstate, other.fTransitiveSubstate); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public TransitiveSubstates specification() { - return TransitiveSubstates.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static TransitiveSubstates.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static TransitiveSubstates.Match newMutableMatch(final State pState, final State pTransitiveSubstate) { - return new Mutable(pState, pTransitiveSubstate); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the (partial) match object. - * - */ - public static TransitiveSubstates.Match newMatch(final State pState, final State pTransitiveSubstate) { - return new Immutable(pState, pTransitiveSubstate); - } - - private static final class Mutable extends TransitiveSubstates.Match { - Mutable(final State pState, final State pTransitiveSubstate) { - super(pState, pTransitiveSubstate); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends TransitiveSubstates.Match { - Immutable(final State pState, final State pTransitiveSubstate) { - super(pState, pTransitiveSubstate); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstates pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing a simple pattern with transitive closure.
-   *  
-   * pattern transitiveSubstates(state : State, transitiveSubstate : State) {
-   * 	find parentState+(transitiveSubstate, state);
-   * }
-   * 
- * - * @see Match - * @see TransitiveSubstates - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static TransitiveSubstates.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static TransitiveSubstates.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final int POSITION_TRANSITIVESUBSTATE = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TransitiveSubstates.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState, final State pTransitiveSubstate) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstate}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState, final State pTransitiveSubstate) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState, final State pTransitiveSubstate) { - return rawGetOneArbitraryMatch(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState, final State pTransitiveSubstate) { - return rawHasMatch(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState, final State pTransitiveSubstate) { - return rawCountMatches(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final State pTransitiveSubstate, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState, pTransitiveSubstate}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the (partial) match object. - * - */ - public TransitiveSubstates.Match newMatch(final State pState, final State pTransitiveSubstate) { - return TransitiveSubstates.Match.newMatch(pState, pTransitiveSubstate); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final TransitiveSubstates.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final State pTransitiveSubstate) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstate}); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final TransitiveSubstates.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final State pTransitiveSubstate) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstate}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftransitiveSubstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_TRANSITIVESUBSTATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate() { - return rawStreamAllValuesOftransitiveSubstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate() { - return rawStreamAllValuesOftransitiveSubstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate(final TransitiveSubstates.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate(final State pState) { - return rawStreamAllValuesOftransitiveSubstate(new Object[]{pState, null}); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate(final TransitiveSubstates.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate(final State pState) { - return rawStreamAllValuesOftransitiveSubstate(new Object[]{pState, null}).collect(Collectors.toSet()); - } - - @Override - protected TransitiveSubstates.Match tupleToMatch(final Tuple t) { - try { - return TransitiveSubstates.Match.newMatch((State) t.get(POSITION_STATE), (State) t.get(POSITION_TRANSITIVESUBSTATE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected TransitiveSubstates.Match arrayToMatch(final Object[] match) { - try { - return TransitiveSubstates.Match.newMatch((State) match[POSITION_STATE], (State) match[POSITION_TRANSITIVESUBSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected TransitiveSubstates.Match arrayToMatchMutable(final Object[] match) { - try { - return TransitiveSubstates.Match.newMutableMatch((State) match[POSITION_STATE], (State) match[POSITION_TRANSITIVESUBSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return TransitiveSubstates.instance(); - } - } - - private TransitiveSubstates() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static TransitiveSubstates instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected TransitiveSubstates.Matcher instantiate(final ViatraQueryEngine engine) { - return TransitiveSubstates.Matcher.on(engine); - } - - @Override - public TransitiveSubstates.Matcher instantiate() { - return TransitiveSubstates.Matcher.create(); - } - - @Override - public TransitiveSubstates.Match newEmptyMatch() { - return TransitiveSubstates.Match.newEmptyMatch(); - } - - @Override - public TransitiveSubstates.Match newMatch(final Object... parameters) { - return TransitiveSubstates.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0], (com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link TransitiveSubstates} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link TransitiveSubstates#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final TransitiveSubstates INSTANCE = new TransitiveSubstates(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final TransitiveSubstates.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final PParameter parameter_transitiveSubstate = new PParameter("transitiveSubstate", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state, parameter_transitiveSubstate); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstates"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state","transitiveSubstate"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_transitiveSubstate = body.getOrCreateVariableByName("transitiveSubstate"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_transitiveSubstate), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state), - new ExportedParameter(body, var_transitiveSubstate, parameter_transitiveSubstate) - )); - // find parentState+(transitiveSubstate, state) - new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_transitiveSubstate, var_state), ParentState.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstatesWithCheck.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstatesWithCheck.java deleted file mode 100644 index eaee554..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstatesWithCheck.java +++ /dev/null @@ -1,710 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.ParentState; -import com.incquerylabs.magicdraw.benchmark.queries.StatesWithShortNames; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing a simple pattern with a check expression before the transitive closure.
- *          
- *         pattern transitiveSubstatesWithCheck(state : State, transitiveSubstate : State) {
- *         	find statesWithShortNames(state);
- *         	find parentState+(transitiveSubstate, state);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class TransitiveSubstatesWithCheck extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstatesWithCheck pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private State fTransitiveSubstate; - - private static List parameterNames = makeImmutableList("state", "transitiveSubstate"); - - private Match(final State pState, final State pTransitiveSubstate) { - this.fState = pState; - this.fTransitiveSubstate = pTransitiveSubstate; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - case "transitiveSubstate": return this.fTransitiveSubstate; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - case 1: return this.fTransitiveSubstate; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - public State getTransitiveSubstate() { - return this.fTransitiveSubstate; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - if ("transitiveSubstate".equals(parameterName) ) { - this.fTransitiveSubstate = (State) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - public void setTransitiveSubstate(final State pTransitiveSubstate) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTransitiveSubstate = pTransitiveSubstate; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstatesWithCheck"; - } - - @Override - public List parameterNames() { - return TransitiveSubstatesWithCheck.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState, fTransitiveSubstate}; - } - - @Override - public TransitiveSubstatesWithCheck.Match toImmutable() { - return isMutable() ? newMatch(fState, fTransitiveSubstate) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState) + ", "); - result.append("\"transitiveSubstate\"=" + prettyPrintValue(fTransitiveSubstate)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState, fTransitiveSubstate); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof TransitiveSubstatesWithCheck.Match)) { - TransitiveSubstatesWithCheck.Match other = (TransitiveSubstatesWithCheck.Match) obj; - return Objects.equals(fState, other.fState) && Objects.equals(fTransitiveSubstate, other.fTransitiveSubstate); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public TransitiveSubstatesWithCheck specification() { - return TransitiveSubstatesWithCheck.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static TransitiveSubstatesWithCheck.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static TransitiveSubstatesWithCheck.Match newMutableMatch(final State pState, final State pTransitiveSubstate) { - return new Mutable(pState, pTransitiveSubstate); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the (partial) match object. - * - */ - public static TransitiveSubstatesWithCheck.Match newMatch(final State pState, final State pTransitiveSubstate) { - return new Immutable(pState, pTransitiveSubstate); - } - - private static final class Mutable extends TransitiveSubstatesWithCheck.Match { - Mutable(final State pState, final State pTransitiveSubstate) { - super(pState, pTransitiveSubstate); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends TransitiveSubstatesWithCheck.Match { - Immutable(final State pState, final State pTransitiveSubstate) { - super(pState, pTransitiveSubstate); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstatesWithCheck pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing a simple pattern with a check expression before the transitive closure.
-   *  
-   * pattern transitiveSubstatesWithCheck(state : State, transitiveSubstate : State) {
-   * 	find statesWithShortNames(state);
-   * 	find parentState+(transitiveSubstate, state);
-   * }
-   * 
- * - * @see Match - * @see TransitiveSubstatesWithCheck - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static TransitiveSubstatesWithCheck.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static TransitiveSubstatesWithCheck.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final int POSITION_TRANSITIVESUBSTATE = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TransitiveSubstatesWithCheck.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState, final State pTransitiveSubstate) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstate}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState, final State pTransitiveSubstate) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState, final State pTransitiveSubstate) { - return rawGetOneArbitraryMatch(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState, final State pTransitiveSubstate) { - return rawHasMatch(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState, final State pTransitiveSubstate) { - return rawCountMatches(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final State pTransitiveSubstate, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState, pTransitiveSubstate}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the (partial) match object. - * - */ - public TransitiveSubstatesWithCheck.Match newMatch(final State pState, final State pTransitiveSubstate) { - return TransitiveSubstatesWithCheck.Match.newMatch(pState, pTransitiveSubstate); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final TransitiveSubstatesWithCheck.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final State pTransitiveSubstate) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstate}); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final TransitiveSubstatesWithCheck.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final State pTransitiveSubstate) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstate}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftransitiveSubstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_TRANSITIVESUBSTATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate() { - return rawStreamAllValuesOftransitiveSubstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate() { - return rawStreamAllValuesOftransitiveSubstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate(final TransitiveSubstatesWithCheck.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate(final State pState) { - return rawStreamAllValuesOftransitiveSubstate(new Object[]{pState, null}); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate(final TransitiveSubstatesWithCheck.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate(final State pState) { - return rawStreamAllValuesOftransitiveSubstate(new Object[]{pState, null}).collect(Collectors.toSet()); - } - - @Override - protected TransitiveSubstatesWithCheck.Match tupleToMatch(final Tuple t) { - try { - return TransitiveSubstatesWithCheck.Match.newMatch((State) t.get(POSITION_STATE), (State) t.get(POSITION_TRANSITIVESUBSTATE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected TransitiveSubstatesWithCheck.Match arrayToMatch(final Object[] match) { - try { - return TransitiveSubstatesWithCheck.Match.newMatch((State) match[POSITION_STATE], (State) match[POSITION_TRANSITIVESUBSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected TransitiveSubstatesWithCheck.Match arrayToMatchMutable(final Object[] match) { - try { - return TransitiveSubstatesWithCheck.Match.newMutableMatch((State) match[POSITION_STATE], (State) match[POSITION_TRANSITIVESUBSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return TransitiveSubstatesWithCheck.instance(); - } - } - - private TransitiveSubstatesWithCheck() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static TransitiveSubstatesWithCheck instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected TransitiveSubstatesWithCheck.Matcher instantiate(final ViatraQueryEngine engine) { - return TransitiveSubstatesWithCheck.Matcher.on(engine); - } - - @Override - public TransitiveSubstatesWithCheck.Matcher instantiate() { - return TransitiveSubstatesWithCheck.Matcher.create(); - } - - @Override - public TransitiveSubstatesWithCheck.Match newEmptyMatch() { - return TransitiveSubstatesWithCheck.Match.newEmptyMatch(); - } - - @Override - public TransitiveSubstatesWithCheck.Match newMatch(final Object... parameters) { - return TransitiveSubstatesWithCheck.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0], (com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link TransitiveSubstatesWithCheck} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link TransitiveSubstatesWithCheck#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final TransitiveSubstatesWithCheck INSTANCE = new TransitiveSubstatesWithCheck(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final TransitiveSubstatesWithCheck.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final PParameter parameter_transitiveSubstate = new PParameter("transitiveSubstate", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state, parameter_transitiveSubstate); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstatesWithCheck"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state","transitiveSubstate"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_transitiveSubstate = body.getOrCreateVariableByName("transitiveSubstate"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_transitiveSubstate), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state), - new ExportedParameter(body, var_transitiveSubstate, parameter_transitiveSubstate) - )); - // find statesWithShortNames(state) - new PositivePatternCall(body, Tuples.flatTupleOf(var_state), StatesWithShortNames.instance().getInternalQueryRepresentation()); - // find parentState+(transitiveSubstate, state) - new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_transitiveSubstate, var_state), ParentState.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstatesWithCheck2.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstatesWithCheck2.java deleted file mode 100644 index aa1af02..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstatesWithCheck2.java +++ /dev/null @@ -1,742 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.IncomingTransitions; -import com.incquerylabs.magicdraw.benchmark.queries.ParentState; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing a simple pattern with a check expression before the transitive closure.
- *          
- *         pattern transitiveSubstatesWithCheck2(state : State, transitiveSubstate : State) {
- *         	transitionCount == count find incomingTransitions(_, state);
- *         	check (transitionCount {@literal >} 1);
- *         	find parentState+(transitiveSubstate, state);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class TransitiveSubstatesWithCheck2 extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstatesWithCheck2 pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private State fTransitiveSubstate; - - private static List parameterNames = makeImmutableList("state", "transitiveSubstate"); - - private Match(final State pState, final State pTransitiveSubstate) { - this.fState = pState; - this.fTransitiveSubstate = pTransitiveSubstate; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - case "transitiveSubstate": return this.fTransitiveSubstate; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - case 1: return this.fTransitiveSubstate; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - public State getTransitiveSubstate() { - return this.fTransitiveSubstate; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - if ("transitiveSubstate".equals(parameterName) ) { - this.fTransitiveSubstate = (State) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - public void setTransitiveSubstate(final State pTransitiveSubstate) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTransitiveSubstate = pTransitiveSubstate; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstatesWithCheck2"; - } - - @Override - public List parameterNames() { - return TransitiveSubstatesWithCheck2.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState, fTransitiveSubstate}; - } - - @Override - public TransitiveSubstatesWithCheck2.Match toImmutable() { - return isMutable() ? newMatch(fState, fTransitiveSubstate) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState) + ", "); - result.append("\"transitiveSubstate\"=" + prettyPrintValue(fTransitiveSubstate)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState, fTransitiveSubstate); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof TransitiveSubstatesWithCheck2.Match)) { - TransitiveSubstatesWithCheck2.Match other = (TransitiveSubstatesWithCheck2.Match) obj; - return Objects.equals(fState, other.fState) && Objects.equals(fTransitiveSubstate, other.fTransitiveSubstate); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public TransitiveSubstatesWithCheck2 specification() { - return TransitiveSubstatesWithCheck2.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static TransitiveSubstatesWithCheck2.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static TransitiveSubstatesWithCheck2.Match newMutableMatch(final State pState, final State pTransitiveSubstate) { - return new Mutable(pState, pTransitiveSubstate); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the (partial) match object. - * - */ - public static TransitiveSubstatesWithCheck2.Match newMatch(final State pState, final State pTransitiveSubstate) { - return new Immutable(pState, pTransitiveSubstate); - } - - private static final class Mutable extends TransitiveSubstatesWithCheck2.Match { - Mutable(final State pState, final State pTransitiveSubstate) { - super(pState, pTransitiveSubstate); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends TransitiveSubstatesWithCheck2.Match { - Immutable(final State pState, final State pTransitiveSubstate) { - super(pState, pTransitiveSubstate); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstatesWithCheck2 pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing a simple pattern with a check expression before the transitive closure.
-   *  
-   * pattern transitiveSubstatesWithCheck2(state : State, transitiveSubstate : State) {
-   * 	transitionCount == count find incomingTransitions(_, state);
-   * 	check (transitionCount {@literal >} 1);
-   * 	find parentState+(transitiveSubstate, state);
-   * }
-   * 
- * - * @see Match - * @see TransitiveSubstatesWithCheck2 - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static TransitiveSubstatesWithCheck2.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static TransitiveSubstatesWithCheck2.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final int POSITION_TRANSITIVESUBSTATE = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TransitiveSubstatesWithCheck2.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState, final State pTransitiveSubstate) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstate}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState, final State pTransitiveSubstate) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState, final State pTransitiveSubstate) { - return rawGetOneArbitraryMatch(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState, final State pTransitiveSubstate) { - return rawHasMatch(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState, final State pTransitiveSubstate) { - return rawCountMatches(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final State pTransitiveSubstate, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState, pTransitiveSubstate}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the (partial) match object. - * - */ - public TransitiveSubstatesWithCheck2.Match newMatch(final State pState, final State pTransitiveSubstate) { - return TransitiveSubstatesWithCheck2.Match.newMatch(pState, pTransitiveSubstate); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final TransitiveSubstatesWithCheck2.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final State pTransitiveSubstate) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstate}); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final TransitiveSubstatesWithCheck2.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final State pTransitiveSubstate) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstate}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftransitiveSubstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_TRANSITIVESUBSTATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate() { - return rawStreamAllValuesOftransitiveSubstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate() { - return rawStreamAllValuesOftransitiveSubstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate(final TransitiveSubstatesWithCheck2.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate(final State pState) { - return rawStreamAllValuesOftransitiveSubstate(new Object[]{pState, null}); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate(final TransitiveSubstatesWithCheck2.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate(final State pState) { - return rawStreamAllValuesOftransitiveSubstate(new Object[]{pState, null}).collect(Collectors.toSet()); - } - - @Override - protected TransitiveSubstatesWithCheck2.Match tupleToMatch(final Tuple t) { - try { - return TransitiveSubstatesWithCheck2.Match.newMatch((State) t.get(POSITION_STATE), (State) t.get(POSITION_TRANSITIVESUBSTATE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected TransitiveSubstatesWithCheck2.Match arrayToMatch(final Object[] match) { - try { - return TransitiveSubstatesWithCheck2.Match.newMatch((State) match[POSITION_STATE], (State) match[POSITION_TRANSITIVESUBSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected TransitiveSubstatesWithCheck2.Match arrayToMatchMutable(final Object[] match) { - try { - return TransitiveSubstatesWithCheck2.Match.newMutableMatch((State) match[POSITION_STATE], (State) match[POSITION_TRANSITIVESUBSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return TransitiveSubstatesWithCheck2.instance(); - } - } - - private TransitiveSubstatesWithCheck2() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static TransitiveSubstatesWithCheck2 instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected TransitiveSubstatesWithCheck2.Matcher instantiate(final ViatraQueryEngine engine) { - return TransitiveSubstatesWithCheck2.Matcher.on(engine); - } - - @Override - public TransitiveSubstatesWithCheck2.Matcher instantiate() { - return TransitiveSubstatesWithCheck2.Matcher.create(); - } - - @Override - public TransitiveSubstatesWithCheck2.Match newEmptyMatch() { - return TransitiveSubstatesWithCheck2.Match.newEmptyMatch(); - } - - @Override - public TransitiveSubstatesWithCheck2.Match newMatch(final Object... parameters) { - return TransitiveSubstatesWithCheck2.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0], (com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link TransitiveSubstatesWithCheck2} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link TransitiveSubstatesWithCheck2#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final TransitiveSubstatesWithCheck2 INSTANCE = new TransitiveSubstatesWithCheck2(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final TransitiveSubstatesWithCheck2.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final PParameter parameter_transitiveSubstate = new PParameter("transitiveSubstate", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state, parameter_transitiveSubstate); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstatesWithCheck2"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state","transitiveSubstate"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_transitiveSubstate = body.getOrCreateVariableByName("transitiveSubstate"); - PVariable var_transitionCount = body.getOrCreateVariableByName("transitionCount"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_transitiveSubstate), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state), - new ExportedParameter(body, var_transitiveSubstate, parameter_transitiveSubstate) - )); - // transitionCount == count find incomingTransitions(_, state) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new PatternMatchCounter(body, Tuples.flatTupleOf(var___0_, var_state), IncomingTransitions.instance().getInternalQueryRepresentation(), var__virtual_0_); - new Equality(body, var_transitionCount, var__virtual_0_); - // check (transitionCount > 1) - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern transitiveSubstatesWithCheck2"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("transitionCount");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - Integer transitionCount = (Integer) provider.getValue("transitionCount"); - return evaluateExpression_1_1(transitionCount); - } - }, null); - // find parentState+(transitiveSubstate, state) - new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_transitiveSubstate, var_state), ParentState.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } - - private static boolean evaluateExpression_1_1(final Integer transitionCount) { - return ((transitionCount).intValue() > 1); - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstatesWithCheck3.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstatesWithCheck3.java deleted file mode 100644 index a7b376b..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/TransitiveSubstatesWithCheck3.java +++ /dev/null @@ -1,710 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.ParentState; -import com.incquerylabs.magicdraw.benchmark.queries.StatesWithMoreIncomingTransitions; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Reusing a simple pattern with a check expression before the transitive closure.
- *          
- *         pattern transitiveSubstatesWithCheck3(state : State, transitiveSubstate : State) {
- *         	find statesWithMoreIncomingTransitions(state);
- *         	find parentState+(transitiveSubstate, state);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class TransitiveSubstatesWithCheck3 extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstatesWithCheck3 pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private State fState; - - private State fTransitiveSubstate; - - private static List parameterNames = makeImmutableList("state", "transitiveSubstate"); - - private Match(final State pState, final State pTransitiveSubstate) { - this.fState = pState; - this.fTransitiveSubstate = pTransitiveSubstate; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "state": return this.fState; - case "transitiveSubstate": return this.fTransitiveSubstate; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fState; - case 1: return this.fTransitiveSubstate; - default: return null; - } - } - - public State getState() { - return this.fState; - } - - public State getTransitiveSubstate() { - return this.fTransitiveSubstate; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("state".equals(parameterName) ) { - this.fState = (State) newValue; - return true; - } - if ("transitiveSubstate".equals(parameterName) ) { - this.fTransitiveSubstate = (State) newValue; - return true; - } - return false; - } - - public void setState(final State pState) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fState = pState; - } - - public void setTransitiveSubstate(final State pTransitiveSubstate) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fTransitiveSubstate = pTransitiveSubstate; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstatesWithCheck3"; - } - - @Override - public List parameterNames() { - return TransitiveSubstatesWithCheck3.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fState, fTransitiveSubstate}; - } - - @Override - public TransitiveSubstatesWithCheck3.Match toImmutable() { - return isMutable() ? newMatch(fState, fTransitiveSubstate) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"state\"=" + prettyPrintValue(fState) + ", "); - result.append("\"transitiveSubstate\"=" + prettyPrintValue(fTransitiveSubstate)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fState, fTransitiveSubstate); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof TransitiveSubstatesWithCheck3.Match)) { - TransitiveSubstatesWithCheck3.Match other = (TransitiveSubstatesWithCheck3.Match) obj; - return Objects.equals(fState, other.fState) && Objects.equals(fTransitiveSubstate, other.fTransitiveSubstate); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public TransitiveSubstatesWithCheck3 specification() { - return TransitiveSubstatesWithCheck3.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static TransitiveSubstatesWithCheck3.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static TransitiveSubstatesWithCheck3.Match newMutableMatch(final State pState, final State pTransitiveSubstate) { - return new Mutable(pState, pTransitiveSubstate); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the (partial) match object. - * - */ - public static TransitiveSubstatesWithCheck3.Match newMatch(final State pState, final State pTransitiveSubstate) { - return new Immutable(pState, pTransitiveSubstate); - } - - private static final class Mutable extends TransitiveSubstatesWithCheck3.Match { - Mutable(final State pState, final State pTransitiveSubstate) { - super(pState, pTransitiveSubstate); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends TransitiveSubstatesWithCheck3.Match { - Immutable(final State pState, final State pTransitiveSubstate) { - super(pState, pTransitiveSubstate); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstatesWithCheck3 pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * Reusing a simple pattern with a check expression before the transitive closure.
-   *  
-   * pattern transitiveSubstatesWithCheck3(state : State, transitiveSubstate : State) {
-   * 	find statesWithMoreIncomingTransitions(state);
-   * 	find parentState+(transitiveSubstate, state);
-   * }
-   * 
- * - * @see Match - * @see TransitiveSubstatesWithCheck3 - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static TransitiveSubstatesWithCheck3.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static TransitiveSubstatesWithCheck3.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_STATE = 0; - - private static final int POSITION_TRANSITIVESUBSTATE = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TransitiveSubstatesWithCheck3.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final State pState, final State pTransitiveSubstate) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstate}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final State pState, final State pTransitiveSubstate) { - return rawStreamAllMatches(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final State pState, final State pTransitiveSubstate) { - return rawGetOneArbitraryMatch(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final State pState, final State pTransitiveSubstate) { - return rawHasMatch(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final State pState, final State pTransitiveSubstate) { - return rawCountMatches(new Object[]{pState, pTransitiveSubstate}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final State pState, final State pTransitiveSubstate, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pState, pTransitiveSubstate}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pState the fixed value of pattern parameter state, or null if not bound. - * @param pTransitiveSubstate the fixed value of pattern parameter transitiveSubstate, or null if not bound. - * @return the (partial) match object. - * - */ - public TransitiveSubstatesWithCheck3.Match newMatch(final State pState, final State pTransitiveSubstate) { - return TransitiveSubstatesWithCheck3.Match.newMatch(pState, pTransitiveSubstate); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate() { - return rawStreamAllValuesOfstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final TransitiveSubstatesWithCheck3.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for state. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfstate(final State pTransitiveSubstate) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstate}); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final TransitiveSubstatesWithCheck3.Match partialMatch) { - return rawStreamAllValuesOfstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for state. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfstate(final State pTransitiveSubstate) { - return rawStreamAllValuesOfstate(new Object[]{null, pTransitiveSubstate}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftransitiveSubstate(final Object[] parameters) { - return rawStreamAllValues(POSITION_TRANSITIVESUBSTATE, parameters).map(State.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate() { - return rawStreamAllValuesOftransitiveSubstate(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate() { - return rawStreamAllValuesOftransitiveSubstate(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate(final TransitiveSubstatesWithCheck3.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstate(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftransitiveSubstate(final State pState) { - return rawStreamAllValuesOftransitiveSubstate(new Object[]{pState, null}); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate(final TransitiveSubstatesWithCheck3.Match partialMatch) { - return rawStreamAllValuesOftransitiveSubstate(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for transitiveSubstate. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftransitiveSubstate(final State pState) { - return rawStreamAllValuesOftransitiveSubstate(new Object[]{pState, null}).collect(Collectors.toSet()); - } - - @Override - protected TransitiveSubstatesWithCheck3.Match tupleToMatch(final Tuple t) { - try { - return TransitiveSubstatesWithCheck3.Match.newMatch((State) t.get(POSITION_STATE), (State) t.get(POSITION_TRANSITIVESUBSTATE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected TransitiveSubstatesWithCheck3.Match arrayToMatch(final Object[] match) { - try { - return TransitiveSubstatesWithCheck3.Match.newMatch((State) match[POSITION_STATE], (State) match[POSITION_TRANSITIVESUBSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected TransitiveSubstatesWithCheck3.Match arrayToMatchMutable(final Object[] match) { - try { - return TransitiveSubstatesWithCheck3.Match.newMutableMatch((State) match[POSITION_STATE], (State) match[POSITION_TRANSITIVESUBSTATE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return TransitiveSubstatesWithCheck3.instance(); - } - } - - private TransitiveSubstatesWithCheck3() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static TransitiveSubstatesWithCheck3 instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected TransitiveSubstatesWithCheck3.Matcher instantiate(final ViatraQueryEngine engine) { - return TransitiveSubstatesWithCheck3.Matcher.on(engine); - } - - @Override - public TransitiveSubstatesWithCheck3.Matcher instantiate() { - return TransitiveSubstatesWithCheck3.Matcher.create(); - } - - @Override - public TransitiveSubstatesWithCheck3.Match newEmptyMatch() { - return TransitiveSubstatesWithCheck3.Match.newEmptyMatch(); - } - - @Override - public TransitiveSubstatesWithCheck3.Match newMatch(final Object... parameters) { - return TransitiveSubstatesWithCheck3.Match.newMatch((com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[0], (com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link TransitiveSubstatesWithCheck3} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link TransitiveSubstatesWithCheck3#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final TransitiveSubstatesWithCheck3 INSTANCE = new TransitiveSubstatesWithCheck3(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final TransitiveSubstatesWithCheck3.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final PParameter parameter_transitiveSubstate = new PParameter("transitiveSubstate", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state, parameter_transitiveSubstate); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.transitiveSubstatesWithCheck3"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state","transitiveSubstate"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - PVariable var_transitiveSubstate = body.getOrCreateVariableByName("transitiveSubstate"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_transitiveSubstate), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state), - new ExportedParameter(body, var_transitiveSubstate, parameter_transitiveSubstate) - )); - // find statesWithMoreIncomingTransitions(state) - new PositivePatternCall(body, Tuples.flatTupleOf(var_state), StatesWithMoreIncomingTransitions.instance().getInternalQueryRepresentation()); - // find parentState+(transitiveSubstate, state) - new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_transitiveSubstate, var_state), ParentState.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Variables.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Variables.java deleted file mode 100644 index 6a0f6be..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/Variables.java +++ /dev/null @@ -1,709 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/WarmUpQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.nomagic.uml2.ext.magicdraw.activities.mdstructuredactivities.Variable; -import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Type; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         // All these patterns are used to warm up the JVM before the real performance queries.
- *         
- *         pattern variables(variable : Variable, type : Type ) {
- *         	Variable.type(variable, type);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class Variables extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.magicdraw.benchmark.queries.variables pattern, - * to be used in conjunction with {@link Matcher}. - * - *

Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. - * Each instance is a (possibly partial) substitution of pattern parameters, - * usable to represent a match of the pattern in the result of a query, - * or to specify the bound (fixed) input parameters when issuing a query. - * - * @see Matcher - * - */ - public static abstract class Match extends BasePatternMatch { - private Variable fVariable; - - private Type fType; - - private static List parameterNames = makeImmutableList("variable", "type"); - - private Match(final Variable pVariable, final Type pType) { - this.fVariable = pVariable; - this.fType = pType; - } - - @Override - public Object get(final String parameterName) { - switch(parameterName) { - case "variable": return this.fVariable; - case "type": return this.fType; - default: return null; - } - } - - @Override - public Object get(final int index) { - switch(index) { - case 0: return this.fVariable; - case 1: return this.fType; - default: return null; - } - } - - public Variable getVariable() { - return this.fVariable; - } - - public Type getType() { - return this.fType; - } - - @Override - public boolean set(final String parameterName, final Object newValue) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - if ("variable".equals(parameterName) ) { - this.fVariable = (Variable) newValue; - return true; - } - if ("type".equals(parameterName) ) { - this.fType = (Type) newValue; - return true; - } - return false; - } - - public void setVariable(final Variable pVariable) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fVariable = pVariable; - } - - public void setType(final Type pType) { - if (!isMutable()) throw new java.lang.UnsupportedOperationException(); - this.fType = pType; - } - - @Override - public String patternName() { - return "com.incquerylabs.magicdraw.benchmark.queries.variables"; - } - - @Override - public List parameterNames() { - return Variables.Match.parameterNames; - } - - @Override - public Object[] toArray() { - return new Object[]{fVariable, fType}; - } - - @Override - public Variables.Match toImmutable() { - return isMutable() ? newMatch(fVariable, fType) : this; - } - - @Override - public String prettyPrint() { - StringBuilder result = new StringBuilder(); - result.append("\"variable\"=" + prettyPrintValue(fVariable) + ", "); - result.append("\"type\"=" + prettyPrintValue(fType)); - return result.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(fVariable, fType); - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) { - return false; - } - if ((obj instanceof Variables.Match)) { - Variables.Match other = (Variables.Match) obj; - return Objects.equals(fVariable, other.fVariable) && Objects.equals(fType, other.fType); - } else { - // this should be infrequent - if (!(obj instanceof IPatternMatch)) { - return false; - } - IPatternMatch otherSig = (IPatternMatch) obj; - return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); - } - } - - @Override - public Variables specification() { - return Variables.instance(); - } - - /** - * Returns an empty, mutable match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @return the empty match. - * - */ - public static Variables.Match newEmptyMatch() { - return new Mutable(null, null); - } - - /** - * Returns a mutable (partial) match. - * Fields of the mutable match can be filled to create a partial match, usable as matcher input. - * - * @param pVariable the fixed value of pattern parameter variable, or null if not bound. - * @param pType the fixed value of pattern parameter type, or null if not bound. - * @return the new, mutable (partial) match object. - * - */ - public static Variables.Match newMutableMatch(final Variable pVariable, final Type pType) { - return new Mutable(pVariable, pType); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pVariable the fixed value of pattern parameter variable, or null if not bound. - * @param pType the fixed value of pattern parameter type, or null if not bound. - * @return the (partial) match object. - * - */ - public static Variables.Match newMatch(final Variable pVariable, final Type pType) { - return new Immutable(pVariable, pType); - } - - private static final class Mutable extends Variables.Match { - Mutable(final Variable pVariable, final Type pType) { - super(pVariable, pType); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends Variables.Match { - Immutable(final Variable pVariable, final Type pType) { - super(pVariable, pType); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.magicdraw.benchmark.queries.variables pattern, - * providing pattern-specific query methods. - * - *

Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, - * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. - * - *

Matches of the pattern will be represented as {@link Match}. - * - *

Original source: - *

-   * // All these patterns are used to warm up the JVM before the real performance queries.
-   * 
-   * pattern variables(variable : Variable, type : Type ) {
-   * 	Variable.type(variable, type);
-   * }
-   * 
- * - * @see Match - * @see Variables - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static Variables.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static Variables.Matcher create() { - return new Matcher(); - } - - private static final int POSITION_VARIABLE = 0; - - private static final int POSITION_TYPE = 1; - - private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Variables.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pVariable the fixed value of pattern parameter variable, or null if not bound. - * @param pType the fixed value of pattern parameter type, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Variable pVariable, final Type pType) { - return rawStreamAllMatches(new Object[]{pVariable, pType}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * @param pVariable the fixed value of pattern parameter variable, or null if not bound. - * @param pType the fixed value of pattern parameter type, or null if not bound. - * @return a stream of matches represented as a Match object. - * - */ - public Stream streamAllMatches(final Variable pVariable, final Type pType) { - return rawStreamAllMatches(new Object[]{pVariable, pType}); - } - - /** - * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pVariable the fixed value of pattern parameter variable, or null if not bound. - * @param pType the fixed value of pattern parameter type, or null if not bound. - * @return a match represented as a Match object, or null if no match is found. - * - */ - public Optional getOneArbitraryMatch(final Variable pVariable, final Type pType) { - return rawGetOneArbitraryMatch(new Object[]{pVariable, pType}); - } - - /** - * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, - * under any possible substitution of the unspecified parameters (if any). - * @param pVariable the fixed value of pattern parameter variable, or null if not bound. - * @param pType the fixed value of pattern parameter type, or null if not bound. - * @return true if the input is a valid (partial) match of the pattern. - * - */ - public boolean hasMatch(final Variable pVariable, final Type pType) { - return rawHasMatch(new Object[]{pVariable, pType}); - } - - /** - * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pVariable the fixed value of pattern parameter variable, or null if not bound. - * @param pType the fixed value of pattern parameter type, or null if not bound. - * @return the number of pattern matches found. - * - */ - public int countMatches(final Variable pVariable, final Type pType) { - return rawCountMatches(new Object[]{pVariable, pType}); - } - - /** - * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. - * Neither determinism nor randomness of selection is guaranteed. - * @param pVariable the fixed value of pattern parameter variable, or null if not bound. - * @param pType the fixed value of pattern parameter type, or null if not bound. - * @param processor the action that will process the selected match. - * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked - * - */ - public boolean forOneArbitraryMatch(final Variable pVariable, final Type pType, final Consumer processor) { - return rawForOneArbitraryMatch(new Object[]{pVariable, pType}, processor); - } - - /** - * Returns a new (partial) match. - * This can be used e.g. to call the matcher with a partial match. - *

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pVariable the fixed value of pattern parameter variable, or null if not bound. - * @param pType the fixed value of pattern parameter type, or null if not bound. - * @return the (partial) match object. - * - */ - public Variables.Match newMatch(final Variable pVariable, final Type pType) { - return Variables.Match.newMatch(pVariable, pType); - } - - /** - * Retrieve the set of values that occur in matches for variable. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfvariable(final Object[] parameters) { - return rawStreamAllValues(POSITION_VARIABLE, parameters).map(Variable.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for variable. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfvariable() { - return rawStreamAllValuesOfvariable(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for variable. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfvariable() { - return rawStreamAllValuesOfvariable(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for variable. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfvariable(final Variables.Match partialMatch) { - return rawStreamAllValuesOfvariable(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for variable. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfvariable(final Type pType) { - return rawStreamAllValuesOfvariable(new Object[]{null, pType}); - } - - /** - * Retrieve the set of values that occur in matches for variable. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfvariable(final Variables.Match partialMatch) { - return rawStreamAllValuesOfvariable(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for variable. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfvariable(final Type pType) { - return rawStreamAllValuesOfvariable(new Object[]{null, pType}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for type. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOftype(final Object[] parameters) { - return rawStreamAllValues(POSITION_TYPE, parameters).map(Type.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for type. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftype() { - return rawStreamAllValuesOftype(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for type. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftype() { - return rawStreamAllValuesOftype(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for type. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftype(final Variables.Match partialMatch) { - return rawStreamAllValuesOftype(partialMatch.toArray()); - } - - /** - * Retrieve the set of values that occur in matches for type. - *

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOftype(final Variable pVariable) { - return rawStreamAllValuesOftype(new Object[]{pVariable, null}); - } - - /** - * Retrieve the set of values that occur in matches for type. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftype(final Variables.Match partialMatch) { - return rawStreamAllValuesOftype(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for type. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOftype(final Variable pVariable) { - return rawStreamAllValuesOftype(new Object[]{pVariable, null}).collect(Collectors.toSet()); - } - - @Override - protected Variables.Match tupleToMatch(final Tuple t) { - try { - return Variables.Match.newMatch((Variable) t.get(POSITION_VARIABLE), (Type) t.get(POSITION_TYPE)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected Variables.Match arrayToMatch(final Object[] match) { - try { - return Variables.Match.newMatch((Variable) match[POSITION_VARIABLE], (Type) match[POSITION_TYPE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected Variables.Match arrayToMatchMutable(final Object[] match) { - try { - return Variables.Match.newMutableMatch((Variable) match[POSITION_VARIABLE], (Type) match[POSITION_TYPE]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return Variables.instance(); - } - } - - private Variables() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static Variables instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected Variables.Matcher instantiate(final ViatraQueryEngine engine) { - return Variables.Matcher.on(engine); - } - - @Override - public Variables.Matcher instantiate() { - return Variables.Matcher.create(); - } - - @Override - public Variables.Match newEmptyMatch() { - return Variables.Match.newEmptyMatch(); - } - - @Override - public Variables.Match newMatch(final Object... parameters) { - return Variables.Match.newMatch((com.nomagic.uml2.ext.magicdraw.activities.mdstructuredactivities.Variable) parameters[0], (com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Type) parameters[1]); - } - - /** - * Inner class allowing the singleton instance of {@link Variables} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link Variables#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final Variables INSTANCE = new Variables(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final Variables.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_variable = new PParameter("variable", "com.nomagic.uml2.ext.magicdraw.activities.mdstructuredactivities.Variable", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Variable")), PParameterDirection.INOUT); - - private final PParameter parameter_type = new PParameter("type", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Type", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Type")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_variable, parameter_type); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.variables"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("variable","type"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_variable = body.getOrCreateVariableByName("variable"); - PVariable var_type = body.getOrCreateVariableByName("type"); - new TypeConstraint(body, Tuples.flatTupleOf(var_variable), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Variable"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_type), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Type"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_variable, parameter_variable), - new ExportedParameter(body, var_type, parameter_type) - )); - // Variable.type(variable, type) - new TypeConstraint(body, Tuples.flatTupleOf(var_variable), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Variable"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_variable, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "TypedElement", "type"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Type"))); - new Equality(body, var__virtual_0_, var_type); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/WarmUpQueries.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/WarmUpQueries.java deleted file mode 100644 index b085388..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/WarmUpQueries.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/WarmUpQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries; - -import com.incquerylabs.magicdraw.benchmark.queries.Activitites; -import com.incquerylabs.magicdraw.benchmark.queries.ActorGeneralization; -import com.incquerylabs.magicdraw.benchmark.queries.AssociationClasses; -import com.incquerylabs.magicdraw.benchmark.queries.Variables; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in WarmUpQueries.vql. - * - *

Use the static instance as any {@link interface org.eclipse.viatra.query.runtime.api.IQueryGroup}, to conveniently prepare - * a VIATRA Query engine for matching all patterns originally defined in file WarmUpQueries.vql, - * in order to achieve better performance than one-by-one on-demand matcher initialization. - * - *

From package com.incquerylabs.magicdraw.benchmark.queries, the group contains the definition of the following patterns:

    - *
  • variables
  • - *
  • associationClasses
  • - *
  • activitites
  • - *
  • actorGeneralization
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class WarmUpQueries extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static WarmUpQueries instance() { - if (INSTANCE == null) { - INSTANCE = new WarmUpQueries(); - } - return INSTANCE; - } - - private static WarmUpQueries INSTANCE; - - private WarmUpQueries() { - querySpecifications.add(Variables.instance()); - querySpecifications.add(AssociationClasses.instance()); - querySpecifications.add(Activitites.instance()); - querySpecifications.add(ActorGeneralization.instance()); - } - - public Variables getVariables() { - return Variables.instance(); - } - - public Variables.Matcher getVariables(final ViatraQueryEngine engine) { - return Variables.Matcher.on(engine); - } - - public AssociationClasses getAssociationClasses() { - return AssociationClasses.instance(); - } - - public AssociationClasses.Matcher getAssociationClasses(final ViatraQueryEngine engine) { - return AssociationClasses.Matcher.on(engine); - } - - public Activitites getActivitites() { - return Activitites.instance(); - } - - public Activitites.Matcher getActivitites(final ViatraQueryEngine engine) { - return Activitites.Matcher.on(engine); - } - - public ActorGeneralization getActorGeneralization() { - return ActorGeneralization.instance(); - } - - public ActorGeneralization.Matcher getActorGeneralization(final ViatraQueryEngine engine) { - return ActorGeneralization.Matcher.on(engine); - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/internal/APerformanceQueriesAll.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/internal/APerformanceQueriesAll.java deleted file mode 100644 index 7c38b02..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/internal/APerformanceQueriesAll.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries.internal; - -import com.incquerylabs.magicdraw.benchmark.queries.AllBenchMarkedQueries; -import com.incquerylabs.magicdraw.benchmark.queries.AlphabeticalDependencies; -import com.incquerylabs.magicdraw.benchmark.queries.Blocks; -import com.incquerylabs.magicdraw.benchmark.queries.BlocksOrRequirements; -import com.incquerylabs.magicdraw.benchmark.queries.BlocksOrRequirementsOrConstraints; -import com.incquerylabs.magicdraw.benchmark.queries.CircularDependencies; -import com.incquerylabs.magicdraw.benchmark.queries.Classes; -import com.incquerylabs.magicdraw.benchmark.queries.ComplexNameOfElements; -import com.incquerylabs.magicdraw.benchmark.queries.Dependencies; -import com.incquerylabs.magicdraw.benchmark.queries.DependencyChains; -import com.incquerylabs.magicdraw.benchmark.queries.ElementsWithShortNames; -import com.incquerylabs.magicdraw.benchmark.queries.IncomingTransitions; -import com.incquerylabs.magicdraw.benchmark.queries.LoopTransitionWithTriggerEffectEventNoGuard; -import com.incquerylabs.magicdraw.benchmark.queries.NamedElement; -import com.incquerylabs.magicdraw.benchmark.queries.NamesOfDependencyEndpoints; -import com.incquerylabs.magicdraw.benchmark.queries.NonBlockClasses; -import com.incquerylabs.magicdraw.benchmark.queries.NumberOfSubregions; -import com.incquerylabs.magicdraw.benchmark.queries.NumberOfTransitiveSubstates; -import com.incquerylabs.magicdraw.benchmark.queries.ParentState; -import com.incquerylabs.magicdraw.benchmark.queries.Requirements; -import com.incquerylabs.magicdraw.benchmark.queries.StateWithMostSubstates; -import com.incquerylabs.magicdraw.benchmark.queries.StatesWithMoreIncomingTransitions; -import com.incquerylabs.magicdraw.benchmark.queries.StatesWithShortNames; -import com.incquerylabs.magicdraw.benchmark.queries.Subregions; -import com.incquerylabs.magicdraw.benchmark.queries.TransitionPointingOutOfCompState; -import com.incquerylabs.magicdraw.benchmark.queries.TransitiveSubstates; -import com.incquerylabs.magicdraw.benchmark.queries.TransitiveSubstatesWithCheck; -import com.incquerylabs.magicdraw.benchmark.queries.TransitiveSubstatesWithCheck2; -import com.incquerylabs.magicdraw.benchmark.queries.TransitiveSubstatesWithCheck3; -import com.incquerylabs.magicdraw.benchmark.queries.internal.ConstraintBlocks; -import com.incquerylabs.magicdraw.benchmark.queries.internal.TransitionWithGuard; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all patterns defined in APerformanceQueries.vql. - * - *

A private group that includes private patterns as well. Only intended use case is for pattern testing. - * - *

From package com.incquerylabs.magicdraw.benchmark.queries, the group contains the definition of the following patterns:

    - *
  • classes
  • - *
  • nonBlockClasses
  • - *
  • blocks
  • - *
  • requirements
  • - *
  • constraintBlocks
  • - *
  • blocksOrRequirements
  • - *
  • blocksOrRequirementsOrConstraints
  • - *
  • namedElement
  • - *
  • complexNameOfElements
  • - *
  • dependencyChains
  • - *
  • circularDependencies
  • - *
  • dependencies
  • - *
  • namesOfDependencyEndpoints
  • - *
  • alphabeticalDependencies
  • - *
  • elementsWithShortNames
  • - *
  • transitionPointingOutOfCompState
  • - *
  • loopTransitionWithTriggerEffectEventNoGuard
  • - *
  • transitionWithGuard
  • - *
  • parentState
  • - *
  • subregions
  • - *
  • numberOfSubregions
  • - *
  • statesWithShortNames
  • - *
  • incomingTransitions
  • - *
  • transitiveSubstates
  • - *
  • transitiveSubstatesWithCheck
  • - *
  • statesWithMoreIncomingTransitions
  • - *
  • transitiveSubstatesWithCheck2
  • - *
  • transitiveSubstatesWithCheck3
  • - *
  • numberOfTransitiveSubstates
  • - *
  • stateWithMostSubstates
  • - *
  • allBenchMarkedQueries
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class APerformanceQueriesAll extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static APerformanceQueriesAll instance() { - if (INSTANCE == null) { - INSTANCE = new APerformanceQueriesAll(); - } - return INSTANCE; - } - - private static APerformanceQueriesAll INSTANCE; - - private APerformanceQueriesAll() { - querySpecifications.add(Classes.instance()); - querySpecifications.add(NonBlockClasses.instance()); - querySpecifications.add(Blocks.instance()); - querySpecifications.add(Requirements.instance()); - querySpecifications.add(ConstraintBlocks.instance()); - querySpecifications.add(BlocksOrRequirements.instance()); - querySpecifications.add(BlocksOrRequirementsOrConstraints.instance()); - querySpecifications.add(NamedElement.instance()); - querySpecifications.add(ComplexNameOfElements.instance()); - querySpecifications.add(DependencyChains.instance()); - querySpecifications.add(CircularDependencies.instance()); - querySpecifications.add(Dependencies.instance()); - querySpecifications.add(NamesOfDependencyEndpoints.instance()); - querySpecifications.add(AlphabeticalDependencies.instance()); - querySpecifications.add(ElementsWithShortNames.instance()); - querySpecifications.add(TransitionPointingOutOfCompState.instance()); - querySpecifications.add(LoopTransitionWithTriggerEffectEventNoGuard.instance()); - querySpecifications.add(TransitionWithGuard.instance()); - querySpecifications.add(ParentState.instance()); - querySpecifications.add(Subregions.instance()); - querySpecifications.add(NumberOfSubregions.instance()); - querySpecifications.add(StatesWithShortNames.instance()); - querySpecifications.add(IncomingTransitions.instance()); - querySpecifications.add(TransitiveSubstates.instance()); - querySpecifications.add(TransitiveSubstatesWithCheck.instance()); - querySpecifications.add(StatesWithMoreIncomingTransitions.instance()); - querySpecifications.add(TransitiveSubstatesWithCheck2.instance()); - querySpecifications.add(TransitiveSubstatesWithCheck3.instance()); - querySpecifications.add(NumberOfTransitiveSubstates.instance()); - querySpecifications.add(StateWithMostSubstates.instance()); - querySpecifications.add(AllBenchMarkedQueries.instance()); - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/internal/ConstraintBlocks.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/internal/ConstraintBlocks.java deleted file mode 100644 index e09417b..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/internal/ConstraintBlocks.java +++ /dev/null @@ -1,146 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries.internal; - -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

Original source: - *

- *         Querying all instances of an EClass that have a short "reference chain".
- *          
- *         private pattern constraintBlocks(class : Class) {
- *         	Class.appliedStereotypeInstance.classifier.name(class, "Constraint"); 
- *         }
- * 
- * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class ConstraintBlocks extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private ConstraintBlocks() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static ConstraintBlocks instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * Inner class allowing the singleton instance of {@link ConstraintBlocks} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link ConstraintBlocks#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final ConstraintBlocks INSTANCE = new ConstraintBlocks(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final ConstraintBlocks.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_class = new PParameter("class", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_class); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.constraintBlocks"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("class"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class) - )); - // Class.appliedStereotypeInstance.classifier.name(class, "Constraint") - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, "Constraint"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Element", "appliedStereotypeInstance"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification", "classifier"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_3_, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/internal/TransitionWithGuard.java b/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/internal/TransitionWithGuard.java deleted file mode 100644 index 2017d22..0000000 --- a/com.incquerylabs.magicdraw.benchmark/src/generated/vql/com/incquerylabs/magicdraw/benchmark/queries/internal/TransitionWithGuard.java +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.magicdraw.benchmark/src/main/java/com/incquerylabs/magicdraw/benchmark/queries/APerformanceQueries.vql - */ -package com.incquerylabs.magicdraw.benchmark.queries.internal; - -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

Original source: - *

- *         private pattern transitionWithGuard(trans : Transition, guard : Constraint){
- *         	Transition.guard(trans, guard);
- *         }
- * 
- * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class TransitionWithGuard extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private TransitionWithGuard() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static TransitionWithGuard instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * Inner class allowing the singleton instance of {@link TransitionWithGuard} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link TransitionWithGuard#instance()}. - * - *

This workaround is required e.g. to support recursion. - * - */ - private static class LazyHolder { - private static final TransitionWithGuard INSTANCE = new TransitionWithGuard(); - - /** - * Statically initializes the query specification after the field {@link #INSTANCE} is assigned. - * This initialization order is required to support indirect recursion. - * - *

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private static final Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private static final TransitionWithGuard.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_trans = new PParameter("trans", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.Transition", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition")), PParameterDirection.INOUT); - - private final PParameter parameter_guard = new PParameter("guard", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Constraint", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Constraint")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_trans, parameter_guard); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.magicdraw.benchmark.queries.transitionWithGuard"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("trans","guard"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_trans = body.getOrCreateVariableByName("trans"); - PVariable var_guard = body.getOrCreateVariableByName("guard"); - new TypeConstraint(body, Tuples.flatTupleOf(var_trans), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_guard), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Constraint"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_trans, parameter_trans), - new ExportedParameter(body, var_guard, parameter_guard) - )); - // Transition.guard(trans, guard) - new TypeConstraint(body, Tuples.flatTupleOf(var_trans), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_trans, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Transition", "guard"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Constraint"))); - new Equality(body, var__virtual_0_, var_guard); - bodies.add(body); - } - return bodies; - } - } -}