aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar ArenBabikian <aren.babikian@mail.mcgill.ca>2019-04-11 16:59:48 -0400
committerLibravatar ArenBabikian <aren.babikian@mail.mcgill.ca>2019-04-11 16:59:48 -0400
commit77f583cd433f3ed0fed3a1f240c0677e41cb4d31 (patch)
tree13103d95d81bf7f799394ab204f8f78cfcfc0d3e
parentImplement containment circularity avoidance #20 (diff)
downloadVIATRA-Generator-77f583cd433f3ed0fed3a1f240c0677e41cb4d31.tar.gz
VIATRA-Generator-77f583cd433f3ed0fed3a1f240c0677e41cb4d31.tar.zst
VIATRA-Generator-77f583cd433f3ed0fed3a1f240c0677e41cb4d31.zip
VAMPIRE: #39 Reorganise tests, working yakindu test, need debugging
-rw-r--r--Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbinbin1701 -> 1701 bytes
-rw-r--r--Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbinbin2526 -> 2526 bytes
-rw-r--r--Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/plugin.xml29
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ide/xtend-gen/ca/mcgill/ecse/dslreasoner/ide/.VampireLanguageIdeModule.xtendbinbin1685 -> 1685 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ide/xtend-gen/ca/mcgill/ecse/dslreasoner/ide/.VampireLanguageIdeSetup.xtendbinbin2500 -> 2500 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/.VampireLanguageUiModule.xtendbinbin2342 -> 2342 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/contentassist/.VampireLanguageProposalProvider.xtendbinbin1792 -> 1792 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/labeling/.VampireLanguageDescriptionLabelProvider.xtendbinbin1965 -> 1965 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/labeling/.VampireLanguageLabelProvider.xtendbinbin2405 -> 2405 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/outline/.VampireLanguageOutlineTreeProvider.xtendbinbin1819 -> 1819 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/quickfix/.VampireLanguageQuickfixProvider.xtendbinbin1786 -> 1786 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/.VampireLanguageRuntimeModule.xtendbinbin1706 -> 1706 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/.VampireLanguageStandaloneSetup.xtendbinbin1980 -> 1980 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/formatting2/.VampireLanguageFormatter.xtendbinbin4130 -> 4130 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/generator/.VampireLanguageGenerator.xtendbinbin2338 -> 2338 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/scoping/.VampireLanguageScopeProvider.xtendbinbin1751 -> 1751 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/validation/.VampireLanguageValidator.xtendbinbin1736 -> 1736 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/.VampireAnalyzerConfiguration.xtendbinbin2691 -> 2691 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/.VampireSolver.xtendbinbin5892 -> 5892 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper.xtendbinbin18157 -> 18156 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapperTrace.xtendbinbin4215 -> 4215 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ConstantMapper.xtendbinbin3164 -> 3164 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ContainmentMapper.xtendbinbin10551 -> 10551 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_RelationMapper.xtendbinbin8209 -> 8209 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ScopeMapper.xtendbinbin9839 -> 9839 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_Support.xtendbinbin13092 -> 13093 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_TypeMapper.xtendbinbin10705 -> 10705 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Vampire2LogicMapper.xtendbinbin1720 -> 1720 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireHandler.xtendbinbin4908 -> 4908 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireModelInterpretation_TypeInterpretation.xtendbinbin1491 -> 1491 bytes
-rw-r--r--Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireModelInterpretation_TypeInterpretation_FilteredTypes.xtendbinbin1688 -> 1688 bytes
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/metamodels/filesystem.ecore2
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/metamodels/yakindu.aird675
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/plugin.xml104
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/Child.java721
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/ChoiceHasNoIncoming.java551
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/ChoiceHasNoOutgoing.java559
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/EntryInRegion.java702
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/HasMultipleIncomingTrainsition.java549
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/HasMultipleOutgoingTrainsition.java549
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/HasMultipleRegions.java555
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/IncomingToEntry.java703
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/MultipleTransitionFromEntry.java827
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NoEntryInRegion.java550
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NoOutgoingTransitionFromEntry.java551
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NoStateInRegion.java558
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NotSynchronizingStates.java554
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/OutgoingFromExit.java715
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/OutgoingFromFinal.java715
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/StateInRegion.java694
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchHasNoIncoming.java551
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchHasNoOutgoing.java559
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchThree.java639
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedIncomingInSameRegion.java888
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedRegionDoesNotHaveMultipleRegions.java744
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedRegionsAreNotSiblings.java902
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/Transition.java808
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/TwoSynch.java714
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/META-INF/MANIFEST.MF3
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/output/FAMTest/Fam.logicproblem2
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/output/FAMTest/vampireProblem.tptp50
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/plugin.xml10
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.xtend97
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FileSystemTest.xtend99
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.xtend117
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/YakinduTest.xtend98
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.EcoreTest.xtendbinbin6358 -> 6358 bytes
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.FAMTest.xtendbinbin4068 -> 6825 bytes
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.FileSystemTest.xtendbinbin4115 -> 6088 bytes
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.GeneralTest.xtendbinbin8623 -> 6456 bytes
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.YakinduTest.xtendbinbin4054 -> 6042 bytes
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.java107
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FileSystemTest.java102
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.java107
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/YakinduTest.java99
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.MedicalSystem.xtendbinbin4997 -> 4997 bytes
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.SimpleRun.xtendbinbin687 -> 687 bytes
-rw-r--r--Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.VampireTest.xtendbinbin6500 -> 6500 bytes
78 files changed, 1243 insertions, 16316 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin
index 847f3da5..d6392a0b 100644
--- a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin
+++ b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeModule.xtendbin
Binary files differ
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin
index 7d5c3fb3..c97efa0f 100644
--- a/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin
+++ b/Application/hu.bme.mit.inf.dslreasoner.application.ide/xtend-gen/hu/bme/mit/inf/dslreasoner/application/ide/.ApplicationConfigurationIdeSetup.xtendbin
Binary files differ
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/plugin.xml b/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/plugin.xml
index 8069f168..9ace526f 100644
--- a/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/plugin.xml
+++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph/plugin.xml
@@ -3,35 +3,6 @@
3 <!-- @generated yakindu_simplified --> 3 <!-- @generated yakindu_simplified -->
4 <package class="hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage" genModel="model/yakindu_simplified.genmodel" uri="hu.bme.mit.inf.yakindumm"/> 4 <package class="hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage" genModel="model/yakindu_simplified.genmodel" uri="hu.bme.mit.inf.yakindumm"/>
5 </extension> 5 </extension>
6 <extension id="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.Patterns" point="org.eclipse.viatra.query.runtime.queryspecification">
7 <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.Patterns" id="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.Patterns">
8 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.entryInRegion"/>
9 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.noEntryInRegion"/>
10 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.multipleEntryInRegion"/>
11 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.transition"/>
12 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.incomingToEntry"/>
13 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.noOutgoingTransitionFromEntry"/>
14 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.multipleTransitionFromEntry"/>
15 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.outgoingFromExit"/>
16 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.outgoingFromFinal"/>
17 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.noStateInRegion"/>
18 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.StateInRegion"/>
19 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.choiceHasNoOutgoing"/>
20 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.choiceHasNoIncoming"/>
21 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.synchHasNoOutgoing"/>
22 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.synchHasNoIncoming"/>
23 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.SynchronizedIncomingInSameRegion"/>
24 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.notSynchronizingStates"/>
25 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.hasMultipleOutgoingTrainsition"/>
26 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.hasMultipleIncomingTrainsition"/>
27 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.SynchronizedRegionsAreNotSiblings"/>
28 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.child"/>
29 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.SynchronizedRegionDoesNotHaveMultipleRegions"/>
30 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.hasMultipleRegions"/>
31 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.synchThree"/>
32 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.twoSynch"/>
33 </group>
34 </extension>
35 <extension id="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.mutated.Mutated" point="org.eclipse.viatra.query.runtime.queryspecification"> 6 <extension id="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.mutated.Mutated" point="org.eclipse.viatra.query.runtime.queryspecification">
36 <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.mutated.Mutated" id="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.mutated.Mutated"> 7 <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.mutated.Mutated" id="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.mutated.Mutated">
37 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.mutated.entryInRegion_M0"/> 8 <query-specification fqn="hu.bme.mit.inf.dslreasoner.partialsnapshot_mavo.yakindu.mutated.entryInRegion_M0"/>
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ide/xtend-gen/ca/mcgill/ecse/dslreasoner/ide/.VampireLanguageIdeModule.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ide/xtend-gen/ca/mcgill/ecse/dslreasoner/ide/.VampireLanguageIdeModule.xtendbin
index d2b35248..024dcab9 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ide/xtend-gen/ca/mcgill/ecse/dslreasoner/ide/.VampireLanguageIdeModule.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ide/xtend-gen/ca/mcgill/ecse/dslreasoner/ide/.VampireLanguageIdeModule.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ide/xtend-gen/ca/mcgill/ecse/dslreasoner/ide/.VampireLanguageIdeSetup.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ide/xtend-gen/ca/mcgill/ecse/dslreasoner/ide/.VampireLanguageIdeSetup.xtendbin
index f42023dc..7e128ad1 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ide/xtend-gen/ca/mcgill/ecse/dslreasoner/ide/.VampireLanguageIdeSetup.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ide/xtend-gen/ca/mcgill/ecse/dslreasoner/ide/.VampireLanguageIdeSetup.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/.VampireLanguageUiModule.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/.VampireLanguageUiModule.xtendbin
index 6a306754..0bf8ccc6 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/.VampireLanguageUiModule.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/.VampireLanguageUiModule.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/contentassist/.VampireLanguageProposalProvider.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/contentassist/.VampireLanguageProposalProvider.xtendbin
index 48a792a0..58a18bbb 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/contentassist/.VampireLanguageProposalProvider.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/contentassist/.VampireLanguageProposalProvider.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/labeling/.VampireLanguageDescriptionLabelProvider.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/labeling/.VampireLanguageDescriptionLabelProvider.xtendbin
index 0e052102..205afcc4 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/labeling/.VampireLanguageDescriptionLabelProvider.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/labeling/.VampireLanguageDescriptionLabelProvider.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/labeling/.VampireLanguageLabelProvider.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/labeling/.VampireLanguageLabelProvider.xtendbin
index 4865470e..b388bd43 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/labeling/.VampireLanguageLabelProvider.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/labeling/.VampireLanguageLabelProvider.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/outline/.VampireLanguageOutlineTreeProvider.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/outline/.VampireLanguageOutlineTreeProvider.xtendbin
index 3c9c2bbf..3092be97 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/outline/.VampireLanguageOutlineTreeProvider.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/outline/.VampireLanguageOutlineTreeProvider.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/quickfix/.VampireLanguageQuickfixProvider.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/quickfix/.VampireLanguageQuickfixProvider.xtendbin
index d38b36ff..8b23f34d 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/quickfix/.VampireLanguageQuickfixProvider.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language.ui/xtend-gen/ca/mcgill/ecse/dslreasoner/ui/quickfix/.VampireLanguageQuickfixProvider.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/.VampireLanguageRuntimeModule.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/.VampireLanguageRuntimeModule.xtendbin
index 0886858b..84682c47 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/.VampireLanguageRuntimeModule.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/.VampireLanguageRuntimeModule.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/.VampireLanguageStandaloneSetup.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/.VampireLanguageStandaloneSetup.xtendbin
index fb078be1..e3f67a0c 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/.VampireLanguageStandaloneSetup.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/.VampireLanguageStandaloneSetup.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/formatting2/.VampireLanguageFormatter.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/formatting2/.VampireLanguageFormatter.xtendbin
index 7febb8b9..bf354098 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/formatting2/.VampireLanguageFormatter.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/formatting2/.VampireLanguageFormatter.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/generator/.VampireLanguageGenerator.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/generator/.VampireLanguageGenerator.xtendbin
index a790245e..da62f4c1 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/generator/.VampireLanguageGenerator.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/generator/.VampireLanguageGenerator.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/scoping/.VampireLanguageScopeProvider.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/scoping/.VampireLanguageScopeProvider.xtendbin
index 19d74808..482b884e 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/scoping/.VampireLanguageScopeProvider.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/scoping/.VampireLanguageScopeProvider.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/validation/.VampireLanguageValidator.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/validation/.VampireLanguageValidator.xtendbin
index ab5c8cfa..81c1f803 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/validation/.VampireLanguageValidator.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.language/xtend-gen/ca/mcgill/ecse/dslreasoner/validation/.VampireLanguageValidator.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/.VampireAnalyzerConfiguration.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/.VampireAnalyzerConfiguration.xtendbin
index 7394b24e..43e1e477 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/.VampireAnalyzerConfiguration.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/.VampireAnalyzerConfiguration.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/.VampireSolver.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/.VampireSolver.xtendbin
index d328dcf2..4e6f6ca0 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/.VampireSolver.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/.VampireSolver.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper.xtendbin
index 968a2df8..707a6089 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapperTrace.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapperTrace.xtendbin
index 346daf52..3171324f 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapperTrace.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapperTrace.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ConstantMapper.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ConstantMapper.xtendbin
index 48756fcc..301df7fa 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ConstantMapper.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ConstantMapper.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ContainmentMapper.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ContainmentMapper.xtendbin
index 44b06208..5e53ea26 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ContainmentMapper.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ContainmentMapper.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_RelationMapper.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_RelationMapper.xtendbin
index 4cab8309..b378ed09 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_RelationMapper.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_RelationMapper.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ScopeMapper.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ScopeMapper.xtendbin
index ccddb430..605ac88c 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ScopeMapper.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_ScopeMapper.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_Support.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_Support.xtendbin
index a069a62f..0c289e29 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_Support.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_Support.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_TypeMapper.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_TypeMapper.xtendbin
index 46cd58fb..cb72fd90 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_TypeMapper.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Logic2VampireLanguageMapper_TypeMapper.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Vampire2LogicMapper.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Vampire2LogicMapper.xtendbin
index 8725e6b1..cfe1e8cd 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Vampire2LogicMapper.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.Vampire2LogicMapper.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireHandler.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireHandler.xtendbin
index 1b5e4d0b..c2079147 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireHandler.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireHandler.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireModelInterpretation_TypeInterpretation.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireModelInterpretation_TypeInterpretation.xtendbin
index ca749be9..3c70bc14 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireModelInterpretation_TypeInterpretation.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireModelInterpretation_TypeInterpretation.xtendbin
Binary files differ
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireModelInterpretation_TypeInterpretation_FilteredTypes.xtendbin b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireModelInterpretation_TypeInterpretation_FilteredTypes.xtendbin
index 1c910cc9..9ef20b23 100644
--- a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireModelInterpretation_TypeInterpretation_FilteredTypes.xtendbin
+++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/.VampireModelInterpretation_TypeInterpretation_FilteredTypes.xtendbin
Binary files differ
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/metamodels/filesystem.ecore b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/metamodels/filesystem.ecore
index 8952cfb5..bbd4af35 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/metamodels/filesystem.ecore
+++ b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/metamodels/filesystem.ecore
@@ -10,7 +10,7 @@
10 <eStructuralFeatures xsi:type="ecore:EReference" name="live" upperBound="-1" eType="#//FSObject" 10 <eStructuralFeatures xsi:type="ecore:EReference" name="live" upperBound="-1" eType="#//FSObject"
11 changeable="false" volatile="true" transient="true" derived="true"> 11 changeable="false" volatile="true" transient="true" derived="true">
12 <eAnnotations source="org.eclipse.viatra.query.querybasedfeature"> 12 <eAnnotations source="org.eclipse.viatra.query.querybasedfeature">
13 <details key="patternFQN" value="ca.mcgill.ecse.dslreasoner.standalone.test.filesystem.queries.live"/> 13 <details key="patternFQN" value="ca.mcgill.ecse.dslreasoner.vampire.queries.live"/>
14 </eAnnotations> 14 </eAnnotations>
15 </eStructuralFeatures> 15 </eStructuralFeatures>
16 </eClassifiers> 16 </eClassifiers>
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/metamodels/yakindu.aird b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/metamodels/yakindu.aird
new file mode 100644
index 00000000..ef3746fa
--- /dev/null
+++ b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/metamodels/yakindu.aird
@@ -0,0 +1,675 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:diagram="http://www.eclipse.org/sirius/diagram/1.1.0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/style">
3 <viewpoint:DAnalysis uid="_e7vq8FybEemc87q3iJlCgw" selectedViews="_feFjAFybEemc87q3iJlCgw _feTlcFybEemc87q3iJlCgw _feUzkFybEemc87q3iJlCgw _feWBsFybEemc87q3iJlCgw" version="14.1.0.201810161215">
4 <semanticResources>yakindu.ecore</semanticResources>
5 <semanticResources>yakindu.genmodel</semanticResources>
6 <ownedViews xmi:type="viewpoint:DView" uid="_feFjAFybEemc87q3iJlCgw">
7 <viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']"/>
8 <ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_gE_K8FybEemc87q3iJlCgw" name="yakindu class diagram" repPath="#_gDD4UFybEemc87q3iJlCgw">
9 <description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
10 <target xmi:type="ecore:EPackage" href="yakindu.ecore#/"/>
11 </ownedRepresentationDescriptors>
12 </ownedViews>
13 <ownedViews xmi:type="viewpoint:DView" uid="_feTlcFybEemc87q3iJlCgw">
14 <viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Review']"/>
15 </ownedViews>
16 <ownedViews xmi:type="viewpoint:DView" uid="_feUzkFybEemc87q3iJlCgw">
17 <viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Archetype']"/>
18 </ownedViews>
19 <ownedViews xmi:type="viewpoint:DView" uid="_feWBsFybEemc87q3iJlCgw">
20 <viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Generation']"/>
21 </ownedViews>
22 </viewpoint:DAnalysis>
23 <diagram:DSemanticDiagram uid="_gDD4UFybEemc87q3iJlCgw" name="yakindu class diagram">
24 <ownedAnnotationEntries xmi:type="description:AnnotationEntry" uid="_gE1Z8FybEemc87q3iJlCgw" source="DANNOTATION_CUSTOMIZATION_KEY">
25 <data xmi:type="diagram:ComputedStyleDescriptionRegistry" uid="_gE2oEFybEemc87q3iJlCgw">
26 <computedStyleDescriptions xmi:type="style:EdgeStyleDescription" xmi:id="_g_MwcFybEemc87q3iJlCgw" sourceArrow="FillDiamond" routingStyle="manhattan">
27 <strokeColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
28 <centerLabelStyleDescription xmi:type="style:CenterLabelStyleDescription" xmi:id="_g_MwcVybEemc87q3iJlCgw" showIcon="false" labelExpression="service:render">
29 <labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
30 </centerLabelStyleDescription>
31 <endLabelStyleDescription xmi:type="style:EndLabelStyleDescription" xmi:id="_g_MwclybEemc87q3iJlCgw" labelSize="6" showIcon="false" labelExpression="service:eKeysLabel">
32 <labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='dark_blue']"/>
33 </endLabelStyleDescription>
34 </computedStyleDescriptions>
35 <computedStyleDescriptions xmi:type="style:EdgeStyleDescription" xmi:id="_g_g5gVybEemc87q3iJlCgw" sourceArrow="FillDiamond" routingStyle="manhattan">
36 <strokeColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
37 <beginLabelStyleDescription xmi:type="style:BeginLabelStyleDescription" xmi:id="_g_g5glybEemc87q3iJlCgw" showIcon="false" labelExpression="service:renderEOpposite">
38 <labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
39 </beginLabelStyleDescription>
40 <endLabelStyleDescription xmi:type="style:EndLabelStyleDescription" xmi:id="_g_g5g1ybEemc87q3iJlCgw" showIcon="false" labelExpression="service:render">
41 <labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
42 </endLabelStyleDescription>
43 </computedStyleDescriptions>
44 </data>
45 </ownedAnnotationEntries>
46 <ownedAnnotationEntries xmi:type="description:AnnotationEntry" uid="_gH58EFybEemc87q3iJlCgw" source="GMF_DIAGRAMS">
47 <data xmi:type="notation:Diagram" xmi:id="_gH58EVybEemc87q3iJlCgw" type="Sirius" element="_gDD4UFybEemc87q3iJlCgw" measurementUnit="Pixel">
48 <children xmi:type="notation:Node" xmi:id="_g_kj4FybEemc87q3iJlCgw" type="2003" element="_g-GkQFybEemc87q3iJlCgw">
49 <children xmi:type="notation:Node" xmi:id="_g_lK8FybEemc87q3iJlCgw" type="5007"/>
50 <children xmi:type="notation:Node" xmi:id="_g_nnMFybEemc87q3iJlCgw" type="7004">
51 <styles xmi:type="notation:SortingStyle" xmi:id="_g_nnMVybEemc87q3iJlCgw"/>
52 <styles xmi:type="notation:FilteringStyle" xmi:id="_g_nnMlybEemc87q3iJlCgw"/>
53 </children>
54 <styles xmi:type="notation:ShapeStyle" xmi:id="_g_kj4VybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8" italic="true"/>
55 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_kj4lybEemc87q3iJlCgw" x="360" y="324"/>
56 </children>
57 <children xmi:type="notation:Node" xmi:id="_g_o1UFybEemc87q3iJlCgw" type="2003" element="_g-SKcFybEemc87q3iJlCgw">
58 <children xmi:type="notation:Node" xmi:id="_g_pcYFybEemc87q3iJlCgw" type="5007"/>
59 <children xmi:type="notation:Node" xmi:id="_g_pcYVybEemc87q3iJlCgw" type="7004">
60 <styles xmi:type="notation:SortingStyle" xmi:id="_g_pcYlybEemc87q3iJlCgw"/>
61 <styles xmi:type="notation:FilteringStyle" xmi:id="_g_pcY1ybEemc87q3iJlCgw"/>
62 </children>
63 <styles xmi:type="notation:ShapeStyle" xmi:id="_g_o1UVybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8" italic="true"/>
64 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_o1UlybEemc87q3iJlCgw" x="648" y="156"/>
65 </children>
66 <children xmi:type="notation:Node" xmi:id="_g_pcZFybEemc87q3iJlCgw" type="2003" element="_g-T_oFybEemc87q3iJlCgw">
67 <children xmi:type="notation:Node" xmi:id="_g_pcZ1ybEemc87q3iJlCgw" type="5007"/>
68 <children xmi:type="notation:Node" xmi:id="_g_pcaFybEemc87q3iJlCgw" type="7004">
69 <styles xmi:type="notation:SortingStyle" xmi:id="_g_pcaVybEemc87q3iJlCgw"/>
70 <styles xmi:type="notation:FilteringStyle" xmi:id="_g_pcalybEemc87q3iJlCgw"/>
71 </children>
72 <styles xmi:type="notation:ShapeStyle" xmi:id="_g_pcZVybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
73 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_pcZlybEemc87q3iJlCgw" x="648" y="324"/>
74 </children>
75 <children xmi:type="notation:Node" xmi:id="_g_qDcFybEemc87q3iJlCgw" type="2003" element="_g-Wb4FybEemc87q3iJlCgw">
76 <children xmi:type="notation:Node" xmi:id="_g_qDc1ybEemc87q3iJlCgw" type="5007"/>
77 <children xmi:type="notation:Node" xmi:id="_g_qDdFybEemc87q3iJlCgw" type="7004">
78 <styles xmi:type="notation:SortingStyle" xmi:id="_g_qDdVybEemc87q3iJlCgw"/>
79 <styles xmi:type="notation:FilteringStyle" xmi:id="_g_qDdlybEemc87q3iJlCgw"/>
80 </children>
81 <styles xmi:type="notation:ShapeStyle" xmi:id="_g_qDcVybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
82 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_qDclybEemc87q3iJlCgw" x="648"/>
83 </children>
84 <children xmi:type="notation:Node" xmi:id="_g_qqgFybEemc87q3iJlCgw" type="2003" element="_g-YREFybEemc87q3iJlCgw">
85 <children xmi:type="notation:Node" xmi:id="_g_qqg1ybEemc87q3iJlCgw" type="5007"/>
86 <children xmi:type="notation:Node" xmi:id="_g_qqhFybEemc87q3iJlCgw" type="7004">
87 <styles xmi:type="notation:SortingStyle" xmi:id="_g_qqhVybEemc87q3iJlCgw"/>
88 <styles xmi:type="notation:FilteringStyle" xmi:id="_g_qqhlybEemc87q3iJlCgw"/>
89 </children>
90 <styles xmi:type="notation:ShapeStyle" xmi:id="_g_qqgVybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
91 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_qqglybEemc87q3iJlCgw" x="648" y="636"/>
92 </children>
93 <children xmi:type="notation:Node" xmi:id="_g_qqh1ybEemc87q3iJlCgw" type="2003" element="_g-aGQFybEemc87q3iJlCgw">
94 <children xmi:type="notation:Node" xmi:id="_g_rRkFybEemc87q3iJlCgw" type="5007"/>
95 <children xmi:type="notation:Node" xmi:id="_g_rRkVybEemc87q3iJlCgw" type="7004">
96 <styles xmi:type="notation:SortingStyle" xmi:id="_g_rRklybEemc87q3iJlCgw"/>
97 <styles xmi:type="notation:FilteringStyle" xmi:id="_g_rRk1ybEemc87q3iJlCgw"/>
98 </children>
99 <styles xmi:type="notation:ShapeStyle" xmi:id="_g_qqiFybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
100 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_qqiVybEemc87q3iJlCgw" x="180" y="480"/>
101 </children>
102 <children xmi:type="notation:Node" xmi:id="_g_rRlFybEemc87q3iJlCgw" type="2003" element="_g-b7cFybEemc87q3iJlCgw">
103 <children xmi:type="notation:Node" xmi:id="_g_r4oFybEemc87q3iJlCgw" type="5007"/>
104 <children xmi:type="notation:Node" xmi:id="_g_r4oVybEemc87q3iJlCgw" type="7004">
105 <styles xmi:type="notation:SortingStyle" xmi:id="_g_r4olybEemc87q3iJlCgw"/>
106 <styles xmi:type="notation:FilteringStyle" xmi:id="_g_r4o1ybEemc87q3iJlCgw"/>
107 </children>
108 <styles xmi:type="notation:ShapeStyle" xmi:id="_g_rRlVybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
109 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_rRllybEemc87q3iJlCgw" y="480"/>
110 </children>
111 <children xmi:type="notation:Node" xmi:id="_g_sfsFybEemc87q3iJlCgw" type="2003" element="_g-dJkVybEemc87q3iJlCgw">
112 <children xmi:type="notation:Node" xmi:id="_g_sfs1ybEemc87q3iJlCgw" type="5007"/>
113 <children xmi:type="notation:Node" xmi:id="_g_sftFybEemc87q3iJlCgw" type="7004">
114 <styles xmi:type="notation:SortingStyle" xmi:id="_g_sftVybEemc87q3iJlCgw"/>
115 <styles xmi:type="notation:FilteringStyle" xmi:id="_g_sftlybEemc87q3iJlCgw"/>
116 </children>
117 <styles xmi:type="notation:ShapeStyle" xmi:id="_g_sfsVybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
118 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_sfslybEemc87q3iJlCgw" x="828" y="636"/>
119 </children>
120 <children xmi:type="notation:Node" xmi:id="_g_tGwFybEemc87q3iJlCgw" type="2003" element="_g-fl0FybEemc87q3iJlCgw">
121 <children xmi:type="notation:Node" xmi:id="_g_uU4FybEemc87q3iJlCgw" type="5007"/>
122 <children xmi:type="notation:Node" xmi:id="_g_u78FybEemc87q3iJlCgw" type="7004">
123 <styles xmi:type="notation:SortingStyle" xmi:id="_g_u78VybEemc87q3iJlCgw"/>
124 <styles xmi:type="notation:FilteringStyle" xmi:id="_g_u78lybEemc87q3iJlCgw"/>
125 </children>
126 <styles xmi:type="notation:ShapeStyle" xmi:id="_g_tGwVybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8" italic="true"/>
127 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_tGwlybEemc87q3iJlCgw" x="828" y="324"/>
128 </children>
129 <children xmi:type="notation:Node" xmi:id="_g_u781ybEemc87q3iJlCgw" type="2003" element="_g-hbAVybEemc87q3iJlCgw">
130 <children xmi:type="notation:Node" xmi:id="_g_vjAFybEemc87q3iJlCgw" type="5007"/>
131 <children xmi:type="notation:Node" xmi:id="_g_vjAVybEemc87q3iJlCgw" type="7004">
132 <styles xmi:type="notation:SortingStyle" xmi:id="_g_vjAlybEemc87q3iJlCgw"/>
133 <styles xmi:type="notation:FilteringStyle" xmi:id="_g_vjA1ybEemc87q3iJlCgw"/>
134 </children>
135 <styles xmi:type="notation:ShapeStyle" xmi:id="_g_u79FybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8" italic="true"/>
136 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_u79VybEemc87q3iJlCgw" x="720" y="480"/>
137 </children>
138 <children xmi:type="notation:Node" xmi:id="_g_vjBFybEemc87q3iJlCgw" type="2003" element="_g-jQMFybEemc87q3iJlCgw">
139 <children xmi:type="notation:Node" xmi:id="_g_wKEFybEemc87q3iJlCgw" type="5007"/>
140 <children xmi:type="notation:Node" xmi:id="_g_wKEVybEemc87q3iJlCgw" type="7004">
141 <styles xmi:type="notation:SortingStyle" xmi:id="_g_wKElybEemc87q3iJlCgw"/>
142 <styles xmi:type="notation:FilteringStyle" xmi:id="_g_wKE1ybEemc87q3iJlCgw"/>
143 </children>
144 <styles xmi:type="notation:ShapeStyle" xmi:id="_g_vjBVybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
145 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_vjBlybEemc87q3iJlCgw" x="360" y="480"/>
146 </children>
147 <children xmi:type="notation:Node" xmi:id="_g_wKFFybEemc87q3iJlCgw" type="2003" element="_g-lscFybEemc87q3iJlCgw">
148 <children xmi:type="notation:Node" xmi:id="_g_wKF1ybEemc87q3iJlCgw" type="5007"/>
149 <children xmi:type="notation:Node" xmi:id="_g_wKGFybEemc87q3iJlCgw" type="7004">
150 <styles xmi:type="notation:SortingStyle" xmi:id="_g_wKGVybEemc87q3iJlCgw"/>
151 <styles xmi:type="notation:FilteringStyle" xmi:id="_g_wKGlybEemc87q3iJlCgw"/>
152 </children>
153 <styles xmi:type="notation:ShapeStyle" xmi:id="_g_wKFVybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
154 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_wKFlybEemc87q3iJlCgw" x="540" y="480"/>
155 </children>
156 <children xmi:type="notation:Node" xmi:id="_g_wxIFybEemc87q3iJlCgw" type="2003" element="_g-m6kFybEemc87q3iJlCgw">
157 <children xmi:type="notation:Node" xmi:id="_g_wxI1ybEemc87q3iJlCgw" type="5007"/>
158 <children xmi:type="notation:Node" xmi:id="_g_wxJFybEemc87q3iJlCgw" type="7004">
159 <styles xmi:type="notation:SortingStyle" xmi:id="_g_wxJVybEemc87q3iJlCgw"/>
160 <styles xmi:type="notation:FilteringStyle" xmi:id="_g_wxJlybEemc87q3iJlCgw"/>
161 </children>
162 <styles xmi:type="notation:ShapeStyle" xmi:id="_g_wxIVybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
163 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_wxIlybEemc87q3iJlCgw" x="936" y="480"/>
164 </children>
165 <styles xmi:type="notation:DiagramStyle" xmi:id="_gH58ElybEemc87q3iJlCgw"/>
166 <edges xmi:type="notation:Edge" xmi:id="_g_z0cFybEemc87q3iJlCgw" type="4001" element="_g_JtIFybEemc87q3iJlCgw" source="_g_pcZFybEemc87q3iJlCgw" target="_g_o1UFybEemc87q3iJlCgw">
167 <children xmi:type="notation:Node" xmi:id="_g_4s8FybEemc87q3iJlCgw" type="6001">
168 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_4s8VybEemc87q3iJlCgw" x="19" y="47"/>
169 </children>
170 <children xmi:type="notation:Node" xmi:id="_g_4s8lybEemc87q3iJlCgw" type="6002">
171 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_4s81ybEemc87q3iJlCgw" y="10"/>
172 </children>
173 <children xmi:type="notation:Node" xmi:id="_g_4s9FybEemc87q3iJlCgw" type="6003">
174 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_g_4s9VybEemc87q3iJlCgw" y="10"/>
175 </children>
176 <styles xmi:type="notation:ConnectorStyle" xmi:id="_g_z0cVybEemc87q3iJlCgw" routing="Rectilinear"/>
177 <styles xmi:type="notation:FontStyle" xmi:id="_g_z0clybEemc87q3iJlCgw" fontColor="7490599" fontName="Segoe UI" fontHeight="8"/>
178 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_g_z0c1ybEemc87q3iJlCgw" points="[25, 0, 25, 70]$[25, -70, 25, 0]"/>
179 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAETIFybEemc87q3iJlCgw" id="(0.5,0.0)"/>
180 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAETIVybEemc87q3iJlCgw" id="(0.5,1.0)"/>
181 </edges>
182 <edges xmi:type="notation:Edge" xmi:id="_hAETIlybEemc87q3iJlCgw" type="4001" element="_g_MweVybEemc87q3iJlCgw" source="_g_u781ybEemc87q3iJlCgw" target="_g_pcZFybEemc87q3iJlCgw">
183 <children xmi:type="notation:Node" xmi:id="_hAETJlybEemc87q3iJlCgw" type="6001">
184 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAETJ1ybEemc87q3iJlCgw" y="-10"/>
185 </children>
186 <children xmi:type="notation:Node" xmi:id="_hAFhQFybEemc87q3iJlCgw" type="6002">
187 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAFhQVybEemc87q3iJlCgw" y="10"/>
188 </children>
189 <children xmi:type="notation:Node" xmi:id="_hAFhQlybEemc87q3iJlCgw" type="6003">
190 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAFhQ1ybEemc87q3iJlCgw" y="10"/>
191 </children>
192 <styles xmi:type="notation:ConnectorStyle" xmi:id="_hAETI1ybEemc87q3iJlCgw" routing="Rectilinear"/>
193 <styles xmi:type="notation:FontStyle" xmi:id="_hAETJFybEemc87q3iJlCgw" fontColor="7490599" fontName="Segoe UI" fontHeight="8"/>
194 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hAETJVybEemc87q3iJlCgw" points="[0, 0, 75, 60]$[-75, -60, 0, 0]"/>
195 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAFhRFybEemc87q3iJlCgw" id="(0.5,0.0)"/>
196 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAFhRVybEemc87q3iJlCgw" id="(0.5,1.0)"/>
197 </edges>
198 <edges xmi:type="notation:Edge" xmi:id="_hAFhRlybEemc87q3iJlCgw" type="4001" element="_g_S3EFybEemc87q3iJlCgw" source="_g_tGwFybEemc87q3iJlCgw" target="_g_o1UFybEemc87q3iJlCgw">
199 <children xmi:type="notation:Node" xmi:id="_hAGIUFybEemc87q3iJlCgw" type="6001">
200 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAGIUVybEemc87q3iJlCgw" y="-10"/>
201 </children>
202 <children xmi:type="notation:Node" xmi:id="_hAGIUlybEemc87q3iJlCgw" type="6002">
203 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAGIU1ybEemc87q3iJlCgw" y="10"/>
204 </children>
205 <children xmi:type="notation:Node" xmi:id="_hAGIVFybEemc87q3iJlCgw" type="6003">
206 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAGIVVybEemc87q3iJlCgw" y="10"/>
207 </children>
208 <styles xmi:type="notation:ConnectorStyle" xmi:id="_hAFhR1ybEemc87q3iJlCgw" routing="Tree"/>
209 <styles xmi:type="notation:FontStyle" xmi:id="_hAFhSFybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
210 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hAFhSVybEemc87q3iJlCgw" points="[0, 0, 180, 60]$[-180, -60, 0, 0]"/>
211 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAGIVlybEemc87q3iJlCgw" id="(0.5,0.0)"/>
212 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAGIV1ybEemc87q3iJlCgw" id="(0.5,1.0)"/>
213 </edges>
214 <edges xmi:type="notation:Edge" xmi:id="_hAGIWFybEemc87q3iJlCgw" type="4001" element="_g_V6ZlybEemc87q3iJlCgw" source="_g_vjBFybEemc87q3iJlCgw" target="_g_kj4FybEemc87q3iJlCgw">
215 <children xmi:type="notation:Node" xmi:id="_hAGvYFybEemc87q3iJlCgw" type="6001">
216 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAGvYVybEemc87q3iJlCgw" y="-10"/>
217 </children>
218 <children xmi:type="notation:Node" xmi:id="_hAGvYlybEemc87q3iJlCgw" type="6002">
219 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAGvY1ybEemc87q3iJlCgw" y="10"/>
220 </children>
221 <children xmi:type="notation:Node" xmi:id="_hAGvZFybEemc87q3iJlCgw" type="6003">
222 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAGvZVybEemc87q3iJlCgw" y="10"/>
223 </children>
224 <styles xmi:type="notation:ConnectorStyle" xmi:id="_hAGIWVybEemc87q3iJlCgw" routing="Tree"/>
225 <styles xmi:type="notation:FontStyle" xmi:id="_hAGIWlybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
226 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hAGIW1ybEemc87q3iJlCgw" points="[0, 0, 0, 60]$[0, -60, 0, 0]"/>
227 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAHWcFybEemc87q3iJlCgw" id="(0.5,0.0)"/>
228 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAHWcVybEemc87q3iJlCgw" id="(0.5,1.0)"/>
229 </edges>
230 <edges xmi:type="notation:Edge" xmi:id="_hAHWclybEemc87q3iJlCgw" type="4001" element="_g_V6bVybEemc87q3iJlCgw" source="_g_wKFFybEemc87q3iJlCgw" target="_g_kj4FybEemc87q3iJlCgw">
231 <children xmi:type="notation:Node" xmi:id="_hAH9gFybEemc87q3iJlCgw" type="6001">
232 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAH9gVybEemc87q3iJlCgw" y="-10"/>
233 </children>
234 <children xmi:type="notation:Node" xmi:id="_hAH9glybEemc87q3iJlCgw" type="6002">
235 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAH9g1ybEemc87q3iJlCgw" y="10"/>
236 </children>
237 <children xmi:type="notation:Node" xmi:id="_hAH9hFybEemc87q3iJlCgw" type="6003">
238 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAH9hVybEemc87q3iJlCgw" y="10"/>
239 </children>
240 <styles xmi:type="notation:ConnectorStyle" xmi:id="_hAHWc1ybEemc87q3iJlCgw" routing="Tree"/>
241 <styles xmi:type="notation:FontStyle" xmi:id="_hAHWdFybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
242 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hAHWdVybEemc87q3iJlCgw" points="[0, 0, 180, 60]$[-180, -60, 0, 0]"/>
243 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAH9hlybEemc87q3iJlCgw" id="(0.5,0.0)"/>
244 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAH9h1ybEemc87q3iJlCgw" id="(0.5,1.0)"/>
245 </edges>
246 <edges xmi:type="notation:Edge" xmi:id="_hAIkkFybEemc87q3iJlCgw" type="4001" element="_g_aL0FybEemc87q3iJlCgw" source="_g_wxIFybEemc87q3iJlCgw" target="_g_tGwFybEemc87q3iJlCgw">
247 <children xmi:type="notation:Node" xmi:id="_hAIklFybEemc87q3iJlCgw" type="6001">
248 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAIklVybEemc87q3iJlCgw" y="-10"/>
249 </children>
250 <children xmi:type="notation:Node" xmi:id="_hAIkllybEemc87q3iJlCgw" type="6002">
251 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAIkl1ybEemc87q3iJlCgw" y="10"/>
252 </children>
253 <children xmi:type="notation:Node" xmi:id="_hAIkmFybEemc87q3iJlCgw" type="6003">
254 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAIkmVybEemc87q3iJlCgw" y="10"/>
255 </children>
256 <styles xmi:type="notation:ConnectorStyle" xmi:id="_hAIkkVybEemc87q3iJlCgw" routing="Tree"/>
257 <styles xmi:type="notation:FontStyle" xmi:id="_hAIkklybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
258 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hAIkk1ybEemc87q3iJlCgw" points="[0, 0, 106, 60]$[-106, -60, 0, 0]"/>
259 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAJLoFybEemc87q3iJlCgw" id="(0.5,0.0)"/>
260 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAJLoVybEemc87q3iJlCgw" id="(0.5,1.0)"/>
261 </edges>
262 <edges xmi:type="notation:Edge" xmi:id="_hAJLolybEemc87q3iJlCgw" type="4001" element="_g_ay41ybEemc87q3iJlCgw" source="_g_qqh1ybEemc87q3iJlCgw" target="_g_kj4FybEemc87q3iJlCgw">
263 <children xmi:type="notation:Node" xmi:id="_hAJLplybEemc87q3iJlCgw" type="6001">
264 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAJLp1ybEemc87q3iJlCgw" y="-10"/>
265 </children>
266 <children xmi:type="notation:Node" xmi:id="_hAJLqFybEemc87q3iJlCgw" type="6002">
267 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAJLqVybEemc87q3iJlCgw" y="10"/>
268 </children>
269 <children xmi:type="notation:Node" xmi:id="_hAJLqlybEemc87q3iJlCgw" type="6003">
270 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAJLq1ybEemc87q3iJlCgw" y="10"/>
271 </children>
272 <styles xmi:type="notation:ConnectorStyle" xmi:id="_hAJLo1ybEemc87q3iJlCgw" routing="Tree"/>
273 <styles xmi:type="notation:FontStyle" xmi:id="_hAJLpFybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
274 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hAJLpVybEemc87q3iJlCgw" points="[0, 0, -180, 60]$[180, -60, 0, 0]"/>
275 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAKZwFybEemc87q3iJlCgw" id="(0.5,0.0)"/>
276 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAKZwVybEemc87q3iJlCgw" id="(0.5,1.0)"/>
277 </edges>
278 <edges xmi:type="notation:Edge" xmi:id="_hAKZwlybEemc87q3iJlCgw" type="4001" element="_g_cBAFybEemc87q3iJlCgw" source="_g_qqgFybEemc87q3iJlCgw" target="_g_u781ybEemc87q3iJlCgw">
279 <children xmi:type="notation:Node" xmi:id="_hAKZxlybEemc87q3iJlCgw" type="6001">
280 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAKZx1ybEemc87q3iJlCgw" y="-10"/>
281 </children>
282 <children xmi:type="notation:Node" xmi:id="_hAKZyFybEemc87q3iJlCgw" type="6002">
283 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAKZyVybEemc87q3iJlCgw" y="10"/>
284 </children>
285 <children xmi:type="notation:Node" xmi:id="_hAKZylybEemc87q3iJlCgw" type="6003">
286 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAKZy1ybEemc87q3iJlCgw" y="10"/>
287 </children>
288 <styles xmi:type="notation:ConnectorStyle" xmi:id="_hAKZw1ybEemc87q3iJlCgw" routing="Tree"/>
289 <styles xmi:type="notation:FontStyle" xmi:id="_hAKZxFybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
290 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hAKZxVybEemc87q3iJlCgw" points="[0, 0, -75, 60]$[75, -60, 0, 0]"/>
291 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hALA0FybEemc87q3iJlCgw" id="(0.5,0.0)"/>
292 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hALA0VybEemc87q3iJlCgw" id="(0.5,1.0)"/>
293 </edges>
294 <edges xmi:type="notation:Edge" xmi:id="_hALA0lybEemc87q3iJlCgw" type="4001" element="_g_coEFybEemc87q3iJlCgw" source="_g_rRlFybEemc87q3iJlCgw" target="_g_kj4FybEemc87q3iJlCgw">
295 <children xmi:type="notation:Node" xmi:id="_hALA1lybEemc87q3iJlCgw" type="6001">
296 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hALA11ybEemc87q3iJlCgw" y="-10"/>
297 </children>
298 <children xmi:type="notation:Node" xmi:id="_hALA2FybEemc87q3iJlCgw" type="6002">
299 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hALA2VybEemc87q3iJlCgw" y="10"/>
300 </children>
301 <children xmi:type="notation:Node" xmi:id="_hALA2lybEemc87q3iJlCgw" type="6003">
302 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hALA21ybEemc87q3iJlCgw" y="10"/>
303 </children>
304 <styles xmi:type="notation:ConnectorStyle" xmi:id="_hALA01ybEemc87q3iJlCgw" routing="Tree"/>
305 <styles xmi:type="notation:FontStyle" xmi:id="_hALA1FybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
306 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hALA1VybEemc87q3iJlCgw" points="[0, 0, -360, 60]$[360, -60, 0, 0]"/>
307 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hALn4FybEemc87q3iJlCgw" id="(0.5,0.0)"/>
308 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hALn4VybEemc87q3iJlCgw" id="(0.5,1.0)"/>
309 </edges>
310 <edges xmi:type="notation:Edge" xmi:id="_hAMO8FybEemc87q3iJlCgw" type="4001" element="_g_dPI1ybEemc87q3iJlCgw" source="_g_sfsFybEemc87q3iJlCgw" target="_g_tGwFybEemc87q3iJlCgw">
311 <children xmi:type="notation:Node" xmi:id="_hAMO9FybEemc87q3iJlCgw" type="6001">
312 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAMO9VybEemc87q3iJlCgw" y="-10"/>
313 </children>
314 <children xmi:type="notation:Node" xmi:id="_hAMO9lybEemc87q3iJlCgw" type="6002">
315 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAMO91ybEemc87q3iJlCgw" y="10"/>
316 </children>
317 <children xmi:type="notation:Node" xmi:id="_hAMO-FybEemc87q3iJlCgw" type="6003">
318 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAMO-VybEemc87q3iJlCgw" y="10"/>
319 </children>
320 <styles xmi:type="notation:ConnectorStyle" xmi:id="_hAMO8VybEemc87q3iJlCgw" routing="Tree"/>
321 <styles xmi:type="notation:FontStyle" xmi:id="_hAMO8lybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
322 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hAMO81ybEemc87q3iJlCgw" points="[0, 0, 0, 220]$[0, -220, 0, 0]"/>
323 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAei0FybEemc87q3iJlCgw" id="(0.5,0.0)"/>
324 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAei0VybEemc87q3iJlCgw" id="(0.5,1.0)"/>
325 </edges>
326 <edges xmi:type="notation:Edge" xmi:id="_hAfJ4FybEemc87q3iJlCgw" type="4001" element="_g_edQFybEemc87q3iJlCgw" source="_g_sfsFybEemc87q3iJlCgw" target="_g_u781ybEemc87q3iJlCgw">
327 <children xmi:type="notation:Node" xmi:id="_hAfw8FybEemc87q3iJlCgw" type="6001">
328 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAfw8VybEemc87q3iJlCgw" y="-10"/>
329 </children>
330 <children xmi:type="notation:Node" xmi:id="_hAfw8lybEemc87q3iJlCgw" type="6002">
331 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAfw81ybEemc87q3iJlCgw" y="10"/>
332 </children>
333 <children xmi:type="notation:Node" xmi:id="_hAfw9FybEemc87q3iJlCgw" type="6003">
334 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAfw9VybEemc87q3iJlCgw" y="10"/>
335 </children>
336 <styles xmi:type="notation:ConnectorStyle" xmi:id="_hAfJ4VybEemc87q3iJlCgw" routing="Tree"/>
337 <styles xmi:type="notation:FontStyle" xmi:id="_hAfJ4lybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
338 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hAfJ41ybEemc87q3iJlCgw" points="[0, 0, 105, 60]$[-105, -60, 0, 0]"/>
339 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAgYAFybEemc87q3iJlCgw" id="(0.5,0.0)"/>
340 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAgYAVybEemc87q3iJlCgw" id="(0.5,1.0)"/>
341 </edges>
342 <edges xmi:type="notation:Edge" xmi:id="_hAgYAlybEemc87q3iJlCgw" type="4001" element="_g_fEUFybEemc87q3iJlCgw" source="_g_kj4FybEemc87q3iJlCgw" target="_g_o1UFybEemc87q3iJlCgw">
343 <children xmi:type="notation:Node" xmi:id="_hAgYBlybEemc87q3iJlCgw" type="6001">
344 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAgYB1ybEemc87q3iJlCgw" y="-10"/>
345 </children>
346 <children xmi:type="notation:Node" xmi:id="_hAg_EFybEemc87q3iJlCgw" type="6002">
347 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAg_EVybEemc87q3iJlCgw" y="10"/>
348 </children>
349 <children xmi:type="notation:Node" xmi:id="_hAg_ElybEemc87q3iJlCgw" type="6003">
350 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAg_E1ybEemc87q3iJlCgw" y="10"/>
351 </children>
352 <styles xmi:type="notation:ConnectorStyle" xmi:id="_hAgYA1ybEemc87q3iJlCgw" routing="Tree"/>
353 <styles xmi:type="notation:FontStyle" xmi:id="_hAgYBFybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
354 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hAgYBVybEemc87q3iJlCgw" points="[0, 0, -285, 60]$[285, -60, 0, 0]"/>
355 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAg_FFybEemc87q3iJlCgw" id="(0.5,0.0)"/>
356 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAg_FVybEemc87q3iJlCgw" id="(0.5,1.0)"/>
357 </edges>
358 <edges xmi:type="notation:Edge" xmi:id="_hAhmIFybEemc87q3iJlCgw" type="4001" element="_g_frY1ybEemc87q3iJlCgw" source="_g_o1UFybEemc87q3iJlCgw" target="_g_qDcFybEemc87q3iJlCgw">
359 <children xmi:type="notation:Node" xmi:id="_hAhmJFybEemc87q3iJlCgw" type="6001">
360 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAhmJVybEemc87q3iJlCgw" x="1" y="-10"/>
361 </children>
362 <children xmi:type="notation:Node" xmi:id="_hAhmJlybEemc87q3iJlCgw" type="6002">
363 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAhmJ1ybEemc87q3iJlCgw" y="-10"/>
364 </children>
365 <children xmi:type="notation:Node" xmi:id="_hAhmKFybEemc87q3iJlCgw" type="6003">
366 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAhmKVybEemc87q3iJlCgw" y="10"/>
367 </children>
368 <styles xmi:type="notation:ConnectorStyle" xmi:id="_hAhmIVybEemc87q3iJlCgw" routing="Rectilinear"/>
369 <styles xmi:type="notation:FontStyle" xmi:id="_hAhmIlybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
370 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hAhmI1ybEemc87q3iJlCgw" points="[-59, 50, -59, 108]$[-143, 50, -143, 108]$[-143, -106, -143, -48]$[-59, -106, -59, -48]"/>
371 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAiNMFybEemc87q3iJlCgw" id="(0.5,0.0)"/>
372 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAiNMVybEemc87q3iJlCgw" id="(0.5,1.0)"/>
373 </edges>
374 <edges xmi:type="notation:Edge" xmi:id="_hAiNMlybEemc87q3iJlCgw" type="4001" element="_g_g5gFybEemc87q3iJlCgw" source="_g_o1UFybEemc87q3iJlCgw" target="_g_qDcFybEemc87q3iJlCgw">
375 <children xmi:type="notation:Node" xmi:id="_hAiNNlybEemc87q3iJlCgw" type="6001">
376 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAiNN1ybEemc87q3iJlCgw" x="1" y="-10"/>
377 </children>
378 <children xmi:type="notation:Node" xmi:id="_hAi0QFybEemc87q3iJlCgw" type="6002">
379 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAi0QVybEemc87q3iJlCgw" y="10"/>
380 </children>
381 <children xmi:type="notation:Node" xmi:id="_hAi0QlybEemc87q3iJlCgw" type="6003">
382 <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hAi0Q1ybEemc87q3iJlCgw" y="-10"/>
383 </children>
384 <styles xmi:type="notation:ConnectorStyle" xmi:id="_hAiNM1ybEemc87q3iJlCgw" routing="Rectilinear"/>
385 <styles xmi:type="notation:FontStyle" xmi:id="_hAiNNFybEemc87q3iJlCgw" fontName="Segoe UI" fontHeight="8"/>
386 <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hAiNNVybEemc87q3iJlCgw" points="[59, 50, 59, 108]$[130, 50, 130, 108]$[130, -106, 130, -48]$[59, -106, 59, -48]"/>
387 <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAi0RFybEemc87q3iJlCgw" id="(0.5,0.0)"/>
388 <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hAi0RVybEemc87q3iJlCgw" id="(0.5,1.0)"/>
389 </edges>
390 </data>
391 </ownedAnnotationEntries>
392 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_g-GkQFybEemc87q3iJlCgw" name="Pseudostate" tooltipText="" outgoingEdges="_g_fEUFybEemc87q3iJlCgw" incomingEdges="_g_V6ZlybEemc87q3iJlCgw _g_V6bVybEemc87q3iJlCgw _g_ay41ybEemc87q3iJlCgw _g_coEFybEemc87q3iJlCgw" width="12" height="10">
393 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Pseudostate"/>
394 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Pseudostate"/>
395 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_g-NR8FybEemc87q3iJlCgw" iconPath="/org.eclipse.emf.ecoretools.design/icons/full/obj16/EClass_abstract.gif" borderSize="1" borderSizeComputationExpression="1" borderColor="125,125,125" backgroundStyle="Liquid" foregroundColor="228,228,228">
396 <labelFormat>italic</labelFormat>
397 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@conditionnalStyles.1/@style"/>
398 </ownedStyle>
399 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
400 </ownedDiagramElements>
401 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_g-SKcFybEemc87q3iJlCgw" name="Vertex" tooltipText="" outgoingEdges="_g_frY1ybEemc87q3iJlCgw _g_g5gFybEemc87q3iJlCgw" incomingEdges="_g_JtIFybEemc87q3iJlCgw _g_S3EFybEemc87q3iJlCgw _g_fEUFybEemc87q3iJlCgw" width="12" height="10">
402 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Vertex"/>
403 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Vertex"/>
404 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_g-SxgFybEemc87q3iJlCgw" iconPath="/org.eclipse.emf.ecoretools.design/icons/full/obj16/EClass_abstract.gif" borderSize="1" borderSizeComputationExpression="1" borderColor="125,125,125" backgroundStyle="Liquid" foregroundColor="228,228,228">
405 <labelFormat>italic</labelFormat>
406 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@conditionnalStyles.1/@style"/>
407 </ownedStyle>
408 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
409 </ownedDiagramElements>
410 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_g-T_oFybEemc87q3iJlCgw" name="Region" tooltipText="" outgoingEdges="_g_JtIFybEemc87q3iJlCgw" incomingEdges="_g_MweVybEemc87q3iJlCgw" width="12" height="10">
411 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Region"/>
412 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Region"/>
413 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_g-VNwFybEemc87q3iJlCgw" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
414 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
415 </ownedStyle>
416 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
417 </ownedDiagramElements>
418 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_g-Wb4FybEemc87q3iJlCgw" name="Transition" tooltipText="" incomingEdges="_g_frY1ybEemc87q3iJlCgw _g_g5gFybEemc87q3iJlCgw" width="12" height="10">
419 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Transition"/>
420 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Transition"/>
421 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_g-XC8FybEemc87q3iJlCgw" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
422 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
423 </ownedStyle>
424 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
425 </ownedDiagramElements>
426 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_g-YREFybEemc87q3iJlCgw" name="Statechart" tooltipText="" outgoingEdges="_g_cBAFybEemc87q3iJlCgw" width="12" height="10">
427 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Statechart"/>
428 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Statechart"/>
429 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_g-ZfMFybEemc87q3iJlCgw" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
430 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
431 </ownedStyle>
432 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
433 </ownedDiagramElements>
434 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_g-aGQFybEemc87q3iJlCgw" name="Entry" tooltipText="" outgoingEdges="_g_ay41ybEemc87q3iJlCgw" width="12" height="10">
435 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Entry"/>
436 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Entry"/>
437 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_g-atUFybEemc87q3iJlCgw" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
438 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
439 </ownedStyle>
440 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
441 </ownedDiagramElements>
442 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_g-b7cFybEemc87q3iJlCgw" name="Synchronization" tooltipText="" outgoingEdges="_g_coEFybEemc87q3iJlCgw" width="12" height="10">
443 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Synchronization"/>
444 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Synchronization"/>
445 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_g-cigFybEemc87q3iJlCgw" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
446 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
447 </ownedStyle>
448 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
449 </ownedDiagramElements>
450 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_g-dJkVybEemc87q3iJlCgw" name="State" tooltipText="" outgoingEdges="_g_dPI1ybEemc87q3iJlCgw _g_edQFybEemc87q3iJlCgw" width="12" height="10">
451 <target xmi:type="ecore:EClass" href="yakindu.ecore#//State"/>
452 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//State"/>
453 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_g-e-wFybEemc87q3iJlCgw" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
454 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
455 </ownedStyle>
456 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
457 </ownedDiagramElements>
458 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_g-fl0FybEemc87q3iJlCgw" name="RegularState" tooltipText="" outgoingEdges="_g_S3EFybEemc87q3iJlCgw" incomingEdges="_g_aL0FybEemc87q3iJlCgw _g_dPI1ybEemc87q3iJlCgw" width="12" height="10">
459 <target xmi:type="ecore:EClass" href="yakindu.ecore#//RegularState"/>
460 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//RegularState"/>
461 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_g-gz8FybEemc87q3iJlCgw" iconPath="/org.eclipse.emf.ecoretools.design/icons/full/obj16/EClass_abstract.gif" borderSize="1" borderSizeComputationExpression="1" borderColor="125,125,125" backgroundStyle="Liquid" foregroundColor="228,228,228">
462 <labelFormat>italic</labelFormat>
463 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@conditionnalStyles.1/@style"/>
464 </ownedStyle>
465 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
466 </ownedDiagramElements>
467 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_g-hbAVybEemc87q3iJlCgw" name="CompositeElement" tooltipText="" outgoingEdges="_g_MweVybEemc87q3iJlCgw" incomingEdges="_g_cBAFybEemc87q3iJlCgw _g_edQFybEemc87q3iJlCgw" width="12" height="10">
468 <target xmi:type="ecore:EClass" href="yakindu.ecore#//CompositeElement"/>
469 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//CompositeElement"/>
470 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_g-iCEFybEemc87q3iJlCgw" iconPath="/org.eclipse.emf.ecoretools.design/icons/full/obj16/EClass_abstract.gif" borderSize="1" borderSizeComputationExpression="1" borderColor="125,125,125" backgroundStyle="Liquid" foregroundColor="228,228,228">
471 <labelFormat>italic</labelFormat>
472 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@conditionnalStyles.1/@style"/>
473 </ownedStyle>
474 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
475 </ownedDiagramElements>
476 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_g-jQMFybEemc87q3iJlCgw" name="Choice" tooltipText="" outgoingEdges="_g_V6ZlybEemc87q3iJlCgw" width="12" height="10">
477 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Choice"/>
478 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Choice"/>
479 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_g-keUFybEemc87q3iJlCgw" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
480 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
481 </ownedStyle>
482 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
483 </ownedDiagramElements>
484 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_g-lscFybEemc87q3iJlCgw" name="Exit" tooltipText="" outgoingEdges="_g_V6bVybEemc87q3iJlCgw" width="12" height="10">
485 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Exit"/>
486 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Exit"/>
487 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_g-mTgFybEemc87q3iJlCgw" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
488 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
489 </ownedStyle>
490 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
491 </ownedDiagramElements>
492 <ownedDiagramElements xmi:type="diagram:DNodeList" uid="_g-m6kFybEemc87q3iJlCgw" name="FinalState" tooltipText="" outgoingEdges="_g_aL0FybEemc87q3iJlCgw" width="12" height="10">
493 <target xmi:type="ecore:EClass" href="yakindu.ecore#//FinalState"/>
494 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//FinalState"/>
495 <ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_g-nhoFybEemc87q3iJlCgw" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
496 <description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
497 </ownedStyle>
498 <actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
499 </ownedDiagramElements>
500 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_g_JtIFybEemc87q3iJlCgw" name="[0..*] vertices" sourceNode="_g-T_oFybEemc87q3iJlCgw" targetNode="_g-SKcFybEemc87q3iJlCgw">
501 <target xmi:type="ecore:EReference" href="yakindu.ecore#//Region/vertices"/>
502 <semanticElements xmi:type="ecore:EReference" href="yakindu.ecore#//Region/vertices"/>
503 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_g_Mwc1ybEemc87q3iJlCgw" description="_g_MwcFybEemc87q3iJlCgw" sourceArrow="FillDiamond" routingStyle="manhattan" strokeColor="0,0,0">
504 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_g_MwdVybEemc87q3iJlCgw" showIcon="false">
505 <customFeatures>labelSize</customFeatures>
506 </centerLabelStyle>
507 <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_g_MwdFybEemc87q3iJlCgw" showIcon="false" labelColor="39,76,114">
508 <customFeatures>labelSize</customFeatures>
509 </endLabelStyle>
510 </ownedStyle>
511 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']"/>
512 </ownedDiagramElements>
513 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_g_MweVybEemc87q3iJlCgw" name="[0..*] regions" sourceNode="_g-hbAVybEemc87q3iJlCgw" targetNode="_g-T_oFybEemc87q3iJlCgw">
514 <target xmi:type="ecore:EReference" href="yakindu.ecore#//CompositeElement/regions"/>
515 <semanticElements xmi:type="ecore:EReference" href="yakindu.ecore#//CompositeElement/regions"/>
516 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_g_RB4FybEemc87q3iJlCgw" description="_g_MwcFybEemc87q3iJlCgw" sourceArrow="FillDiamond" routingStyle="manhattan" strokeColor="0,0,0">
517 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_g_RB4lybEemc87q3iJlCgw" showIcon="false">
518 <customFeatures>labelSize</customFeatures>
519 </centerLabelStyle>
520 <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_g_RB4VybEemc87q3iJlCgw" showIcon="false" labelColor="39,76,114">
521 <customFeatures>labelSize</customFeatures>
522 </endLabelStyle>
523 </ownedStyle>
524 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC_EReference']"/>
525 </ownedDiagramElements>
526 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_g_S3EFybEemc87q3iJlCgw" sourceNode="_g-fl0FybEemc87q3iJlCgw" targetNode="_g-SKcFybEemc87q3iJlCgw">
527 <target xmi:type="ecore:EClass" href="yakindu.ecore#//RegularState"/>
528 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//RegularState"/>
529 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_g_V6YFybEemc87q3iJlCgw" targetArrow="InputClosedArrow" routingStyle="tree">
530 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/>
531 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_g_V6YVybEemc87q3iJlCgw" showIcon="false">
532 <labelFormat>italic</labelFormat>
533 </beginLabelStyle>
534 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_g_V6YlybEemc87q3iJlCgw" showIcon="false"/>
535 </ownedStyle>
536 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
537 </ownedDiagramElements>
538 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_g_V6ZlybEemc87q3iJlCgw" sourceNode="_g-jQMFybEemc87q3iJlCgw" targetNode="_g-GkQFybEemc87q3iJlCgw">
539 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Choice"/>
540 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Choice"/>
541 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_g_V6Z1ybEemc87q3iJlCgw" targetArrow="InputClosedArrow" routingStyle="tree">
542 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/>
543 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_g_V6aFybEemc87q3iJlCgw" showIcon="false">
544 <labelFormat>italic</labelFormat>
545 </beginLabelStyle>
546 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_g_V6aVybEemc87q3iJlCgw" showIcon="false"/>
547 </ownedStyle>
548 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
549 </ownedDiagramElements>
550 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_g_V6bVybEemc87q3iJlCgw" sourceNode="_g-lscFybEemc87q3iJlCgw" targetNode="_g-GkQFybEemc87q3iJlCgw">
551 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Exit"/>
552 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Exit"/>
553 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_g_V6blybEemc87q3iJlCgw" targetArrow="InputClosedArrow" routingStyle="tree">
554 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/>
555 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_g_V6b1ybEemc87q3iJlCgw" showIcon="false">
556 <labelFormat>italic</labelFormat>
557 </beginLabelStyle>
558 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_g_V6cFybEemc87q3iJlCgw" showIcon="false"/>
559 </ownedStyle>
560 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
561 </ownedDiagramElements>
562 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_g_aL0FybEemc87q3iJlCgw" sourceNode="_g-m6kFybEemc87q3iJlCgw" targetNode="_g-fl0FybEemc87q3iJlCgw">
563 <target xmi:type="ecore:EClass" href="yakindu.ecore#//FinalState"/>
564 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//FinalState"/>
565 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_g_aL0VybEemc87q3iJlCgw" targetArrow="InputClosedArrow" routingStyle="tree">
566 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/>
567 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_g_aL0lybEemc87q3iJlCgw" showIcon="false">
568 <labelFormat>italic</labelFormat>
569 </beginLabelStyle>
570 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_g_aL01ybEemc87q3iJlCgw" showIcon="false"/>
571 </ownedStyle>
572 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
573 </ownedDiagramElements>
574 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_g_ay41ybEemc87q3iJlCgw" sourceNode="_g-aGQFybEemc87q3iJlCgw" targetNode="_g-GkQFybEemc87q3iJlCgw">
575 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Entry"/>
576 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Entry"/>
577 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_g_ay5FybEemc87q3iJlCgw" targetArrow="InputClosedArrow" routingStyle="tree">
578 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/>
579 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_g_ay5VybEemc87q3iJlCgw" showIcon="false">
580 <labelFormat>italic</labelFormat>
581 </beginLabelStyle>
582 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_g_ay5lybEemc87q3iJlCgw" showIcon="false"/>
583 </ownedStyle>
584 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
585 </ownedDiagramElements>
586 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_g_cBAFybEemc87q3iJlCgw" sourceNode="_g-YREFybEemc87q3iJlCgw" targetNode="_g-hbAVybEemc87q3iJlCgw">
587 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Statechart"/>
588 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Statechart"/>
589 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_g_cBAVybEemc87q3iJlCgw" targetArrow="InputClosedArrow" routingStyle="tree">
590 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/>
591 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_g_cBAlybEemc87q3iJlCgw" showIcon="false">
592 <labelFormat>italic</labelFormat>
593 </beginLabelStyle>
594 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_g_cBA1ybEemc87q3iJlCgw" showIcon="false"/>
595 </ownedStyle>
596 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
597 </ownedDiagramElements>
598 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_g_coEFybEemc87q3iJlCgw" sourceNode="_g-b7cFybEemc87q3iJlCgw" targetNode="_g-GkQFybEemc87q3iJlCgw">
599 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Synchronization"/>
600 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Synchronization"/>
601 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_g_coEVybEemc87q3iJlCgw" targetArrow="InputClosedArrow" routingStyle="tree">
602 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/>
603 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_g_coElybEemc87q3iJlCgw" showIcon="false">
604 <labelFormat>italic</labelFormat>
605 </beginLabelStyle>
606 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_g_coE1ybEemc87q3iJlCgw" showIcon="false"/>
607 </ownedStyle>
608 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
609 </ownedDiagramElements>
610 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_g_dPI1ybEemc87q3iJlCgw" sourceNode="_g-dJkVybEemc87q3iJlCgw" targetNode="_g-fl0FybEemc87q3iJlCgw">
611 <target xmi:type="ecore:EClass" href="yakindu.ecore#//State"/>
612 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//State"/>
613 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_g_dPJFybEemc87q3iJlCgw" targetArrow="InputClosedArrow" routingStyle="tree">
614 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/>
615 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_g_dPJVybEemc87q3iJlCgw" showIcon="false">
616 <labelFormat>italic</labelFormat>
617 </beginLabelStyle>
618 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_g_dPJlybEemc87q3iJlCgw" showIcon="false"/>
619 </ownedStyle>
620 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
621 </ownedDiagramElements>
622 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_g_edQFybEemc87q3iJlCgw" sourceNode="_g-dJkVybEemc87q3iJlCgw" targetNode="_g-hbAVybEemc87q3iJlCgw">
623 <target xmi:type="ecore:EClass" href="yakindu.ecore#//State"/>
624 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//State"/>
625 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_g_edQVybEemc87q3iJlCgw" targetArrow="InputClosedArrow" routingStyle="tree">
626 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/>
627 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_g_edQlybEemc87q3iJlCgw" showIcon="false">
628 <labelFormat>italic</labelFormat>
629 </beginLabelStyle>
630 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_g_edQ1ybEemc87q3iJlCgw" showIcon="false"/>
631 </ownedStyle>
632 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
633 </ownedDiagramElements>
634 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_g_fEUFybEemc87q3iJlCgw" sourceNode="_g-GkQFybEemc87q3iJlCgw" targetNode="_g-SKcFybEemc87q3iJlCgw">
635 <target xmi:type="ecore:EClass" href="yakindu.ecore#//Pseudostate"/>
636 <semanticElements xmi:type="ecore:EClass" href="yakindu.ecore#//Pseudostate"/>
637 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_g_fEUVybEemc87q3iJlCgw" targetArrow="InputClosedArrow" routingStyle="tree">
638 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/>
639 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_g_fEUlybEemc87q3iJlCgw" showIcon="false">
640 <labelFormat>italic</labelFormat>
641 </beginLabelStyle>
642 <centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_g_fEU1ybEemc87q3iJlCgw" showIcon="false"/>
643 </ownedStyle>
644 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
645 </ownedDiagramElements>
646 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_g_frY1ybEemc87q3iJlCgw" sourceNode="_g-SKcFybEemc87q3iJlCgw" targetNode="_g-Wb4FybEemc87q3iJlCgw" beginLabel="[1..1] target" endLabel="[0..*] incomingTransitions">
647 <target xmi:type="ecore:EReference" href="yakindu.ecore#//Vertex/incomingTransitions"/>
648 <semanticElements xmi:type="ecore:EReference" href="yakindu.ecore#//Vertex/incomingTransitions"/>
649 <semanticElements xmi:type="ecore:EReference" href="yakindu.ecore#//Transition/target"/>
650 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_g_gScFybEemc87q3iJlCgw" sourceArrow="InputArrow" routingStyle="manhattan" strokeColor="0,0,0">
651 <description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='Bi-directional%20EC_EReference%20']/@style"/>
652 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_g_gScVybEemc87q3iJlCgw" showIcon="false"/>
653 <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_g_gSclybEemc87q3iJlCgw" showIcon="false"/>
654 </ownedStyle>
655 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='Bi-directional%20EC_EReference%20']"/>
656 </ownedDiagramElements>
657 <ownedDiagramElements xmi:type="diagram:DEdge" uid="_g_g5gFybEemc87q3iJlCgw" sourceNode="_g-SKcFybEemc87q3iJlCgw" targetNode="_g-Wb4FybEemc87q3iJlCgw" beginLabel="[0..1] source" endLabel="[0..*] outgoingTransitions">
658 <target xmi:type="ecore:EReference" href="yakindu.ecore#//Vertex/outgoingTransitions"/>
659 <semanticElements xmi:type="ecore:EReference" href="yakindu.ecore#//Vertex/outgoingTransitions"/>
660 <semanticElements xmi:type="ecore:EReference" href="yakindu.ecore#//Transition/source"/>
661 <ownedStyle xmi:type="diagram:EdgeStyle" uid="_g_g5hFybEemc87q3iJlCgw" description="_g_g5gVybEemc87q3iJlCgw" sourceArrow="FillDiamond" routingStyle="manhattan" strokeColor="0,0,0">
662 <beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_g_g5hVybEemc87q3iJlCgw" showIcon="false"/>
663 <endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_g_g5hlybEemc87q3iJlCgw" showIcon="false"/>
664 </ownedStyle>
665 <actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='Bi-directional%20EC_EReference%20']"/>
666 </ownedDiagramElements>
667 <description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
668 <filterVariableHistory xmi:type="diagram:FilterVariableHistory" uid="_gDlcwFybEemc87q3iJlCgw"/>
669 <activatedLayers xmi:type="description_1:Layer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer"/>
670 <activatedLayers xmi:type="description_1:AdditionalLayer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Package']"/>
671 <activatedLayers xmi:type="description_1:AdditionalLayer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Validation']"/>
672 <activatedLayers xmi:type="description_1:AdditionalLayer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Archetype']/@ownedRepresentationExtensions[name='Entities%20With%20Archetypes']/@layers[name='Archetypes']"/>
673 <target xmi:type="ecore:EPackage" href="yakindu.ecore#/"/>
674 </diagram:DSemanticDiagram>
675</xmi:XMI>
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/plugin.xml b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/plugin.xml
index a2a573fc..f9d517b9 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/plugin.xml
+++ b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/plugin.xml
@@ -27,110 +27,6 @@
27 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.fam.queries.parent"/> 27 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.fam.queries.parent"/>
28 </group> 28 </group>
29 </extension> 29 </extension>
30 <extension id="ca.mcgill.ecse.dslreasoner.standalone.test.filesystem.queries.FileSystemPatterns" point="org.eclipse.viatra.query.runtime.queryspecification">
31 <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:ca.mcgill.ecse.dslreasoner.standalone.test.filesystem.queries.FileSystemPatterns" id="ca.mcgill.ecse.dslreasoner.standalone.test.filesystem.queries.FileSystemPatterns">
32 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.filesystem.queries.patternContent"/>
33 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.filesystem.queries.live"/>
34 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.filesystem.queries.contentInNotLive"/>
35 </group>
36 </extension>
37 <extension id="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.YakinduMutatedPatterns" point="org.eclipse.viatra.query.runtime.queryspecification">
38 <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.YakinduMutatedPatterns" id="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.YakinduMutatedPatterns">
39 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.entryInRegion_M0"/>
40 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.entryInRegion_M1"/>
41 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.entryInRegion_M2"/>
42 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noEntryInRegion_M0"/>
43 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noEntryInRegion_M1"/>
44 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noEntryInRegion_M2"/>
45 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noEntryInRegion_M3"/>
46 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noEntryInRegion_M4"/>
47 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noEntryInRegion_M5"/>
48 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleEntryInRegion_M0"/>
49 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleEntryInRegion_M1"/>
50 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleEntryInRegion_M2"/>
51 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleEntryInRegion_M3"/>
52 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleEntryInRegion_M4"/>
53 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleEntryInRegion_M5"/>
54 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.transition_M0"/>
55 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.transition_M1"/>
56 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.transition_M2"/>
57 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.transition_M3"/>
58 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.transition_M4"/>
59 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.incomingToEntry_M0"/>
60 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.incomingToEntry_1"/>
61 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.incomingToEntry_2"/>
62 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.incomingToEntry_3"/>
63 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.incomingToEntry_4"/>
64 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.incomingToEntry_5"/>
65 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noOutgoingTransitionFromEntry_M0"/>
66 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noOutgoingTransitionFromEntry_M1"/>
67 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noOutgoingTransitionFromEntry_M2"/>
68 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noOutgoingTransitionFromEntry_M3"/>
69 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noOutgoingTransitionFromEntry_M4"/>
70 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noOutgoingTransitionFromEntry_M5"/>
71 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleTransitionFromEntry_M0"/>
72 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleTransitionFromEntry_M1"/>
73 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleTransitionFromEntry_M2"/>
74 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleTransitionFromEntry_M3"/>
75 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleTransitionFromEntry_M4"/>
76 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromExit_M0"/>
77 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromExit_M1"/>
78 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromExit_M2"/>
79 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromFinal_M0"/>
80 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromFinal_M1"/>
81 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromFinal_M2"/>
82 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noStateInRegion_M0"/>
83 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noStateInRegion_M1"/>
84 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noStateInRegion_M2"/>
85 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noStateInRegion_M3"/>
86 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.StateInRegion_M0"/>
87 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.StateInRegion_M1"/>
88 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.StateInRegion_M2"/>
89 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoOutgoing_M0"/>
90 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoOutgoing_M1"/>
91 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoOutgoing_M2"/>
92 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoOutgoing_M3"/>
93 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoOutgoing_M4"/>
94 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoOutgoing_M5"/>
95 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoOutgoing_M6"/>
96 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoIncoming_M0"/>
97 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoIncoming_M1"/>
98 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoIncoming_M2"/>
99 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoIncoming_M3"/>
100 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoIncoming_M4"/>
101 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoIncoming_M5"/>
102 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoIncoming_M6"/>
103 </group>
104 </extension>
105 <extension id="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.YakinduPatterns" point="org.eclipse.viatra.query.runtime.queryspecification">
106 <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.YakinduPatterns" id="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.YakinduPatterns">
107 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.entryInRegion"/>
108 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noEntryInRegion"/>
109 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleEntryInRegion"/>
110 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.transition"/>
111 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.incomingToEntry"/>
112 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noOutgoingTransitionFromEntry"/>
113 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleTransitionFromEntry"/>
114 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromExit"/>
115 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromFinal"/>
116 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noStateInRegion"/>
117 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.StateInRegion"/>
118 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoOutgoing"/>
119 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoIncoming"/>
120 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchHasNoOutgoing"/>
121 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchHasNoIncoming"/>
122 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedIncomingInSameRegion"/>
123 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.notSynchronizingStates"/>
124 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleOutgoingTrainsition"/>
125 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleIncomingTrainsition"/>
126 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings"/>
127 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.child"/>
128 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionDoesNotHaveMultipleRegions"/>
129 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleRegions"/>
130 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchThree"/>
131 <query-specification fqn="ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.twoSynch"/>
132 </group>
133 </extension>
134 <extension id="extension.derived.ca.mcgill.ecse.dslreasoner.standalone.test.fam.queries.model" point="org.eclipse.viatra.query.runtime.base.wellbehaving.derived.features"> 30 <extension id="extension.derived.ca.mcgill.ecse.dslreasoner.standalone.test.fam.queries.model" point="org.eclipse.viatra.query.runtime.base.wellbehaving.derived.features">
135 <wellbehaving-derived-feature classifier-name="FunctionalElement" feature-name="model" package-nsUri="FamMetamodel"/> 31 <wellbehaving-derived-feature classifier-name="FunctionalElement" feature-name="model" package-nsUri="FamMetamodel"/>
136 </extension> 32 </extension>
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/Child.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/Child.java
deleted file mode 100644
index 9867c1ee..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/Child.java
+++ /dev/null
@@ -1,721 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.CompositeElement;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
29import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
31import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
38import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
40import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
41
42/**
43 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
44 *
45 * <p>Original source:
46 * <code><pre>
47 * ///////////////////////////////
48 * // Extra
49 * //
50 * //{@literal @}Constraint(severity="error", message="error", key = {s})
51 * //pattern SynchronizedRegionDoesNotHaveParent(s : Synchronization, v : Vertex) {
52 * // find transition(_, v, s);
53 * // neg find child(_,v);
54 * //} or {
55 * // find transition(_, s, v);
56 * // neg find child(_,v);
57 * //}
58 *
59 * pattern child(parent: CompositeElement, child: Vertex) {
60 * CompositeElement.regions.vertices(parent, child);
61 * }
62 * </pre></code>
63 *
64 * @see Matcher
65 * @see Match
66 *
67 */
68@SuppressWarnings("all")
69public final class Child extends BaseGeneratedEMFQuerySpecification<Child.Matcher> {
70 /**
71 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.child pattern,
72 * to be used in conjunction with {@link Matcher}.
73 *
74 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
75 * Each instance is a (possibly partial) substitution of pattern parameters,
76 * usable to represent a match of the pattern in the result of a query,
77 * or to specify the bound (fixed) input parameters when issuing a query.
78 *
79 * @see Matcher
80 *
81 */
82 public static abstract class Match extends BasePatternMatch {
83 private CompositeElement fParent;
84
85 private Vertex fChild;
86
87 private static List<String> parameterNames = makeImmutableList("parent", "child");
88
89 private Match(final CompositeElement pParent, final Vertex pChild) {
90 this.fParent = pParent;
91 this.fChild = pChild;
92 }
93
94 @Override
95 public Object get(final String parameterName) {
96 if ("parent".equals(parameterName)) return this.fParent;
97 if ("child".equals(parameterName)) return this.fChild;
98 return null;
99 }
100
101 public CompositeElement getParent() {
102 return this.fParent;
103 }
104
105 public Vertex getChild() {
106 return this.fChild;
107 }
108
109 @Override
110 public boolean set(final String parameterName, final Object newValue) {
111 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
112 if ("parent".equals(parameterName) ) {
113 this.fParent = (CompositeElement) newValue;
114 return true;
115 }
116 if ("child".equals(parameterName) ) {
117 this.fChild = (Vertex) newValue;
118 return true;
119 }
120 return false;
121 }
122
123 public void setParent(final CompositeElement pParent) {
124 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
125 this.fParent = pParent;
126 }
127
128 public void setChild(final Vertex pChild) {
129 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
130 this.fChild = pChild;
131 }
132
133 @Override
134 public String patternName() {
135 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.child";
136 }
137
138 @Override
139 public List<String> parameterNames() {
140 return Child.Match.parameterNames;
141 }
142
143 @Override
144 public Object[] toArray() {
145 return new Object[]{fParent, fChild};
146 }
147
148 @Override
149 public Child.Match toImmutable() {
150 return isMutable() ? newMatch(fParent, fChild) : this;
151 }
152
153 @Override
154 public String prettyPrint() {
155 StringBuilder result = new StringBuilder();
156 result.append("\"parent\"=" + prettyPrintValue(fParent) + ", ");
157 result.append("\"child\"=" + prettyPrintValue(fChild));
158 return result.toString();
159 }
160
161 @Override
162 public int hashCode() {
163 return Objects.hash(fParent, fChild);
164 }
165
166 @Override
167 public boolean equals(final Object obj) {
168 if (this == obj)
169 return true;
170 if (obj == null) {
171 return false;
172 }
173 if ((obj instanceof Child.Match)) {
174 Child.Match other = (Child.Match) obj;
175 return Objects.equals(fParent, other.fParent) && Objects.equals(fChild, other.fChild);
176 } else {
177 // this should be infrequent
178 if (!(obj instanceof IPatternMatch)) {
179 return false;
180 }
181 IPatternMatch otherSig = (IPatternMatch) obj;
182 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
183 }
184 }
185
186 @Override
187 public Child specification() {
188 return Child.instance();
189 }
190
191 /**
192 * Returns an empty, mutable match.
193 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
194 *
195 * @return the empty match.
196 *
197 */
198 public static Child.Match newEmptyMatch() {
199 return new Mutable(null, null);
200 }
201
202 /**
203 * Returns a mutable (partial) match.
204 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
205 *
206 * @param pParent the fixed value of pattern parameter parent, or null if not bound.
207 * @param pChild the fixed value of pattern parameter child, or null if not bound.
208 * @return the new, mutable (partial) match object.
209 *
210 */
211 public static Child.Match newMutableMatch(final CompositeElement pParent, final Vertex pChild) {
212 return new Mutable(pParent, pChild);
213 }
214
215 /**
216 * Returns a new (partial) match.
217 * This can be used e.g. to call the matcher with a partial match.
218 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
219 * @param pParent the fixed value of pattern parameter parent, or null if not bound.
220 * @param pChild the fixed value of pattern parameter child, or null if not bound.
221 * @return the (partial) match object.
222 *
223 */
224 public static Child.Match newMatch(final CompositeElement pParent, final Vertex pChild) {
225 return new Immutable(pParent, pChild);
226 }
227
228 private static final class Mutable extends Child.Match {
229 Mutable(final CompositeElement pParent, final Vertex pChild) {
230 super(pParent, pChild);
231 }
232
233 @Override
234 public boolean isMutable() {
235 return true;
236 }
237 }
238
239 private static final class Immutable extends Child.Match {
240 Immutable(final CompositeElement pParent, final Vertex pChild) {
241 super(pParent, pChild);
242 }
243
244 @Override
245 public boolean isMutable() {
246 return false;
247 }
248 }
249 }
250
251 /**
252 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.child pattern,
253 * providing pattern-specific query methods.
254 *
255 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
256 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
257 *
258 * <p>Matches of the pattern will be represented as {@link Match}.
259 *
260 * <p>Original source:
261 * <code><pre>
262 * ///////////////////////////////
263 * // Extra
264 * //
265 * //{@literal @}Constraint(severity="error", message="error", key = {s})
266 * //pattern SynchronizedRegionDoesNotHaveParent(s : Synchronization, v : Vertex) {
267 * // find transition(_, v, s);
268 * // neg find child(_,v);
269 * //} or {
270 * // find transition(_, s, v);
271 * // neg find child(_,v);
272 * //}
273 *
274 * pattern child(parent: CompositeElement, child: Vertex) {
275 * CompositeElement.regions.vertices(parent, child);
276 * }
277 * </pre></code>
278 *
279 * @see Match
280 * @see Child
281 *
282 */
283 public static class Matcher extends BaseMatcher<Child.Match> {
284 /**
285 * Initializes the pattern matcher within an existing VIATRA Query engine.
286 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
287 *
288 * @param engine the existing VIATRA Query engine in which this matcher will be created.
289 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
290 *
291 */
292 public static Child.Matcher on(final ViatraQueryEngine engine) {
293 // check if matcher already exists
294 Matcher matcher = engine.getExistingMatcher(querySpecification());
295 if (matcher == null) {
296 matcher = (Matcher)engine.getMatcher(querySpecification());
297 }
298 return matcher;
299 }
300
301 /**
302 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
303 * @return an initialized matcher
304 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
305 *
306 */
307 public static Child.Matcher create() {
308 return new Matcher();
309 }
310
311 private final static int POSITION_PARENT = 0;
312
313 private final static int POSITION_CHILD = 1;
314
315 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Child.Matcher.class);
316
317 /**
318 * Initializes the pattern matcher within an existing VIATRA Query engine.
319 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
320 *
321 * @param engine the existing VIATRA Query engine in which this matcher will be created.
322 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
323 *
324 */
325 private Matcher() {
326 super(querySpecification());
327 }
328
329 /**
330 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
331 * @param pParent the fixed value of pattern parameter parent, or null if not bound.
332 * @param pChild the fixed value of pattern parameter child, or null if not bound.
333 * @return matches represented as a Match object.
334 *
335 */
336 public Collection<Child.Match> getAllMatches(final CompositeElement pParent, final Vertex pChild) {
337 return rawStreamAllMatches(new Object[]{pParent, pChild}).collect(Collectors.toSet());
338 }
339
340 /**
341 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
342 * </p>
343 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
344 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
345 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
346 * @param pParent the fixed value of pattern parameter parent, or null if not bound.
347 * @param pChild the fixed value of pattern parameter child, or null if not bound.
348 * @return a stream of matches represented as a Match object.
349 *
350 */
351 public Stream<Child.Match> streamAllMatches(final CompositeElement pParent, final Vertex pChild) {
352 return rawStreamAllMatches(new Object[]{pParent, pChild});
353 }
354
355 /**
356 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
357 * Neither determinism nor randomness of selection is guaranteed.
358 * @param pParent the fixed value of pattern parameter parent, or null if not bound.
359 * @param pChild the fixed value of pattern parameter child, or null if not bound.
360 * @return a match represented as a Match object, or null if no match is found.
361 *
362 */
363 public Optional<Child.Match> getOneArbitraryMatch(final CompositeElement pParent, final Vertex pChild) {
364 return rawGetOneArbitraryMatch(new Object[]{pParent, pChild});
365 }
366
367 /**
368 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
369 * under any possible substitution of the unspecified parameters (if any).
370 * @param pParent the fixed value of pattern parameter parent, or null if not bound.
371 * @param pChild the fixed value of pattern parameter child, or null if not bound.
372 * @return true if the input is a valid (partial) match of the pattern.
373 *
374 */
375 public boolean hasMatch(final CompositeElement pParent, final Vertex pChild) {
376 return rawHasMatch(new Object[]{pParent, pChild});
377 }
378
379 /**
380 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
381 * @param pParent the fixed value of pattern parameter parent, or null if not bound.
382 * @param pChild the fixed value of pattern parameter child, or null if not bound.
383 * @return the number of pattern matches found.
384 *
385 */
386 public int countMatches(final CompositeElement pParent, final Vertex pChild) {
387 return rawCountMatches(new Object[]{pParent, pChild});
388 }
389
390 /**
391 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
392 * Neither determinism nor randomness of selection is guaranteed.
393 * @param pParent the fixed value of pattern parameter parent, or null if not bound.
394 * @param pChild the fixed value of pattern parameter child, or null if not bound.
395 * @param processor the action that will process the selected match.
396 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
397 *
398 */
399 public boolean forOneArbitraryMatch(final CompositeElement pParent, final Vertex pChild, final Consumer<? super Child.Match> processor) {
400 return rawForOneArbitraryMatch(new Object[]{pParent, pChild}, processor);
401 }
402
403 /**
404 * Returns a new (partial) match.
405 * This can be used e.g. to call the matcher with a partial match.
406 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
407 * @param pParent the fixed value of pattern parameter parent, or null if not bound.
408 * @param pChild the fixed value of pattern parameter child, or null if not bound.
409 * @return the (partial) match object.
410 *
411 */
412 public Child.Match newMatch(final CompositeElement pParent, final Vertex pChild) {
413 return Child.Match.newMatch(pParent, pChild);
414 }
415
416 /**
417 * Retrieve the set of values that occur in matches for parent.
418 * @return the Set of all values or empty set if there are no matches
419 *
420 */
421 protected Stream<CompositeElement> rawStreamAllValuesOfparent(final Object[] parameters) {
422 return rawStreamAllValues(POSITION_PARENT, parameters).map(CompositeElement.class::cast);
423 }
424
425 /**
426 * Retrieve the set of values that occur in matches for parent.
427 * @return the Set of all values or empty set if there are no matches
428 *
429 */
430 public Set<CompositeElement> getAllValuesOfparent() {
431 return rawStreamAllValuesOfparent(emptyArray()).collect(Collectors.toSet());
432 }
433
434 /**
435 * Retrieve the set of values that occur in matches for parent.
436 * @return the Set of all values or empty set if there are no matches
437 *
438 */
439 public Stream<CompositeElement> streamAllValuesOfparent() {
440 return rawStreamAllValuesOfparent(emptyArray());
441 }
442
443 /**
444 * Retrieve the set of values that occur in matches for parent.
445 * </p>
446 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
447 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
448 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
449 *
450 * @return the Stream of all values or empty set if there are no matches
451 *
452 */
453 public Stream<CompositeElement> streamAllValuesOfparent(final Child.Match partialMatch) {
454 return rawStreamAllValuesOfparent(partialMatch.toArray());
455 }
456
457 /**
458 * Retrieve the set of values that occur in matches for parent.
459 * </p>
460 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
461 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
462 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
463 *
464 * @return the Stream of all values or empty set if there are no matches
465 *
466 */
467 public Stream<CompositeElement> streamAllValuesOfparent(final Vertex pChild) {
468 return rawStreamAllValuesOfparent(new Object[]{null, pChild});
469 }
470
471 /**
472 * Retrieve the set of values that occur in matches for parent.
473 * @return the Set of all values or empty set if there are no matches
474 *
475 */
476 public Set<CompositeElement> getAllValuesOfparent(final Child.Match partialMatch) {
477 return rawStreamAllValuesOfparent(partialMatch.toArray()).collect(Collectors.toSet());
478 }
479
480 /**
481 * Retrieve the set of values that occur in matches for parent.
482 * @return the Set of all values or empty set if there are no matches
483 *
484 */
485 public Set<CompositeElement> getAllValuesOfparent(final Vertex pChild) {
486 return rawStreamAllValuesOfparent(new Object[]{null, pChild}).collect(Collectors.toSet());
487 }
488
489 /**
490 * Retrieve the set of values that occur in matches for child.
491 * @return the Set of all values or empty set if there are no matches
492 *
493 */
494 protected Stream<Vertex> rawStreamAllValuesOfchild(final Object[] parameters) {
495 return rawStreamAllValues(POSITION_CHILD, parameters).map(Vertex.class::cast);
496 }
497
498 /**
499 * Retrieve the set of values that occur in matches for child.
500 * @return the Set of all values or empty set if there are no matches
501 *
502 */
503 public Set<Vertex> getAllValuesOfchild() {
504 return rawStreamAllValuesOfchild(emptyArray()).collect(Collectors.toSet());
505 }
506
507 /**
508 * Retrieve the set of values that occur in matches for child.
509 * @return the Set of all values or empty set if there are no matches
510 *
511 */
512 public Stream<Vertex> streamAllValuesOfchild() {
513 return rawStreamAllValuesOfchild(emptyArray());
514 }
515
516 /**
517 * Retrieve the set of values that occur in matches for child.
518 * </p>
519 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
520 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
521 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
522 *
523 * @return the Stream of all values or empty set if there are no matches
524 *
525 */
526 public Stream<Vertex> streamAllValuesOfchild(final Child.Match partialMatch) {
527 return rawStreamAllValuesOfchild(partialMatch.toArray());
528 }
529
530 /**
531 * Retrieve the set of values that occur in matches for child.
532 * </p>
533 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
534 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
535 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
536 *
537 * @return the Stream of all values or empty set if there are no matches
538 *
539 */
540 public Stream<Vertex> streamAllValuesOfchild(final CompositeElement pParent) {
541 return rawStreamAllValuesOfchild(new Object[]{pParent, null});
542 }
543
544 /**
545 * Retrieve the set of values that occur in matches for child.
546 * @return the Set of all values or empty set if there are no matches
547 *
548 */
549 public Set<Vertex> getAllValuesOfchild(final Child.Match partialMatch) {
550 return rawStreamAllValuesOfchild(partialMatch.toArray()).collect(Collectors.toSet());
551 }
552
553 /**
554 * Retrieve the set of values that occur in matches for child.
555 * @return the Set of all values or empty set if there are no matches
556 *
557 */
558 public Set<Vertex> getAllValuesOfchild(final CompositeElement pParent) {
559 return rawStreamAllValuesOfchild(new Object[]{pParent, null}).collect(Collectors.toSet());
560 }
561
562 @Override
563 protected Child.Match tupleToMatch(final Tuple t) {
564 try {
565 return Child.Match.newMatch((CompositeElement) t.get(POSITION_PARENT), (Vertex) t.get(POSITION_CHILD));
566 } catch(ClassCastException e) {
567 LOGGER.error("Element(s) in tuple not properly typed!",e);
568 return null;
569 }
570 }
571
572 @Override
573 protected Child.Match arrayToMatch(final Object[] match) {
574 try {
575 return Child.Match.newMatch((CompositeElement) match[POSITION_PARENT], (Vertex) match[POSITION_CHILD]);
576 } catch(ClassCastException e) {
577 LOGGER.error("Element(s) in array not properly typed!",e);
578 return null;
579 }
580 }
581
582 @Override
583 protected Child.Match arrayToMatchMutable(final Object[] match) {
584 try {
585 return Child.Match.newMutableMatch((CompositeElement) match[POSITION_PARENT], (Vertex) match[POSITION_CHILD]);
586 } catch(ClassCastException e) {
587 LOGGER.error("Element(s) in array not properly typed!",e);
588 return null;
589 }
590 }
591
592 /**
593 * @return the singleton instance of the query specification of this pattern
594 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
595 *
596 */
597 public static IQuerySpecification<Child.Matcher> querySpecification() {
598 return Child.instance();
599 }
600 }
601
602 private Child() {
603 super(GeneratedPQuery.INSTANCE);
604 }
605
606 /**
607 * @return the singleton instance of the query specification
608 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
609 *
610 */
611 public static Child instance() {
612 try{
613 return LazyHolder.INSTANCE;
614 } catch (ExceptionInInitializerError err) {
615 throw processInitializerError(err);
616 }
617 }
618
619 @Override
620 protected Child.Matcher instantiate(final ViatraQueryEngine engine) {
621 return Child.Matcher.on(engine);
622 }
623
624 @Override
625 public Child.Matcher instantiate() {
626 return Child.Matcher.create();
627 }
628
629 @Override
630 public Child.Match newEmptyMatch() {
631 return Child.Match.newEmptyMatch();
632 }
633
634 @Override
635 public Child.Match newMatch(final Object... parameters) {
636 return Child.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.CompositeElement) parameters[0], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex) parameters[1]);
637 }
638
639 /**
640 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Child (visibility: PUBLIC, simpleName: Child, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Child, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
641 * <b>not</b> at the class load time of the outer class,
642 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Child (visibility: PUBLIC, simpleName: Child, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Child, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
643 *
644 * <p> This workaround is required e.g. to support recursion.
645 *
646 */
647 private static class LazyHolder {
648 private final static Child INSTANCE = new Child();
649
650 /**
651 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
652 * This initialization order is required to support indirect recursion.
653 *
654 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
655 *
656 */
657 private final static Object STATIC_INITIALIZER = ensureInitialized();
658
659 public static Object ensureInitialized() {
660 INSTANCE.ensureInitializedInternal();
661 return null;
662 }
663 }
664
665 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
666 private final static Child.GeneratedPQuery INSTANCE = new GeneratedPQuery();
667
668 private final PParameter parameter_parent = new PParameter("parent", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.CompositeElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "CompositeElement")), PParameterDirection.INOUT);
669
670 private final PParameter parameter_child = new PParameter("child", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Vertex")), PParameterDirection.INOUT);
671
672 private final List<PParameter> parameters = Arrays.asList(parameter_parent, parameter_child);
673
674 private GeneratedPQuery() {
675 super(PVisibility.PUBLIC);
676 }
677
678 @Override
679 public String getFullyQualifiedName() {
680 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.child";
681 }
682
683 @Override
684 public List<String> getParameterNames() {
685 return Arrays.asList("parent","child");
686 }
687
688 @Override
689 public List<PParameter> getParameters() {
690 return parameters;
691 }
692
693 @Override
694 public Set<PBody> doGetContainedBodies() {
695 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
696 Set<PBody> bodies = new LinkedHashSet<>();
697 {
698 PBody body = new PBody(this);
699 PVariable var_parent = body.getOrCreateVariableByName("parent");
700 PVariable var_child = body.getOrCreateVariableByName("child");
701 new TypeConstraint(body, Tuples.flatTupleOf(var_parent), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "CompositeElement")));
702 new TypeConstraint(body, Tuples.flatTupleOf(var_child), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
703 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
704 new ExportedParameter(body, var_parent, parameter_parent),
705 new ExportedParameter(body, var_child, parameter_child)
706 ));
707 // CompositeElement.regions.vertices(parent, child)
708 new TypeConstraint(body, Tuples.flatTupleOf(var_parent), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "CompositeElement")));
709 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
710 new TypeConstraint(body, Tuples.flatTupleOf(var_parent, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "CompositeElement", "regions")));
711 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
712 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
713 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices")));
714 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
715 new Equality(body, var__virtual_1_, var_child);
716 bodies.add(body);
717 }
718 return bodies;
719 }
720 }
721}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/ChoiceHasNoIncoming.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/ChoiceHasNoIncoming.java
deleted file mode 100644
index 8e62ee9d..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/ChoiceHasNoIncoming.java
+++ /dev/null
@@ -1,551 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Choice;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
42
43/**
44 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
45 *
46 * <p>Original source:
47 * <code><pre>
48 * {@literal @}Constraint(severity="error", message="error", key = {c})
49 * pattern choiceHasNoIncoming(c: Choice) {
50 * neg find transition(_, _, c);
51 * }
52 * </pre></code>
53 *
54 * @see Matcher
55 * @see Match
56 *
57 */
58@SuppressWarnings("all")
59public final class ChoiceHasNoIncoming extends BaseGeneratedEMFQuerySpecification<ChoiceHasNoIncoming.Matcher> {
60 /**
61 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoIncoming pattern,
62 * to be used in conjunction with {@link Matcher}.
63 *
64 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
65 * Each instance is a (possibly partial) substitution of pattern parameters,
66 * usable to represent a match of the pattern in the result of a query,
67 * or to specify the bound (fixed) input parameters when issuing a query.
68 *
69 * @see Matcher
70 *
71 */
72 public static abstract class Match extends BasePatternMatch {
73 private Choice fC;
74
75 private static List<String> parameterNames = makeImmutableList("c");
76
77 private Match(final Choice pC) {
78 this.fC = pC;
79 }
80
81 @Override
82 public Object get(final String parameterName) {
83 if ("c".equals(parameterName)) return this.fC;
84 return null;
85 }
86
87 public Choice getC() {
88 return this.fC;
89 }
90
91 @Override
92 public boolean set(final String parameterName, final Object newValue) {
93 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
94 if ("c".equals(parameterName) ) {
95 this.fC = (Choice) newValue;
96 return true;
97 }
98 return false;
99 }
100
101 public void setC(final Choice pC) {
102 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
103 this.fC = pC;
104 }
105
106 @Override
107 public String patternName() {
108 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoIncoming";
109 }
110
111 @Override
112 public List<String> parameterNames() {
113 return ChoiceHasNoIncoming.Match.parameterNames;
114 }
115
116 @Override
117 public Object[] toArray() {
118 return new Object[]{fC};
119 }
120
121 @Override
122 public ChoiceHasNoIncoming.Match toImmutable() {
123 return isMutable() ? newMatch(fC) : this;
124 }
125
126 @Override
127 public String prettyPrint() {
128 StringBuilder result = new StringBuilder();
129 result.append("\"c\"=" + prettyPrintValue(fC));
130 return result.toString();
131 }
132
133 @Override
134 public int hashCode() {
135 return Objects.hash(fC);
136 }
137
138 @Override
139 public boolean equals(final Object obj) {
140 if (this == obj)
141 return true;
142 if (obj == null) {
143 return false;
144 }
145 if ((obj instanceof ChoiceHasNoIncoming.Match)) {
146 ChoiceHasNoIncoming.Match other = (ChoiceHasNoIncoming.Match) obj;
147 return Objects.equals(fC, other.fC);
148 } else {
149 // this should be infrequent
150 if (!(obj instanceof IPatternMatch)) {
151 return false;
152 }
153 IPatternMatch otherSig = (IPatternMatch) obj;
154 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
155 }
156 }
157
158 @Override
159 public ChoiceHasNoIncoming specification() {
160 return ChoiceHasNoIncoming.instance();
161 }
162
163 /**
164 * Returns an empty, mutable match.
165 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
166 *
167 * @return the empty match.
168 *
169 */
170 public static ChoiceHasNoIncoming.Match newEmptyMatch() {
171 return new Mutable(null);
172 }
173
174 /**
175 * Returns a mutable (partial) match.
176 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
177 *
178 * @param pC the fixed value of pattern parameter c, or null if not bound.
179 * @return the new, mutable (partial) match object.
180 *
181 */
182 public static ChoiceHasNoIncoming.Match newMutableMatch(final Choice pC) {
183 return new Mutable(pC);
184 }
185
186 /**
187 * Returns a new (partial) match.
188 * This can be used e.g. to call the matcher with a partial match.
189 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
190 * @param pC the fixed value of pattern parameter c, or null if not bound.
191 * @return the (partial) match object.
192 *
193 */
194 public static ChoiceHasNoIncoming.Match newMatch(final Choice pC) {
195 return new Immutable(pC);
196 }
197
198 private static final class Mutable extends ChoiceHasNoIncoming.Match {
199 Mutable(final Choice pC) {
200 super(pC);
201 }
202
203 @Override
204 public boolean isMutable() {
205 return true;
206 }
207 }
208
209 private static final class Immutable extends ChoiceHasNoIncoming.Match {
210 Immutable(final Choice pC) {
211 super(pC);
212 }
213
214 @Override
215 public boolean isMutable() {
216 return false;
217 }
218 }
219 }
220
221 /**
222 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoIncoming pattern,
223 * providing pattern-specific query methods.
224 *
225 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
226 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
227 *
228 * <p>Matches of the pattern will be represented as {@link Match}.
229 *
230 * <p>Original source:
231 * <code><pre>
232 * {@literal @}Constraint(severity="error", message="error", key = {c})
233 * pattern choiceHasNoIncoming(c: Choice) {
234 * neg find transition(_, _, c);
235 * }
236 * </pre></code>
237 *
238 * @see Match
239 * @see ChoiceHasNoIncoming
240 *
241 */
242 public static class Matcher extends BaseMatcher<ChoiceHasNoIncoming.Match> {
243 /**
244 * Initializes the pattern matcher within an existing VIATRA Query engine.
245 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
246 *
247 * @param engine the existing VIATRA Query engine in which this matcher will be created.
248 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
249 *
250 */
251 public static ChoiceHasNoIncoming.Matcher on(final ViatraQueryEngine engine) {
252 // check if matcher already exists
253 Matcher matcher = engine.getExistingMatcher(querySpecification());
254 if (matcher == null) {
255 matcher = (Matcher)engine.getMatcher(querySpecification());
256 }
257 return matcher;
258 }
259
260 /**
261 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
262 * @return an initialized matcher
263 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
264 *
265 */
266 public static ChoiceHasNoIncoming.Matcher create() {
267 return new Matcher();
268 }
269
270 private final static int POSITION_C = 0;
271
272 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ChoiceHasNoIncoming.Matcher.class);
273
274 /**
275 * Initializes the pattern matcher within an existing VIATRA Query engine.
276 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
277 *
278 * @param engine the existing VIATRA Query engine in which this matcher will be created.
279 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
280 *
281 */
282 private Matcher() {
283 super(querySpecification());
284 }
285
286 /**
287 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
288 * @param pC the fixed value of pattern parameter c, or null if not bound.
289 * @return matches represented as a Match object.
290 *
291 */
292 public Collection<ChoiceHasNoIncoming.Match> getAllMatches(final Choice pC) {
293 return rawStreamAllMatches(new Object[]{pC}).collect(Collectors.toSet());
294 }
295
296 /**
297 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
298 * </p>
299 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
300 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
301 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
302 * @param pC the fixed value of pattern parameter c, or null if not bound.
303 * @return a stream of matches represented as a Match object.
304 *
305 */
306 public Stream<ChoiceHasNoIncoming.Match> streamAllMatches(final Choice pC) {
307 return rawStreamAllMatches(new Object[]{pC});
308 }
309
310 /**
311 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
312 * Neither determinism nor randomness of selection is guaranteed.
313 * @param pC the fixed value of pattern parameter c, or null if not bound.
314 * @return a match represented as a Match object, or null if no match is found.
315 *
316 */
317 public Optional<ChoiceHasNoIncoming.Match> getOneArbitraryMatch(final Choice pC) {
318 return rawGetOneArbitraryMatch(new Object[]{pC});
319 }
320
321 /**
322 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
323 * under any possible substitution of the unspecified parameters (if any).
324 * @param pC the fixed value of pattern parameter c, or null if not bound.
325 * @return true if the input is a valid (partial) match of the pattern.
326 *
327 */
328 public boolean hasMatch(final Choice pC) {
329 return rawHasMatch(new Object[]{pC});
330 }
331
332 /**
333 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
334 * @param pC the fixed value of pattern parameter c, or null if not bound.
335 * @return the number of pattern matches found.
336 *
337 */
338 public int countMatches(final Choice pC) {
339 return rawCountMatches(new Object[]{pC});
340 }
341
342 /**
343 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
344 * Neither determinism nor randomness of selection is guaranteed.
345 * @param pC the fixed value of pattern parameter c, or null if not bound.
346 * @param processor the action that will process the selected match.
347 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
348 *
349 */
350 public boolean forOneArbitraryMatch(final Choice pC, final Consumer<? super ChoiceHasNoIncoming.Match> processor) {
351 return rawForOneArbitraryMatch(new Object[]{pC}, processor);
352 }
353
354 /**
355 * Returns a new (partial) match.
356 * This can be used e.g. to call the matcher with a partial match.
357 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
358 * @param pC the fixed value of pattern parameter c, or null if not bound.
359 * @return the (partial) match object.
360 *
361 */
362 public ChoiceHasNoIncoming.Match newMatch(final Choice pC) {
363 return ChoiceHasNoIncoming.Match.newMatch(pC);
364 }
365
366 /**
367 * Retrieve the set of values that occur in matches for c.
368 * @return the Set of all values or empty set if there are no matches
369 *
370 */
371 protected Stream<Choice> rawStreamAllValuesOfc(final Object[] parameters) {
372 return rawStreamAllValues(POSITION_C, parameters).map(Choice.class::cast);
373 }
374
375 /**
376 * Retrieve the set of values that occur in matches for c.
377 * @return the Set of all values or empty set if there are no matches
378 *
379 */
380 public Set<Choice> getAllValuesOfc() {
381 return rawStreamAllValuesOfc(emptyArray()).collect(Collectors.toSet());
382 }
383
384 /**
385 * Retrieve the set of values that occur in matches for c.
386 * @return the Set of all values or empty set if there are no matches
387 *
388 */
389 public Stream<Choice> streamAllValuesOfc() {
390 return rawStreamAllValuesOfc(emptyArray());
391 }
392
393 @Override
394 protected ChoiceHasNoIncoming.Match tupleToMatch(final Tuple t) {
395 try {
396 return ChoiceHasNoIncoming.Match.newMatch((Choice) t.get(POSITION_C));
397 } catch(ClassCastException e) {
398 LOGGER.error("Element(s) in tuple not properly typed!",e);
399 return null;
400 }
401 }
402
403 @Override
404 protected ChoiceHasNoIncoming.Match arrayToMatch(final Object[] match) {
405 try {
406 return ChoiceHasNoIncoming.Match.newMatch((Choice) match[POSITION_C]);
407 } catch(ClassCastException e) {
408 LOGGER.error("Element(s) in array not properly typed!",e);
409 return null;
410 }
411 }
412
413 @Override
414 protected ChoiceHasNoIncoming.Match arrayToMatchMutable(final Object[] match) {
415 try {
416 return ChoiceHasNoIncoming.Match.newMutableMatch((Choice) match[POSITION_C]);
417 } catch(ClassCastException e) {
418 LOGGER.error("Element(s) in array not properly typed!",e);
419 return null;
420 }
421 }
422
423 /**
424 * @return the singleton instance of the query specification of this pattern
425 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
426 *
427 */
428 public static IQuerySpecification<ChoiceHasNoIncoming.Matcher> querySpecification() {
429 return ChoiceHasNoIncoming.instance();
430 }
431 }
432
433 private ChoiceHasNoIncoming() {
434 super(GeneratedPQuery.INSTANCE);
435 }
436
437 /**
438 * @return the singleton instance of the query specification
439 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
440 *
441 */
442 public static ChoiceHasNoIncoming instance() {
443 try{
444 return LazyHolder.INSTANCE;
445 } catch (ExceptionInInitializerError err) {
446 throw processInitializerError(err);
447 }
448 }
449
450 @Override
451 protected ChoiceHasNoIncoming.Matcher instantiate(final ViatraQueryEngine engine) {
452 return ChoiceHasNoIncoming.Matcher.on(engine);
453 }
454
455 @Override
456 public ChoiceHasNoIncoming.Matcher instantiate() {
457 return ChoiceHasNoIncoming.Matcher.create();
458 }
459
460 @Override
461 public ChoiceHasNoIncoming.Match newEmptyMatch() {
462 return ChoiceHasNoIncoming.Match.newEmptyMatch();
463 }
464
465 @Override
466 public ChoiceHasNoIncoming.Match newMatch(final Object... parameters) {
467 return ChoiceHasNoIncoming.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Choice) parameters[0]);
468 }
469
470 /**
471 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.ChoiceHasNoIncoming (visibility: PUBLIC, simpleName: ChoiceHasNoIncoming, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.ChoiceHasNoIncoming, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
472 * <b>not</b> at the class load time of the outer class,
473 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.ChoiceHasNoIncoming (visibility: PUBLIC, simpleName: ChoiceHasNoIncoming, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.ChoiceHasNoIncoming, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
474 *
475 * <p> This workaround is required e.g. to support recursion.
476 *
477 */
478 private static class LazyHolder {
479 private final static ChoiceHasNoIncoming INSTANCE = new ChoiceHasNoIncoming();
480
481 /**
482 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
483 * This initialization order is required to support indirect recursion.
484 *
485 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
486 *
487 */
488 private final static Object STATIC_INITIALIZER = ensureInitialized();
489
490 public static Object ensureInitialized() {
491 INSTANCE.ensureInitializedInternal();
492 return null;
493 }
494 }
495
496 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
497 private final static ChoiceHasNoIncoming.GeneratedPQuery INSTANCE = new GeneratedPQuery();
498
499 private final PParameter parameter_c = new PParameter("c", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Choice", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Choice")), PParameterDirection.INOUT);
500
501 private final List<PParameter> parameters = Arrays.asList(parameter_c);
502
503 private GeneratedPQuery() {
504 super(PVisibility.PUBLIC);
505 }
506
507 @Override
508 public String getFullyQualifiedName() {
509 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoIncoming";
510 }
511
512 @Override
513 public List<String> getParameterNames() {
514 return Arrays.asList("c");
515 }
516
517 @Override
518 public List<PParameter> getParameters() {
519 return parameters;
520 }
521
522 @Override
523 public Set<PBody> doGetContainedBodies() {
524 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
525 Set<PBody> bodies = new LinkedHashSet<>();
526 {
527 PBody body = new PBody(this);
528 PVariable var_c = body.getOrCreateVariableByName("c");
529 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
530 PVariable var___1_ = body.getOrCreateVariableByName("_<1>");
531 new TypeConstraint(body, Tuples.flatTupleOf(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Choice")));
532 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
533 new ExportedParameter(body, var_c, parameter_c)
534 ));
535 // neg find transition(_, _, c)
536 new NegativePatternCall(body, Tuples.flatTupleOf(var___0_, var___1_, var_c), Transition.instance().getInternalQueryRepresentation());
537 bodies.add(body);
538 }
539 {
540 PAnnotation annotation = new PAnnotation("Constraint");
541 annotation.addAttribute("severity", "error");
542 annotation.addAttribute("message", "error");
543 annotation.addAttribute("key", Arrays.asList(new Object[] {
544 new ParameterReference("c")
545 }));
546 addAnnotation(annotation);
547 }
548 return bodies;
549 }
550 }
551}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/ChoiceHasNoOutgoing.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/ChoiceHasNoOutgoing.java
deleted file mode 100644
index 1c20a03b..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/ChoiceHasNoOutgoing.java
+++ /dev/null
@@ -1,559 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Choice;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
42
43/**
44 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
45 *
46 * <p>Original source:
47 * <code><pre>
48 * /////////
49 * // Choice
50 * /////////
51 *
52 * {@literal @}Constraint(severity="error", message="error", key = {c})
53 * pattern choiceHasNoOutgoing(c : Choice) {
54 * neg find transition(_, c, _);
55 * }
56 * </pre></code>
57 *
58 * @see Matcher
59 * @see Match
60 *
61 */
62@SuppressWarnings("all")
63public final class ChoiceHasNoOutgoing extends BaseGeneratedEMFQuerySpecification<ChoiceHasNoOutgoing.Matcher> {
64 /**
65 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoOutgoing pattern,
66 * to be used in conjunction with {@link Matcher}.
67 *
68 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
69 * Each instance is a (possibly partial) substitution of pattern parameters,
70 * usable to represent a match of the pattern in the result of a query,
71 * or to specify the bound (fixed) input parameters when issuing a query.
72 *
73 * @see Matcher
74 *
75 */
76 public static abstract class Match extends BasePatternMatch {
77 private Choice fC;
78
79 private static List<String> parameterNames = makeImmutableList("c");
80
81 private Match(final Choice pC) {
82 this.fC = pC;
83 }
84
85 @Override
86 public Object get(final String parameterName) {
87 if ("c".equals(parameterName)) return this.fC;
88 return null;
89 }
90
91 public Choice getC() {
92 return this.fC;
93 }
94
95 @Override
96 public boolean set(final String parameterName, final Object newValue) {
97 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
98 if ("c".equals(parameterName) ) {
99 this.fC = (Choice) newValue;
100 return true;
101 }
102 return false;
103 }
104
105 public void setC(final Choice pC) {
106 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
107 this.fC = pC;
108 }
109
110 @Override
111 public String patternName() {
112 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoOutgoing";
113 }
114
115 @Override
116 public List<String> parameterNames() {
117 return ChoiceHasNoOutgoing.Match.parameterNames;
118 }
119
120 @Override
121 public Object[] toArray() {
122 return new Object[]{fC};
123 }
124
125 @Override
126 public ChoiceHasNoOutgoing.Match toImmutable() {
127 return isMutable() ? newMatch(fC) : this;
128 }
129
130 @Override
131 public String prettyPrint() {
132 StringBuilder result = new StringBuilder();
133 result.append("\"c\"=" + prettyPrintValue(fC));
134 return result.toString();
135 }
136
137 @Override
138 public int hashCode() {
139 return Objects.hash(fC);
140 }
141
142 @Override
143 public boolean equals(final Object obj) {
144 if (this == obj)
145 return true;
146 if (obj == null) {
147 return false;
148 }
149 if ((obj instanceof ChoiceHasNoOutgoing.Match)) {
150 ChoiceHasNoOutgoing.Match other = (ChoiceHasNoOutgoing.Match) obj;
151 return Objects.equals(fC, other.fC);
152 } else {
153 // this should be infrequent
154 if (!(obj instanceof IPatternMatch)) {
155 return false;
156 }
157 IPatternMatch otherSig = (IPatternMatch) obj;
158 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
159 }
160 }
161
162 @Override
163 public ChoiceHasNoOutgoing specification() {
164 return ChoiceHasNoOutgoing.instance();
165 }
166
167 /**
168 * Returns an empty, mutable match.
169 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
170 *
171 * @return the empty match.
172 *
173 */
174 public static ChoiceHasNoOutgoing.Match newEmptyMatch() {
175 return new Mutable(null);
176 }
177
178 /**
179 * Returns a mutable (partial) match.
180 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
181 *
182 * @param pC the fixed value of pattern parameter c, or null if not bound.
183 * @return the new, mutable (partial) match object.
184 *
185 */
186 public static ChoiceHasNoOutgoing.Match newMutableMatch(final Choice pC) {
187 return new Mutable(pC);
188 }
189
190 /**
191 * Returns a new (partial) match.
192 * This can be used e.g. to call the matcher with a partial match.
193 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
194 * @param pC the fixed value of pattern parameter c, or null if not bound.
195 * @return the (partial) match object.
196 *
197 */
198 public static ChoiceHasNoOutgoing.Match newMatch(final Choice pC) {
199 return new Immutable(pC);
200 }
201
202 private static final class Mutable extends ChoiceHasNoOutgoing.Match {
203 Mutable(final Choice pC) {
204 super(pC);
205 }
206
207 @Override
208 public boolean isMutable() {
209 return true;
210 }
211 }
212
213 private static final class Immutable extends ChoiceHasNoOutgoing.Match {
214 Immutable(final Choice pC) {
215 super(pC);
216 }
217
218 @Override
219 public boolean isMutable() {
220 return false;
221 }
222 }
223 }
224
225 /**
226 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoOutgoing pattern,
227 * providing pattern-specific query methods.
228 *
229 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
230 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
231 *
232 * <p>Matches of the pattern will be represented as {@link Match}.
233 *
234 * <p>Original source:
235 * <code><pre>
236 * /////////
237 * // Choice
238 * /////////
239 *
240 * {@literal @}Constraint(severity="error", message="error", key = {c})
241 * pattern choiceHasNoOutgoing(c : Choice) {
242 * neg find transition(_, c, _);
243 * }
244 * </pre></code>
245 *
246 * @see Match
247 * @see ChoiceHasNoOutgoing
248 *
249 */
250 public static class Matcher extends BaseMatcher<ChoiceHasNoOutgoing.Match> {
251 /**
252 * Initializes the pattern matcher within an existing VIATRA Query engine.
253 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
254 *
255 * @param engine the existing VIATRA Query engine in which this matcher will be created.
256 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
257 *
258 */
259 public static ChoiceHasNoOutgoing.Matcher on(final ViatraQueryEngine engine) {
260 // check if matcher already exists
261 Matcher matcher = engine.getExistingMatcher(querySpecification());
262 if (matcher == null) {
263 matcher = (Matcher)engine.getMatcher(querySpecification());
264 }
265 return matcher;
266 }
267
268 /**
269 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
270 * @return an initialized matcher
271 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
272 *
273 */
274 public static ChoiceHasNoOutgoing.Matcher create() {
275 return new Matcher();
276 }
277
278 private final static int POSITION_C = 0;
279
280 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ChoiceHasNoOutgoing.Matcher.class);
281
282 /**
283 * Initializes the pattern matcher within an existing VIATRA Query engine.
284 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
285 *
286 * @param engine the existing VIATRA Query engine in which this matcher will be created.
287 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
288 *
289 */
290 private Matcher() {
291 super(querySpecification());
292 }
293
294 /**
295 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
296 * @param pC the fixed value of pattern parameter c, or null if not bound.
297 * @return matches represented as a Match object.
298 *
299 */
300 public Collection<ChoiceHasNoOutgoing.Match> getAllMatches(final Choice pC) {
301 return rawStreamAllMatches(new Object[]{pC}).collect(Collectors.toSet());
302 }
303
304 /**
305 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
306 * </p>
307 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
308 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
309 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
310 * @param pC the fixed value of pattern parameter c, or null if not bound.
311 * @return a stream of matches represented as a Match object.
312 *
313 */
314 public Stream<ChoiceHasNoOutgoing.Match> streamAllMatches(final Choice pC) {
315 return rawStreamAllMatches(new Object[]{pC});
316 }
317
318 /**
319 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
320 * Neither determinism nor randomness of selection is guaranteed.
321 * @param pC the fixed value of pattern parameter c, or null if not bound.
322 * @return a match represented as a Match object, or null if no match is found.
323 *
324 */
325 public Optional<ChoiceHasNoOutgoing.Match> getOneArbitraryMatch(final Choice pC) {
326 return rawGetOneArbitraryMatch(new Object[]{pC});
327 }
328
329 /**
330 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
331 * under any possible substitution of the unspecified parameters (if any).
332 * @param pC the fixed value of pattern parameter c, or null if not bound.
333 * @return true if the input is a valid (partial) match of the pattern.
334 *
335 */
336 public boolean hasMatch(final Choice pC) {
337 return rawHasMatch(new Object[]{pC});
338 }
339
340 /**
341 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
342 * @param pC the fixed value of pattern parameter c, or null if not bound.
343 * @return the number of pattern matches found.
344 *
345 */
346 public int countMatches(final Choice pC) {
347 return rawCountMatches(new Object[]{pC});
348 }
349
350 /**
351 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
352 * Neither determinism nor randomness of selection is guaranteed.
353 * @param pC the fixed value of pattern parameter c, or null if not bound.
354 * @param processor the action that will process the selected match.
355 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
356 *
357 */
358 public boolean forOneArbitraryMatch(final Choice pC, final Consumer<? super ChoiceHasNoOutgoing.Match> processor) {
359 return rawForOneArbitraryMatch(new Object[]{pC}, processor);
360 }
361
362 /**
363 * Returns a new (partial) match.
364 * This can be used e.g. to call the matcher with a partial match.
365 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
366 * @param pC the fixed value of pattern parameter c, or null if not bound.
367 * @return the (partial) match object.
368 *
369 */
370 public ChoiceHasNoOutgoing.Match newMatch(final Choice pC) {
371 return ChoiceHasNoOutgoing.Match.newMatch(pC);
372 }
373
374 /**
375 * Retrieve the set of values that occur in matches for c.
376 * @return the Set of all values or empty set if there are no matches
377 *
378 */
379 protected Stream<Choice> rawStreamAllValuesOfc(final Object[] parameters) {
380 return rawStreamAllValues(POSITION_C, parameters).map(Choice.class::cast);
381 }
382
383 /**
384 * Retrieve the set of values that occur in matches for c.
385 * @return the Set of all values or empty set if there are no matches
386 *
387 */
388 public Set<Choice> getAllValuesOfc() {
389 return rawStreamAllValuesOfc(emptyArray()).collect(Collectors.toSet());
390 }
391
392 /**
393 * Retrieve the set of values that occur in matches for c.
394 * @return the Set of all values or empty set if there are no matches
395 *
396 */
397 public Stream<Choice> streamAllValuesOfc() {
398 return rawStreamAllValuesOfc(emptyArray());
399 }
400
401 @Override
402 protected ChoiceHasNoOutgoing.Match tupleToMatch(final Tuple t) {
403 try {
404 return ChoiceHasNoOutgoing.Match.newMatch((Choice) t.get(POSITION_C));
405 } catch(ClassCastException e) {
406 LOGGER.error("Element(s) in tuple not properly typed!",e);
407 return null;
408 }
409 }
410
411 @Override
412 protected ChoiceHasNoOutgoing.Match arrayToMatch(final Object[] match) {
413 try {
414 return ChoiceHasNoOutgoing.Match.newMatch((Choice) match[POSITION_C]);
415 } catch(ClassCastException e) {
416 LOGGER.error("Element(s) in array not properly typed!",e);
417 return null;
418 }
419 }
420
421 @Override
422 protected ChoiceHasNoOutgoing.Match arrayToMatchMutable(final Object[] match) {
423 try {
424 return ChoiceHasNoOutgoing.Match.newMutableMatch((Choice) match[POSITION_C]);
425 } catch(ClassCastException e) {
426 LOGGER.error("Element(s) in array not properly typed!",e);
427 return null;
428 }
429 }
430
431 /**
432 * @return the singleton instance of the query specification of this pattern
433 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
434 *
435 */
436 public static IQuerySpecification<ChoiceHasNoOutgoing.Matcher> querySpecification() {
437 return ChoiceHasNoOutgoing.instance();
438 }
439 }
440
441 private ChoiceHasNoOutgoing() {
442 super(GeneratedPQuery.INSTANCE);
443 }
444
445 /**
446 * @return the singleton instance of the query specification
447 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
448 *
449 */
450 public static ChoiceHasNoOutgoing instance() {
451 try{
452 return LazyHolder.INSTANCE;
453 } catch (ExceptionInInitializerError err) {
454 throw processInitializerError(err);
455 }
456 }
457
458 @Override
459 protected ChoiceHasNoOutgoing.Matcher instantiate(final ViatraQueryEngine engine) {
460 return ChoiceHasNoOutgoing.Matcher.on(engine);
461 }
462
463 @Override
464 public ChoiceHasNoOutgoing.Matcher instantiate() {
465 return ChoiceHasNoOutgoing.Matcher.create();
466 }
467
468 @Override
469 public ChoiceHasNoOutgoing.Match newEmptyMatch() {
470 return ChoiceHasNoOutgoing.Match.newEmptyMatch();
471 }
472
473 @Override
474 public ChoiceHasNoOutgoing.Match newMatch(final Object... parameters) {
475 return ChoiceHasNoOutgoing.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Choice) parameters[0]);
476 }
477
478 /**
479 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.ChoiceHasNoOutgoing (visibility: PUBLIC, simpleName: ChoiceHasNoOutgoing, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.ChoiceHasNoOutgoing, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
480 * <b>not</b> at the class load time of the outer class,
481 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.ChoiceHasNoOutgoing (visibility: PUBLIC, simpleName: ChoiceHasNoOutgoing, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.ChoiceHasNoOutgoing, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
482 *
483 * <p> This workaround is required e.g. to support recursion.
484 *
485 */
486 private static class LazyHolder {
487 private final static ChoiceHasNoOutgoing INSTANCE = new ChoiceHasNoOutgoing();
488
489 /**
490 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
491 * This initialization order is required to support indirect recursion.
492 *
493 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
494 *
495 */
496 private final static Object STATIC_INITIALIZER = ensureInitialized();
497
498 public static Object ensureInitialized() {
499 INSTANCE.ensureInitializedInternal();
500 return null;
501 }
502 }
503
504 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
505 private final static ChoiceHasNoOutgoing.GeneratedPQuery INSTANCE = new GeneratedPQuery();
506
507 private final PParameter parameter_c = new PParameter("c", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Choice", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Choice")), PParameterDirection.INOUT);
508
509 private final List<PParameter> parameters = Arrays.asList(parameter_c);
510
511 private GeneratedPQuery() {
512 super(PVisibility.PUBLIC);
513 }
514
515 @Override
516 public String getFullyQualifiedName() {
517 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.choiceHasNoOutgoing";
518 }
519
520 @Override
521 public List<String> getParameterNames() {
522 return Arrays.asList("c");
523 }
524
525 @Override
526 public List<PParameter> getParameters() {
527 return parameters;
528 }
529
530 @Override
531 public Set<PBody> doGetContainedBodies() {
532 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
533 Set<PBody> bodies = new LinkedHashSet<>();
534 {
535 PBody body = new PBody(this);
536 PVariable var_c = body.getOrCreateVariableByName("c");
537 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
538 PVariable var___1_ = body.getOrCreateVariableByName("_<1>");
539 new TypeConstraint(body, Tuples.flatTupleOf(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Choice")));
540 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
541 new ExportedParameter(body, var_c, parameter_c)
542 ));
543 // neg find transition(_, c, _)
544 new NegativePatternCall(body, Tuples.flatTupleOf(var___0_, var_c, var___1_), Transition.instance().getInternalQueryRepresentation());
545 bodies.add(body);
546 }
547 {
548 PAnnotation annotation = new PAnnotation("Constraint");
549 annotation.addAttribute("severity", "error");
550 annotation.addAttribute("message", "error");
551 annotation.addAttribute("key", Arrays.asList(new Object[] {
552 new ParameterReference("c")
553 }));
554 addAnnotation(annotation);
555 }
556 return bodies;
557 }
558 }
559}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/EntryInRegion.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/EntryInRegion.java
deleted file mode 100644
index 147b27f9..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/EntryInRegion.java
+++ /dev/null
@@ -1,702 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Entry;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Region;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
29import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
31import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
38import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
40import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
41
42/**
43 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
44 *
45 * <p>Original source:
46 * <code><pre>
47 * /////////
48 * // Entry
49 * /////////
50 *
51 * pattern entryInRegion(r1 : Region, e1 : Entry) {
52 * Region.vertices(r1, e1);
53 * }
54 * </pre></code>
55 *
56 * @see Matcher
57 * @see Match
58 *
59 */
60@SuppressWarnings("all")
61public final class EntryInRegion extends BaseGeneratedEMFQuerySpecification<EntryInRegion.Matcher> {
62 /**
63 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.entryInRegion pattern,
64 * to be used in conjunction with {@link Matcher}.
65 *
66 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
67 * Each instance is a (possibly partial) substitution of pattern parameters,
68 * usable to represent a match of the pattern in the result of a query,
69 * or to specify the bound (fixed) input parameters when issuing a query.
70 *
71 * @see Matcher
72 *
73 */
74 public static abstract class Match extends BasePatternMatch {
75 private Region fR1;
76
77 private Entry fE1;
78
79 private static List<String> parameterNames = makeImmutableList("r1", "e1");
80
81 private Match(final Region pR1, final Entry pE1) {
82 this.fR1 = pR1;
83 this.fE1 = pE1;
84 }
85
86 @Override
87 public Object get(final String parameterName) {
88 if ("r1".equals(parameterName)) return this.fR1;
89 if ("e1".equals(parameterName)) return this.fE1;
90 return null;
91 }
92
93 public Region getR1() {
94 return this.fR1;
95 }
96
97 public Entry getE1() {
98 return this.fE1;
99 }
100
101 @Override
102 public boolean set(final String parameterName, final Object newValue) {
103 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
104 if ("r1".equals(parameterName) ) {
105 this.fR1 = (Region) newValue;
106 return true;
107 }
108 if ("e1".equals(parameterName) ) {
109 this.fE1 = (Entry) newValue;
110 return true;
111 }
112 return false;
113 }
114
115 public void setR1(final Region pR1) {
116 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
117 this.fR1 = pR1;
118 }
119
120 public void setE1(final Entry pE1) {
121 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
122 this.fE1 = pE1;
123 }
124
125 @Override
126 public String patternName() {
127 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.entryInRegion";
128 }
129
130 @Override
131 public List<String> parameterNames() {
132 return EntryInRegion.Match.parameterNames;
133 }
134
135 @Override
136 public Object[] toArray() {
137 return new Object[]{fR1, fE1};
138 }
139
140 @Override
141 public EntryInRegion.Match toImmutable() {
142 return isMutable() ? newMatch(fR1, fE1) : this;
143 }
144
145 @Override
146 public String prettyPrint() {
147 StringBuilder result = new StringBuilder();
148 result.append("\"r1\"=" + prettyPrintValue(fR1) + ", ");
149 result.append("\"e1\"=" + prettyPrintValue(fE1));
150 return result.toString();
151 }
152
153 @Override
154 public int hashCode() {
155 return Objects.hash(fR1, fE1);
156 }
157
158 @Override
159 public boolean equals(final Object obj) {
160 if (this == obj)
161 return true;
162 if (obj == null) {
163 return false;
164 }
165 if ((obj instanceof EntryInRegion.Match)) {
166 EntryInRegion.Match other = (EntryInRegion.Match) obj;
167 return Objects.equals(fR1, other.fR1) && Objects.equals(fE1, other.fE1);
168 } else {
169 // this should be infrequent
170 if (!(obj instanceof IPatternMatch)) {
171 return false;
172 }
173 IPatternMatch otherSig = (IPatternMatch) obj;
174 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
175 }
176 }
177
178 @Override
179 public EntryInRegion specification() {
180 return EntryInRegion.instance();
181 }
182
183 /**
184 * Returns an empty, mutable match.
185 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
186 *
187 * @return the empty match.
188 *
189 */
190 public static EntryInRegion.Match newEmptyMatch() {
191 return new Mutable(null, null);
192 }
193
194 /**
195 * Returns a mutable (partial) match.
196 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
197 *
198 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
199 * @param pE1 the fixed value of pattern parameter e1, or null if not bound.
200 * @return the new, mutable (partial) match object.
201 *
202 */
203 public static EntryInRegion.Match newMutableMatch(final Region pR1, final Entry pE1) {
204 return new Mutable(pR1, pE1);
205 }
206
207 /**
208 * Returns a new (partial) match.
209 * This can be used e.g. to call the matcher with a partial match.
210 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
211 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
212 * @param pE1 the fixed value of pattern parameter e1, or null if not bound.
213 * @return the (partial) match object.
214 *
215 */
216 public static EntryInRegion.Match newMatch(final Region pR1, final Entry pE1) {
217 return new Immutable(pR1, pE1);
218 }
219
220 private static final class Mutable extends EntryInRegion.Match {
221 Mutable(final Region pR1, final Entry pE1) {
222 super(pR1, pE1);
223 }
224
225 @Override
226 public boolean isMutable() {
227 return true;
228 }
229 }
230
231 private static final class Immutable extends EntryInRegion.Match {
232 Immutable(final Region pR1, final Entry pE1) {
233 super(pR1, pE1);
234 }
235
236 @Override
237 public boolean isMutable() {
238 return false;
239 }
240 }
241 }
242
243 /**
244 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.entryInRegion pattern,
245 * providing pattern-specific query methods.
246 *
247 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
248 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
249 *
250 * <p>Matches of the pattern will be represented as {@link Match}.
251 *
252 * <p>Original source:
253 * <code><pre>
254 * /////////
255 * // Entry
256 * /////////
257 *
258 * pattern entryInRegion(r1 : Region, e1 : Entry) {
259 * Region.vertices(r1, e1);
260 * }
261 * </pre></code>
262 *
263 * @see Match
264 * @see EntryInRegion
265 *
266 */
267 public static class Matcher extends BaseMatcher<EntryInRegion.Match> {
268 /**
269 * Initializes the pattern matcher within an existing VIATRA Query engine.
270 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
271 *
272 * @param engine the existing VIATRA Query engine in which this matcher will be created.
273 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
274 *
275 */
276 public static EntryInRegion.Matcher on(final ViatraQueryEngine engine) {
277 // check if matcher already exists
278 Matcher matcher = engine.getExistingMatcher(querySpecification());
279 if (matcher == null) {
280 matcher = (Matcher)engine.getMatcher(querySpecification());
281 }
282 return matcher;
283 }
284
285 /**
286 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
287 * @return an initialized matcher
288 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
289 *
290 */
291 public static EntryInRegion.Matcher create() {
292 return new Matcher();
293 }
294
295 private final static int POSITION_R1 = 0;
296
297 private final static int POSITION_E1 = 1;
298
299 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(EntryInRegion.Matcher.class);
300
301 /**
302 * Initializes the pattern matcher within an existing VIATRA Query engine.
303 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
304 *
305 * @param engine the existing VIATRA Query engine in which this matcher will be created.
306 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
307 *
308 */
309 private Matcher() {
310 super(querySpecification());
311 }
312
313 /**
314 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
315 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
316 * @param pE1 the fixed value of pattern parameter e1, or null if not bound.
317 * @return matches represented as a Match object.
318 *
319 */
320 public Collection<EntryInRegion.Match> getAllMatches(final Region pR1, final Entry pE1) {
321 return rawStreamAllMatches(new Object[]{pR1, pE1}).collect(Collectors.toSet());
322 }
323
324 /**
325 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
326 * </p>
327 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
328 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
329 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
330 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
331 * @param pE1 the fixed value of pattern parameter e1, or null if not bound.
332 * @return a stream of matches represented as a Match object.
333 *
334 */
335 public Stream<EntryInRegion.Match> streamAllMatches(final Region pR1, final Entry pE1) {
336 return rawStreamAllMatches(new Object[]{pR1, pE1});
337 }
338
339 /**
340 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
341 * Neither determinism nor randomness of selection is guaranteed.
342 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
343 * @param pE1 the fixed value of pattern parameter e1, or null if not bound.
344 * @return a match represented as a Match object, or null if no match is found.
345 *
346 */
347 public Optional<EntryInRegion.Match> getOneArbitraryMatch(final Region pR1, final Entry pE1) {
348 return rawGetOneArbitraryMatch(new Object[]{pR1, pE1});
349 }
350
351 /**
352 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
353 * under any possible substitution of the unspecified parameters (if any).
354 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
355 * @param pE1 the fixed value of pattern parameter e1, or null if not bound.
356 * @return true if the input is a valid (partial) match of the pattern.
357 *
358 */
359 public boolean hasMatch(final Region pR1, final Entry pE1) {
360 return rawHasMatch(new Object[]{pR1, pE1});
361 }
362
363 /**
364 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
365 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
366 * @param pE1 the fixed value of pattern parameter e1, or null if not bound.
367 * @return the number of pattern matches found.
368 *
369 */
370 public int countMatches(final Region pR1, final Entry pE1) {
371 return rawCountMatches(new Object[]{pR1, pE1});
372 }
373
374 /**
375 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
376 * Neither determinism nor randomness of selection is guaranteed.
377 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
378 * @param pE1 the fixed value of pattern parameter e1, or null if not bound.
379 * @param processor the action that will process the selected match.
380 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
381 *
382 */
383 public boolean forOneArbitraryMatch(final Region pR1, final Entry pE1, final Consumer<? super EntryInRegion.Match> processor) {
384 return rawForOneArbitraryMatch(new Object[]{pR1, pE1}, processor);
385 }
386
387 /**
388 * Returns a new (partial) match.
389 * This can be used e.g. to call the matcher with a partial match.
390 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
391 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
392 * @param pE1 the fixed value of pattern parameter e1, or null if not bound.
393 * @return the (partial) match object.
394 *
395 */
396 public EntryInRegion.Match newMatch(final Region pR1, final Entry pE1) {
397 return EntryInRegion.Match.newMatch(pR1, pE1);
398 }
399
400 /**
401 * Retrieve the set of values that occur in matches for r1.
402 * @return the Set of all values or empty set if there are no matches
403 *
404 */
405 protected Stream<Region> rawStreamAllValuesOfr1(final Object[] parameters) {
406 return rawStreamAllValues(POSITION_R1, parameters).map(Region.class::cast);
407 }
408
409 /**
410 * Retrieve the set of values that occur in matches for r1.
411 * @return the Set of all values or empty set if there are no matches
412 *
413 */
414 public Set<Region> getAllValuesOfr1() {
415 return rawStreamAllValuesOfr1(emptyArray()).collect(Collectors.toSet());
416 }
417
418 /**
419 * Retrieve the set of values that occur in matches for r1.
420 * @return the Set of all values or empty set if there are no matches
421 *
422 */
423 public Stream<Region> streamAllValuesOfr1() {
424 return rawStreamAllValuesOfr1(emptyArray());
425 }
426
427 /**
428 * Retrieve the set of values that occur in matches for r1.
429 * </p>
430 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
431 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
432 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
433 *
434 * @return the Stream of all values or empty set if there are no matches
435 *
436 */
437 public Stream<Region> streamAllValuesOfr1(final EntryInRegion.Match partialMatch) {
438 return rawStreamAllValuesOfr1(partialMatch.toArray());
439 }
440
441 /**
442 * Retrieve the set of values that occur in matches for r1.
443 * </p>
444 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
445 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
446 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
447 *
448 * @return the Stream of all values or empty set if there are no matches
449 *
450 */
451 public Stream<Region> streamAllValuesOfr1(final Entry pE1) {
452 return rawStreamAllValuesOfr1(new Object[]{null, pE1});
453 }
454
455 /**
456 * Retrieve the set of values that occur in matches for r1.
457 * @return the Set of all values or empty set if there are no matches
458 *
459 */
460 public Set<Region> getAllValuesOfr1(final EntryInRegion.Match partialMatch) {
461 return rawStreamAllValuesOfr1(partialMatch.toArray()).collect(Collectors.toSet());
462 }
463
464 /**
465 * Retrieve the set of values that occur in matches for r1.
466 * @return the Set of all values or empty set if there are no matches
467 *
468 */
469 public Set<Region> getAllValuesOfr1(final Entry pE1) {
470 return rawStreamAllValuesOfr1(new Object[]{null, pE1}).collect(Collectors.toSet());
471 }
472
473 /**
474 * Retrieve the set of values that occur in matches for e1.
475 * @return the Set of all values or empty set if there are no matches
476 *
477 */
478 protected Stream<Entry> rawStreamAllValuesOfe1(final Object[] parameters) {
479 return rawStreamAllValues(POSITION_E1, parameters).map(Entry.class::cast);
480 }
481
482 /**
483 * Retrieve the set of values that occur in matches for e1.
484 * @return the Set of all values or empty set if there are no matches
485 *
486 */
487 public Set<Entry> getAllValuesOfe1() {
488 return rawStreamAllValuesOfe1(emptyArray()).collect(Collectors.toSet());
489 }
490
491 /**
492 * Retrieve the set of values that occur in matches for e1.
493 * @return the Set of all values or empty set if there are no matches
494 *
495 */
496 public Stream<Entry> streamAllValuesOfe1() {
497 return rawStreamAllValuesOfe1(emptyArray());
498 }
499
500 /**
501 * Retrieve the set of values that occur in matches for e1.
502 * </p>
503 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
504 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
505 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
506 *
507 * @return the Stream of all values or empty set if there are no matches
508 *
509 */
510 public Stream<Entry> streamAllValuesOfe1(final EntryInRegion.Match partialMatch) {
511 return rawStreamAllValuesOfe1(partialMatch.toArray());
512 }
513
514 /**
515 * Retrieve the set of values that occur in matches for e1.
516 * </p>
517 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
518 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
519 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
520 *
521 * @return the Stream of all values or empty set if there are no matches
522 *
523 */
524 public Stream<Entry> streamAllValuesOfe1(final Region pR1) {
525 return rawStreamAllValuesOfe1(new Object[]{pR1, null});
526 }
527
528 /**
529 * Retrieve the set of values that occur in matches for e1.
530 * @return the Set of all values or empty set if there are no matches
531 *
532 */
533 public Set<Entry> getAllValuesOfe1(final EntryInRegion.Match partialMatch) {
534 return rawStreamAllValuesOfe1(partialMatch.toArray()).collect(Collectors.toSet());
535 }
536
537 /**
538 * Retrieve the set of values that occur in matches for e1.
539 * @return the Set of all values or empty set if there are no matches
540 *
541 */
542 public Set<Entry> getAllValuesOfe1(final Region pR1) {
543 return rawStreamAllValuesOfe1(new Object[]{pR1, null}).collect(Collectors.toSet());
544 }
545
546 @Override
547 protected EntryInRegion.Match tupleToMatch(final Tuple t) {
548 try {
549 return EntryInRegion.Match.newMatch((Region) t.get(POSITION_R1), (Entry) t.get(POSITION_E1));
550 } catch(ClassCastException e) {
551 LOGGER.error("Element(s) in tuple not properly typed!",e);
552 return null;
553 }
554 }
555
556 @Override
557 protected EntryInRegion.Match arrayToMatch(final Object[] match) {
558 try {
559 return EntryInRegion.Match.newMatch((Region) match[POSITION_R1], (Entry) match[POSITION_E1]);
560 } catch(ClassCastException e) {
561 LOGGER.error("Element(s) in array not properly typed!",e);
562 return null;
563 }
564 }
565
566 @Override
567 protected EntryInRegion.Match arrayToMatchMutable(final Object[] match) {
568 try {
569 return EntryInRegion.Match.newMutableMatch((Region) match[POSITION_R1], (Entry) match[POSITION_E1]);
570 } catch(ClassCastException e) {
571 LOGGER.error("Element(s) in array not properly typed!",e);
572 return null;
573 }
574 }
575
576 /**
577 * @return the singleton instance of the query specification of this pattern
578 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
579 *
580 */
581 public static IQuerySpecification<EntryInRegion.Matcher> querySpecification() {
582 return EntryInRegion.instance();
583 }
584 }
585
586 private EntryInRegion() {
587 super(GeneratedPQuery.INSTANCE);
588 }
589
590 /**
591 * @return the singleton instance of the query specification
592 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
593 *
594 */
595 public static EntryInRegion instance() {
596 try{
597 return LazyHolder.INSTANCE;
598 } catch (ExceptionInInitializerError err) {
599 throw processInitializerError(err);
600 }
601 }
602
603 @Override
604 protected EntryInRegion.Matcher instantiate(final ViatraQueryEngine engine) {
605 return EntryInRegion.Matcher.on(engine);
606 }
607
608 @Override
609 public EntryInRegion.Matcher instantiate() {
610 return EntryInRegion.Matcher.create();
611 }
612
613 @Override
614 public EntryInRegion.Match newEmptyMatch() {
615 return EntryInRegion.Match.newEmptyMatch();
616 }
617
618 @Override
619 public EntryInRegion.Match newMatch(final Object... parameters) {
620 return EntryInRegion.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Region) parameters[0], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Entry) parameters[1]);
621 }
622
623 /**
624 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.EntryInRegion (visibility: PUBLIC, simpleName: EntryInRegion, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.EntryInRegion, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
625 * <b>not</b> at the class load time of the outer class,
626 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.EntryInRegion (visibility: PUBLIC, simpleName: EntryInRegion, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.EntryInRegion, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
627 *
628 * <p> This workaround is required e.g. to support recursion.
629 *
630 */
631 private static class LazyHolder {
632 private final static EntryInRegion INSTANCE = new EntryInRegion();
633
634 /**
635 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
636 * This initialization order is required to support indirect recursion.
637 *
638 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
639 *
640 */
641 private final static Object STATIC_INITIALIZER = ensureInitialized();
642
643 public static Object ensureInitialized() {
644 INSTANCE.ensureInitializedInternal();
645 return null;
646 }
647 }
648
649 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
650 private final static EntryInRegion.GeneratedPQuery INSTANCE = new GeneratedPQuery();
651
652 private final PParameter parameter_r1 = new PParameter("r1", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Region", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Region")), PParameterDirection.INOUT);
653
654 private final PParameter parameter_e1 = new PParameter("e1", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Entry", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Entry")), PParameterDirection.INOUT);
655
656 private final List<PParameter> parameters = Arrays.asList(parameter_r1, parameter_e1);
657
658 private GeneratedPQuery() {
659 super(PVisibility.PUBLIC);
660 }
661
662 @Override
663 public String getFullyQualifiedName() {
664 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.entryInRegion";
665 }
666
667 @Override
668 public List<String> getParameterNames() {
669 return Arrays.asList("r1","e1");
670 }
671
672 @Override
673 public List<PParameter> getParameters() {
674 return parameters;
675 }
676
677 @Override
678 public Set<PBody> doGetContainedBodies() {
679 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
680 Set<PBody> bodies = new LinkedHashSet<>();
681 {
682 PBody body = new PBody(this);
683 PVariable var_r1 = body.getOrCreateVariableByName("r1");
684 PVariable var_e1 = body.getOrCreateVariableByName("e1");
685 new TypeConstraint(body, Tuples.flatTupleOf(var_r1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
686 new TypeConstraint(body, Tuples.flatTupleOf(var_e1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Entry")));
687 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
688 new ExportedParameter(body, var_r1, parameter_r1),
689 new ExportedParameter(body, var_e1, parameter_e1)
690 ));
691 // Region.vertices(r1, e1)
692 new TypeConstraint(body, Tuples.flatTupleOf(var_r1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
693 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
694 new TypeConstraint(body, Tuples.flatTupleOf(var_r1, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices")));
695 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
696 new Equality(body, var__virtual_0_, var_e1);
697 bodies.add(body);
698 }
699 return bodies;
700 }
701 }
702}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/HasMultipleIncomingTrainsition.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/HasMultipleIncomingTrainsition.java
deleted file mode 100644
index 236ce5ff..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/HasMultipleIncomingTrainsition.java
+++ /dev/null
@@ -1,549 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
38import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
40import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
41
42/**
43 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
44 *
45 * <p>Original source:
46 * <code><pre>
47 * pattern hasMultipleIncomingTrainsition(v : Synchronization) {
48 * find transition(_, src1, v);
49 * find transition(_, src2, v);
50 * src1 != src2;
51 * }
52 * </pre></code>
53 *
54 * @see Matcher
55 * @see Match
56 *
57 */
58@SuppressWarnings("all")
59public final class HasMultipleIncomingTrainsition extends BaseGeneratedEMFQuerySpecification<HasMultipleIncomingTrainsition.Matcher> {
60 /**
61 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleIncomingTrainsition pattern,
62 * to be used in conjunction with {@link Matcher}.
63 *
64 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
65 * Each instance is a (possibly partial) substitution of pattern parameters,
66 * usable to represent a match of the pattern in the result of a query,
67 * or to specify the bound (fixed) input parameters when issuing a query.
68 *
69 * @see Matcher
70 *
71 */
72 public static abstract class Match extends BasePatternMatch {
73 private Synchronization fV;
74
75 private static List<String> parameterNames = makeImmutableList("v");
76
77 private Match(final Synchronization pV) {
78 this.fV = pV;
79 }
80
81 @Override
82 public Object get(final String parameterName) {
83 if ("v".equals(parameterName)) return this.fV;
84 return null;
85 }
86
87 public Synchronization getV() {
88 return this.fV;
89 }
90
91 @Override
92 public boolean set(final String parameterName, final Object newValue) {
93 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
94 if ("v".equals(parameterName) ) {
95 this.fV = (Synchronization) newValue;
96 return true;
97 }
98 return false;
99 }
100
101 public void setV(final Synchronization pV) {
102 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
103 this.fV = pV;
104 }
105
106 @Override
107 public String patternName() {
108 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleIncomingTrainsition";
109 }
110
111 @Override
112 public List<String> parameterNames() {
113 return HasMultipleIncomingTrainsition.Match.parameterNames;
114 }
115
116 @Override
117 public Object[] toArray() {
118 return new Object[]{fV};
119 }
120
121 @Override
122 public HasMultipleIncomingTrainsition.Match toImmutable() {
123 return isMutable() ? newMatch(fV) : this;
124 }
125
126 @Override
127 public String prettyPrint() {
128 StringBuilder result = new StringBuilder();
129 result.append("\"v\"=" + prettyPrintValue(fV));
130 return result.toString();
131 }
132
133 @Override
134 public int hashCode() {
135 return Objects.hash(fV);
136 }
137
138 @Override
139 public boolean equals(final Object obj) {
140 if (this == obj)
141 return true;
142 if (obj == null) {
143 return false;
144 }
145 if ((obj instanceof HasMultipleIncomingTrainsition.Match)) {
146 HasMultipleIncomingTrainsition.Match other = (HasMultipleIncomingTrainsition.Match) obj;
147 return Objects.equals(fV, other.fV);
148 } else {
149 // this should be infrequent
150 if (!(obj instanceof IPatternMatch)) {
151 return false;
152 }
153 IPatternMatch otherSig = (IPatternMatch) obj;
154 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
155 }
156 }
157
158 @Override
159 public HasMultipleIncomingTrainsition specification() {
160 return HasMultipleIncomingTrainsition.instance();
161 }
162
163 /**
164 * Returns an empty, mutable match.
165 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
166 *
167 * @return the empty match.
168 *
169 */
170 public static HasMultipleIncomingTrainsition.Match newEmptyMatch() {
171 return new Mutable(null);
172 }
173
174 /**
175 * Returns a mutable (partial) match.
176 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
177 *
178 * @param pV the fixed value of pattern parameter v, or null if not bound.
179 * @return the new, mutable (partial) match object.
180 *
181 */
182 public static HasMultipleIncomingTrainsition.Match newMutableMatch(final Synchronization pV) {
183 return new Mutable(pV);
184 }
185
186 /**
187 * Returns a new (partial) match.
188 * This can be used e.g. to call the matcher with a partial match.
189 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
190 * @param pV the fixed value of pattern parameter v, or null if not bound.
191 * @return the (partial) match object.
192 *
193 */
194 public static HasMultipleIncomingTrainsition.Match newMatch(final Synchronization pV) {
195 return new Immutable(pV);
196 }
197
198 private static final class Mutable extends HasMultipleIncomingTrainsition.Match {
199 Mutable(final Synchronization pV) {
200 super(pV);
201 }
202
203 @Override
204 public boolean isMutable() {
205 return true;
206 }
207 }
208
209 private static final class Immutable extends HasMultipleIncomingTrainsition.Match {
210 Immutable(final Synchronization pV) {
211 super(pV);
212 }
213
214 @Override
215 public boolean isMutable() {
216 return false;
217 }
218 }
219 }
220
221 /**
222 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleIncomingTrainsition pattern,
223 * providing pattern-specific query methods.
224 *
225 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
226 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
227 *
228 * <p>Matches of the pattern will be represented as {@link Match}.
229 *
230 * <p>Original source:
231 * <code><pre>
232 * pattern hasMultipleIncomingTrainsition(v : Synchronization) {
233 * find transition(_, src1, v);
234 * find transition(_, src2, v);
235 * src1 != src2;
236 * }
237 * </pre></code>
238 *
239 * @see Match
240 * @see HasMultipleIncomingTrainsition
241 *
242 */
243 public static class Matcher extends BaseMatcher<HasMultipleIncomingTrainsition.Match> {
244 /**
245 * Initializes the pattern matcher within an existing VIATRA Query engine.
246 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
247 *
248 * @param engine the existing VIATRA Query engine in which this matcher will be created.
249 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
250 *
251 */
252 public static HasMultipleIncomingTrainsition.Matcher on(final ViatraQueryEngine engine) {
253 // check if matcher already exists
254 Matcher matcher = engine.getExistingMatcher(querySpecification());
255 if (matcher == null) {
256 matcher = (Matcher)engine.getMatcher(querySpecification());
257 }
258 return matcher;
259 }
260
261 /**
262 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
263 * @return an initialized matcher
264 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
265 *
266 */
267 public static HasMultipleIncomingTrainsition.Matcher create() {
268 return new Matcher();
269 }
270
271 private final static int POSITION_V = 0;
272
273 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(HasMultipleIncomingTrainsition.Matcher.class);
274
275 /**
276 * Initializes the pattern matcher within an existing VIATRA Query engine.
277 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
278 *
279 * @param engine the existing VIATRA Query engine in which this matcher will be created.
280 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
281 *
282 */
283 private Matcher() {
284 super(querySpecification());
285 }
286
287 /**
288 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
289 * @param pV the fixed value of pattern parameter v, or null if not bound.
290 * @return matches represented as a Match object.
291 *
292 */
293 public Collection<HasMultipleIncomingTrainsition.Match> getAllMatches(final Synchronization pV) {
294 return rawStreamAllMatches(new Object[]{pV}).collect(Collectors.toSet());
295 }
296
297 /**
298 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
299 * </p>
300 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
301 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
302 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
303 * @param pV the fixed value of pattern parameter v, or null if not bound.
304 * @return a stream of matches represented as a Match object.
305 *
306 */
307 public Stream<HasMultipleIncomingTrainsition.Match> streamAllMatches(final Synchronization pV) {
308 return rawStreamAllMatches(new Object[]{pV});
309 }
310
311 /**
312 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
313 * Neither determinism nor randomness of selection is guaranteed.
314 * @param pV the fixed value of pattern parameter v, or null if not bound.
315 * @return a match represented as a Match object, or null if no match is found.
316 *
317 */
318 public Optional<HasMultipleIncomingTrainsition.Match> getOneArbitraryMatch(final Synchronization pV) {
319 return rawGetOneArbitraryMatch(new Object[]{pV});
320 }
321
322 /**
323 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
324 * under any possible substitution of the unspecified parameters (if any).
325 * @param pV the fixed value of pattern parameter v, or null if not bound.
326 * @return true if the input is a valid (partial) match of the pattern.
327 *
328 */
329 public boolean hasMatch(final Synchronization pV) {
330 return rawHasMatch(new Object[]{pV});
331 }
332
333 /**
334 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
335 * @param pV the fixed value of pattern parameter v, or null if not bound.
336 * @return the number of pattern matches found.
337 *
338 */
339 public int countMatches(final Synchronization pV) {
340 return rawCountMatches(new Object[]{pV});
341 }
342
343 /**
344 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
345 * Neither determinism nor randomness of selection is guaranteed.
346 * @param pV the fixed value of pattern parameter v, or null if not bound.
347 * @param processor the action that will process the selected match.
348 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
349 *
350 */
351 public boolean forOneArbitraryMatch(final Synchronization pV, final Consumer<? super HasMultipleIncomingTrainsition.Match> processor) {
352 return rawForOneArbitraryMatch(new Object[]{pV}, processor);
353 }
354
355 /**
356 * Returns a new (partial) match.
357 * This can be used e.g. to call the matcher with a partial match.
358 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
359 * @param pV the fixed value of pattern parameter v, or null if not bound.
360 * @return the (partial) match object.
361 *
362 */
363 public HasMultipleIncomingTrainsition.Match newMatch(final Synchronization pV) {
364 return HasMultipleIncomingTrainsition.Match.newMatch(pV);
365 }
366
367 /**
368 * Retrieve the set of values that occur in matches for v.
369 * @return the Set of all values or empty set if there are no matches
370 *
371 */
372 protected Stream<Synchronization> rawStreamAllValuesOfv(final Object[] parameters) {
373 return rawStreamAllValues(POSITION_V, parameters).map(Synchronization.class::cast);
374 }
375
376 /**
377 * Retrieve the set of values that occur in matches for v.
378 * @return the Set of all values or empty set if there are no matches
379 *
380 */
381 public Set<Synchronization> getAllValuesOfv() {
382 return rawStreamAllValuesOfv(emptyArray()).collect(Collectors.toSet());
383 }
384
385 /**
386 * Retrieve the set of values that occur in matches for v.
387 * @return the Set of all values or empty set if there are no matches
388 *
389 */
390 public Stream<Synchronization> streamAllValuesOfv() {
391 return rawStreamAllValuesOfv(emptyArray());
392 }
393
394 @Override
395 protected HasMultipleIncomingTrainsition.Match tupleToMatch(final Tuple t) {
396 try {
397 return HasMultipleIncomingTrainsition.Match.newMatch((Synchronization) t.get(POSITION_V));
398 } catch(ClassCastException e) {
399 LOGGER.error("Element(s) in tuple not properly typed!",e);
400 return null;
401 }
402 }
403
404 @Override
405 protected HasMultipleIncomingTrainsition.Match arrayToMatch(final Object[] match) {
406 try {
407 return HasMultipleIncomingTrainsition.Match.newMatch((Synchronization) match[POSITION_V]);
408 } catch(ClassCastException e) {
409 LOGGER.error("Element(s) in array not properly typed!",e);
410 return null;
411 }
412 }
413
414 @Override
415 protected HasMultipleIncomingTrainsition.Match arrayToMatchMutable(final Object[] match) {
416 try {
417 return HasMultipleIncomingTrainsition.Match.newMutableMatch((Synchronization) match[POSITION_V]);
418 } catch(ClassCastException e) {
419 LOGGER.error("Element(s) in array not properly typed!",e);
420 return null;
421 }
422 }
423
424 /**
425 * @return the singleton instance of the query specification of this pattern
426 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
427 *
428 */
429 public static IQuerySpecification<HasMultipleIncomingTrainsition.Matcher> querySpecification() {
430 return HasMultipleIncomingTrainsition.instance();
431 }
432 }
433
434 private HasMultipleIncomingTrainsition() {
435 super(GeneratedPQuery.INSTANCE);
436 }
437
438 /**
439 * @return the singleton instance of the query specification
440 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
441 *
442 */
443 public static HasMultipleIncomingTrainsition instance() {
444 try{
445 return LazyHolder.INSTANCE;
446 } catch (ExceptionInInitializerError err) {
447 throw processInitializerError(err);
448 }
449 }
450
451 @Override
452 protected HasMultipleIncomingTrainsition.Matcher instantiate(final ViatraQueryEngine engine) {
453 return HasMultipleIncomingTrainsition.Matcher.on(engine);
454 }
455
456 @Override
457 public HasMultipleIncomingTrainsition.Matcher instantiate() {
458 return HasMultipleIncomingTrainsition.Matcher.create();
459 }
460
461 @Override
462 public HasMultipleIncomingTrainsition.Match newEmptyMatch() {
463 return HasMultipleIncomingTrainsition.Match.newEmptyMatch();
464 }
465
466 @Override
467 public HasMultipleIncomingTrainsition.Match newMatch(final Object... parameters) {
468 return HasMultipleIncomingTrainsition.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization) parameters[0]);
469 }
470
471 /**
472 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleIncomingTrainsition (visibility: PUBLIC, simpleName: HasMultipleIncomingTrainsition, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleIncomingTrainsition, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
473 * <b>not</b> at the class load time of the outer class,
474 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleIncomingTrainsition (visibility: PUBLIC, simpleName: HasMultipleIncomingTrainsition, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleIncomingTrainsition, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
475 *
476 * <p> This workaround is required e.g. to support recursion.
477 *
478 */
479 private static class LazyHolder {
480 private final static HasMultipleIncomingTrainsition INSTANCE = new HasMultipleIncomingTrainsition();
481
482 /**
483 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
484 * This initialization order is required to support indirect recursion.
485 *
486 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
487 *
488 */
489 private final static Object STATIC_INITIALIZER = ensureInitialized();
490
491 public static Object ensureInitialized() {
492 INSTANCE.ensureInitializedInternal();
493 return null;
494 }
495 }
496
497 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
498 private final static HasMultipleIncomingTrainsition.GeneratedPQuery INSTANCE = new GeneratedPQuery();
499
500 private final PParameter parameter_v = new PParameter("v", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Synchronization")), PParameterDirection.INOUT);
501
502 private final List<PParameter> parameters = Arrays.asList(parameter_v);
503
504 private GeneratedPQuery() {
505 super(PVisibility.PUBLIC);
506 }
507
508 @Override
509 public String getFullyQualifiedName() {
510 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleIncomingTrainsition";
511 }
512
513 @Override
514 public List<String> getParameterNames() {
515 return Arrays.asList("v");
516 }
517
518 @Override
519 public List<PParameter> getParameters() {
520 return parameters;
521 }
522
523 @Override
524 public Set<PBody> doGetContainedBodies() {
525 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
526 Set<PBody> bodies = new LinkedHashSet<>();
527 {
528 PBody body = new PBody(this);
529 PVariable var_v = body.getOrCreateVariableByName("v");
530 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
531 PVariable var_src1 = body.getOrCreateVariableByName("src1");
532 PVariable var___1_ = body.getOrCreateVariableByName("_<1>");
533 PVariable var_src2 = body.getOrCreateVariableByName("src2");
534 new TypeConstraint(body, Tuples.flatTupleOf(var_v), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
535 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
536 new ExportedParameter(body, var_v, parameter_v)
537 ));
538 // find transition(_, src1, v)
539 new PositivePatternCall(body, Tuples.flatTupleOf(var___0_, var_src1, var_v), Transition.instance().getInternalQueryRepresentation());
540 // find transition(_, src2, v)
541 new PositivePatternCall(body, Tuples.flatTupleOf(var___1_, var_src2, var_v), Transition.instance().getInternalQueryRepresentation());
542 // src1 != src2
543 new Inequality(body, var_src1, var_src2);
544 bodies.add(body);
545 }
546 return bodies;
547 }
548 }
549}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/HasMultipleOutgoingTrainsition.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/HasMultipleOutgoingTrainsition.java
deleted file mode 100644
index 115b93e1..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/HasMultipleOutgoingTrainsition.java
+++ /dev/null
@@ -1,549 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
38import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
40import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
41
42/**
43 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
44 *
45 * <p>Original source:
46 * <code><pre>
47 * pattern hasMultipleOutgoingTrainsition(v : Synchronization) {
48 * find transition(_, v, trg1);
49 * find transition(_, v, trg2);
50 * trg1 != trg2;
51 * }
52 * </pre></code>
53 *
54 * @see Matcher
55 * @see Match
56 *
57 */
58@SuppressWarnings("all")
59public final class HasMultipleOutgoingTrainsition extends BaseGeneratedEMFQuerySpecification<HasMultipleOutgoingTrainsition.Matcher> {
60 /**
61 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleOutgoingTrainsition pattern,
62 * to be used in conjunction with {@link Matcher}.
63 *
64 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
65 * Each instance is a (possibly partial) substitution of pattern parameters,
66 * usable to represent a match of the pattern in the result of a query,
67 * or to specify the bound (fixed) input parameters when issuing a query.
68 *
69 * @see Matcher
70 *
71 */
72 public static abstract class Match extends BasePatternMatch {
73 private Synchronization fV;
74
75 private static List<String> parameterNames = makeImmutableList("v");
76
77 private Match(final Synchronization pV) {
78 this.fV = pV;
79 }
80
81 @Override
82 public Object get(final String parameterName) {
83 if ("v".equals(parameterName)) return this.fV;
84 return null;
85 }
86
87 public Synchronization getV() {
88 return this.fV;
89 }
90
91 @Override
92 public boolean set(final String parameterName, final Object newValue) {
93 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
94 if ("v".equals(parameterName) ) {
95 this.fV = (Synchronization) newValue;
96 return true;
97 }
98 return false;
99 }
100
101 public void setV(final Synchronization pV) {
102 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
103 this.fV = pV;
104 }
105
106 @Override
107 public String patternName() {
108 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleOutgoingTrainsition";
109 }
110
111 @Override
112 public List<String> parameterNames() {
113 return HasMultipleOutgoingTrainsition.Match.parameterNames;
114 }
115
116 @Override
117 public Object[] toArray() {
118 return new Object[]{fV};
119 }
120
121 @Override
122 public HasMultipleOutgoingTrainsition.Match toImmutable() {
123 return isMutable() ? newMatch(fV) : this;
124 }
125
126 @Override
127 public String prettyPrint() {
128 StringBuilder result = new StringBuilder();
129 result.append("\"v\"=" + prettyPrintValue(fV));
130 return result.toString();
131 }
132
133 @Override
134 public int hashCode() {
135 return Objects.hash(fV);
136 }
137
138 @Override
139 public boolean equals(final Object obj) {
140 if (this == obj)
141 return true;
142 if (obj == null) {
143 return false;
144 }
145 if ((obj instanceof HasMultipleOutgoingTrainsition.Match)) {
146 HasMultipleOutgoingTrainsition.Match other = (HasMultipleOutgoingTrainsition.Match) obj;
147 return Objects.equals(fV, other.fV);
148 } else {
149 // this should be infrequent
150 if (!(obj instanceof IPatternMatch)) {
151 return false;
152 }
153 IPatternMatch otherSig = (IPatternMatch) obj;
154 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
155 }
156 }
157
158 @Override
159 public HasMultipleOutgoingTrainsition specification() {
160 return HasMultipleOutgoingTrainsition.instance();
161 }
162
163 /**
164 * Returns an empty, mutable match.
165 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
166 *
167 * @return the empty match.
168 *
169 */
170 public static HasMultipleOutgoingTrainsition.Match newEmptyMatch() {
171 return new Mutable(null);
172 }
173
174 /**
175 * Returns a mutable (partial) match.
176 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
177 *
178 * @param pV the fixed value of pattern parameter v, or null if not bound.
179 * @return the new, mutable (partial) match object.
180 *
181 */
182 public static HasMultipleOutgoingTrainsition.Match newMutableMatch(final Synchronization pV) {
183 return new Mutable(pV);
184 }
185
186 /**
187 * Returns a new (partial) match.
188 * This can be used e.g. to call the matcher with a partial match.
189 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
190 * @param pV the fixed value of pattern parameter v, or null if not bound.
191 * @return the (partial) match object.
192 *
193 */
194 public static HasMultipleOutgoingTrainsition.Match newMatch(final Synchronization pV) {
195 return new Immutable(pV);
196 }
197
198 private static final class Mutable extends HasMultipleOutgoingTrainsition.Match {
199 Mutable(final Synchronization pV) {
200 super(pV);
201 }
202
203 @Override
204 public boolean isMutable() {
205 return true;
206 }
207 }
208
209 private static final class Immutable extends HasMultipleOutgoingTrainsition.Match {
210 Immutable(final Synchronization pV) {
211 super(pV);
212 }
213
214 @Override
215 public boolean isMutable() {
216 return false;
217 }
218 }
219 }
220
221 /**
222 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleOutgoingTrainsition pattern,
223 * providing pattern-specific query methods.
224 *
225 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
226 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
227 *
228 * <p>Matches of the pattern will be represented as {@link Match}.
229 *
230 * <p>Original source:
231 * <code><pre>
232 * pattern hasMultipleOutgoingTrainsition(v : Synchronization) {
233 * find transition(_, v, trg1);
234 * find transition(_, v, trg2);
235 * trg1 != trg2;
236 * }
237 * </pre></code>
238 *
239 * @see Match
240 * @see HasMultipleOutgoingTrainsition
241 *
242 */
243 public static class Matcher extends BaseMatcher<HasMultipleOutgoingTrainsition.Match> {
244 /**
245 * Initializes the pattern matcher within an existing VIATRA Query engine.
246 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
247 *
248 * @param engine the existing VIATRA Query engine in which this matcher will be created.
249 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
250 *
251 */
252 public static HasMultipleOutgoingTrainsition.Matcher on(final ViatraQueryEngine engine) {
253 // check if matcher already exists
254 Matcher matcher = engine.getExistingMatcher(querySpecification());
255 if (matcher == null) {
256 matcher = (Matcher)engine.getMatcher(querySpecification());
257 }
258 return matcher;
259 }
260
261 /**
262 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
263 * @return an initialized matcher
264 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
265 *
266 */
267 public static HasMultipleOutgoingTrainsition.Matcher create() {
268 return new Matcher();
269 }
270
271 private final static int POSITION_V = 0;
272
273 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(HasMultipleOutgoingTrainsition.Matcher.class);
274
275 /**
276 * Initializes the pattern matcher within an existing VIATRA Query engine.
277 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
278 *
279 * @param engine the existing VIATRA Query engine in which this matcher will be created.
280 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
281 *
282 */
283 private Matcher() {
284 super(querySpecification());
285 }
286
287 /**
288 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
289 * @param pV the fixed value of pattern parameter v, or null if not bound.
290 * @return matches represented as a Match object.
291 *
292 */
293 public Collection<HasMultipleOutgoingTrainsition.Match> getAllMatches(final Synchronization pV) {
294 return rawStreamAllMatches(new Object[]{pV}).collect(Collectors.toSet());
295 }
296
297 /**
298 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
299 * </p>
300 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
301 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
302 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
303 * @param pV the fixed value of pattern parameter v, or null if not bound.
304 * @return a stream of matches represented as a Match object.
305 *
306 */
307 public Stream<HasMultipleOutgoingTrainsition.Match> streamAllMatches(final Synchronization pV) {
308 return rawStreamAllMatches(new Object[]{pV});
309 }
310
311 /**
312 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
313 * Neither determinism nor randomness of selection is guaranteed.
314 * @param pV the fixed value of pattern parameter v, or null if not bound.
315 * @return a match represented as a Match object, or null if no match is found.
316 *
317 */
318 public Optional<HasMultipleOutgoingTrainsition.Match> getOneArbitraryMatch(final Synchronization pV) {
319 return rawGetOneArbitraryMatch(new Object[]{pV});
320 }
321
322 /**
323 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
324 * under any possible substitution of the unspecified parameters (if any).
325 * @param pV the fixed value of pattern parameter v, or null if not bound.
326 * @return true if the input is a valid (partial) match of the pattern.
327 *
328 */
329 public boolean hasMatch(final Synchronization pV) {
330 return rawHasMatch(new Object[]{pV});
331 }
332
333 /**
334 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
335 * @param pV the fixed value of pattern parameter v, or null if not bound.
336 * @return the number of pattern matches found.
337 *
338 */
339 public int countMatches(final Synchronization pV) {
340 return rawCountMatches(new Object[]{pV});
341 }
342
343 /**
344 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
345 * Neither determinism nor randomness of selection is guaranteed.
346 * @param pV the fixed value of pattern parameter v, or null if not bound.
347 * @param processor the action that will process the selected match.
348 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
349 *
350 */
351 public boolean forOneArbitraryMatch(final Synchronization pV, final Consumer<? super HasMultipleOutgoingTrainsition.Match> processor) {
352 return rawForOneArbitraryMatch(new Object[]{pV}, processor);
353 }
354
355 /**
356 * Returns a new (partial) match.
357 * This can be used e.g. to call the matcher with a partial match.
358 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
359 * @param pV the fixed value of pattern parameter v, or null if not bound.
360 * @return the (partial) match object.
361 *
362 */
363 public HasMultipleOutgoingTrainsition.Match newMatch(final Synchronization pV) {
364 return HasMultipleOutgoingTrainsition.Match.newMatch(pV);
365 }
366
367 /**
368 * Retrieve the set of values that occur in matches for v.
369 * @return the Set of all values or empty set if there are no matches
370 *
371 */
372 protected Stream<Synchronization> rawStreamAllValuesOfv(final Object[] parameters) {
373 return rawStreamAllValues(POSITION_V, parameters).map(Synchronization.class::cast);
374 }
375
376 /**
377 * Retrieve the set of values that occur in matches for v.
378 * @return the Set of all values or empty set if there are no matches
379 *
380 */
381 public Set<Synchronization> getAllValuesOfv() {
382 return rawStreamAllValuesOfv(emptyArray()).collect(Collectors.toSet());
383 }
384
385 /**
386 * Retrieve the set of values that occur in matches for v.
387 * @return the Set of all values or empty set if there are no matches
388 *
389 */
390 public Stream<Synchronization> streamAllValuesOfv() {
391 return rawStreamAllValuesOfv(emptyArray());
392 }
393
394 @Override
395 protected HasMultipleOutgoingTrainsition.Match tupleToMatch(final Tuple t) {
396 try {
397 return HasMultipleOutgoingTrainsition.Match.newMatch((Synchronization) t.get(POSITION_V));
398 } catch(ClassCastException e) {
399 LOGGER.error("Element(s) in tuple not properly typed!",e);
400 return null;
401 }
402 }
403
404 @Override
405 protected HasMultipleOutgoingTrainsition.Match arrayToMatch(final Object[] match) {
406 try {
407 return HasMultipleOutgoingTrainsition.Match.newMatch((Synchronization) match[POSITION_V]);
408 } catch(ClassCastException e) {
409 LOGGER.error("Element(s) in array not properly typed!",e);
410 return null;
411 }
412 }
413
414 @Override
415 protected HasMultipleOutgoingTrainsition.Match arrayToMatchMutable(final Object[] match) {
416 try {
417 return HasMultipleOutgoingTrainsition.Match.newMutableMatch((Synchronization) match[POSITION_V]);
418 } catch(ClassCastException e) {
419 LOGGER.error("Element(s) in array not properly typed!",e);
420 return null;
421 }
422 }
423
424 /**
425 * @return the singleton instance of the query specification of this pattern
426 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
427 *
428 */
429 public static IQuerySpecification<HasMultipleOutgoingTrainsition.Matcher> querySpecification() {
430 return HasMultipleOutgoingTrainsition.instance();
431 }
432 }
433
434 private HasMultipleOutgoingTrainsition() {
435 super(GeneratedPQuery.INSTANCE);
436 }
437
438 /**
439 * @return the singleton instance of the query specification
440 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
441 *
442 */
443 public static HasMultipleOutgoingTrainsition instance() {
444 try{
445 return LazyHolder.INSTANCE;
446 } catch (ExceptionInInitializerError err) {
447 throw processInitializerError(err);
448 }
449 }
450
451 @Override
452 protected HasMultipleOutgoingTrainsition.Matcher instantiate(final ViatraQueryEngine engine) {
453 return HasMultipleOutgoingTrainsition.Matcher.on(engine);
454 }
455
456 @Override
457 public HasMultipleOutgoingTrainsition.Matcher instantiate() {
458 return HasMultipleOutgoingTrainsition.Matcher.create();
459 }
460
461 @Override
462 public HasMultipleOutgoingTrainsition.Match newEmptyMatch() {
463 return HasMultipleOutgoingTrainsition.Match.newEmptyMatch();
464 }
465
466 @Override
467 public HasMultipleOutgoingTrainsition.Match newMatch(final Object... parameters) {
468 return HasMultipleOutgoingTrainsition.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization) parameters[0]);
469 }
470
471 /**
472 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleOutgoingTrainsition (visibility: PUBLIC, simpleName: HasMultipleOutgoingTrainsition, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleOutgoingTrainsition, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
473 * <b>not</b> at the class load time of the outer class,
474 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleOutgoingTrainsition (visibility: PUBLIC, simpleName: HasMultipleOutgoingTrainsition, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleOutgoingTrainsition, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
475 *
476 * <p> This workaround is required e.g. to support recursion.
477 *
478 */
479 private static class LazyHolder {
480 private final static HasMultipleOutgoingTrainsition INSTANCE = new HasMultipleOutgoingTrainsition();
481
482 /**
483 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
484 * This initialization order is required to support indirect recursion.
485 *
486 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
487 *
488 */
489 private final static Object STATIC_INITIALIZER = ensureInitialized();
490
491 public static Object ensureInitialized() {
492 INSTANCE.ensureInitializedInternal();
493 return null;
494 }
495 }
496
497 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
498 private final static HasMultipleOutgoingTrainsition.GeneratedPQuery INSTANCE = new GeneratedPQuery();
499
500 private final PParameter parameter_v = new PParameter("v", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Synchronization")), PParameterDirection.INOUT);
501
502 private final List<PParameter> parameters = Arrays.asList(parameter_v);
503
504 private GeneratedPQuery() {
505 super(PVisibility.PUBLIC);
506 }
507
508 @Override
509 public String getFullyQualifiedName() {
510 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleOutgoingTrainsition";
511 }
512
513 @Override
514 public List<String> getParameterNames() {
515 return Arrays.asList("v");
516 }
517
518 @Override
519 public List<PParameter> getParameters() {
520 return parameters;
521 }
522
523 @Override
524 public Set<PBody> doGetContainedBodies() {
525 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
526 Set<PBody> bodies = new LinkedHashSet<>();
527 {
528 PBody body = new PBody(this);
529 PVariable var_v = body.getOrCreateVariableByName("v");
530 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
531 PVariable var_trg1 = body.getOrCreateVariableByName("trg1");
532 PVariable var___1_ = body.getOrCreateVariableByName("_<1>");
533 PVariable var_trg2 = body.getOrCreateVariableByName("trg2");
534 new TypeConstraint(body, Tuples.flatTupleOf(var_v), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
535 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
536 new ExportedParameter(body, var_v, parameter_v)
537 ));
538 // find transition(_, v, trg1)
539 new PositivePatternCall(body, Tuples.flatTupleOf(var___0_, var_v, var_trg1), Transition.instance().getInternalQueryRepresentation());
540 // find transition(_, v, trg2)
541 new PositivePatternCall(body, Tuples.flatTupleOf(var___1_, var_v, var_trg2), Transition.instance().getInternalQueryRepresentation());
542 // trg1 != trg2
543 new Inequality(body, var_trg1, var_trg2);
544 bodies.add(body);
545 }
546 return bodies;
547 }
548 }
549}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/HasMultipleRegions.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/HasMultipleRegions.java
deleted file mode 100644
index 5542ccbb..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/HasMultipleRegions.java
+++ /dev/null
@@ -1,555 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.CompositeElement;
7import java.util.Arrays;
8import java.util.Collection;
9import java.util.LinkedHashSet;
10import java.util.List;
11import java.util.Objects;
12import java.util.Optional;
13import java.util.Set;
14import java.util.function.Consumer;
15import java.util.stream.Collectors;
16import java.util.stream.Stream;
17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.viatra.query.runtime.api.IPatternMatch;
20import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
27import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
38import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
40import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
41
42/**
43 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
44 *
45 * <p>Original source:
46 * <code><pre>
47 * pattern hasMultipleRegions(composite: CompositeElement) {
48 * CompositeElement.regions(composite,region1);
49 * CompositeElement.regions(composite,region2);
50 * region1 != region2;
51 * }
52 * </pre></code>
53 *
54 * @see Matcher
55 * @see Match
56 *
57 */
58@SuppressWarnings("all")
59public final class HasMultipleRegions extends BaseGeneratedEMFQuerySpecification<HasMultipleRegions.Matcher> {
60 /**
61 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleRegions pattern,
62 * to be used in conjunction with {@link Matcher}.
63 *
64 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
65 * Each instance is a (possibly partial) substitution of pattern parameters,
66 * usable to represent a match of the pattern in the result of a query,
67 * or to specify the bound (fixed) input parameters when issuing a query.
68 *
69 * @see Matcher
70 *
71 */
72 public static abstract class Match extends BasePatternMatch {
73 private CompositeElement fComposite;
74
75 private static List<String> parameterNames = makeImmutableList("composite");
76
77 private Match(final CompositeElement pComposite) {
78 this.fComposite = pComposite;
79 }
80
81 @Override
82 public Object get(final String parameterName) {
83 if ("composite".equals(parameterName)) return this.fComposite;
84 return null;
85 }
86
87 public CompositeElement getComposite() {
88 return this.fComposite;
89 }
90
91 @Override
92 public boolean set(final String parameterName, final Object newValue) {
93 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
94 if ("composite".equals(parameterName) ) {
95 this.fComposite = (CompositeElement) newValue;
96 return true;
97 }
98 return false;
99 }
100
101 public void setComposite(final CompositeElement pComposite) {
102 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
103 this.fComposite = pComposite;
104 }
105
106 @Override
107 public String patternName() {
108 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleRegions";
109 }
110
111 @Override
112 public List<String> parameterNames() {
113 return HasMultipleRegions.Match.parameterNames;
114 }
115
116 @Override
117 public Object[] toArray() {
118 return new Object[]{fComposite};
119 }
120
121 @Override
122 public HasMultipleRegions.Match toImmutable() {
123 return isMutable() ? newMatch(fComposite) : this;
124 }
125
126 @Override
127 public String prettyPrint() {
128 StringBuilder result = new StringBuilder();
129 result.append("\"composite\"=" + prettyPrintValue(fComposite));
130 return result.toString();
131 }
132
133 @Override
134 public int hashCode() {
135 return Objects.hash(fComposite);
136 }
137
138 @Override
139 public boolean equals(final Object obj) {
140 if (this == obj)
141 return true;
142 if (obj == null) {
143 return false;
144 }
145 if ((obj instanceof HasMultipleRegions.Match)) {
146 HasMultipleRegions.Match other = (HasMultipleRegions.Match) obj;
147 return Objects.equals(fComposite, other.fComposite);
148 } else {
149 // this should be infrequent
150 if (!(obj instanceof IPatternMatch)) {
151 return false;
152 }
153 IPatternMatch otherSig = (IPatternMatch) obj;
154 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
155 }
156 }
157
158 @Override
159 public HasMultipleRegions specification() {
160 return HasMultipleRegions.instance();
161 }
162
163 /**
164 * Returns an empty, mutable match.
165 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
166 *
167 * @return the empty match.
168 *
169 */
170 public static HasMultipleRegions.Match newEmptyMatch() {
171 return new Mutable(null);
172 }
173
174 /**
175 * Returns a mutable (partial) match.
176 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
177 *
178 * @param pComposite the fixed value of pattern parameter composite, or null if not bound.
179 * @return the new, mutable (partial) match object.
180 *
181 */
182 public static HasMultipleRegions.Match newMutableMatch(final CompositeElement pComposite) {
183 return new Mutable(pComposite);
184 }
185
186 /**
187 * Returns a new (partial) match.
188 * This can be used e.g. to call the matcher with a partial match.
189 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
190 * @param pComposite the fixed value of pattern parameter composite, or null if not bound.
191 * @return the (partial) match object.
192 *
193 */
194 public static HasMultipleRegions.Match newMatch(final CompositeElement pComposite) {
195 return new Immutable(pComposite);
196 }
197
198 private static final class Mutable extends HasMultipleRegions.Match {
199 Mutable(final CompositeElement pComposite) {
200 super(pComposite);
201 }
202
203 @Override
204 public boolean isMutable() {
205 return true;
206 }
207 }
208
209 private static final class Immutable extends HasMultipleRegions.Match {
210 Immutable(final CompositeElement pComposite) {
211 super(pComposite);
212 }
213
214 @Override
215 public boolean isMutable() {
216 return false;
217 }
218 }
219 }
220
221 /**
222 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleRegions pattern,
223 * providing pattern-specific query methods.
224 *
225 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
226 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
227 *
228 * <p>Matches of the pattern will be represented as {@link Match}.
229 *
230 * <p>Original source:
231 * <code><pre>
232 * pattern hasMultipleRegions(composite: CompositeElement) {
233 * CompositeElement.regions(composite,region1);
234 * CompositeElement.regions(composite,region2);
235 * region1 != region2;
236 * }
237 * </pre></code>
238 *
239 * @see Match
240 * @see HasMultipleRegions
241 *
242 */
243 public static class Matcher extends BaseMatcher<HasMultipleRegions.Match> {
244 /**
245 * Initializes the pattern matcher within an existing VIATRA Query engine.
246 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
247 *
248 * @param engine the existing VIATRA Query engine in which this matcher will be created.
249 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
250 *
251 */
252 public static HasMultipleRegions.Matcher on(final ViatraQueryEngine engine) {
253 // check if matcher already exists
254 Matcher matcher = engine.getExistingMatcher(querySpecification());
255 if (matcher == null) {
256 matcher = (Matcher)engine.getMatcher(querySpecification());
257 }
258 return matcher;
259 }
260
261 /**
262 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
263 * @return an initialized matcher
264 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
265 *
266 */
267 public static HasMultipleRegions.Matcher create() {
268 return new Matcher();
269 }
270
271 private final static int POSITION_COMPOSITE = 0;
272
273 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(HasMultipleRegions.Matcher.class);
274
275 /**
276 * Initializes the pattern matcher within an existing VIATRA Query engine.
277 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
278 *
279 * @param engine the existing VIATRA Query engine in which this matcher will be created.
280 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
281 *
282 */
283 private Matcher() {
284 super(querySpecification());
285 }
286
287 /**
288 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
289 * @param pComposite the fixed value of pattern parameter composite, or null if not bound.
290 * @return matches represented as a Match object.
291 *
292 */
293 public Collection<HasMultipleRegions.Match> getAllMatches(final CompositeElement pComposite) {
294 return rawStreamAllMatches(new Object[]{pComposite}).collect(Collectors.toSet());
295 }
296
297 /**
298 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
299 * </p>
300 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
301 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
302 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
303 * @param pComposite the fixed value of pattern parameter composite, or null if not bound.
304 * @return a stream of matches represented as a Match object.
305 *
306 */
307 public Stream<HasMultipleRegions.Match> streamAllMatches(final CompositeElement pComposite) {
308 return rawStreamAllMatches(new Object[]{pComposite});
309 }
310
311 /**
312 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
313 * Neither determinism nor randomness of selection is guaranteed.
314 * @param pComposite the fixed value of pattern parameter composite, or null if not bound.
315 * @return a match represented as a Match object, or null if no match is found.
316 *
317 */
318 public Optional<HasMultipleRegions.Match> getOneArbitraryMatch(final CompositeElement pComposite) {
319 return rawGetOneArbitraryMatch(new Object[]{pComposite});
320 }
321
322 /**
323 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
324 * under any possible substitution of the unspecified parameters (if any).
325 * @param pComposite the fixed value of pattern parameter composite, or null if not bound.
326 * @return true if the input is a valid (partial) match of the pattern.
327 *
328 */
329 public boolean hasMatch(final CompositeElement pComposite) {
330 return rawHasMatch(new Object[]{pComposite});
331 }
332
333 /**
334 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
335 * @param pComposite the fixed value of pattern parameter composite, or null if not bound.
336 * @return the number of pattern matches found.
337 *
338 */
339 public int countMatches(final CompositeElement pComposite) {
340 return rawCountMatches(new Object[]{pComposite});
341 }
342
343 /**
344 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
345 * Neither determinism nor randomness of selection is guaranteed.
346 * @param pComposite the fixed value of pattern parameter composite, or null if not bound.
347 * @param processor the action that will process the selected match.
348 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
349 *
350 */
351 public boolean forOneArbitraryMatch(final CompositeElement pComposite, final Consumer<? super HasMultipleRegions.Match> processor) {
352 return rawForOneArbitraryMatch(new Object[]{pComposite}, processor);
353 }
354
355 /**
356 * Returns a new (partial) match.
357 * This can be used e.g. to call the matcher with a partial match.
358 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
359 * @param pComposite the fixed value of pattern parameter composite, or null if not bound.
360 * @return the (partial) match object.
361 *
362 */
363 public HasMultipleRegions.Match newMatch(final CompositeElement pComposite) {
364 return HasMultipleRegions.Match.newMatch(pComposite);
365 }
366
367 /**
368 * Retrieve the set of values that occur in matches for composite.
369 * @return the Set of all values or empty set if there are no matches
370 *
371 */
372 protected Stream<CompositeElement> rawStreamAllValuesOfcomposite(final Object[] parameters) {
373 return rawStreamAllValues(POSITION_COMPOSITE, parameters).map(CompositeElement.class::cast);
374 }
375
376 /**
377 * Retrieve the set of values that occur in matches for composite.
378 * @return the Set of all values or empty set if there are no matches
379 *
380 */
381 public Set<CompositeElement> getAllValuesOfcomposite() {
382 return rawStreamAllValuesOfcomposite(emptyArray()).collect(Collectors.toSet());
383 }
384
385 /**
386 * Retrieve the set of values that occur in matches for composite.
387 * @return the Set of all values or empty set if there are no matches
388 *
389 */
390 public Stream<CompositeElement> streamAllValuesOfcomposite() {
391 return rawStreamAllValuesOfcomposite(emptyArray());
392 }
393
394 @Override
395 protected HasMultipleRegions.Match tupleToMatch(final Tuple t) {
396 try {
397 return HasMultipleRegions.Match.newMatch((CompositeElement) t.get(POSITION_COMPOSITE));
398 } catch(ClassCastException e) {
399 LOGGER.error("Element(s) in tuple not properly typed!",e);
400 return null;
401 }
402 }
403
404 @Override
405 protected HasMultipleRegions.Match arrayToMatch(final Object[] match) {
406 try {
407 return HasMultipleRegions.Match.newMatch((CompositeElement) match[POSITION_COMPOSITE]);
408 } catch(ClassCastException e) {
409 LOGGER.error("Element(s) in array not properly typed!",e);
410 return null;
411 }
412 }
413
414 @Override
415 protected HasMultipleRegions.Match arrayToMatchMutable(final Object[] match) {
416 try {
417 return HasMultipleRegions.Match.newMutableMatch((CompositeElement) match[POSITION_COMPOSITE]);
418 } catch(ClassCastException e) {
419 LOGGER.error("Element(s) in array not properly typed!",e);
420 return null;
421 }
422 }
423
424 /**
425 * @return the singleton instance of the query specification of this pattern
426 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
427 *
428 */
429 public static IQuerySpecification<HasMultipleRegions.Matcher> querySpecification() {
430 return HasMultipleRegions.instance();
431 }
432 }
433
434 private HasMultipleRegions() {
435 super(GeneratedPQuery.INSTANCE);
436 }
437
438 /**
439 * @return the singleton instance of the query specification
440 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
441 *
442 */
443 public static HasMultipleRegions instance() {
444 try{
445 return LazyHolder.INSTANCE;
446 } catch (ExceptionInInitializerError err) {
447 throw processInitializerError(err);
448 }
449 }
450
451 @Override
452 protected HasMultipleRegions.Matcher instantiate(final ViatraQueryEngine engine) {
453 return HasMultipleRegions.Matcher.on(engine);
454 }
455
456 @Override
457 public HasMultipleRegions.Matcher instantiate() {
458 return HasMultipleRegions.Matcher.create();
459 }
460
461 @Override
462 public HasMultipleRegions.Match newEmptyMatch() {
463 return HasMultipleRegions.Match.newEmptyMatch();
464 }
465
466 @Override
467 public HasMultipleRegions.Match newMatch(final Object... parameters) {
468 return HasMultipleRegions.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.CompositeElement) parameters[0]);
469 }
470
471 /**
472 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleRegions (visibility: PUBLIC, simpleName: HasMultipleRegions, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleRegions, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
473 * <b>not</b> at the class load time of the outer class,
474 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleRegions (visibility: PUBLIC, simpleName: HasMultipleRegions, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleRegions, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
475 *
476 * <p> This workaround is required e.g. to support recursion.
477 *
478 */
479 private static class LazyHolder {
480 private final static HasMultipleRegions INSTANCE = new HasMultipleRegions();
481
482 /**
483 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
484 * This initialization order is required to support indirect recursion.
485 *
486 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
487 *
488 */
489 private final static Object STATIC_INITIALIZER = ensureInitialized();
490
491 public static Object ensureInitialized() {
492 INSTANCE.ensureInitializedInternal();
493 return null;
494 }
495 }
496
497 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
498 private final static HasMultipleRegions.GeneratedPQuery INSTANCE = new GeneratedPQuery();
499
500 private final PParameter parameter_composite = new PParameter("composite", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.CompositeElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "CompositeElement")), PParameterDirection.INOUT);
501
502 private final List<PParameter> parameters = Arrays.asList(parameter_composite);
503
504 private GeneratedPQuery() {
505 super(PVisibility.PUBLIC);
506 }
507
508 @Override
509 public String getFullyQualifiedName() {
510 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.hasMultipleRegions";
511 }
512
513 @Override
514 public List<String> getParameterNames() {
515 return Arrays.asList("composite");
516 }
517
518 @Override
519 public List<PParameter> getParameters() {
520 return parameters;
521 }
522
523 @Override
524 public Set<PBody> doGetContainedBodies() {
525 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
526 Set<PBody> bodies = new LinkedHashSet<>();
527 {
528 PBody body = new PBody(this);
529 PVariable var_composite = body.getOrCreateVariableByName("composite");
530 PVariable var_region1 = body.getOrCreateVariableByName("region1");
531 PVariable var_region2 = body.getOrCreateVariableByName("region2");
532 new TypeConstraint(body, Tuples.flatTupleOf(var_composite), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "CompositeElement")));
533 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
534 new ExportedParameter(body, var_composite, parameter_composite)
535 ));
536 // CompositeElement.regions(composite,region1)
537 new TypeConstraint(body, Tuples.flatTupleOf(var_composite), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "CompositeElement")));
538 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
539 new TypeConstraint(body, Tuples.flatTupleOf(var_composite, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "CompositeElement", "regions")));
540 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
541 new Equality(body, var__virtual_0_, var_region1);
542 // CompositeElement.regions(composite,region2)
543 new TypeConstraint(body, Tuples.flatTupleOf(var_composite), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "CompositeElement")));
544 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
545 new TypeConstraint(body, Tuples.flatTupleOf(var_composite, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "CompositeElement", "regions")));
546 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
547 new Equality(body, var__virtual_1_, var_region2);
548 // region1 != region2
549 new Inequality(body, var_region1, var_region2);
550 bodies.add(body);
551 }
552 return bodies;
553 }
554 }
555}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/IncomingToEntry.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/IncomingToEntry.java
deleted file mode 100644
index ed8ca3e5..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/IncomingToEntry.java
+++ /dev/null
@@ -1,703 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Entry;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
42
43/**
44 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
45 *
46 * <p>Original source:
47 * <code><pre>
48 * {@literal @}Constraint(severity="error", message="error", key = {e})
49 * pattern incomingToEntry(t : Transition, e : Entry) {
50 * find transition(t, _, e);
51 * }
52 * </pre></code>
53 *
54 * @see Matcher
55 * @see Match
56 *
57 */
58@SuppressWarnings("all")
59public final class IncomingToEntry extends BaseGeneratedEMFQuerySpecification<IncomingToEntry.Matcher> {
60 /**
61 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.incomingToEntry pattern,
62 * to be used in conjunction with {@link Matcher}.
63 *
64 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
65 * Each instance is a (possibly partial) substitution of pattern parameters,
66 * usable to represent a match of the pattern in the result of a query,
67 * or to specify the bound (fixed) input parameters when issuing a query.
68 *
69 * @see Matcher
70 *
71 */
72 public static abstract class Match extends BasePatternMatch {
73 private Transition fT;
74
75 private Entry fE;
76
77 private static List<String> parameterNames = makeImmutableList("t", "e");
78
79 private Match(final Transition pT, final Entry pE) {
80 this.fT = pT;
81 this.fE = pE;
82 }
83
84 @Override
85 public Object get(final String parameterName) {
86 if ("t".equals(parameterName)) return this.fT;
87 if ("e".equals(parameterName)) return this.fE;
88 return null;
89 }
90
91 public Transition getT() {
92 return this.fT;
93 }
94
95 public Entry getE() {
96 return this.fE;
97 }
98
99 @Override
100 public boolean set(final String parameterName, final Object newValue) {
101 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
102 if ("t".equals(parameterName) ) {
103 this.fT = (Transition) newValue;
104 return true;
105 }
106 if ("e".equals(parameterName) ) {
107 this.fE = (Entry) newValue;
108 return true;
109 }
110 return false;
111 }
112
113 public void setT(final Transition pT) {
114 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
115 this.fT = pT;
116 }
117
118 public void setE(final Entry pE) {
119 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
120 this.fE = pE;
121 }
122
123 @Override
124 public String patternName() {
125 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.incomingToEntry";
126 }
127
128 @Override
129 public List<String> parameterNames() {
130 return IncomingToEntry.Match.parameterNames;
131 }
132
133 @Override
134 public Object[] toArray() {
135 return new Object[]{fT, fE};
136 }
137
138 @Override
139 public IncomingToEntry.Match toImmutable() {
140 return isMutable() ? newMatch(fT, fE) : this;
141 }
142
143 @Override
144 public String prettyPrint() {
145 StringBuilder result = new StringBuilder();
146 result.append("\"t\"=" + prettyPrintValue(fT) + ", ");
147 result.append("\"e\"=" + prettyPrintValue(fE));
148 return result.toString();
149 }
150
151 @Override
152 public int hashCode() {
153 return Objects.hash(fT, fE);
154 }
155
156 @Override
157 public boolean equals(final Object obj) {
158 if (this == obj)
159 return true;
160 if (obj == null) {
161 return false;
162 }
163 if ((obj instanceof IncomingToEntry.Match)) {
164 IncomingToEntry.Match other = (IncomingToEntry.Match) obj;
165 return Objects.equals(fT, other.fT) && Objects.equals(fE, other.fE);
166 } else {
167 // this should be infrequent
168 if (!(obj instanceof IPatternMatch)) {
169 return false;
170 }
171 IPatternMatch otherSig = (IPatternMatch) obj;
172 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
173 }
174 }
175
176 @Override
177 public IncomingToEntry specification() {
178 return IncomingToEntry.instance();
179 }
180
181 /**
182 * Returns an empty, mutable match.
183 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
184 *
185 * @return the empty match.
186 *
187 */
188 public static IncomingToEntry.Match newEmptyMatch() {
189 return new Mutable(null, null);
190 }
191
192 /**
193 * Returns a mutable (partial) match.
194 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
195 *
196 * @param pT the fixed value of pattern parameter t, or null if not bound.
197 * @param pE the fixed value of pattern parameter e, or null if not bound.
198 * @return the new, mutable (partial) match object.
199 *
200 */
201 public static IncomingToEntry.Match newMutableMatch(final Transition pT, final Entry pE) {
202 return new Mutable(pT, pE);
203 }
204
205 /**
206 * Returns a new (partial) match.
207 * This can be used e.g. to call the matcher with a partial match.
208 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
209 * @param pT the fixed value of pattern parameter t, or null if not bound.
210 * @param pE the fixed value of pattern parameter e, or null if not bound.
211 * @return the (partial) match object.
212 *
213 */
214 public static IncomingToEntry.Match newMatch(final Transition pT, final Entry pE) {
215 return new Immutable(pT, pE);
216 }
217
218 private static final class Mutable extends IncomingToEntry.Match {
219 Mutable(final Transition pT, final Entry pE) {
220 super(pT, pE);
221 }
222
223 @Override
224 public boolean isMutable() {
225 return true;
226 }
227 }
228
229 private static final class Immutable extends IncomingToEntry.Match {
230 Immutable(final Transition pT, final Entry pE) {
231 super(pT, pE);
232 }
233
234 @Override
235 public boolean isMutable() {
236 return false;
237 }
238 }
239 }
240
241 /**
242 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.incomingToEntry pattern,
243 * providing pattern-specific query methods.
244 *
245 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
246 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
247 *
248 * <p>Matches of the pattern will be represented as {@link Match}.
249 *
250 * <p>Original source:
251 * <code><pre>
252 * {@literal @}Constraint(severity="error", message="error", key = {e})
253 * pattern incomingToEntry(t : Transition, e : Entry) {
254 * find transition(t, _, e);
255 * }
256 * </pre></code>
257 *
258 * @see Match
259 * @see IncomingToEntry
260 *
261 */
262 public static class Matcher extends BaseMatcher<IncomingToEntry.Match> {
263 /**
264 * Initializes the pattern matcher within an existing VIATRA Query engine.
265 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
266 *
267 * @param engine the existing VIATRA Query engine in which this matcher will be created.
268 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
269 *
270 */
271 public static IncomingToEntry.Matcher on(final ViatraQueryEngine engine) {
272 // check if matcher already exists
273 Matcher matcher = engine.getExistingMatcher(querySpecification());
274 if (matcher == null) {
275 matcher = (Matcher)engine.getMatcher(querySpecification());
276 }
277 return matcher;
278 }
279
280 /**
281 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
282 * @return an initialized matcher
283 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
284 *
285 */
286 public static IncomingToEntry.Matcher create() {
287 return new Matcher();
288 }
289
290 private final static int POSITION_T = 0;
291
292 private final static int POSITION_E = 1;
293
294 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(IncomingToEntry.Matcher.class);
295
296 /**
297 * Initializes the pattern matcher within an existing VIATRA Query engine.
298 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
299 *
300 * @param engine the existing VIATRA Query engine in which this matcher will be created.
301 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
302 *
303 */
304 private Matcher() {
305 super(querySpecification());
306 }
307
308 /**
309 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
310 * @param pT the fixed value of pattern parameter t, or null if not bound.
311 * @param pE the fixed value of pattern parameter e, or null if not bound.
312 * @return matches represented as a Match object.
313 *
314 */
315 public Collection<IncomingToEntry.Match> getAllMatches(final Transition pT, final Entry pE) {
316 return rawStreamAllMatches(new Object[]{pT, pE}).collect(Collectors.toSet());
317 }
318
319 /**
320 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
321 * </p>
322 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
323 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
324 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
325 * @param pT the fixed value of pattern parameter t, or null if not bound.
326 * @param pE the fixed value of pattern parameter e, or null if not bound.
327 * @return a stream of matches represented as a Match object.
328 *
329 */
330 public Stream<IncomingToEntry.Match> streamAllMatches(final Transition pT, final Entry pE) {
331 return rawStreamAllMatches(new Object[]{pT, pE});
332 }
333
334 /**
335 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
336 * Neither determinism nor randomness of selection is guaranteed.
337 * @param pT the fixed value of pattern parameter t, or null if not bound.
338 * @param pE the fixed value of pattern parameter e, or null if not bound.
339 * @return a match represented as a Match object, or null if no match is found.
340 *
341 */
342 public Optional<IncomingToEntry.Match> getOneArbitraryMatch(final Transition pT, final Entry pE) {
343 return rawGetOneArbitraryMatch(new Object[]{pT, pE});
344 }
345
346 /**
347 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
348 * under any possible substitution of the unspecified parameters (if any).
349 * @param pT the fixed value of pattern parameter t, or null if not bound.
350 * @param pE the fixed value of pattern parameter e, or null if not bound.
351 * @return true if the input is a valid (partial) match of the pattern.
352 *
353 */
354 public boolean hasMatch(final Transition pT, final Entry pE) {
355 return rawHasMatch(new Object[]{pT, pE});
356 }
357
358 /**
359 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
360 * @param pT the fixed value of pattern parameter t, or null if not bound.
361 * @param pE the fixed value of pattern parameter e, or null if not bound.
362 * @return the number of pattern matches found.
363 *
364 */
365 public int countMatches(final Transition pT, final Entry pE) {
366 return rawCountMatches(new Object[]{pT, pE});
367 }
368
369 /**
370 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
371 * Neither determinism nor randomness of selection is guaranteed.
372 * @param pT the fixed value of pattern parameter t, or null if not bound.
373 * @param pE the fixed value of pattern parameter e, or null if not bound.
374 * @param processor the action that will process the selected match.
375 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
376 *
377 */
378 public boolean forOneArbitraryMatch(final Transition pT, final Entry pE, final Consumer<? super IncomingToEntry.Match> processor) {
379 return rawForOneArbitraryMatch(new Object[]{pT, pE}, processor);
380 }
381
382 /**
383 * Returns a new (partial) match.
384 * This can be used e.g. to call the matcher with a partial match.
385 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
386 * @param pT the fixed value of pattern parameter t, or null if not bound.
387 * @param pE the fixed value of pattern parameter e, or null if not bound.
388 * @return the (partial) match object.
389 *
390 */
391 public IncomingToEntry.Match newMatch(final Transition pT, final Entry pE) {
392 return IncomingToEntry.Match.newMatch(pT, pE);
393 }
394
395 /**
396 * Retrieve the set of values that occur in matches for t.
397 * @return the Set of all values or empty set if there are no matches
398 *
399 */
400 protected Stream<Transition> rawStreamAllValuesOft(final Object[] parameters) {
401 return rawStreamAllValues(POSITION_T, parameters).map(Transition.class::cast);
402 }
403
404 /**
405 * Retrieve the set of values that occur in matches for t.
406 * @return the Set of all values or empty set if there are no matches
407 *
408 */
409 public Set<Transition> getAllValuesOft() {
410 return rawStreamAllValuesOft(emptyArray()).collect(Collectors.toSet());
411 }
412
413 /**
414 * Retrieve the set of values that occur in matches for t.
415 * @return the Set of all values or empty set if there are no matches
416 *
417 */
418 public Stream<Transition> streamAllValuesOft() {
419 return rawStreamAllValuesOft(emptyArray());
420 }
421
422 /**
423 * Retrieve the set of values that occur in matches for t.
424 * </p>
425 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
426 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
427 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
428 *
429 * @return the Stream of all values or empty set if there are no matches
430 *
431 */
432 public Stream<Transition> streamAllValuesOft(final IncomingToEntry.Match partialMatch) {
433 return rawStreamAllValuesOft(partialMatch.toArray());
434 }
435
436 /**
437 * Retrieve the set of values that occur in matches for t.
438 * </p>
439 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
440 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
441 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
442 *
443 * @return the Stream of all values or empty set if there are no matches
444 *
445 */
446 public Stream<Transition> streamAllValuesOft(final Entry pE) {
447 return rawStreamAllValuesOft(new Object[]{null, pE});
448 }
449
450 /**
451 * Retrieve the set of values that occur in matches for t.
452 * @return the Set of all values or empty set if there are no matches
453 *
454 */
455 public Set<Transition> getAllValuesOft(final IncomingToEntry.Match partialMatch) {
456 return rawStreamAllValuesOft(partialMatch.toArray()).collect(Collectors.toSet());
457 }
458
459 /**
460 * Retrieve the set of values that occur in matches for t.
461 * @return the Set of all values or empty set if there are no matches
462 *
463 */
464 public Set<Transition> getAllValuesOft(final Entry pE) {
465 return rawStreamAllValuesOft(new Object[]{null, pE}).collect(Collectors.toSet());
466 }
467
468 /**
469 * Retrieve the set of values that occur in matches for e.
470 * @return the Set of all values or empty set if there are no matches
471 *
472 */
473 protected Stream<Entry> rawStreamAllValuesOfe(final Object[] parameters) {
474 return rawStreamAllValues(POSITION_E, parameters).map(Entry.class::cast);
475 }
476
477 /**
478 * Retrieve the set of values that occur in matches for e.
479 * @return the Set of all values or empty set if there are no matches
480 *
481 */
482 public Set<Entry> getAllValuesOfe() {
483 return rawStreamAllValuesOfe(emptyArray()).collect(Collectors.toSet());
484 }
485
486 /**
487 * Retrieve the set of values that occur in matches for e.
488 * @return the Set of all values or empty set if there are no matches
489 *
490 */
491 public Stream<Entry> streamAllValuesOfe() {
492 return rawStreamAllValuesOfe(emptyArray());
493 }
494
495 /**
496 * Retrieve the set of values that occur in matches for e.
497 * </p>
498 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
499 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
500 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
501 *
502 * @return the Stream of all values or empty set if there are no matches
503 *
504 */
505 public Stream<Entry> streamAllValuesOfe(final IncomingToEntry.Match partialMatch) {
506 return rawStreamAllValuesOfe(partialMatch.toArray());
507 }
508
509 /**
510 * Retrieve the set of values that occur in matches for e.
511 * </p>
512 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
513 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
514 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
515 *
516 * @return the Stream of all values or empty set if there are no matches
517 *
518 */
519 public Stream<Entry> streamAllValuesOfe(final Transition pT) {
520 return rawStreamAllValuesOfe(new Object[]{pT, null});
521 }
522
523 /**
524 * Retrieve the set of values that occur in matches for e.
525 * @return the Set of all values or empty set if there are no matches
526 *
527 */
528 public Set<Entry> getAllValuesOfe(final IncomingToEntry.Match partialMatch) {
529 return rawStreamAllValuesOfe(partialMatch.toArray()).collect(Collectors.toSet());
530 }
531
532 /**
533 * Retrieve the set of values that occur in matches for e.
534 * @return the Set of all values or empty set if there are no matches
535 *
536 */
537 public Set<Entry> getAllValuesOfe(final Transition pT) {
538 return rawStreamAllValuesOfe(new Object[]{pT, null}).collect(Collectors.toSet());
539 }
540
541 @Override
542 protected IncomingToEntry.Match tupleToMatch(final Tuple t) {
543 try {
544 return IncomingToEntry.Match.newMatch((Transition) t.get(POSITION_T), (Entry) t.get(POSITION_E));
545 } catch(ClassCastException e) {
546 LOGGER.error("Element(s) in tuple not properly typed!",e);
547 return null;
548 }
549 }
550
551 @Override
552 protected IncomingToEntry.Match arrayToMatch(final Object[] match) {
553 try {
554 return IncomingToEntry.Match.newMatch((Transition) match[POSITION_T], (Entry) match[POSITION_E]);
555 } catch(ClassCastException e) {
556 LOGGER.error("Element(s) in array not properly typed!",e);
557 return null;
558 }
559 }
560
561 @Override
562 protected IncomingToEntry.Match arrayToMatchMutable(final Object[] match) {
563 try {
564 return IncomingToEntry.Match.newMutableMatch((Transition) match[POSITION_T], (Entry) match[POSITION_E]);
565 } catch(ClassCastException e) {
566 LOGGER.error("Element(s) in array not properly typed!",e);
567 return null;
568 }
569 }
570
571 /**
572 * @return the singleton instance of the query specification of this pattern
573 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
574 *
575 */
576 public static IQuerySpecification<IncomingToEntry.Matcher> querySpecification() {
577 return IncomingToEntry.instance();
578 }
579 }
580
581 private IncomingToEntry() {
582 super(GeneratedPQuery.INSTANCE);
583 }
584
585 /**
586 * @return the singleton instance of the query specification
587 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
588 *
589 */
590 public static IncomingToEntry instance() {
591 try{
592 return LazyHolder.INSTANCE;
593 } catch (ExceptionInInitializerError err) {
594 throw processInitializerError(err);
595 }
596 }
597
598 @Override
599 protected IncomingToEntry.Matcher instantiate(final ViatraQueryEngine engine) {
600 return IncomingToEntry.Matcher.on(engine);
601 }
602
603 @Override
604 public IncomingToEntry.Matcher instantiate() {
605 return IncomingToEntry.Matcher.create();
606 }
607
608 @Override
609 public IncomingToEntry.Match newEmptyMatch() {
610 return IncomingToEntry.Match.newEmptyMatch();
611 }
612
613 @Override
614 public IncomingToEntry.Match newMatch(final Object... parameters) {
615 return IncomingToEntry.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition) parameters[0], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Entry) parameters[1]);
616 }
617
618 /**
619 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.IncomingToEntry (visibility: PUBLIC, simpleName: IncomingToEntry, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.IncomingToEntry, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
620 * <b>not</b> at the class load time of the outer class,
621 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.IncomingToEntry (visibility: PUBLIC, simpleName: IncomingToEntry, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.IncomingToEntry, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
622 *
623 * <p> This workaround is required e.g. to support recursion.
624 *
625 */
626 private static class LazyHolder {
627 private final static IncomingToEntry INSTANCE = new IncomingToEntry();
628
629 /**
630 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
631 * This initialization order is required to support indirect recursion.
632 *
633 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
634 *
635 */
636 private final static Object STATIC_INITIALIZER = ensureInitialized();
637
638 public static Object ensureInitialized() {
639 INSTANCE.ensureInitializedInternal();
640 return null;
641 }
642 }
643
644 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
645 private final static IncomingToEntry.GeneratedPQuery INSTANCE = new GeneratedPQuery();
646
647 private final PParameter parameter_t = new PParameter("t", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Transition")), PParameterDirection.INOUT);
648
649 private final PParameter parameter_e = new PParameter("e", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Entry", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Entry")), PParameterDirection.INOUT);
650
651 private final List<PParameter> parameters = Arrays.asList(parameter_t, parameter_e);
652
653 private GeneratedPQuery() {
654 super(PVisibility.PUBLIC);
655 }
656
657 @Override
658 public String getFullyQualifiedName() {
659 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.incomingToEntry";
660 }
661
662 @Override
663 public List<String> getParameterNames() {
664 return Arrays.asList("t","e");
665 }
666
667 @Override
668 public List<PParameter> getParameters() {
669 return parameters;
670 }
671
672 @Override
673 public Set<PBody> doGetContainedBodies() {
674 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
675 Set<PBody> bodies = new LinkedHashSet<>();
676 {
677 PBody body = new PBody(this);
678 PVariable var_t = body.getOrCreateVariableByName("t");
679 PVariable var_e = body.getOrCreateVariableByName("e");
680 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
681 new TypeConstraint(body, Tuples.flatTupleOf(var_t), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
682 new TypeConstraint(body, Tuples.flatTupleOf(var_e), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Entry")));
683 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
684 new ExportedParameter(body, var_t, parameter_t),
685 new ExportedParameter(body, var_e, parameter_e)
686 ));
687 // find transition(t, _, e)
688 new PositivePatternCall(body, Tuples.flatTupleOf(var_t, var___0_, var_e), ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition.instance().getInternalQueryRepresentation());
689 bodies.add(body);
690 }
691 {
692 PAnnotation annotation = new PAnnotation("Constraint");
693 annotation.addAttribute("severity", "error");
694 annotation.addAttribute("message", "error");
695 annotation.addAttribute("key", Arrays.asList(new Object[] {
696 new ParameterReference("e")
697 }));
698 addAnnotation(annotation);
699 }
700 return bodies;
701 }
702 }
703}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/MultipleTransitionFromEntry.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/MultipleTransitionFromEntry.java
deleted file mode 100644
index e4c1bac5..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/MultipleTransitionFromEntry.java
+++ /dev/null
@@ -1,827 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Entry;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
29import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
31import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
33import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
39import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
40import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
41import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
42import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
43import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
44
45/**
46 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
47 *
48 * <p>Original source:
49 * <code><pre>
50 * {@literal @}Constraint(severity="error", message="error", key = {e})
51 * pattern multipleTransitionFromEntry(e : Entry, t1 : Transition, t2: Transition) {
52 * Entry.outgoingTransitions(e,t1);
53 * Entry.outgoingTransitions(e,t2);
54 * t1!=t2;
55 * }
56 * </pre></code>
57 *
58 * @see Matcher
59 * @see Match
60 *
61 */
62@SuppressWarnings("all")
63public final class MultipleTransitionFromEntry extends BaseGeneratedEMFQuerySpecification<MultipleTransitionFromEntry.Matcher> {
64 /**
65 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleTransitionFromEntry pattern,
66 * to be used in conjunction with {@link Matcher}.
67 *
68 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
69 * Each instance is a (possibly partial) substitution of pattern parameters,
70 * usable to represent a match of the pattern in the result of a query,
71 * or to specify the bound (fixed) input parameters when issuing a query.
72 *
73 * @see Matcher
74 *
75 */
76 public static abstract class Match extends BasePatternMatch {
77 private Entry fE;
78
79 private Transition fT1;
80
81 private Transition fT2;
82
83 private static List<String> parameterNames = makeImmutableList("e", "t1", "t2");
84
85 private Match(final Entry pE, final Transition pT1, final Transition pT2) {
86 this.fE = pE;
87 this.fT1 = pT1;
88 this.fT2 = pT2;
89 }
90
91 @Override
92 public Object get(final String parameterName) {
93 if ("e".equals(parameterName)) return this.fE;
94 if ("t1".equals(parameterName)) return this.fT1;
95 if ("t2".equals(parameterName)) return this.fT2;
96 return null;
97 }
98
99 public Entry getE() {
100 return this.fE;
101 }
102
103 public Transition getT1() {
104 return this.fT1;
105 }
106
107 public Transition getT2() {
108 return this.fT2;
109 }
110
111 @Override
112 public boolean set(final String parameterName, final Object newValue) {
113 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
114 if ("e".equals(parameterName) ) {
115 this.fE = (Entry) newValue;
116 return true;
117 }
118 if ("t1".equals(parameterName) ) {
119 this.fT1 = (Transition) newValue;
120 return true;
121 }
122 if ("t2".equals(parameterName) ) {
123 this.fT2 = (Transition) newValue;
124 return true;
125 }
126 return false;
127 }
128
129 public void setE(final Entry pE) {
130 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
131 this.fE = pE;
132 }
133
134 public void setT1(final Transition pT1) {
135 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
136 this.fT1 = pT1;
137 }
138
139 public void setT2(final Transition pT2) {
140 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
141 this.fT2 = pT2;
142 }
143
144 @Override
145 public String patternName() {
146 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleTransitionFromEntry";
147 }
148
149 @Override
150 public List<String> parameterNames() {
151 return MultipleTransitionFromEntry.Match.parameterNames;
152 }
153
154 @Override
155 public Object[] toArray() {
156 return new Object[]{fE, fT1, fT2};
157 }
158
159 @Override
160 public MultipleTransitionFromEntry.Match toImmutable() {
161 return isMutable() ? newMatch(fE, fT1, fT2) : this;
162 }
163
164 @Override
165 public String prettyPrint() {
166 StringBuilder result = new StringBuilder();
167 result.append("\"e\"=" + prettyPrintValue(fE) + ", ");
168 result.append("\"t1\"=" + prettyPrintValue(fT1) + ", ");
169 result.append("\"t2\"=" + prettyPrintValue(fT2));
170 return result.toString();
171 }
172
173 @Override
174 public int hashCode() {
175 return Objects.hash(fE, fT1, fT2);
176 }
177
178 @Override
179 public boolean equals(final Object obj) {
180 if (this == obj)
181 return true;
182 if (obj == null) {
183 return false;
184 }
185 if ((obj instanceof MultipleTransitionFromEntry.Match)) {
186 MultipleTransitionFromEntry.Match other = (MultipleTransitionFromEntry.Match) obj;
187 return Objects.equals(fE, other.fE) && Objects.equals(fT1, other.fT1) && Objects.equals(fT2, other.fT2);
188 } else {
189 // this should be infrequent
190 if (!(obj instanceof IPatternMatch)) {
191 return false;
192 }
193 IPatternMatch otherSig = (IPatternMatch) obj;
194 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
195 }
196 }
197
198 @Override
199 public MultipleTransitionFromEntry specification() {
200 return MultipleTransitionFromEntry.instance();
201 }
202
203 /**
204 * Returns an empty, mutable match.
205 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
206 *
207 * @return the empty match.
208 *
209 */
210 public static MultipleTransitionFromEntry.Match newEmptyMatch() {
211 return new Mutable(null, null, null);
212 }
213
214 /**
215 * Returns a mutable (partial) match.
216 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
217 *
218 * @param pE the fixed value of pattern parameter e, or null if not bound.
219 * @param pT1 the fixed value of pattern parameter t1, or null if not bound.
220 * @param pT2 the fixed value of pattern parameter t2, or null if not bound.
221 * @return the new, mutable (partial) match object.
222 *
223 */
224 public static MultipleTransitionFromEntry.Match newMutableMatch(final Entry pE, final Transition pT1, final Transition pT2) {
225 return new Mutable(pE, pT1, pT2);
226 }
227
228 /**
229 * Returns a new (partial) match.
230 * This can be used e.g. to call the matcher with a partial match.
231 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
232 * @param pE the fixed value of pattern parameter e, or null if not bound.
233 * @param pT1 the fixed value of pattern parameter t1, or null if not bound.
234 * @param pT2 the fixed value of pattern parameter t2, or null if not bound.
235 * @return the (partial) match object.
236 *
237 */
238 public static MultipleTransitionFromEntry.Match newMatch(final Entry pE, final Transition pT1, final Transition pT2) {
239 return new Immutable(pE, pT1, pT2);
240 }
241
242 private static final class Mutable extends MultipleTransitionFromEntry.Match {
243 Mutable(final Entry pE, final Transition pT1, final Transition pT2) {
244 super(pE, pT1, pT2);
245 }
246
247 @Override
248 public boolean isMutable() {
249 return true;
250 }
251 }
252
253 private static final class Immutable extends MultipleTransitionFromEntry.Match {
254 Immutable(final Entry pE, final Transition pT1, final Transition pT2) {
255 super(pE, pT1, pT2);
256 }
257
258 @Override
259 public boolean isMutable() {
260 return false;
261 }
262 }
263 }
264
265 /**
266 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleTransitionFromEntry pattern,
267 * providing pattern-specific query methods.
268 *
269 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
270 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
271 *
272 * <p>Matches of the pattern will be represented as {@link Match}.
273 *
274 * <p>Original source:
275 * <code><pre>
276 * {@literal @}Constraint(severity="error", message="error", key = {e})
277 * pattern multipleTransitionFromEntry(e : Entry, t1 : Transition, t2: Transition) {
278 * Entry.outgoingTransitions(e,t1);
279 * Entry.outgoingTransitions(e,t2);
280 * t1!=t2;
281 * }
282 * </pre></code>
283 *
284 * @see Match
285 * @see MultipleTransitionFromEntry
286 *
287 */
288 public static class Matcher extends BaseMatcher<MultipleTransitionFromEntry.Match> {
289 /**
290 * Initializes the pattern matcher within an existing VIATRA Query engine.
291 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
292 *
293 * @param engine the existing VIATRA Query engine in which this matcher will be created.
294 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
295 *
296 */
297 public static MultipleTransitionFromEntry.Matcher on(final ViatraQueryEngine engine) {
298 // check if matcher already exists
299 Matcher matcher = engine.getExistingMatcher(querySpecification());
300 if (matcher == null) {
301 matcher = (Matcher)engine.getMatcher(querySpecification());
302 }
303 return matcher;
304 }
305
306 /**
307 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
308 * @return an initialized matcher
309 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
310 *
311 */
312 public static MultipleTransitionFromEntry.Matcher create() {
313 return new Matcher();
314 }
315
316 private final static int POSITION_E = 0;
317
318 private final static int POSITION_T1 = 1;
319
320 private final static int POSITION_T2 = 2;
321
322 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(MultipleTransitionFromEntry.Matcher.class);
323
324 /**
325 * Initializes the pattern matcher within an existing VIATRA Query engine.
326 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
327 *
328 * @param engine the existing VIATRA Query engine in which this matcher will be created.
329 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
330 *
331 */
332 private Matcher() {
333 super(querySpecification());
334 }
335
336 /**
337 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
338 * @param pE the fixed value of pattern parameter e, or null if not bound.
339 * @param pT1 the fixed value of pattern parameter t1, or null if not bound.
340 * @param pT2 the fixed value of pattern parameter t2, or null if not bound.
341 * @return matches represented as a Match object.
342 *
343 */
344 public Collection<MultipleTransitionFromEntry.Match> getAllMatches(final Entry pE, final Transition pT1, final Transition pT2) {
345 return rawStreamAllMatches(new Object[]{pE, pT1, pT2}).collect(Collectors.toSet());
346 }
347
348 /**
349 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
350 * </p>
351 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
352 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
353 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
354 * @param pE the fixed value of pattern parameter e, or null if not bound.
355 * @param pT1 the fixed value of pattern parameter t1, or null if not bound.
356 * @param pT2 the fixed value of pattern parameter t2, or null if not bound.
357 * @return a stream of matches represented as a Match object.
358 *
359 */
360 public Stream<MultipleTransitionFromEntry.Match> streamAllMatches(final Entry pE, final Transition pT1, final Transition pT2) {
361 return rawStreamAllMatches(new Object[]{pE, pT1, pT2});
362 }
363
364 /**
365 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
366 * Neither determinism nor randomness of selection is guaranteed.
367 * @param pE the fixed value of pattern parameter e, or null if not bound.
368 * @param pT1 the fixed value of pattern parameter t1, or null if not bound.
369 * @param pT2 the fixed value of pattern parameter t2, or null if not bound.
370 * @return a match represented as a Match object, or null if no match is found.
371 *
372 */
373 public Optional<MultipleTransitionFromEntry.Match> getOneArbitraryMatch(final Entry pE, final Transition pT1, final Transition pT2) {
374 return rawGetOneArbitraryMatch(new Object[]{pE, pT1, pT2});
375 }
376
377 /**
378 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
379 * under any possible substitution of the unspecified parameters (if any).
380 * @param pE the fixed value of pattern parameter e, or null if not bound.
381 * @param pT1 the fixed value of pattern parameter t1, or null if not bound.
382 * @param pT2 the fixed value of pattern parameter t2, or null if not bound.
383 * @return true if the input is a valid (partial) match of the pattern.
384 *
385 */
386 public boolean hasMatch(final Entry pE, final Transition pT1, final Transition pT2) {
387 return rawHasMatch(new Object[]{pE, pT1, pT2});
388 }
389
390 /**
391 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
392 * @param pE the fixed value of pattern parameter e, or null if not bound.
393 * @param pT1 the fixed value of pattern parameter t1, or null if not bound.
394 * @param pT2 the fixed value of pattern parameter t2, or null if not bound.
395 * @return the number of pattern matches found.
396 *
397 */
398 public int countMatches(final Entry pE, final Transition pT1, final Transition pT2) {
399 return rawCountMatches(new Object[]{pE, pT1, pT2});
400 }
401
402 /**
403 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
404 * Neither determinism nor randomness of selection is guaranteed.
405 * @param pE the fixed value of pattern parameter e, or null if not bound.
406 * @param pT1 the fixed value of pattern parameter t1, or null if not bound.
407 * @param pT2 the fixed value of pattern parameter t2, or null if not bound.
408 * @param processor the action that will process the selected match.
409 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
410 *
411 */
412 public boolean forOneArbitraryMatch(final Entry pE, final Transition pT1, final Transition pT2, final Consumer<? super MultipleTransitionFromEntry.Match> processor) {
413 return rawForOneArbitraryMatch(new Object[]{pE, pT1, pT2}, processor);
414 }
415
416 /**
417 * Returns a new (partial) match.
418 * This can be used e.g. to call the matcher with a partial match.
419 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
420 * @param pE the fixed value of pattern parameter e, or null if not bound.
421 * @param pT1 the fixed value of pattern parameter t1, or null if not bound.
422 * @param pT2 the fixed value of pattern parameter t2, or null if not bound.
423 * @return the (partial) match object.
424 *
425 */
426 public MultipleTransitionFromEntry.Match newMatch(final Entry pE, final Transition pT1, final Transition pT2) {
427 return MultipleTransitionFromEntry.Match.newMatch(pE, pT1, pT2);
428 }
429
430 /**
431 * Retrieve the set of values that occur in matches for e.
432 * @return the Set of all values or empty set if there are no matches
433 *
434 */
435 protected Stream<Entry> rawStreamAllValuesOfe(final Object[] parameters) {
436 return rawStreamAllValues(POSITION_E, parameters).map(Entry.class::cast);
437 }
438
439 /**
440 * Retrieve the set of values that occur in matches for e.
441 * @return the Set of all values or empty set if there are no matches
442 *
443 */
444 public Set<Entry> getAllValuesOfe() {
445 return rawStreamAllValuesOfe(emptyArray()).collect(Collectors.toSet());
446 }
447
448 /**
449 * Retrieve the set of values that occur in matches for e.
450 * @return the Set of all values or empty set if there are no matches
451 *
452 */
453 public Stream<Entry> streamAllValuesOfe() {
454 return rawStreamAllValuesOfe(emptyArray());
455 }
456
457 /**
458 * Retrieve the set of values that occur in matches for e.
459 * </p>
460 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
461 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
462 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
463 *
464 * @return the Stream of all values or empty set if there are no matches
465 *
466 */
467 public Stream<Entry> streamAllValuesOfe(final MultipleTransitionFromEntry.Match partialMatch) {
468 return rawStreamAllValuesOfe(partialMatch.toArray());
469 }
470
471 /**
472 * Retrieve the set of values that occur in matches for e.
473 * </p>
474 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
475 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
476 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
477 *
478 * @return the Stream of all values or empty set if there are no matches
479 *
480 */
481 public Stream<Entry> streamAllValuesOfe(final Transition pT1, final Transition pT2) {
482 return rawStreamAllValuesOfe(new Object[]{null, pT1, pT2});
483 }
484
485 /**
486 * Retrieve the set of values that occur in matches for e.
487 * @return the Set of all values or empty set if there are no matches
488 *
489 */
490 public Set<Entry> getAllValuesOfe(final MultipleTransitionFromEntry.Match partialMatch) {
491 return rawStreamAllValuesOfe(partialMatch.toArray()).collect(Collectors.toSet());
492 }
493
494 /**
495 * Retrieve the set of values that occur in matches for e.
496 * @return the Set of all values or empty set if there are no matches
497 *
498 */
499 public Set<Entry> getAllValuesOfe(final Transition pT1, final Transition pT2) {
500 return rawStreamAllValuesOfe(new Object[]{null, pT1, pT2}).collect(Collectors.toSet());
501 }
502
503 /**
504 * Retrieve the set of values that occur in matches for t1.
505 * @return the Set of all values or empty set if there are no matches
506 *
507 */
508 protected Stream<Transition> rawStreamAllValuesOft1(final Object[] parameters) {
509 return rawStreamAllValues(POSITION_T1, parameters).map(Transition.class::cast);
510 }
511
512 /**
513 * Retrieve the set of values that occur in matches for t1.
514 * @return the Set of all values or empty set if there are no matches
515 *
516 */
517 public Set<Transition> getAllValuesOft1() {
518 return rawStreamAllValuesOft1(emptyArray()).collect(Collectors.toSet());
519 }
520
521 /**
522 * Retrieve the set of values that occur in matches for t1.
523 * @return the Set of all values or empty set if there are no matches
524 *
525 */
526 public Stream<Transition> streamAllValuesOft1() {
527 return rawStreamAllValuesOft1(emptyArray());
528 }
529
530 /**
531 * Retrieve the set of values that occur in matches for t1.
532 * </p>
533 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
534 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
535 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
536 *
537 * @return the Stream of all values or empty set if there are no matches
538 *
539 */
540 public Stream<Transition> streamAllValuesOft1(final MultipleTransitionFromEntry.Match partialMatch) {
541 return rawStreamAllValuesOft1(partialMatch.toArray());
542 }
543
544 /**
545 * Retrieve the set of values that occur in matches for t1.
546 * </p>
547 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
548 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
549 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
550 *
551 * @return the Stream of all values or empty set if there are no matches
552 *
553 */
554 public Stream<Transition> streamAllValuesOft1(final Entry pE, final Transition pT2) {
555 return rawStreamAllValuesOft1(new Object[]{pE, null, pT2});
556 }
557
558 /**
559 * Retrieve the set of values that occur in matches for t1.
560 * @return the Set of all values or empty set if there are no matches
561 *
562 */
563 public Set<Transition> getAllValuesOft1(final MultipleTransitionFromEntry.Match partialMatch) {
564 return rawStreamAllValuesOft1(partialMatch.toArray()).collect(Collectors.toSet());
565 }
566
567 /**
568 * Retrieve the set of values that occur in matches for t1.
569 * @return the Set of all values or empty set if there are no matches
570 *
571 */
572 public Set<Transition> getAllValuesOft1(final Entry pE, final Transition pT2) {
573 return rawStreamAllValuesOft1(new Object[]{pE, null, pT2}).collect(Collectors.toSet());
574 }
575
576 /**
577 * Retrieve the set of values that occur in matches for t2.
578 * @return the Set of all values or empty set if there are no matches
579 *
580 */
581 protected Stream<Transition> rawStreamAllValuesOft2(final Object[] parameters) {
582 return rawStreamAllValues(POSITION_T2, parameters).map(Transition.class::cast);
583 }
584
585 /**
586 * Retrieve the set of values that occur in matches for t2.
587 * @return the Set of all values or empty set if there are no matches
588 *
589 */
590 public Set<Transition> getAllValuesOft2() {
591 return rawStreamAllValuesOft2(emptyArray()).collect(Collectors.toSet());
592 }
593
594 /**
595 * Retrieve the set of values that occur in matches for t2.
596 * @return the Set of all values or empty set if there are no matches
597 *
598 */
599 public Stream<Transition> streamAllValuesOft2() {
600 return rawStreamAllValuesOft2(emptyArray());
601 }
602
603 /**
604 * Retrieve the set of values that occur in matches for t2.
605 * </p>
606 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
607 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
608 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
609 *
610 * @return the Stream of all values or empty set if there are no matches
611 *
612 */
613 public Stream<Transition> streamAllValuesOft2(final MultipleTransitionFromEntry.Match partialMatch) {
614 return rawStreamAllValuesOft2(partialMatch.toArray());
615 }
616
617 /**
618 * Retrieve the set of values that occur in matches for t2.
619 * </p>
620 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
621 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
622 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
623 *
624 * @return the Stream of all values or empty set if there are no matches
625 *
626 */
627 public Stream<Transition> streamAllValuesOft2(final Entry pE, final Transition pT1) {
628 return rawStreamAllValuesOft2(new Object[]{pE, pT1, null});
629 }
630
631 /**
632 * Retrieve the set of values that occur in matches for t2.
633 * @return the Set of all values or empty set if there are no matches
634 *
635 */
636 public Set<Transition> getAllValuesOft2(final MultipleTransitionFromEntry.Match partialMatch) {
637 return rawStreamAllValuesOft2(partialMatch.toArray()).collect(Collectors.toSet());
638 }
639
640 /**
641 * Retrieve the set of values that occur in matches for t2.
642 * @return the Set of all values or empty set if there are no matches
643 *
644 */
645 public Set<Transition> getAllValuesOft2(final Entry pE, final Transition pT1) {
646 return rawStreamAllValuesOft2(new Object[]{pE, pT1, null}).collect(Collectors.toSet());
647 }
648
649 @Override
650 protected MultipleTransitionFromEntry.Match tupleToMatch(final Tuple t) {
651 try {
652 return MultipleTransitionFromEntry.Match.newMatch((Entry) t.get(POSITION_E), (Transition) t.get(POSITION_T1), (Transition) t.get(POSITION_T2));
653 } catch(ClassCastException e) {
654 LOGGER.error("Element(s) in tuple not properly typed!",e);
655 return null;
656 }
657 }
658
659 @Override
660 protected MultipleTransitionFromEntry.Match arrayToMatch(final Object[] match) {
661 try {
662 return MultipleTransitionFromEntry.Match.newMatch((Entry) match[POSITION_E], (Transition) match[POSITION_T1], (Transition) match[POSITION_T2]);
663 } catch(ClassCastException e) {
664 LOGGER.error("Element(s) in array not properly typed!",e);
665 return null;
666 }
667 }
668
669 @Override
670 protected MultipleTransitionFromEntry.Match arrayToMatchMutable(final Object[] match) {
671 try {
672 return MultipleTransitionFromEntry.Match.newMutableMatch((Entry) match[POSITION_E], (Transition) match[POSITION_T1], (Transition) match[POSITION_T2]);
673 } catch(ClassCastException e) {
674 LOGGER.error("Element(s) in array not properly typed!",e);
675 return null;
676 }
677 }
678
679 /**
680 * @return the singleton instance of the query specification of this pattern
681 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
682 *
683 */
684 public static IQuerySpecification<MultipleTransitionFromEntry.Matcher> querySpecification() {
685 return MultipleTransitionFromEntry.instance();
686 }
687 }
688
689 private MultipleTransitionFromEntry() {
690 super(GeneratedPQuery.INSTANCE);
691 }
692
693 /**
694 * @return the singleton instance of the query specification
695 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
696 *
697 */
698 public static MultipleTransitionFromEntry instance() {
699 try{
700 return LazyHolder.INSTANCE;
701 } catch (ExceptionInInitializerError err) {
702 throw processInitializerError(err);
703 }
704 }
705
706 @Override
707 protected MultipleTransitionFromEntry.Matcher instantiate(final ViatraQueryEngine engine) {
708 return MultipleTransitionFromEntry.Matcher.on(engine);
709 }
710
711 @Override
712 public MultipleTransitionFromEntry.Matcher instantiate() {
713 return MultipleTransitionFromEntry.Matcher.create();
714 }
715
716 @Override
717 public MultipleTransitionFromEntry.Match newEmptyMatch() {
718 return MultipleTransitionFromEntry.Match.newEmptyMatch();
719 }
720
721 @Override
722 public MultipleTransitionFromEntry.Match newMatch(final Object... parameters) {
723 return MultipleTransitionFromEntry.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Entry) parameters[0], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition) parameters[1], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition) parameters[2]);
724 }
725
726 /**
727 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.MultipleTransitionFromEntry (visibility: PUBLIC, simpleName: MultipleTransitionFromEntry, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.MultipleTransitionFromEntry, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
728 * <b>not</b> at the class load time of the outer class,
729 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.MultipleTransitionFromEntry (visibility: PUBLIC, simpleName: MultipleTransitionFromEntry, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.MultipleTransitionFromEntry, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
730 *
731 * <p> This workaround is required e.g. to support recursion.
732 *
733 */
734 private static class LazyHolder {
735 private final static MultipleTransitionFromEntry INSTANCE = new MultipleTransitionFromEntry();
736
737 /**
738 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
739 * This initialization order is required to support indirect recursion.
740 *
741 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
742 *
743 */
744 private final static Object STATIC_INITIALIZER = ensureInitialized();
745
746 public static Object ensureInitialized() {
747 INSTANCE.ensureInitializedInternal();
748 return null;
749 }
750 }
751
752 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
753 private final static MultipleTransitionFromEntry.GeneratedPQuery INSTANCE = new GeneratedPQuery();
754
755 private final PParameter parameter_e = new PParameter("e", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Entry", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Entry")), PParameterDirection.INOUT);
756
757 private final PParameter parameter_t1 = new PParameter("t1", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Transition")), PParameterDirection.INOUT);
758
759 private final PParameter parameter_t2 = new PParameter("t2", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Transition")), PParameterDirection.INOUT);
760
761 private final List<PParameter> parameters = Arrays.asList(parameter_e, parameter_t1, parameter_t2);
762
763 private GeneratedPQuery() {
764 super(PVisibility.PUBLIC);
765 }
766
767 @Override
768 public String getFullyQualifiedName() {
769 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.multipleTransitionFromEntry";
770 }
771
772 @Override
773 public List<String> getParameterNames() {
774 return Arrays.asList("e","t1","t2");
775 }
776
777 @Override
778 public List<PParameter> getParameters() {
779 return parameters;
780 }
781
782 @Override
783 public Set<PBody> doGetContainedBodies() {
784 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
785 Set<PBody> bodies = new LinkedHashSet<>();
786 {
787 PBody body = new PBody(this);
788 PVariable var_e = body.getOrCreateVariableByName("e");
789 PVariable var_t1 = body.getOrCreateVariableByName("t1");
790 PVariable var_t2 = body.getOrCreateVariableByName("t2");
791 new TypeConstraint(body, Tuples.flatTupleOf(var_e), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Entry")));
792 new TypeConstraint(body, Tuples.flatTupleOf(var_t1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
793 new TypeConstraint(body, Tuples.flatTupleOf(var_t2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
794 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
795 new ExportedParameter(body, var_e, parameter_e),
796 new ExportedParameter(body, var_t1, parameter_t1),
797 new ExportedParameter(body, var_t2, parameter_t2)
798 ));
799 // Entry.outgoingTransitions(e,t1)
800 new TypeConstraint(body, Tuples.flatTupleOf(var_e), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Entry")));
801 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
802 new TypeConstraint(body, Tuples.flatTupleOf(var_e, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Vertex", "outgoingTransitions")));
803 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
804 new Equality(body, var__virtual_0_, var_t1);
805 // Entry.outgoingTransitions(e,t2)
806 new TypeConstraint(body, Tuples.flatTupleOf(var_e), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Entry")));
807 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
808 new TypeConstraint(body, Tuples.flatTupleOf(var_e, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Vertex", "outgoingTransitions")));
809 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
810 new Equality(body, var__virtual_1_, var_t2);
811 // t1!=t2
812 new Inequality(body, var_t1, var_t2);
813 bodies.add(body);
814 }
815 {
816 PAnnotation annotation = new PAnnotation("Constraint");
817 annotation.addAttribute("severity", "error");
818 annotation.addAttribute("message", "error");
819 annotation.addAttribute("key", Arrays.asList(new Object[] {
820 new ParameterReference("e")
821 }));
822 addAnnotation(annotation);
823 }
824 return bodies;
825 }
826 }
827}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NoEntryInRegion.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NoEntryInRegion.java
deleted file mode 100644
index c1f7df4a..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NoEntryInRegion.java
+++ /dev/null
@@ -1,550 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Region;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.EntryInRegion;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
42
43/**
44 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
45 *
46 * <p>Original source:
47 * <code><pre>
48 * {@literal @}Constraint(severity="error", message="error", key = {r1})
49 * pattern noEntryInRegion(r1 : Region) {
50 * neg find entryInRegion(r1, _);
51 * }
52 * </pre></code>
53 *
54 * @see Matcher
55 * @see Match
56 *
57 */
58@SuppressWarnings("all")
59public final class NoEntryInRegion extends BaseGeneratedEMFQuerySpecification<NoEntryInRegion.Matcher> {
60 /**
61 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noEntryInRegion pattern,
62 * to be used in conjunction with {@link Matcher}.
63 *
64 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
65 * Each instance is a (possibly partial) substitution of pattern parameters,
66 * usable to represent a match of the pattern in the result of a query,
67 * or to specify the bound (fixed) input parameters when issuing a query.
68 *
69 * @see Matcher
70 *
71 */
72 public static abstract class Match extends BasePatternMatch {
73 private Region fR1;
74
75 private static List<String> parameterNames = makeImmutableList("r1");
76
77 private Match(final Region pR1) {
78 this.fR1 = pR1;
79 }
80
81 @Override
82 public Object get(final String parameterName) {
83 if ("r1".equals(parameterName)) return this.fR1;
84 return null;
85 }
86
87 public Region getR1() {
88 return this.fR1;
89 }
90
91 @Override
92 public boolean set(final String parameterName, final Object newValue) {
93 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
94 if ("r1".equals(parameterName) ) {
95 this.fR1 = (Region) newValue;
96 return true;
97 }
98 return false;
99 }
100
101 public void setR1(final Region pR1) {
102 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
103 this.fR1 = pR1;
104 }
105
106 @Override
107 public String patternName() {
108 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noEntryInRegion";
109 }
110
111 @Override
112 public List<String> parameterNames() {
113 return NoEntryInRegion.Match.parameterNames;
114 }
115
116 @Override
117 public Object[] toArray() {
118 return new Object[]{fR1};
119 }
120
121 @Override
122 public NoEntryInRegion.Match toImmutable() {
123 return isMutable() ? newMatch(fR1) : this;
124 }
125
126 @Override
127 public String prettyPrint() {
128 StringBuilder result = new StringBuilder();
129 result.append("\"r1\"=" + prettyPrintValue(fR1));
130 return result.toString();
131 }
132
133 @Override
134 public int hashCode() {
135 return Objects.hash(fR1);
136 }
137
138 @Override
139 public boolean equals(final Object obj) {
140 if (this == obj)
141 return true;
142 if (obj == null) {
143 return false;
144 }
145 if ((obj instanceof NoEntryInRegion.Match)) {
146 NoEntryInRegion.Match other = (NoEntryInRegion.Match) obj;
147 return Objects.equals(fR1, other.fR1);
148 } else {
149 // this should be infrequent
150 if (!(obj instanceof IPatternMatch)) {
151 return false;
152 }
153 IPatternMatch otherSig = (IPatternMatch) obj;
154 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
155 }
156 }
157
158 @Override
159 public NoEntryInRegion specification() {
160 return NoEntryInRegion.instance();
161 }
162
163 /**
164 * Returns an empty, mutable match.
165 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
166 *
167 * @return the empty match.
168 *
169 */
170 public static NoEntryInRegion.Match newEmptyMatch() {
171 return new Mutable(null);
172 }
173
174 /**
175 * Returns a mutable (partial) match.
176 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
177 *
178 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
179 * @return the new, mutable (partial) match object.
180 *
181 */
182 public static NoEntryInRegion.Match newMutableMatch(final Region pR1) {
183 return new Mutable(pR1);
184 }
185
186 /**
187 * Returns a new (partial) match.
188 * This can be used e.g. to call the matcher with a partial match.
189 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
190 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
191 * @return the (partial) match object.
192 *
193 */
194 public static NoEntryInRegion.Match newMatch(final Region pR1) {
195 return new Immutable(pR1);
196 }
197
198 private static final class Mutable extends NoEntryInRegion.Match {
199 Mutable(final Region pR1) {
200 super(pR1);
201 }
202
203 @Override
204 public boolean isMutable() {
205 return true;
206 }
207 }
208
209 private static final class Immutable extends NoEntryInRegion.Match {
210 Immutable(final Region pR1) {
211 super(pR1);
212 }
213
214 @Override
215 public boolean isMutable() {
216 return false;
217 }
218 }
219 }
220
221 /**
222 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noEntryInRegion pattern,
223 * providing pattern-specific query methods.
224 *
225 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
226 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
227 *
228 * <p>Matches of the pattern will be represented as {@link Match}.
229 *
230 * <p>Original source:
231 * <code><pre>
232 * {@literal @}Constraint(severity="error", message="error", key = {r1})
233 * pattern noEntryInRegion(r1 : Region) {
234 * neg find entryInRegion(r1, _);
235 * }
236 * </pre></code>
237 *
238 * @see Match
239 * @see NoEntryInRegion
240 *
241 */
242 public static class Matcher extends BaseMatcher<NoEntryInRegion.Match> {
243 /**
244 * Initializes the pattern matcher within an existing VIATRA Query engine.
245 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
246 *
247 * @param engine the existing VIATRA Query engine in which this matcher will be created.
248 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
249 *
250 */
251 public static NoEntryInRegion.Matcher on(final ViatraQueryEngine engine) {
252 // check if matcher already exists
253 Matcher matcher = engine.getExistingMatcher(querySpecification());
254 if (matcher == null) {
255 matcher = (Matcher)engine.getMatcher(querySpecification());
256 }
257 return matcher;
258 }
259
260 /**
261 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
262 * @return an initialized matcher
263 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
264 *
265 */
266 public static NoEntryInRegion.Matcher create() {
267 return new Matcher();
268 }
269
270 private final static int POSITION_R1 = 0;
271
272 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NoEntryInRegion.Matcher.class);
273
274 /**
275 * Initializes the pattern matcher within an existing VIATRA Query engine.
276 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
277 *
278 * @param engine the existing VIATRA Query engine in which this matcher will be created.
279 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
280 *
281 */
282 private Matcher() {
283 super(querySpecification());
284 }
285
286 /**
287 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
288 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
289 * @return matches represented as a Match object.
290 *
291 */
292 public Collection<NoEntryInRegion.Match> getAllMatches(final Region pR1) {
293 return rawStreamAllMatches(new Object[]{pR1}).collect(Collectors.toSet());
294 }
295
296 /**
297 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
298 * </p>
299 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
300 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
301 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
302 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
303 * @return a stream of matches represented as a Match object.
304 *
305 */
306 public Stream<NoEntryInRegion.Match> streamAllMatches(final Region pR1) {
307 return rawStreamAllMatches(new Object[]{pR1});
308 }
309
310 /**
311 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
312 * Neither determinism nor randomness of selection is guaranteed.
313 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
314 * @return a match represented as a Match object, or null if no match is found.
315 *
316 */
317 public Optional<NoEntryInRegion.Match> getOneArbitraryMatch(final Region pR1) {
318 return rawGetOneArbitraryMatch(new Object[]{pR1});
319 }
320
321 /**
322 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
323 * under any possible substitution of the unspecified parameters (if any).
324 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
325 * @return true if the input is a valid (partial) match of the pattern.
326 *
327 */
328 public boolean hasMatch(final Region pR1) {
329 return rawHasMatch(new Object[]{pR1});
330 }
331
332 /**
333 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
334 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
335 * @return the number of pattern matches found.
336 *
337 */
338 public int countMatches(final Region pR1) {
339 return rawCountMatches(new Object[]{pR1});
340 }
341
342 /**
343 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
344 * Neither determinism nor randomness of selection is guaranteed.
345 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
346 * @param processor the action that will process the selected match.
347 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
348 *
349 */
350 public boolean forOneArbitraryMatch(final Region pR1, final Consumer<? super NoEntryInRegion.Match> processor) {
351 return rawForOneArbitraryMatch(new Object[]{pR1}, processor);
352 }
353
354 /**
355 * Returns a new (partial) match.
356 * This can be used e.g. to call the matcher with a partial match.
357 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
358 * @param pR1 the fixed value of pattern parameter r1, or null if not bound.
359 * @return the (partial) match object.
360 *
361 */
362 public NoEntryInRegion.Match newMatch(final Region pR1) {
363 return NoEntryInRegion.Match.newMatch(pR1);
364 }
365
366 /**
367 * Retrieve the set of values that occur in matches for r1.
368 * @return the Set of all values or empty set if there are no matches
369 *
370 */
371 protected Stream<Region> rawStreamAllValuesOfr1(final Object[] parameters) {
372 return rawStreamAllValues(POSITION_R1, parameters).map(Region.class::cast);
373 }
374
375 /**
376 * Retrieve the set of values that occur in matches for r1.
377 * @return the Set of all values or empty set if there are no matches
378 *
379 */
380 public Set<Region> getAllValuesOfr1() {
381 return rawStreamAllValuesOfr1(emptyArray()).collect(Collectors.toSet());
382 }
383
384 /**
385 * Retrieve the set of values that occur in matches for r1.
386 * @return the Set of all values or empty set if there are no matches
387 *
388 */
389 public Stream<Region> streamAllValuesOfr1() {
390 return rawStreamAllValuesOfr1(emptyArray());
391 }
392
393 @Override
394 protected NoEntryInRegion.Match tupleToMatch(final Tuple t) {
395 try {
396 return NoEntryInRegion.Match.newMatch((Region) t.get(POSITION_R1));
397 } catch(ClassCastException e) {
398 LOGGER.error("Element(s) in tuple not properly typed!",e);
399 return null;
400 }
401 }
402
403 @Override
404 protected NoEntryInRegion.Match arrayToMatch(final Object[] match) {
405 try {
406 return NoEntryInRegion.Match.newMatch((Region) match[POSITION_R1]);
407 } catch(ClassCastException e) {
408 LOGGER.error("Element(s) in array not properly typed!",e);
409 return null;
410 }
411 }
412
413 @Override
414 protected NoEntryInRegion.Match arrayToMatchMutable(final Object[] match) {
415 try {
416 return NoEntryInRegion.Match.newMutableMatch((Region) match[POSITION_R1]);
417 } catch(ClassCastException e) {
418 LOGGER.error("Element(s) in array not properly typed!",e);
419 return null;
420 }
421 }
422
423 /**
424 * @return the singleton instance of the query specification of this pattern
425 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
426 *
427 */
428 public static IQuerySpecification<NoEntryInRegion.Matcher> querySpecification() {
429 return NoEntryInRegion.instance();
430 }
431 }
432
433 private NoEntryInRegion() {
434 super(GeneratedPQuery.INSTANCE);
435 }
436
437 /**
438 * @return the singleton instance of the query specification
439 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
440 *
441 */
442 public static NoEntryInRegion instance() {
443 try{
444 return LazyHolder.INSTANCE;
445 } catch (ExceptionInInitializerError err) {
446 throw processInitializerError(err);
447 }
448 }
449
450 @Override
451 protected NoEntryInRegion.Matcher instantiate(final ViatraQueryEngine engine) {
452 return NoEntryInRegion.Matcher.on(engine);
453 }
454
455 @Override
456 public NoEntryInRegion.Matcher instantiate() {
457 return NoEntryInRegion.Matcher.create();
458 }
459
460 @Override
461 public NoEntryInRegion.Match newEmptyMatch() {
462 return NoEntryInRegion.Match.newEmptyMatch();
463 }
464
465 @Override
466 public NoEntryInRegion.Match newMatch(final Object... parameters) {
467 return NoEntryInRegion.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Region) parameters[0]);
468 }
469
470 /**
471 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NoEntryInRegion (visibility: PUBLIC, simpleName: NoEntryInRegion, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NoEntryInRegion, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
472 * <b>not</b> at the class load time of the outer class,
473 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NoEntryInRegion (visibility: PUBLIC, simpleName: NoEntryInRegion, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NoEntryInRegion, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
474 *
475 * <p> This workaround is required e.g. to support recursion.
476 *
477 */
478 private static class LazyHolder {
479 private final static NoEntryInRegion INSTANCE = new NoEntryInRegion();
480
481 /**
482 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
483 * This initialization order is required to support indirect recursion.
484 *
485 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
486 *
487 */
488 private final static Object STATIC_INITIALIZER = ensureInitialized();
489
490 public static Object ensureInitialized() {
491 INSTANCE.ensureInitializedInternal();
492 return null;
493 }
494 }
495
496 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
497 private final static NoEntryInRegion.GeneratedPQuery INSTANCE = new GeneratedPQuery();
498
499 private final PParameter parameter_r1 = new PParameter("r1", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Region", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Region")), PParameterDirection.INOUT);
500
501 private final List<PParameter> parameters = Arrays.asList(parameter_r1);
502
503 private GeneratedPQuery() {
504 super(PVisibility.PUBLIC);
505 }
506
507 @Override
508 public String getFullyQualifiedName() {
509 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noEntryInRegion";
510 }
511
512 @Override
513 public List<String> getParameterNames() {
514 return Arrays.asList("r1");
515 }
516
517 @Override
518 public List<PParameter> getParameters() {
519 return parameters;
520 }
521
522 @Override
523 public Set<PBody> doGetContainedBodies() {
524 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
525 Set<PBody> bodies = new LinkedHashSet<>();
526 {
527 PBody body = new PBody(this);
528 PVariable var_r1 = body.getOrCreateVariableByName("r1");
529 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
530 new TypeConstraint(body, Tuples.flatTupleOf(var_r1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
531 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
532 new ExportedParameter(body, var_r1, parameter_r1)
533 ));
534 // neg find entryInRegion(r1, _)
535 new NegativePatternCall(body, Tuples.flatTupleOf(var_r1, var___0_), EntryInRegion.instance().getInternalQueryRepresentation());
536 bodies.add(body);
537 }
538 {
539 PAnnotation annotation = new PAnnotation("Constraint");
540 annotation.addAttribute("severity", "error");
541 annotation.addAttribute("message", "error");
542 annotation.addAttribute("key", Arrays.asList(new Object[] {
543 new ParameterReference("r1")
544 }));
545 addAnnotation(annotation);
546 }
547 return bodies;
548 }
549 }
550}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NoOutgoingTransitionFromEntry.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NoOutgoingTransitionFromEntry.java
deleted file mode 100644
index d9a3de50..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NoOutgoingTransitionFromEntry.java
+++ /dev/null
@@ -1,551 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Entry;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
42
43/**
44 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
45 *
46 * <p>Original source:
47 * <code><pre>
48 * {@literal @}Constraint(severity="error", message="error", key = {e})
49 * pattern noOutgoingTransitionFromEntry(e : Entry) {
50 * neg find transition(_, e, _);
51 * }
52 * </pre></code>
53 *
54 * @see Matcher
55 * @see Match
56 *
57 */
58@SuppressWarnings("all")
59public final class NoOutgoingTransitionFromEntry extends BaseGeneratedEMFQuerySpecification<NoOutgoingTransitionFromEntry.Matcher> {
60 /**
61 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noOutgoingTransitionFromEntry pattern,
62 * to be used in conjunction with {@link Matcher}.
63 *
64 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
65 * Each instance is a (possibly partial) substitution of pattern parameters,
66 * usable to represent a match of the pattern in the result of a query,
67 * or to specify the bound (fixed) input parameters when issuing a query.
68 *
69 * @see Matcher
70 *
71 */
72 public static abstract class Match extends BasePatternMatch {
73 private Entry fE;
74
75 private static List<String> parameterNames = makeImmutableList("e");
76
77 private Match(final Entry pE) {
78 this.fE = pE;
79 }
80
81 @Override
82 public Object get(final String parameterName) {
83 if ("e".equals(parameterName)) return this.fE;
84 return null;
85 }
86
87 public Entry getE() {
88 return this.fE;
89 }
90
91 @Override
92 public boolean set(final String parameterName, final Object newValue) {
93 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
94 if ("e".equals(parameterName) ) {
95 this.fE = (Entry) newValue;
96 return true;
97 }
98 return false;
99 }
100
101 public void setE(final Entry pE) {
102 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
103 this.fE = pE;
104 }
105
106 @Override
107 public String patternName() {
108 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noOutgoingTransitionFromEntry";
109 }
110
111 @Override
112 public List<String> parameterNames() {
113 return NoOutgoingTransitionFromEntry.Match.parameterNames;
114 }
115
116 @Override
117 public Object[] toArray() {
118 return new Object[]{fE};
119 }
120
121 @Override
122 public NoOutgoingTransitionFromEntry.Match toImmutable() {
123 return isMutable() ? newMatch(fE) : this;
124 }
125
126 @Override
127 public String prettyPrint() {
128 StringBuilder result = new StringBuilder();
129 result.append("\"e\"=" + prettyPrintValue(fE));
130 return result.toString();
131 }
132
133 @Override
134 public int hashCode() {
135 return Objects.hash(fE);
136 }
137
138 @Override
139 public boolean equals(final Object obj) {
140 if (this == obj)
141 return true;
142 if (obj == null) {
143 return false;
144 }
145 if ((obj instanceof NoOutgoingTransitionFromEntry.Match)) {
146 NoOutgoingTransitionFromEntry.Match other = (NoOutgoingTransitionFromEntry.Match) obj;
147 return Objects.equals(fE, other.fE);
148 } else {
149 // this should be infrequent
150 if (!(obj instanceof IPatternMatch)) {
151 return false;
152 }
153 IPatternMatch otherSig = (IPatternMatch) obj;
154 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
155 }
156 }
157
158 @Override
159 public NoOutgoingTransitionFromEntry specification() {
160 return NoOutgoingTransitionFromEntry.instance();
161 }
162
163 /**
164 * Returns an empty, mutable match.
165 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
166 *
167 * @return the empty match.
168 *
169 */
170 public static NoOutgoingTransitionFromEntry.Match newEmptyMatch() {
171 return new Mutable(null);
172 }
173
174 /**
175 * Returns a mutable (partial) match.
176 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
177 *
178 * @param pE the fixed value of pattern parameter e, or null if not bound.
179 * @return the new, mutable (partial) match object.
180 *
181 */
182 public static NoOutgoingTransitionFromEntry.Match newMutableMatch(final Entry pE) {
183 return new Mutable(pE);
184 }
185
186 /**
187 * Returns a new (partial) match.
188 * This can be used e.g. to call the matcher with a partial match.
189 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
190 * @param pE the fixed value of pattern parameter e, or null if not bound.
191 * @return the (partial) match object.
192 *
193 */
194 public static NoOutgoingTransitionFromEntry.Match newMatch(final Entry pE) {
195 return new Immutable(pE);
196 }
197
198 private static final class Mutable extends NoOutgoingTransitionFromEntry.Match {
199 Mutable(final Entry pE) {
200 super(pE);
201 }
202
203 @Override
204 public boolean isMutable() {
205 return true;
206 }
207 }
208
209 private static final class Immutable extends NoOutgoingTransitionFromEntry.Match {
210 Immutable(final Entry pE) {
211 super(pE);
212 }
213
214 @Override
215 public boolean isMutable() {
216 return false;
217 }
218 }
219 }
220
221 /**
222 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noOutgoingTransitionFromEntry pattern,
223 * providing pattern-specific query methods.
224 *
225 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
226 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
227 *
228 * <p>Matches of the pattern will be represented as {@link Match}.
229 *
230 * <p>Original source:
231 * <code><pre>
232 * {@literal @}Constraint(severity="error", message="error", key = {e})
233 * pattern noOutgoingTransitionFromEntry(e : Entry) {
234 * neg find transition(_, e, _);
235 * }
236 * </pre></code>
237 *
238 * @see Match
239 * @see NoOutgoingTransitionFromEntry
240 *
241 */
242 public static class Matcher extends BaseMatcher<NoOutgoingTransitionFromEntry.Match> {
243 /**
244 * Initializes the pattern matcher within an existing VIATRA Query engine.
245 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
246 *
247 * @param engine the existing VIATRA Query engine in which this matcher will be created.
248 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
249 *
250 */
251 public static NoOutgoingTransitionFromEntry.Matcher on(final ViatraQueryEngine engine) {
252 // check if matcher already exists
253 Matcher matcher = engine.getExistingMatcher(querySpecification());
254 if (matcher == null) {
255 matcher = (Matcher)engine.getMatcher(querySpecification());
256 }
257 return matcher;
258 }
259
260 /**
261 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
262 * @return an initialized matcher
263 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
264 *
265 */
266 public static NoOutgoingTransitionFromEntry.Matcher create() {
267 return new Matcher();
268 }
269
270 private final static int POSITION_E = 0;
271
272 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NoOutgoingTransitionFromEntry.Matcher.class);
273
274 /**
275 * Initializes the pattern matcher within an existing VIATRA Query engine.
276 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
277 *
278 * @param engine the existing VIATRA Query engine in which this matcher will be created.
279 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
280 *
281 */
282 private Matcher() {
283 super(querySpecification());
284 }
285
286 /**
287 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
288 * @param pE the fixed value of pattern parameter e, or null if not bound.
289 * @return matches represented as a Match object.
290 *
291 */
292 public Collection<NoOutgoingTransitionFromEntry.Match> getAllMatches(final Entry pE) {
293 return rawStreamAllMatches(new Object[]{pE}).collect(Collectors.toSet());
294 }
295
296 /**
297 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
298 * </p>
299 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
300 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
301 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
302 * @param pE the fixed value of pattern parameter e, or null if not bound.
303 * @return a stream of matches represented as a Match object.
304 *
305 */
306 public Stream<NoOutgoingTransitionFromEntry.Match> streamAllMatches(final Entry pE) {
307 return rawStreamAllMatches(new Object[]{pE});
308 }
309
310 /**
311 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
312 * Neither determinism nor randomness of selection is guaranteed.
313 * @param pE the fixed value of pattern parameter e, or null if not bound.
314 * @return a match represented as a Match object, or null if no match is found.
315 *
316 */
317 public Optional<NoOutgoingTransitionFromEntry.Match> getOneArbitraryMatch(final Entry pE) {
318 return rawGetOneArbitraryMatch(new Object[]{pE});
319 }
320
321 /**
322 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
323 * under any possible substitution of the unspecified parameters (if any).
324 * @param pE the fixed value of pattern parameter e, or null if not bound.
325 * @return true if the input is a valid (partial) match of the pattern.
326 *
327 */
328 public boolean hasMatch(final Entry pE) {
329 return rawHasMatch(new Object[]{pE});
330 }
331
332 /**
333 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
334 * @param pE the fixed value of pattern parameter e, or null if not bound.
335 * @return the number of pattern matches found.
336 *
337 */
338 public int countMatches(final Entry pE) {
339 return rawCountMatches(new Object[]{pE});
340 }
341
342 /**
343 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
344 * Neither determinism nor randomness of selection is guaranteed.
345 * @param pE the fixed value of pattern parameter e, or null if not bound.
346 * @param processor the action that will process the selected match.
347 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
348 *
349 */
350 public boolean forOneArbitraryMatch(final Entry pE, final Consumer<? super NoOutgoingTransitionFromEntry.Match> processor) {
351 return rawForOneArbitraryMatch(new Object[]{pE}, processor);
352 }
353
354 /**
355 * Returns a new (partial) match.
356 * This can be used e.g. to call the matcher with a partial match.
357 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
358 * @param pE the fixed value of pattern parameter e, or null if not bound.
359 * @return the (partial) match object.
360 *
361 */
362 public NoOutgoingTransitionFromEntry.Match newMatch(final Entry pE) {
363 return NoOutgoingTransitionFromEntry.Match.newMatch(pE);
364 }
365
366 /**
367 * Retrieve the set of values that occur in matches for e.
368 * @return the Set of all values or empty set if there are no matches
369 *
370 */
371 protected Stream<Entry> rawStreamAllValuesOfe(final Object[] parameters) {
372 return rawStreamAllValues(POSITION_E, parameters).map(Entry.class::cast);
373 }
374
375 /**
376 * Retrieve the set of values that occur in matches for e.
377 * @return the Set of all values or empty set if there are no matches
378 *
379 */
380 public Set<Entry> getAllValuesOfe() {
381 return rawStreamAllValuesOfe(emptyArray()).collect(Collectors.toSet());
382 }
383
384 /**
385 * Retrieve the set of values that occur in matches for e.
386 * @return the Set of all values or empty set if there are no matches
387 *
388 */
389 public Stream<Entry> streamAllValuesOfe() {
390 return rawStreamAllValuesOfe(emptyArray());
391 }
392
393 @Override
394 protected NoOutgoingTransitionFromEntry.Match tupleToMatch(final Tuple t) {
395 try {
396 return NoOutgoingTransitionFromEntry.Match.newMatch((Entry) t.get(POSITION_E));
397 } catch(ClassCastException e) {
398 LOGGER.error("Element(s) in tuple not properly typed!",e);
399 return null;
400 }
401 }
402
403 @Override
404 protected NoOutgoingTransitionFromEntry.Match arrayToMatch(final Object[] match) {
405 try {
406 return NoOutgoingTransitionFromEntry.Match.newMatch((Entry) match[POSITION_E]);
407 } catch(ClassCastException e) {
408 LOGGER.error("Element(s) in array not properly typed!",e);
409 return null;
410 }
411 }
412
413 @Override
414 protected NoOutgoingTransitionFromEntry.Match arrayToMatchMutable(final Object[] match) {
415 try {
416 return NoOutgoingTransitionFromEntry.Match.newMutableMatch((Entry) match[POSITION_E]);
417 } catch(ClassCastException e) {
418 LOGGER.error("Element(s) in array not properly typed!",e);
419 return null;
420 }
421 }
422
423 /**
424 * @return the singleton instance of the query specification of this pattern
425 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
426 *
427 */
428 public static IQuerySpecification<NoOutgoingTransitionFromEntry.Matcher> querySpecification() {
429 return NoOutgoingTransitionFromEntry.instance();
430 }
431 }
432
433 private NoOutgoingTransitionFromEntry() {
434 super(GeneratedPQuery.INSTANCE);
435 }
436
437 /**
438 * @return the singleton instance of the query specification
439 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
440 *
441 */
442 public static NoOutgoingTransitionFromEntry instance() {
443 try{
444 return LazyHolder.INSTANCE;
445 } catch (ExceptionInInitializerError err) {
446 throw processInitializerError(err);
447 }
448 }
449
450 @Override
451 protected NoOutgoingTransitionFromEntry.Matcher instantiate(final ViatraQueryEngine engine) {
452 return NoOutgoingTransitionFromEntry.Matcher.on(engine);
453 }
454
455 @Override
456 public NoOutgoingTransitionFromEntry.Matcher instantiate() {
457 return NoOutgoingTransitionFromEntry.Matcher.create();
458 }
459
460 @Override
461 public NoOutgoingTransitionFromEntry.Match newEmptyMatch() {
462 return NoOutgoingTransitionFromEntry.Match.newEmptyMatch();
463 }
464
465 @Override
466 public NoOutgoingTransitionFromEntry.Match newMatch(final Object... parameters) {
467 return NoOutgoingTransitionFromEntry.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Entry) parameters[0]);
468 }
469
470 /**
471 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NoOutgoingTransitionFromEntry (visibility: PUBLIC, simpleName: NoOutgoingTransitionFromEntry, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NoOutgoingTransitionFromEntry, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
472 * <b>not</b> at the class load time of the outer class,
473 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NoOutgoingTransitionFromEntry (visibility: PUBLIC, simpleName: NoOutgoingTransitionFromEntry, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NoOutgoingTransitionFromEntry, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
474 *
475 * <p> This workaround is required e.g. to support recursion.
476 *
477 */
478 private static class LazyHolder {
479 private final static NoOutgoingTransitionFromEntry INSTANCE = new NoOutgoingTransitionFromEntry();
480
481 /**
482 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
483 * This initialization order is required to support indirect recursion.
484 *
485 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
486 *
487 */
488 private final static Object STATIC_INITIALIZER = ensureInitialized();
489
490 public static Object ensureInitialized() {
491 INSTANCE.ensureInitializedInternal();
492 return null;
493 }
494 }
495
496 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
497 private final static NoOutgoingTransitionFromEntry.GeneratedPQuery INSTANCE = new GeneratedPQuery();
498
499 private final PParameter parameter_e = new PParameter("e", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Entry", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Entry")), PParameterDirection.INOUT);
500
501 private final List<PParameter> parameters = Arrays.asList(parameter_e);
502
503 private GeneratedPQuery() {
504 super(PVisibility.PUBLIC);
505 }
506
507 @Override
508 public String getFullyQualifiedName() {
509 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noOutgoingTransitionFromEntry";
510 }
511
512 @Override
513 public List<String> getParameterNames() {
514 return Arrays.asList("e");
515 }
516
517 @Override
518 public List<PParameter> getParameters() {
519 return parameters;
520 }
521
522 @Override
523 public Set<PBody> doGetContainedBodies() {
524 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
525 Set<PBody> bodies = new LinkedHashSet<>();
526 {
527 PBody body = new PBody(this);
528 PVariable var_e = body.getOrCreateVariableByName("e");
529 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
530 PVariable var___1_ = body.getOrCreateVariableByName("_<1>");
531 new TypeConstraint(body, Tuples.flatTupleOf(var_e), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Entry")));
532 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
533 new ExportedParameter(body, var_e, parameter_e)
534 ));
535 // neg find transition(_, e, _)
536 new NegativePatternCall(body, Tuples.flatTupleOf(var___0_, var_e, var___1_), Transition.instance().getInternalQueryRepresentation());
537 bodies.add(body);
538 }
539 {
540 PAnnotation annotation = new PAnnotation("Constraint");
541 annotation.addAttribute("severity", "error");
542 annotation.addAttribute("message", "error");
543 annotation.addAttribute("key", Arrays.asList(new Object[] {
544 new ParameterReference("e")
545 }));
546 addAnnotation(annotation);
547 }
548 return bodies;
549 }
550 }
551}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NoStateInRegion.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NoStateInRegion.java
deleted file mode 100644
index 841339ae..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NoStateInRegion.java
+++ /dev/null
@@ -1,558 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Region;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.StateInRegion;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
42
43/**
44 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
45 *
46 * <p>Original source:
47 * <code><pre>
48 * /////////
49 * // State vs Region
50 * /////////
51 *
52 * {@literal @}Constraint(severity="error", message="error", key = {region})
53 * pattern noStateInRegion(region: Region) {
54 * neg find StateInRegion(region,_);
55 * }
56 * </pre></code>
57 *
58 * @see Matcher
59 * @see Match
60 *
61 */
62@SuppressWarnings("all")
63public final class NoStateInRegion extends BaseGeneratedEMFQuerySpecification<NoStateInRegion.Matcher> {
64 /**
65 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noStateInRegion pattern,
66 * to be used in conjunction with {@link Matcher}.
67 *
68 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
69 * Each instance is a (possibly partial) substitution of pattern parameters,
70 * usable to represent a match of the pattern in the result of a query,
71 * or to specify the bound (fixed) input parameters when issuing a query.
72 *
73 * @see Matcher
74 *
75 */
76 public static abstract class Match extends BasePatternMatch {
77 private Region fRegion;
78
79 private static List<String> parameterNames = makeImmutableList("region");
80
81 private Match(final Region pRegion) {
82 this.fRegion = pRegion;
83 }
84
85 @Override
86 public Object get(final String parameterName) {
87 if ("region".equals(parameterName)) return this.fRegion;
88 return null;
89 }
90
91 public Region getRegion() {
92 return this.fRegion;
93 }
94
95 @Override
96 public boolean set(final String parameterName, final Object newValue) {
97 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
98 if ("region".equals(parameterName) ) {
99 this.fRegion = (Region) newValue;
100 return true;
101 }
102 return false;
103 }
104
105 public void setRegion(final Region pRegion) {
106 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
107 this.fRegion = pRegion;
108 }
109
110 @Override
111 public String patternName() {
112 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noStateInRegion";
113 }
114
115 @Override
116 public List<String> parameterNames() {
117 return NoStateInRegion.Match.parameterNames;
118 }
119
120 @Override
121 public Object[] toArray() {
122 return new Object[]{fRegion};
123 }
124
125 @Override
126 public NoStateInRegion.Match toImmutable() {
127 return isMutable() ? newMatch(fRegion) : this;
128 }
129
130 @Override
131 public String prettyPrint() {
132 StringBuilder result = new StringBuilder();
133 result.append("\"region\"=" + prettyPrintValue(fRegion));
134 return result.toString();
135 }
136
137 @Override
138 public int hashCode() {
139 return Objects.hash(fRegion);
140 }
141
142 @Override
143 public boolean equals(final Object obj) {
144 if (this == obj)
145 return true;
146 if (obj == null) {
147 return false;
148 }
149 if ((obj instanceof NoStateInRegion.Match)) {
150 NoStateInRegion.Match other = (NoStateInRegion.Match) obj;
151 return Objects.equals(fRegion, other.fRegion);
152 } else {
153 // this should be infrequent
154 if (!(obj instanceof IPatternMatch)) {
155 return false;
156 }
157 IPatternMatch otherSig = (IPatternMatch) obj;
158 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
159 }
160 }
161
162 @Override
163 public NoStateInRegion specification() {
164 return NoStateInRegion.instance();
165 }
166
167 /**
168 * Returns an empty, mutable match.
169 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
170 *
171 * @return the empty match.
172 *
173 */
174 public static NoStateInRegion.Match newEmptyMatch() {
175 return new Mutable(null);
176 }
177
178 /**
179 * Returns a mutable (partial) match.
180 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
181 *
182 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
183 * @return the new, mutable (partial) match object.
184 *
185 */
186 public static NoStateInRegion.Match newMutableMatch(final Region pRegion) {
187 return new Mutable(pRegion);
188 }
189
190 /**
191 * Returns a new (partial) match.
192 * This can be used e.g. to call the matcher with a partial match.
193 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
194 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
195 * @return the (partial) match object.
196 *
197 */
198 public static NoStateInRegion.Match newMatch(final Region pRegion) {
199 return new Immutable(pRegion);
200 }
201
202 private static final class Mutable extends NoStateInRegion.Match {
203 Mutable(final Region pRegion) {
204 super(pRegion);
205 }
206
207 @Override
208 public boolean isMutable() {
209 return true;
210 }
211 }
212
213 private static final class Immutable extends NoStateInRegion.Match {
214 Immutable(final Region pRegion) {
215 super(pRegion);
216 }
217
218 @Override
219 public boolean isMutable() {
220 return false;
221 }
222 }
223 }
224
225 /**
226 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noStateInRegion pattern,
227 * providing pattern-specific query methods.
228 *
229 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
230 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
231 *
232 * <p>Matches of the pattern will be represented as {@link Match}.
233 *
234 * <p>Original source:
235 * <code><pre>
236 * /////////
237 * // State vs Region
238 * /////////
239 *
240 * {@literal @}Constraint(severity="error", message="error", key = {region})
241 * pattern noStateInRegion(region: Region) {
242 * neg find StateInRegion(region,_);
243 * }
244 * </pre></code>
245 *
246 * @see Match
247 * @see NoStateInRegion
248 *
249 */
250 public static class Matcher extends BaseMatcher<NoStateInRegion.Match> {
251 /**
252 * Initializes the pattern matcher within an existing VIATRA Query engine.
253 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
254 *
255 * @param engine the existing VIATRA Query engine in which this matcher will be created.
256 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
257 *
258 */
259 public static NoStateInRegion.Matcher on(final ViatraQueryEngine engine) {
260 // check if matcher already exists
261 Matcher matcher = engine.getExistingMatcher(querySpecification());
262 if (matcher == null) {
263 matcher = (Matcher)engine.getMatcher(querySpecification());
264 }
265 return matcher;
266 }
267
268 /**
269 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
270 * @return an initialized matcher
271 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
272 *
273 */
274 public static NoStateInRegion.Matcher create() {
275 return new Matcher();
276 }
277
278 private final static int POSITION_REGION = 0;
279
280 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NoStateInRegion.Matcher.class);
281
282 /**
283 * Initializes the pattern matcher within an existing VIATRA Query engine.
284 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
285 *
286 * @param engine the existing VIATRA Query engine in which this matcher will be created.
287 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
288 *
289 */
290 private Matcher() {
291 super(querySpecification());
292 }
293
294 /**
295 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
296 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
297 * @return matches represented as a Match object.
298 *
299 */
300 public Collection<NoStateInRegion.Match> getAllMatches(final Region pRegion) {
301 return rawStreamAllMatches(new Object[]{pRegion}).collect(Collectors.toSet());
302 }
303
304 /**
305 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
306 * </p>
307 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
308 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
309 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
310 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
311 * @return a stream of matches represented as a Match object.
312 *
313 */
314 public Stream<NoStateInRegion.Match> streamAllMatches(final Region pRegion) {
315 return rawStreamAllMatches(new Object[]{pRegion});
316 }
317
318 /**
319 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
320 * Neither determinism nor randomness of selection is guaranteed.
321 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
322 * @return a match represented as a Match object, or null if no match is found.
323 *
324 */
325 public Optional<NoStateInRegion.Match> getOneArbitraryMatch(final Region pRegion) {
326 return rawGetOneArbitraryMatch(new Object[]{pRegion});
327 }
328
329 /**
330 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
331 * under any possible substitution of the unspecified parameters (if any).
332 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
333 * @return true if the input is a valid (partial) match of the pattern.
334 *
335 */
336 public boolean hasMatch(final Region pRegion) {
337 return rawHasMatch(new Object[]{pRegion});
338 }
339
340 /**
341 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
342 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
343 * @return the number of pattern matches found.
344 *
345 */
346 public int countMatches(final Region pRegion) {
347 return rawCountMatches(new Object[]{pRegion});
348 }
349
350 /**
351 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
352 * Neither determinism nor randomness of selection is guaranteed.
353 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
354 * @param processor the action that will process the selected match.
355 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
356 *
357 */
358 public boolean forOneArbitraryMatch(final Region pRegion, final Consumer<? super NoStateInRegion.Match> processor) {
359 return rawForOneArbitraryMatch(new Object[]{pRegion}, processor);
360 }
361
362 /**
363 * Returns a new (partial) match.
364 * This can be used e.g. to call the matcher with a partial match.
365 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
366 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
367 * @return the (partial) match object.
368 *
369 */
370 public NoStateInRegion.Match newMatch(final Region pRegion) {
371 return NoStateInRegion.Match.newMatch(pRegion);
372 }
373
374 /**
375 * Retrieve the set of values that occur in matches for region.
376 * @return the Set of all values or empty set if there are no matches
377 *
378 */
379 protected Stream<Region> rawStreamAllValuesOfregion(final Object[] parameters) {
380 return rawStreamAllValues(POSITION_REGION, parameters).map(Region.class::cast);
381 }
382
383 /**
384 * Retrieve the set of values that occur in matches for region.
385 * @return the Set of all values or empty set if there are no matches
386 *
387 */
388 public Set<Region> getAllValuesOfregion() {
389 return rawStreamAllValuesOfregion(emptyArray()).collect(Collectors.toSet());
390 }
391
392 /**
393 * Retrieve the set of values that occur in matches for region.
394 * @return the Set of all values or empty set if there are no matches
395 *
396 */
397 public Stream<Region> streamAllValuesOfregion() {
398 return rawStreamAllValuesOfregion(emptyArray());
399 }
400
401 @Override
402 protected NoStateInRegion.Match tupleToMatch(final Tuple t) {
403 try {
404 return NoStateInRegion.Match.newMatch((Region) t.get(POSITION_REGION));
405 } catch(ClassCastException e) {
406 LOGGER.error("Element(s) in tuple not properly typed!",e);
407 return null;
408 }
409 }
410
411 @Override
412 protected NoStateInRegion.Match arrayToMatch(final Object[] match) {
413 try {
414 return NoStateInRegion.Match.newMatch((Region) match[POSITION_REGION]);
415 } catch(ClassCastException e) {
416 LOGGER.error("Element(s) in array not properly typed!",e);
417 return null;
418 }
419 }
420
421 @Override
422 protected NoStateInRegion.Match arrayToMatchMutable(final Object[] match) {
423 try {
424 return NoStateInRegion.Match.newMutableMatch((Region) match[POSITION_REGION]);
425 } catch(ClassCastException e) {
426 LOGGER.error("Element(s) in array not properly typed!",e);
427 return null;
428 }
429 }
430
431 /**
432 * @return the singleton instance of the query specification of this pattern
433 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
434 *
435 */
436 public static IQuerySpecification<NoStateInRegion.Matcher> querySpecification() {
437 return NoStateInRegion.instance();
438 }
439 }
440
441 private NoStateInRegion() {
442 super(GeneratedPQuery.INSTANCE);
443 }
444
445 /**
446 * @return the singleton instance of the query specification
447 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
448 *
449 */
450 public static NoStateInRegion instance() {
451 try{
452 return LazyHolder.INSTANCE;
453 } catch (ExceptionInInitializerError err) {
454 throw processInitializerError(err);
455 }
456 }
457
458 @Override
459 protected NoStateInRegion.Matcher instantiate(final ViatraQueryEngine engine) {
460 return NoStateInRegion.Matcher.on(engine);
461 }
462
463 @Override
464 public NoStateInRegion.Matcher instantiate() {
465 return NoStateInRegion.Matcher.create();
466 }
467
468 @Override
469 public NoStateInRegion.Match newEmptyMatch() {
470 return NoStateInRegion.Match.newEmptyMatch();
471 }
472
473 @Override
474 public NoStateInRegion.Match newMatch(final Object... parameters) {
475 return NoStateInRegion.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Region) parameters[0]);
476 }
477
478 /**
479 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NoStateInRegion (visibility: PUBLIC, simpleName: NoStateInRegion, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NoStateInRegion, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
480 * <b>not</b> at the class load time of the outer class,
481 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NoStateInRegion (visibility: PUBLIC, simpleName: NoStateInRegion, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NoStateInRegion, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
482 *
483 * <p> This workaround is required e.g. to support recursion.
484 *
485 */
486 private static class LazyHolder {
487 private final static NoStateInRegion INSTANCE = new NoStateInRegion();
488
489 /**
490 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
491 * This initialization order is required to support indirect recursion.
492 *
493 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
494 *
495 */
496 private final static Object STATIC_INITIALIZER = ensureInitialized();
497
498 public static Object ensureInitialized() {
499 INSTANCE.ensureInitializedInternal();
500 return null;
501 }
502 }
503
504 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
505 private final static NoStateInRegion.GeneratedPQuery INSTANCE = new GeneratedPQuery();
506
507 private final PParameter parameter_region = new PParameter("region", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Region", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Region")), PParameterDirection.INOUT);
508
509 private final List<PParameter> parameters = Arrays.asList(parameter_region);
510
511 private GeneratedPQuery() {
512 super(PVisibility.PUBLIC);
513 }
514
515 @Override
516 public String getFullyQualifiedName() {
517 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.noStateInRegion";
518 }
519
520 @Override
521 public List<String> getParameterNames() {
522 return Arrays.asList("region");
523 }
524
525 @Override
526 public List<PParameter> getParameters() {
527 return parameters;
528 }
529
530 @Override
531 public Set<PBody> doGetContainedBodies() {
532 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
533 Set<PBody> bodies = new LinkedHashSet<>();
534 {
535 PBody body = new PBody(this);
536 PVariable var_region = body.getOrCreateVariableByName("region");
537 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
538 new TypeConstraint(body, Tuples.flatTupleOf(var_region), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
539 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
540 new ExportedParameter(body, var_region, parameter_region)
541 ));
542 // neg find StateInRegion(region,_)
543 new NegativePatternCall(body, Tuples.flatTupleOf(var_region, var___0_), StateInRegion.instance().getInternalQueryRepresentation());
544 bodies.add(body);
545 }
546 {
547 PAnnotation annotation = new PAnnotation("Constraint");
548 annotation.addAttribute("severity", "error");
549 annotation.addAttribute("message", "error");
550 annotation.addAttribute("key", Arrays.asList(new Object[] {
551 new ParameterReference("region")
552 }));
553 addAnnotation(annotation);
554 }
555 return bodies;
556 }
557 }
558}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NotSynchronizingStates.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NotSynchronizingStates.java
deleted file mode 100644
index b9a60ca9..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/NotSynchronizingStates.java
+++ /dev/null
@@ -1,554 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleIncomingTrainsition;
8import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleOutgoingTrainsition;
9import java.util.Arrays;
10import java.util.Collection;
11import java.util.LinkedHashSet;
12import java.util.List;
13import java.util.Objects;
14import java.util.Optional;
15import java.util.Set;
16import java.util.function.Consumer;
17import java.util.stream.Collectors;
18import java.util.stream.Stream;
19import org.apache.log4j.Logger;
20import org.eclipse.emf.ecore.EClass;
21import org.eclipse.viatra.query.runtime.api.IPatternMatch;
22import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
23import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
25import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
26import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
27import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
28import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
29import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
31import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
33import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
39import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
41import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
42import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
43
44/**
45 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
46 *
47 * <p>Original source:
48 * <code><pre>
49 * {@literal @}Constraint(severity="error", message="error", key = {s})
50 * pattern notSynchronizingStates(s : Synchronization) {
51 * neg find hasMultipleOutgoingTrainsition(s);
52 * neg find hasMultipleIncomingTrainsition(s);
53 * }
54 * </pre></code>
55 *
56 * @see Matcher
57 * @see Match
58 *
59 */
60@SuppressWarnings("all")
61public final class NotSynchronizingStates extends BaseGeneratedEMFQuerySpecification<NotSynchronizingStates.Matcher> {
62 /**
63 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.notSynchronizingStates pattern,
64 * to be used in conjunction with {@link Matcher}.
65 *
66 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
67 * Each instance is a (possibly partial) substitution of pattern parameters,
68 * usable to represent a match of the pattern in the result of a query,
69 * or to specify the bound (fixed) input parameters when issuing a query.
70 *
71 * @see Matcher
72 *
73 */
74 public static abstract class Match extends BasePatternMatch {
75 private Synchronization fS;
76
77 private static List<String> parameterNames = makeImmutableList("s");
78
79 private Match(final Synchronization pS) {
80 this.fS = pS;
81 }
82
83 @Override
84 public Object get(final String parameterName) {
85 if ("s".equals(parameterName)) return this.fS;
86 return null;
87 }
88
89 public Synchronization getS() {
90 return this.fS;
91 }
92
93 @Override
94 public boolean set(final String parameterName, final Object newValue) {
95 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
96 if ("s".equals(parameterName) ) {
97 this.fS = (Synchronization) newValue;
98 return true;
99 }
100 return false;
101 }
102
103 public void setS(final Synchronization pS) {
104 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
105 this.fS = pS;
106 }
107
108 @Override
109 public String patternName() {
110 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.notSynchronizingStates";
111 }
112
113 @Override
114 public List<String> parameterNames() {
115 return NotSynchronizingStates.Match.parameterNames;
116 }
117
118 @Override
119 public Object[] toArray() {
120 return new Object[]{fS};
121 }
122
123 @Override
124 public NotSynchronizingStates.Match toImmutable() {
125 return isMutable() ? newMatch(fS) : this;
126 }
127
128 @Override
129 public String prettyPrint() {
130 StringBuilder result = new StringBuilder();
131 result.append("\"s\"=" + prettyPrintValue(fS));
132 return result.toString();
133 }
134
135 @Override
136 public int hashCode() {
137 return Objects.hash(fS);
138 }
139
140 @Override
141 public boolean equals(final Object obj) {
142 if (this == obj)
143 return true;
144 if (obj == null) {
145 return false;
146 }
147 if ((obj instanceof NotSynchronizingStates.Match)) {
148 NotSynchronizingStates.Match other = (NotSynchronizingStates.Match) obj;
149 return Objects.equals(fS, other.fS);
150 } else {
151 // this should be infrequent
152 if (!(obj instanceof IPatternMatch)) {
153 return false;
154 }
155 IPatternMatch otherSig = (IPatternMatch) obj;
156 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
157 }
158 }
159
160 @Override
161 public NotSynchronizingStates specification() {
162 return NotSynchronizingStates.instance();
163 }
164
165 /**
166 * Returns an empty, mutable match.
167 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
168 *
169 * @return the empty match.
170 *
171 */
172 public static NotSynchronizingStates.Match newEmptyMatch() {
173 return new Mutable(null);
174 }
175
176 /**
177 * Returns a mutable (partial) match.
178 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
179 *
180 * @param pS the fixed value of pattern parameter s, or null if not bound.
181 * @return the new, mutable (partial) match object.
182 *
183 */
184 public static NotSynchronizingStates.Match newMutableMatch(final Synchronization pS) {
185 return new Mutable(pS);
186 }
187
188 /**
189 * Returns a new (partial) match.
190 * This can be used e.g. to call the matcher with a partial match.
191 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
192 * @param pS the fixed value of pattern parameter s, or null if not bound.
193 * @return the (partial) match object.
194 *
195 */
196 public static NotSynchronizingStates.Match newMatch(final Synchronization pS) {
197 return new Immutable(pS);
198 }
199
200 private static final class Mutable extends NotSynchronizingStates.Match {
201 Mutable(final Synchronization pS) {
202 super(pS);
203 }
204
205 @Override
206 public boolean isMutable() {
207 return true;
208 }
209 }
210
211 private static final class Immutable extends NotSynchronizingStates.Match {
212 Immutable(final Synchronization pS) {
213 super(pS);
214 }
215
216 @Override
217 public boolean isMutable() {
218 return false;
219 }
220 }
221 }
222
223 /**
224 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.notSynchronizingStates pattern,
225 * providing pattern-specific query methods.
226 *
227 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
228 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
229 *
230 * <p>Matches of the pattern will be represented as {@link Match}.
231 *
232 * <p>Original source:
233 * <code><pre>
234 * {@literal @}Constraint(severity="error", message="error", key = {s})
235 * pattern notSynchronizingStates(s : Synchronization) {
236 * neg find hasMultipleOutgoingTrainsition(s);
237 * neg find hasMultipleIncomingTrainsition(s);
238 * }
239 * </pre></code>
240 *
241 * @see Match
242 * @see NotSynchronizingStates
243 *
244 */
245 public static class Matcher extends BaseMatcher<NotSynchronizingStates.Match> {
246 /**
247 * Initializes the pattern matcher within an existing VIATRA Query engine.
248 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
249 *
250 * @param engine the existing VIATRA Query engine in which this matcher will be created.
251 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
252 *
253 */
254 public static NotSynchronizingStates.Matcher on(final ViatraQueryEngine engine) {
255 // check if matcher already exists
256 Matcher matcher = engine.getExistingMatcher(querySpecification());
257 if (matcher == null) {
258 matcher = (Matcher)engine.getMatcher(querySpecification());
259 }
260 return matcher;
261 }
262
263 /**
264 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
265 * @return an initialized matcher
266 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
267 *
268 */
269 public static NotSynchronizingStates.Matcher create() {
270 return new Matcher();
271 }
272
273 private final static int POSITION_S = 0;
274
275 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NotSynchronizingStates.Matcher.class);
276
277 /**
278 * Initializes the pattern matcher within an existing VIATRA Query engine.
279 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
280 *
281 * @param engine the existing VIATRA Query engine in which this matcher will be created.
282 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
283 *
284 */
285 private Matcher() {
286 super(querySpecification());
287 }
288
289 /**
290 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
291 * @param pS the fixed value of pattern parameter s, or null if not bound.
292 * @return matches represented as a Match object.
293 *
294 */
295 public Collection<NotSynchronizingStates.Match> getAllMatches(final Synchronization pS) {
296 return rawStreamAllMatches(new Object[]{pS}).collect(Collectors.toSet());
297 }
298
299 /**
300 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
301 * </p>
302 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
303 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
304 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
305 * @param pS the fixed value of pattern parameter s, or null if not bound.
306 * @return a stream of matches represented as a Match object.
307 *
308 */
309 public Stream<NotSynchronizingStates.Match> streamAllMatches(final Synchronization pS) {
310 return rawStreamAllMatches(new Object[]{pS});
311 }
312
313 /**
314 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
315 * Neither determinism nor randomness of selection is guaranteed.
316 * @param pS the fixed value of pattern parameter s, or null if not bound.
317 * @return a match represented as a Match object, or null if no match is found.
318 *
319 */
320 public Optional<NotSynchronizingStates.Match> getOneArbitraryMatch(final Synchronization pS) {
321 return rawGetOneArbitraryMatch(new Object[]{pS});
322 }
323
324 /**
325 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
326 * under any possible substitution of the unspecified parameters (if any).
327 * @param pS the fixed value of pattern parameter s, or null if not bound.
328 * @return true if the input is a valid (partial) match of the pattern.
329 *
330 */
331 public boolean hasMatch(final Synchronization pS) {
332 return rawHasMatch(new Object[]{pS});
333 }
334
335 /**
336 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
337 * @param pS the fixed value of pattern parameter s, or null if not bound.
338 * @return the number of pattern matches found.
339 *
340 */
341 public int countMatches(final Synchronization pS) {
342 return rawCountMatches(new Object[]{pS});
343 }
344
345 /**
346 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
347 * Neither determinism nor randomness of selection is guaranteed.
348 * @param pS the fixed value of pattern parameter s, or null if not bound.
349 * @param processor the action that will process the selected match.
350 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
351 *
352 */
353 public boolean forOneArbitraryMatch(final Synchronization pS, final Consumer<? super NotSynchronizingStates.Match> processor) {
354 return rawForOneArbitraryMatch(new Object[]{pS}, processor);
355 }
356
357 /**
358 * Returns a new (partial) match.
359 * This can be used e.g. to call the matcher with a partial match.
360 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
361 * @param pS the fixed value of pattern parameter s, or null if not bound.
362 * @return the (partial) match object.
363 *
364 */
365 public NotSynchronizingStates.Match newMatch(final Synchronization pS) {
366 return NotSynchronizingStates.Match.newMatch(pS);
367 }
368
369 /**
370 * Retrieve the set of values that occur in matches for s.
371 * @return the Set of all values or empty set if there are no matches
372 *
373 */
374 protected Stream<Synchronization> rawStreamAllValuesOfs(final Object[] parameters) {
375 return rawStreamAllValues(POSITION_S, parameters).map(Synchronization.class::cast);
376 }
377
378 /**
379 * Retrieve the set of values that occur in matches for s.
380 * @return the Set of all values or empty set if there are no matches
381 *
382 */
383 public Set<Synchronization> getAllValuesOfs() {
384 return rawStreamAllValuesOfs(emptyArray()).collect(Collectors.toSet());
385 }
386
387 /**
388 * Retrieve the set of values that occur in matches for s.
389 * @return the Set of all values or empty set if there are no matches
390 *
391 */
392 public Stream<Synchronization> streamAllValuesOfs() {
393 return rawStreamAllValuesOfs(emptyArray());
394 }
395
396 @Override
397 protected NotSynchronizingStates.Match tupleToMatch(final Tuple t) {
398 try {
399 return NotSynchronizingStates.Match.newMatch((Synchronization) t.get(POSITION_S));
400 } catch(ClassCastException e) {
401 LOGGER.error("Element(s) in tuple not properly typed!",e);
402 return null;
403 }
404 }
405
406 @Override
407 protected NotSynchronizingStates.Match arrayToMatch(final Object[] match) {
408 try {
409 return NotSynchronizingStates.Match.newMatch((Synchronization) match[POSITION_S]);
410 } catch(ClassCastException e) {
411 LOGGER.error("Element(s) in array not properly typed!",e);
412 return null;
413 }
414 }
415
416 @Override
417 protected NotSynchronizingStates.Match arrayToMatchMutable(final Object[] match) {
418 try {
419 return NotSynchronizingStates.Match.newMutableMatch((Synchronization) match[POSITION_S]);
420 } catch(ClassCastException e) {
421 LOGGER.error("Element(s) in array not properly typed!",e);
422 return null;
423 }
424 }
425
426 /**
427 * @return the singleton instance of the query specification of this pattern
428 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
429 *
430 */
431 public static IQuerySpecification<NotSynchronizingStates.Matcher> querySpecification() {
432 return NotSynchronizingStates.instance();
433 }
434 }
435
436 private NotSynchronizingStates() {
437 super(GeneratedPQuery.INSTANCE);
438 }
439
440 /**
441 * @return the singleton instance of the query specification
442 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
443 *
444 */
445 public static NotSynchronizingStates instance() {
446 try{
447 return LazyHolder.INSTANCE;
448 } catch (ExceptionInInitializerError err) {
449 throw processInitializerError(err);
450 }
451 }
452
453 @Override
454 protected NotSynchronizingStates.Matcher instantiate(final ViatraQueryEngine engine) {
455 return NotSynchronizingStates.Matcher.on(engine);
456 }
457
458 @Override
459 public NotSynchronizingStates.Matcher instantiate() {
460 return NotSynchronizingStates.Matcher.create();
461 }
462
463 @Override
464 public NotSynchronizingStates.Match newEmptyMatch() {
465 return NotSynchronizingStates.Match.newEmptyMatch();
466 }
467
468 @Override
469 public NotSynchronizingStates.Match newMatch(final Object... parameters) {
470 return NotSynchronizingStates.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization) parameters[0]);
471 }
472
473 /**
474 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NotSynchronizingStates (visibility: PUBLIC, simpleName: NotSynchronizingStates, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NotSynchronizingStates, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
475 * <b>not</b> at the class load time of the outer class,
476 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NotSynchronizingStates (visibility: PUBLIC, simpleName: NotSynchronizingStates, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.NotSynchronizingStates, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
477 *
478 * <p> This workaround is required e.g. to support recursion.
479 *
480 */
481 private static class LazyHolder {
482 private final static NotSynchronizingStates INSTANCE = new NotSynchronizingStates();
483
484 /**
485 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
486 * This initialization order is required to support indirect recursion.
487 *
488 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
489 *
490 */
491 private final static Object STATIC_INITIALIZER = ensureInitialized();
492
493 public static Object ensureInitialized() {
494 INSTANCE.ensureInitializedInternal();
495 return null;
496 }
497 }
498
499 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
500 private final static NotSynchronizingStates.GeneratedPQuery INSTANCE = new GeneratedPQuery();
501
502 private final PParameter parameter_s = new PParameter("s", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Synchronization")), PParameterDirection.INOUT);
503
504 private final List<PParameter> parameters = Arrays.asList(parameter_s);
505
506 private GeneratedPQuery() {
507 super(PVisibility.PUBLIC);
508 }
509
510 @Override
511 public String getFullyQualifiedName() {
512 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.notSynchronizingStates";
513 }
514
515 @Override
516 public List<String> getParameterNames() {
517 return Arrays.asList("s");
518 }
519
520 @Override
521 public List<PParameter> getParameters() {
522 return parameters;
523 }
524
525 @Override
526 public Set<PBody> doGetContainedBodies() {
527 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
528 Set<PBody> bodies = new LinkedHashSet<>();
529 {
530 PBody body = new PBody(this);
531 PVariable var_s = body.getOrCreateVariableByName("s");
532 new TypeConstraint(body, Tuples.flatTupleOf(var_s), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
533 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
534 new ExportedParameter(body, var_s, parameter_s)
535 ));
536 // neg find hasMultipleOutgoingTrainsition(s)
537 new NegativePatternCall(body, Tuples.flatTupleOf(var_s), HasMultipleOutgoingTrainsition.instance().getInternalQueryRepresentation());
538 // neg find hasMultipleIncomingTrainsition(s)
539 new NegativePatternCall(body, Tuples.flatTupleOf(var_s), HasMultipleIncomingTrainsition.instance().getInternalQueryRepresentation());
540 bodies.add(body);
541 }
542 {
543 PAnnotation annotation = new PAnnotation("Constraint");
544 annotation.addAttribute("severity", "error");
545 annotation.addAttribute("message", "error");
546 annotation.addAttribute("key", Arrays.asList(new Object[] {
547 new ParameterReference("s")
548 }));
549 addAnnotation(annotation);
550 }
551 return bodies;
552 }
553 }
554}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/OutgoingFromExit.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/OutgoingFromExit.java
deleted file mode 100644
index 10f0e056..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/OutgoingFromExit.java
+++ /dev/null
@@ -1,715 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Exit;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
29import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
31import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
33import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
39import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
41import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
42import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
43
44/**
45 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
46 *
47 * <p>Original source:
48 * <code><pre>
49 * /////////
50 * // Exit
51 * /////////
52 *
53 * {@literal @}Constraint(severity="error", message="error", key = {e})
54 * pattern outgoingFromExit(t : Transition, e : Exit) {
55 * Exit.outgoingTransitions(e,t);
56 * }
57 * </pre></code>
58 *
59 * @see Matcher
60 * @see Match
61 *
62 */
63@SuppressWarnings("all")
64public final class OutgoingFromExit extends BaseGeneratedEMFQuerySpecification<OutgoingFromExit.Matcher> {
65 /**
66 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromExit pattern,
67 * to be used in conjunction with {@link Matcher}.
68 *
69 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
70 * Each instance is a (possibly partial) substitution of pattern parameters,
71 * usable to represent a match of the pattern in the result of a query,
72 * or to specify the bound (fixed) input parameters when issuing a query.
73 *
74 * @see Matcher
75 *
76 */
77 public static abstract class Match extends BasePatternMatch {
78 private Transition fT;
79
80 private Exit fE;
81
82 private static List<String> parameterNames = makeImmutableList("t", "e");
83
84 private Match(final Transition pT, final Exit pE) {
85 this.fT = pT;
86 this.fE = pE;
87 }
88
89 @Override
90 public Object get(final String parameterName) {
91 if ("t".equals(parameterName)) return this.fT;
92 if ("e".equals(parameterName)) return this.fE;
93 return null;
94 }
95
96 public Transition getT() {
97 return this.fT;
98 }
99
100 public Exit getE() {
101 return this.fE;
102 }
103
104 @Override
105 public boolean set(final String parameterName, final Object newValue) {
106 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
107 if ("t".equals(parameterName) ) {
108 this.fT = (Transition) newValue;
109 return true;
110 }
111 if ("e".equals(parameterName) ) {
112 this.fE = (Exit) newValue;
113 return true;
114 }
115 return false;
116 }
117
118 public void setT(final Transition pT) {
119 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
120 this.fT = pT;
121 }
122
123 public void setE(final Exit pE) {
124 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
125 this.fE = pE;
126 }
127
128 @Override
129 public String patternName() {
130 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromExit";
131 }
132
133 @Override
134 public List<String> parameterNames() {
135 return OutgoingFromExit.Match.parameterNames;
136 }
137
138 @Override
139 public Object[] toArray() {
140 return new Object[]{fT, fE};
141 }
142
143 @Override
144 public OutgoingFromExit.Match toImmutable() {
145 return isMutable() ? newMatch(fT, fE) : this;
146 }
147
148 @Override
149 public String prettyPrint() {
150 StringBuilder result = new StringBuilder();
151 result.append("\"t\"=" + prettyPrintValue(fT) + ", ");
152 result.append("\"e\"=" + prettyPrintValue(fE));
153 return result.toString();
154 }
155
156 @Override
157 public int hashCode() {
158 return Objects.hash(fT, fE);
159 }
160
161 @Override
162 public boolean equals(final Object obj) {
163 if (this == obj)
164 return true;
165 if (obj == null) {
166 return false;
167 }
168 if ((obj instanceof OutgoingFromExit.Match)) {
169 OutgoingFromExit.Match other = (OutgoingFromExit.Match) obj;
170 return Objects.equals(fT, other.fT) && Objects.equals(fE, other.fE);
171 } else {
172 // this should be infrequent
173 if (!(obj instanceof IPatternMatch)) {
174 return false;
175 }
176 IPatternMatch otherSig = (IPatternMatch) obj;
177 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
178 }
179 }
180
181 @Override
182 public OutgoingFromExit specification() {
183 return OutgoingFromExit.instance();
184 }
185
186 /**
187 * Returns an empty, mutable match.
188 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
189 *
190 * @return the empty match.
191 *
192 */
193 public static OutgoingFromExit.Match newEmptyMatch() {
194 return new Mutable(null, null);
195 }
196
197 /**
198 * Returns a mutable (partial) match.
199 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
200 *
201 * @param pT the fixed value of pattern parameter t, or null if not bound.
202 * @param pE the fixed value of pattern parameter e, or null if not bound.
203 * @return the new, mutable (partial) match object.
204 *
205 */
206 public static OutgoingFromExit.Match newMutableMatch(final Transition pT, final Exit pE) {
207 return new Mutable(pT, pE);
208 }
209
210 /**
211 * Returns a new (partial) match.
212 * This can be used e.g. to call the matcher with a partial match.
213 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
214 * @param pT the fixed value of pattern parameter t, or null if not bound.
215 * @param pE the fixed value of pattern parameter e, or null if not bound.
216 * @return the (partial) match object.
217 *
218 */
219 public static OutgoingFromExit.Match newMatch(final Transition pT, final Exit pE) {
220 return new Immutable(pT, pE);
221 }
222
223 private static final class Mutable extends OutgoingFromExit.Match {
224 Mutable(final Transition pT, final Exit pE) {
225 super(pT, pE);
226 }
227
228 @Override
229 public boolean isMutable() {
230 return true;
231 }
232 }
233
234 private static final class Immutable extends OutgoingFromExit.Match {
235 Immutable(final Transition pT, final Exit pE) {
236 super(pT, pE);
237 }
238
239 @Override
240 public boolean isMutable() {
241 return false;
242 }
243 }
244 }
245
246 /**
247 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromExit pattern,
248 * providing pattern-specific query methods.
249 *
250 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
251 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
252 *
253 * <p>Matches of the pattern will be represented as {@link Match}.
254 *
255 * <p>Original source:
256 * <code><pre>
257 * /////////
258 * // Exit
259 * /////////
260 *
261 * {@literal @}Constraint(severity="error", message="error", key = {e})
262 * pattern outgoingFromExit(t : Transition, e : Exit) {
263 * Exit.outgoingTransitions(e,t);
264 * }
265 * </pre></code>
266 *
267 * @see Match
268 * @see OutgoingFromExit
269 *
270 */
271 public static class Matcher extends BaseMatcher<OutgoingFromExit.Match> {
272 /**
273 * Initializes the pattern matcher within an existing VIATRA Query engine.
274 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
275 *
276 * @param engine the existing VIATRA Query engine in which this matcher will be created.
277 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
278 *
279 */
280 public static OutgoingFromExit.Matcher on(final ViatraQueryEngine engine) {
281 // check if matcher already exists
282 Matcher matcher = engine.getExistingMatcher(querySpecification());
283 if (matcher == null) {
284 matcher = (Matcher)engine.getMatcher(querySpecification());
285 }
286 return matcher;
287 }
288
289 /**
290 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
291 * @return an initialized matcher
292 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
293 *
294 */
295 public static OutgoingFromExit.Matcher create() {
296 return new Matcher();
297 }
298
299 private final static int POSITION_T = 0;
300
301 private final static int POSITION_E = 1;
302
303 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(OutgoingFromExit.Matcher.class);
304
305 /**
306 * Initializes the pattern matcher within an existing VIATRA Query engine.
307 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
308 *
309 * @param engine the existing VIATRA Query engine in which this matcher will be created.
310 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
311 *
312 */
313 private Matcher() {
314 super(querySpecification());
315 }
316
317 /**
318 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
319 * @param pT the fixed value of pattern parameter t, or null if not bound.
320 * @param pE the fixed value of pattern parameter e, or null if not bound.
321 * @return matches represented as a Match object.
322 *
323 */
324 public Collection<OutgoingFromExit.Match> getAllMatches(final Transition pT, final Exit pE) {
325 return rawStreamAllMatches(new Object[]{pT, pE}).collect(Collectors.toSet());
326 }
327
328 /**
329 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
330 * </p>
331 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
332 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
333 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
334 * @param pT the fixed value of pattern parameter t, or null if not bound.
335 * @param pE the fixed value of pattern parameter e, or null if not bound.
336 * @return a stream of matches represented as a Match object.
337 *
338 */
339 public Stream<OutgoingFromExit.Match> streamAllMatches(final Transition pT, final Exit pE) {
340 return rawStreamAllMatches(new Object[]{pT, pE});
341 }
342
343 /**
344 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
345 * Neither determinism nor randomness of selection is guaranteed.
346 * @param pT the fixed value of pattern parameter t, or null if not bound.
347 * @param pE the fixed value of pattern parameter e, or null if not bound.
348 * @return a match represented as a Match object, or null if no match is found.
349 *
350 */
351 public Optional<OutgoingFromExit.Match> getOneArbitraryMatch(final Transition pT, final Exit pE) {
352 return rawGetOneArbitraryMatch(new Object[]{pT, pE});
353 }
354
355 /**
356 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
357 * under any possible substitution of the unspecified parameters (if any).
358 * @param pT the fixed value of pattern parameter t, or null if not bound.
359 * @param pE the fixed value of pattern parameter e, or null if not bound.
360 * @return true if the input is a valid (partial) match of the pattern.
361 *
362 */
363 public boolean hasMatch(final Transition pT, final Exit pE) {
364 return rawHasMatch(new Object[]{pT, pE});
365 }
366
367 /**
368 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
369 * @param pT the fixed value of pattern parameter t, or null if not bound.
370 * @param pE the fixed value of pattern parameter e, or null if not bound.
371 * @return the number of pattern matches found.
372 *
373 */
374 public int countMatches(final Transition pT, final Exit pE) {
375 return rawCountMatches(new Object[]{pT, pE});
376 }
377
378 /**
379 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
380 * Neither determinism nor randomness of selection is guaranteed.
381 * @param pT the fixed value of pattern parameter t, or null if not bound.
382 * @param pE the fixed value of pattern parameter e, or null if not bound.
383 * @param processor the action that will process the selected match.
384 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
385 *
386 */
387 public boolean forOneArbitraryMatch(final Transition pT, final Exit pE, final Consumer<? super OutgoingFromExit.Match> processor) {
388 return rawForOneArbitraryMatch(new Object[]{pT, pE}, processor);
389 }
390
391 /**
392 * Returns a new (partial) match.
393 * This can be used e.g. to call the matcher with a partial match.
394 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
395 * @param pT the fixed value of pattern parameter t, or null if not bound.
396 * @param pE the fixed value of pattern parameter e, or null if not bound.
397 * @return the (partial) match object.
398 *
399 */
400 public OutgoingFromExit.Match newMatch(final Transition pT, final Exit pE) {
401 return OutgoingFromExit.Match.newMatch(pT, pE);
402 }
403
404 /**
405 * Retrieve the set of values that occur in matches for t.
406 * @return the Set of all values or empty set if there are no matches
407 *
408 */
409 protected Stream<Transition> rawStreamAllValuesOft(final Object[] parameters) {
410 return rawStreamAllValues(POSITION_T, parameters).map(Transition.class::cast);
411 }
412
413 /**
414 * Retrieve the set of values that occur in matches for t.
415 * @return the Set of all values or empty set if there are no matches
416 *
417 */
418 public Set<Transition> getAllValuesOft() {
419 return rawStreamAllValuesOft(emptyArray()).collect(Collectors.toSet());
420 }
421
422 /**
423 * Retrieve the set of values that occur in matches for t.
424 * @return the Set of all values or empty set if there are no matches
425 *
426 */
427 public Stream<Transition> streamAllValuesOft() {
428 return rawStreamAllValuesOft(emptyArray());
429 }
430
431 /**
432 * Retrieve the set of values that occur in matches for t.
433 * </p>
434 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
435 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
436 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
437 *
438 * @return the Stream of all values or empty set if there are no matches
439 *
440 */
441 public Stream<Transition> streamAllValuesOft(final OutgoingFromExit.Match partialMatch) {
442 return rawStreamAllValuesOft(partialMatch.toArray());
443 }
444
445 /**
446 * Retrieve the set of values that occur in matches for t.
447 * </p>
448 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
449 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
450 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
451 *
452 * @return the Stream of all values or empty set if there are no matches
453 *
454 */
455 public Stream<Transition> streamAllValuesOft(final Exit pE) {
456 return rawStreamAllValuesOft(new Object[]{null, pE});
457 }
458
459 /**
460 * Retrieve the set of values that occur in matches for t.
461 * @return the Set of all values or empty set if there are no matches
462 *
463 */
464 public Set<Transition> getAllValuesOft(final OutgoingFromExit.Match partialMatch) {
465 return rawStreamAllValuesOft(partialMatch.toArray()).collect(Collectors.toSet());
466 }
467
468 /**
469 * Retrieve the set of values that occur in matches for t.
470 * @return the Set of all values or empty set if there are no matches
471 *
472 */
473 public Set<Transition> getAllValuesOft(final Exit pE) {
474 return rawStreamAllValuesOft(new Object[]{null, pE}).collect(Collectors.toSet());
475 }
476
477 /**
478 * Retrieve the set of values that occur in matches for e.
479 * @return the Set of all values or empty set if there are no matches
480 *
481 */
482 protected Stream<Exit> rawStreamAllValuesOfe(final Object[] parameters) {
483 return rawStreamAllValues(POSITION_E, parameters).map(Exit.class::cast);
484 }
485
486 /**
487 * Retrieve the set of values that occur in matches for e.
488 * @return the Set of all values or empty set if there are no matches
489 *
490 */
491 public Set<Exit> getAllValuesOfe() {
492 return rawStreamAllValuesOfe(emptyArray()).collect(Collectors.toSet());
493 }
494
495 /**
496 * Retrieve the set of values that occur in matches for e.
497 * @return the Set of all values or empty set if there are no matches
498 *
499 */
500 public Stream<Exit> streamAllValuesOfe() {
501 return rawStreamAllValuesOfe(emptyArray());
502 }
503
504 /**
505 * Retrieve the set of values that occur in matches for e.
506 * </p>
507 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
508 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
509 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
510 *
511 * @return the Stream of all values or empty set if there are no matches
512 *
513 */
514 public Stream<Exit> streamAllValuesOfe(final OutgoingFromExit.Match partialMatch) {
515 return rawStreamAllValuesOfe(partialMatch.toArray());
516 }
517
518 /**
519 * Retrieve the set of values that occur in matches for e.
520 * </p>
521 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
522 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
523 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
524 *
525 * @return the Stream of all values or empty set if there are no matches
526 *
527 */
528 public Stream<Exit> streamAllValuesOfe(final Transition pT) {
529 return rawStreamAllValuesOfe(new Object[]{pT, null});
530 }
531
532 /**
533 * Retrieve the set of values that occur in matches for e.
534 * @return the Set of all values or empty set if there are no matches
535 *
536 */
537 public Set<Exit> getAllValuesOfe(final OutgoingFromExit.Match partialMatch) {
538 return rawStreamAllValuesOfe(partialMatch.toArray()).collect(Collectors.toSet());
539 }
540
541 /**
542 * Retrieve the set of values that occur in matches for e.
543 * @return the Set of all values or empty set if there are no matches
544 *
545 */
546 public Set<Exit> getAllValuesOfe(final Transition pT) {
547 return rawStreamAllValuesOfe(new Object[]{pT, null}).collect(Collectors.toSet());
548 }
549
550 @Override
551 protected OutgoingFromExit.Match tupleToMatch(final Tuple t) {
552 try {
553 return OutgoingFromExit.Match.newMatch((Transition) t.get(POSITION_T), (Exit) t.get(POSITION_E));
554 } catch(ClassCastException e) {
555 LOGGER.error("Element(s) in tuple not properly typed!",e);
556 return null;
557 }
558 }
559
560 @Override
561 protected OutgoingFromExit.Match arrayToMatch(final Object[] match) {
562 try {
563 return OutgoingFromExit.Match.newMatch((Transition) match[POSITION_T], (Exit) match[POSITION_E]);
564 } catch(ClassCastException e) {
565 LOGGER.error("Element(s) in array not properly typed!",e);
566 return null;
567 }
568 }
569
570 @Override
571 protected OutgoingFromExit.Match arrayToMatchMutable(final Object[] match) {
572 try {
573 return OutgoingFromExit.Match.newMutableMatch((Transition) match[POSITION_T], (Exit) match[POSITION_E]);
574 } catch(ClassCastException e) {
575 LOGGER.error("Element(s) in array not properly typed!",e);
576 return null;
577 }
578 }
579
580 /**
581 * @return the singleton instance of the query specification of this pattern
582 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
583 *
584 */
585 public static IQuerySpecification<OutgoingFromExit.Matcher> querySpecification() {
586 return OutgoingFromExit.instance();
587 }
588 }
589
590 private OutgoingFromExit() {
591 super(GeneratedPQuery.INSTANCE);
592 }
593
594 /**
595 * @return the singleton instance of the query specification
596 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
597 *
598 */
599 public static OutgoingFromExit instance() {
600 try{
601 return LazyHolder.INSTANCE;
602 } catch (ExceptionInInitializerError err) {
603 throw processInitializerError(err);
604 }
605 }
606
607 @Override
608 protected OutgoingFromExit.Matcher instantiate(final ViatraQueryEngine engine) {
609 return OutgoingFromExit.Matcher.on(engine);
610 }
611
612 @Override
613 public OutgoingFromExit.Matcher instantiate() {
614 return OutgoingFromExit.Matcher.create();
615 }
616
617 @Override
618 public OutgoingFromExit.Match newEmptyMatch() {
619 return OutgoingFromExit.Match.newEmptyMatch();
620 }
621
622 @Override
623 public OutgoingFromExit.Match newMatch(final Object... parameters) {
624 return OutgoingFromExit.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition) parameters[0], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Exit) parameters[1]);
625 }
626
627 /**
628 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.OutgoingFromExit (visibility: PUBLIC, simpleName: OutgoingFromExit, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.OutgoingFromExit, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
629 * <b>not</b> at the class load time of the outer class,
630 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.OutgoingFromExit (visibility: PUBLIC, simpleName: OutgoingFromExit, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.OutgoingFromExit, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
631 *
632 * <p> This workaround is required e.g. to support recursion.
633 *
634 */
635 private static class LazyHolder {
636 private final static OutgoingFromExit INSTANCE = new OutgoingFromExit();
637
638 /**
639 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
640 * This initialization order is required to support indirect recursion.
641 *
642 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
643 *
644 */
645 private final static Object STATIC_INITIALIZER = ensureInitialized();
646
647 public static Object ensureInitialized() {
648 INSTANCE.ensureInitializedInternal();
649 return null;
650 }
651 }
652
653 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
654 private final static OutgoingFromExit.GeneratedPQuery INSTANCE = new GeneratedPQuery();
655
656 private final PParameter parameter_t = new PParameter("t", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Transition")), PParameterDirection.INOUT);
657
658 private final PParameter parameter_e = new PParameter("e", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Exit", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Exit")), PParameterDirection.INOUT);
659
660 private final List<PParameter> parameters = Arrays.asList(parameter_t, parameter_e);
661
662 private GeneratedPQuery() {
663 super(PVisibility.PUBLIC);
664 }
665
666 @Override
667 public String getFullyQualifiedName() {
668 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromExit";
669 }
670
671 @Override
672 public List<String> getParameterNames() {
673 return Arrays.asList("t","e");
674 }
675
676 @Override
677 public List<PParameter> getParameters() {
678 return parameters;
679 }
680
681 @Override
682 public Set<PBody> doGetContainedBodies() {
683 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
684 Set<PBody> bodies = new LinkedHashSet<>();
685 {
686 PBody body = new PBody(this);
687 PVariable var_t = body.getOrCreateVariableByName("t");
688 PVariable var_e = body.getOrCreateVariableByName("e");
689 new TypeConstraint(body, Tuples.flatTupleOf(var_t), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
690 new TypeConstraint(body, Tuples.flatTupleOf(var_e), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Exit")));
691 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
692 new ExportedParameter(body, var_t, parameter_t),
693 new ExportedParameter(body, var_e, parameter_e)
694 ));
695 // Exit.outgoingTransitions(e,t)
696 new TypeConstraint(body, Tuples.flatTupleOf(var_e), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Exit")));
697 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
698 new TypeConstraint(body, Tuples.flatTupleOf(var_e, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Vertex", "outgoingTransitions")));
699 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
700 new Equality(body, var__virtual_0_, var_t);
701 bodies.add(body);
702 }
703 {
704 PAnnotation annotation = new PAnnotation("Constraint");
705 annotation.addAttribute("severity", "error");
706 annotation.addAttribute("message", "error");
707 annotation.addAttribute("key", Arrays.asList(new Object[] {
708 new ParameterReference("e")
709 }));
710 addAnnotation(annotation);
711 }
712 return bodies;
713 }
714 }
715}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/OutgoingFromFinal.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/OutgoingFromFinal.java
deleted file mode 100644
index fbac352b..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/OutgoingFromFinal.java
+++ /dev/null
@@ -1,715 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.FinalState;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
29import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
31import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
33import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
39import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
41import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
42import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
43
44/**
45 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
46 *
47 * <p>Original source:
48 * <code><pre>
49 * /////////
50 * // Final
51 * /////////
52 *
53 * {@literal @}Constraint(severity="error", message="error", key = {f})
54 * pattern outgoingFromFinal(t : Transition, f : FinalState) {
55 * FinalState.outgoingTransitions(f,t);
56 * }
57 * </pre></code>
58 *
59 * @see Matcher
60 * @see Match
61 *
62 */
63@SuppressWarnings("all")
64public final class OutgoingFromFinal extends BaseGeneratedEMFQuerySpecification<OutgoingFromFinal.Matcher> {
65 /**
66 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromFinal pattern,
67 * to be used in conjunction with {@link Matcher}.
68 *
69 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
70 * Each instance is a (possibly partial) substitution of pattern parameters,
71 * usable to represent a match of the pattern in the result of a query,
72 * or to specify the bound (fixed) input parameters when issuing a query.
73 *
74 * @see Matcher
75 *
76 */
77 public static abstract class Match extends BasePatternMatch {
78 private Transition fT;
79
80 private FinalState fF;
81
82 private static List<String> parameterNames = makeImmutableList("t", "f");
83
84 private Match(final Transition pT, final FinalState pF) {
85 this.fT = pT;
86 this.fF = pF;
87 }
88
89 @Override
90 public Object get(final String parameterName) {
91 if ("t".equals(parameterName)) return this.fT;
92 if ("f".equals(parameterName)) return this.fF;
93 return null;
94 }
95
96 public Transition getT() {
97 return this.fT;
98 }
99
100 public FinalState getF() {
101 return this.fF;
102 }
103
104 @Override
105 public boolean set(final String parameterName, final Object newValue) {
106 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
107 if ("t".equals(parameterName) ) {
108 this.fT = (Transition) newValue;
109 return true;
110 }
111 if ("f".equals(parameterName) ) {
112 this.fF = (FinalState) newValue;
113 return true;
114 }
115 return false;
116 }
117
118 public void setT(final Transition pT) {
119 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
120 this.fT = pT;
121 }
122
123 public void setF(final FinalState pF) {
124 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
125 this.fF = pF;
126 }
127
128 @Override
129 public String patternName() {
130 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromFinal";
131 }
132
133 @Override
134 public List<String> parameterNames() {
135 return OutgoingFromFinal.Match.parameterNames;
136 }
137
138 @Override
139 public Object[] toArray() {
140 return new Object[]{fT, fF};
141 }
142
143 @Override
144 public OutgoingFromFinal.Match toImmutable() {
145 return isMutable() ? newMatch(fT, fF) : this;
146 }
147
148 @Override
149 public String prettyPrint() {
150 StringBuilder result = new StringBuilder();
151 result.append("\"t\"=" + prettyPrintValue(fT) + ", ");
152 result.append("\"f\"=" + prettyPrintValue(fF));
153 return result.toString();
154 }
155
156 @Override
157 public int hashCode() {
158 return Objects.hash(fT, fF);
159 }
160
161 @Override
162 public boolean equals(final Object obj) {
163 if (this == obj)
164 return true;
165 if (obj == null) {
166 return false;
167 }
168 if ((obj instanceof OutgoingFromFinal.Match)) {
169 OutgoingFromFinal.Match other = (OutgoingFromFinal.Match) obj;
170 return Objects.equals(fT, other.fT) && Objects.equals(fF, other.fF);
171 } else {
172 // this should be infrequent
173 if (!(obj instanceof IPatternMatch)) {
174 return false;
175 }
176 IPatternMatch otherSig = (IPatternMatch) obj;
177 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
178 }
179 }
180
181 @Override
182 public OutgoingFromFinal specification() {
183 return OutgoingFromFinal.instance();
184 }
185
186 /**
187 * Returns an empty, mutable match.
188 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
189 *
190 * @return the empty match.
191 *
192 */
193 public static OutgoingFromFinal.Match newEmptyMatch() {
194 return new Mutable(null, null);
195 }
196
197 /**
198 * Returns a mutable (partial) match.
199 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
200 *
201 * @param pT the fixed value of pattern parameter t, or null if not bound.
202 * @param pF the fixed value of pattern parameter f, or null if not bound.
203 * @return the new, mutable (partial) match object.
204 *
205 */
206 public static OutgoingFromFinal.Match newMutableMatch(final Transition pT, final FinalState pF) {
207 return new Mutable(pT, pF);
208 }
209
210 /**
211 * Returns a new (partial) match.
212 * This can be used e.g. to call the matcher with a partial match.
213 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
214 * @param pT the fixed value of pattern parameter t, or null if not bound.
215 * @param pF the fixed value of pattern parameter f, or null if not bound.
216 * @return the (partial) match object.
217 *
218 */
219 public static OutgoingFromFinal.Match newMatch(final Transition pT, final FinalState pF) {
220 return new Immutable(pT, pF);
221 }
222
223 private static final class Mutable extends OutgoingFromFinal.Match {
224 Mutable(final Transition pT, final FinalState pF) {
225 super(pT, pF);
226 }
227
228 @Override
229 public boolean isMutable() {
230 return true;
231 }
232 }
233
234 private static final class Immutable extends OutgoingFromFinal.Match {
235 Immutable(final Transition pT, final FinalState pF) {
236 super(pT, pF);
237 }
238
239 @Override
240 public boolean isMutable() {
241 return false;
242 }
243 }
244 }
245
246 /**
247 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromFinal pattern,
248 * providing pattern-specific query methods.
249 *
250 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
251 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
252 *
253 * <p>Matches of the pattern will be represented as {@link Match}.
254 *
255 * <p>Original source:
256 * <code><pre>
257 * /////////
258 * // Final
259 * /////////
260 *
261 * {@literal @}Constraint(severity="error", message="error", key = {f})
262 * pattern outgoingFromFinal(t : Transition, f : FinalState) {
263 * FinalState.outgoingTransitions(f,t);
264 * }
265 * </pre></code>
266 *
267 * @see Match
268 * @see OutgoingFromFinal
269 *
270 */
271 public static class Matcher extends BaseMatcher<OutgoingFromFinal.Match> {
272 /**
273 * Initializes the pattern matcher within an existing VIATRA Query engine.
274 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
275 *
276 * @param engine the existing VIATRA Query engine in which this matcher will be created.
277 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
278 *
279 */
280 public static OutgoingFromFinal.Matcher on(final ViatraQueryEngine engine) {
281 // check if matcher already exists
282 Matcher matcher = engine.getExistingMatcher(querySpecification());
283 if (matcher == null) {
284 matcher = (Matcher)engine.getMatcher(querySpecification());
285 }
286 return matcher;
287 }
288
289 /**
290 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
291 * @return an initialized matcher
292 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
293 *
294 */
295 public static OutgoingFromFinal.Matcher create() {
296 return new Matcher();
297 }
298
299 private final static int POSITION_T = 0;
300
301 private final static int POSITION_F = 1;
302
303 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(OutgoingFromFinal.Matcher.class);
304
305 /**
306 * Initializes the pattern matcher within an existing VIATRA Query engine.
307 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
308 *
309 * @param engine the existing VIATRA Query engine in which this matcher will be created.
310 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
311 *
312 */
313 private Matcher() {
314 super(querySpecification());
315 }
316
317 /**
318 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
319 * @param pT the fixed value of pattern parameter t, or null if not bound.
320 * @param pF the fixed value of pattern parameter f, or null if not bound.
321 * @return matches represented as a Match object.
322 *
323 */
324 public Collection<OutgoingFromFinal.Match> getAllMatches(final Transition pT, final FinalState pF) {
325 return rawStreamAllMatches(new Object[]{pT, pF}).collect(Collectors.toSet());
326 }
327
328 /**
329 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
330 * </p>
331 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
332 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
333 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
334 * @param pT the fixed value of pattern parameter t, or null if not bound.
335 * @param pF the fixed value of pattern parameter f, or null if not bound.
336 * @return a stream of matches represented as a Match object.
337 *
338 */
339 public Stream<OutgoingFromFinal.Match> streamAllMatches(final Transition pT, final FinalState pF) {
340 return rawStreamAllMatches(new Object[]{pT, pF});
341 }
342
343 /**
344 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
345 * Neither determinism nor randomness of selection is guaranteed.
346 * @param pT the fixed value of pattern parameter t, or null if not bound.
347 * @param pF the fixed value of pattern parameter f, or null if not bound.
348 * @return a match represented as a Match object, or null if no match is found.
349 *
350 */
351 public Optional<OutgoingFromFinal.Match> getOneArbitraryMatch(final Transition pT, final FinalState pF) {
352 return rawGetOneArbitraryMatch(new Object[]{pT, pF});
353 }
354
355 /**
356 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
357 * under any possible substitution of the unspecified parameters (if any).
358 * @param pT the fixed value of pattern parameter t, or null if not bound.
359 * @param pF the fixed value of pattern parameter f, or null if not bound.
360 * @return true if the input is a valid (partial) match of the pattern.
361 *
362 */
363 public boolean hasMatch(final Transition pT, final FinalState pF) {
364 return rawHasMatch(new Object[]{pT, pF});
365 }
366
367 /**
368 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
369 * @param pT the fixed value of pattern parameter t, or null if not bound.
370 * @param pF the fixed value of pattern parameter f, or null if not bound.
371 * @return the number of pattern matches found.
372 *
373 */
374 public int countMatches(final Transition pT, final FinalState pF) {
375 return rawCountMatches(new Object[]{pT, pF});
376 }
377
378 /**
379 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
380 * Neither determinism nor randomness of selection is guaranteed.
381 * @param pT the fixed value of pattern parameter t, or null if not bound.
382 * @param pF the fixed value of pattern parameter f, or null if not bound.
383 * @param processor the action that will process the selected match.
384 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
385 *
386 */
387 public boolean forOneArbitraryMatch(final Transition pT, final FinalState pF, final Consumer<? super OutgoingFromFinal.Match> processor) {
388 return rawForOneArbitraryMatch(new Object[]{pT, pF}, processor);
389 }
390
391 /**
392 * Returns a new (partial) match.
393 * This can be used e.g. to call the matcher with a partial match.
394 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
395 * @param pT the fixed value of pattern parameter t, or null if not bound.
396 * @param pF the fixed value of pattern parameter f, or null if not bound.
397 * @return the (partial) match object.
398 *
399 */
400 public OutgoingFromFinal.Match newMatch(final Transition pT, final FinalState pF) {
401 return OutgoingFromFinal.Match.newMatch(pT, pF);
402 }
403
404 /**
405 * Retrieve the set of values that occur in matches for t.
406 * @return the Set of all values or empty set if there are no matches
407 *
408 */
409 protected Stream<Transition> rawStreamAllValuesOft(final Object[] parameters) {
410 return rawStreamAllValues(POSITION_T, parameters).map(Transition.class::cast);
411 }
412
413 /**
414 * Retrieve the set of values that occur in matches for t.
415 * @return the Set of all values or empty set if there are no matches
416 *
417 */
418 public Set<Transition> getAllValuesOft() {
419 return rawStreamAllValuesOft(emptyArray()).collect(Collectors.toSet());
420 }
421
422 /**
423 * Retrieve the set of values that occur in matches for t.
424 * @return the Set of all values or empty set if there are no matches
425 *
426 */
427 public Stream<Transition> streamAllValuesOft() {
428 return rawStreamAllValuesOft(emptyArray());
429 }
430
431 /**
432 * Retrieve the set of values that occur in matches for t.
433 * </p>
434 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
435 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
436 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
437 *
438 * @return the Stream of all values or empty set if there are no matches
439 *
440 */
441 public Stream<Transition> streamAllValuesOft(final OutgoingFromFinal.Match partialMatch) {
442 return rawStreamAllValuesOft(partialMatch.toArray());
443 }
444
445 /**
446 * Retrieve the set of values that occur in matches for t.
447 * </p>
448 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
449 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
450 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
451 *
452 * @return the Stream of all values or empty set if there are no matches
453 *
454 */
455 public Stream<Transition> streamAllValuesOft(final FinalState pF) {
456 return rawStreamAllValuesOft(new Object[]{null, pF});
457 }
458
459 /**
460 * Retrieve the set of values that occur in matches for t.
461 * @return the Set of all values or empty set if there are no matches
462 *
463 */
464 public Set<Transition> getAllValuesOft(final OutgoingFromFinal.Match partialMatch) {
465 return rawStreamAllValuesOft(partialMatch.toArray()).collect(Collectors.toSet());
466 }
467
468 /**
469 * Retrieve the set of values that occur in matches for t.
470 * @return the Set of all values or empty set if there are no matches
471 *
472 */
473 public Set<Transition> getAllValuesOft(final FinalState pF) {
474 return rawStreamAllValuesOft(new Object[]{null, pF}).collect(Collectors.toSet());
475 }
476
477 /**
478 * Retrieve the set of values that occur in matches for f.
479 * @return the Set of all values or empty set if there are no matches
480 *
481 */
482 protected Stream<FinalState> rawStreamAllValuesOff(final Object[] parameters) {
483 return rawStreamAllValues(POSITION_F, parameters).map(FinalState.class::cast);
484 }
485
486 /**
487 * Retrieve the set of values that occur in matches for f.
488 * @return the Set of all values or empty set if there are no matches
489 *
490 */
491 public Set<FinalState> getAllValuesOff() {
492 return rawStreamAllValuesOff(emptyArray()).collect(Collectors.toSet());
493 }
494
495 /**
496 * Retrieve the set of values that occur in matches for f.
497 * @return the Set of all values or empty set if there are no matches
498 *
499 */
500 public Stream<FinalState> streamAllValuesOff() {
501 return rawStreamAllValuesOff(emptyArray());
502 }
503
504 /**
505 * Retrieve the set of values that occur in matches for f.
506 * </p>
507 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
508 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
509 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
510 *
511 * @return the Stream of all values or empty set if there are no matches
512 *
513 */
514 public Stream<FinalState> streamAllValuesOff(final OutgoingFromFinal.Match partialMatch) {
515 return rawStreamAllValuesOff(partialMatch.toArray());
516 }
517
518 /**
519 * Retrieve the set of values that occur in matches for f.
520 * </p>
521 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
522 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
523 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
524 *
525 * @return the Stream of all values or empty set if there are no matches
526 *
527 */
528 public Stream<FinalState> streamAllValuesOff(final Transition pT) {
529 return rawStreamAllValuesOff(new Object[]{pT, null});
530 }
531
532 /**
533 * Retrieve the set of values that occur in matches for f.
534 * @return the Set of all values or empty set if there are no matches
535 *
536 */
537 public Set<FinalState> getAllValuesOff(final OutgoingFromFinal.Match partialMatch) {
538 return rawStreamAllValuesOff(partialMatch.toArray()).collect(Collectors.toSet());
539 }
540
541 /**
542 * Retrieve the set of values that occur in matches for f.
543 * @return the Set of all values or empty set if there are no matches
544 *
545 */
546 public Set<FinalState> getAllValuesOff(final Transition pT) {
547 return rawStreamAllValuesOff(new Object[]{pT, null}).collect(Collectors.toSet());
548 }
549
550 @Override
551 protected OutgoingFromFinal.Match tupleToMatch(final Tuple t) {
552 try {
553 return OutgoingFromFinal.Match.newMatch((Transition) t.get(POSITION_T), (FinalState) t.get(POSITION_F));
554 } catch(ClassCastException e) {
555 LOGGER.error("Element(s) in tuple not properly typed!",e);
556 return null;
557 }
558 }
559
560 @Override
561 protected OutgoingFromFinal.Match arrayToMatch(final Object[] match) {
562 try {
563 return OutgoingFromFinal.Match.newMatch((Transition) match[POSITION_T], (FinalState) match[POSITION_F]);
564 } catch(ClassCastException e) {
565 LOGGER.error("Element(s) in array not properly typed!",e);
566 return null;
567 }
568 }
569
570 @Override
571 protected OutgoingFromFinal.Match arrayToMatchMutable(final Object[] match) {
572 try {
573 return OutgoingFromFinal.Match.newMutableMatch((Transition) match[POSITION_T], (FinalState) match[POSITION_F]);
574 } catch(ClassCastException e) {
575 LOGGER.error("Element(s) in array not properly typed!",e);
576 return null;
577 }
578 }
579
580 /**
581 * @return the singleton instance of the query specification of this pattern
582 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
583 *
584 */
585 public static IQuerySpecification<OutgoingFromFinal.Matcher> querySpecification() {
586 return OutgoingFromFinal.instance();
587 }
588 }
589
590 private OutgoingFromFinal() {
591 super(GeneratedPQuery.INSTANCE);
592 }
593
594 /**
595 * @return the singleton instance of the query specification
596 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
597 *
598 */
599 public static OutgoingFromFinal instance() {
600 try{
601 return LazyHolder.INSTANCE;
602 } catch (ExceptionInInitializerError err) {
603 throw processInitializerError(err);
604 }
605 }
606
607 @Override
608 protected OutgoingFromFinal.Matcher instantiate(final ViatraQueryEngine engine) {
609 return OutgoingFromFinal.Matcher.on(engine);
610 }
611
612 @Override
613 public OutgoingFromFinal.Matcher instantiate() {
614 return OutgoingFromFinal.Matcher.create();
615 }
616
617 @Override
618 public OutgoingFromFinal.Match newEmptyMatch() {
619 return OutgoingFromFinal.Match.newEmptyMatch();
620 }
621
622 @Override
623 public OutgoingFromFinal.Match newMatch(final Object... parameters) {
624 return OutgoingFromFinal.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition) parameters[0], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.FinalState) parameters[1]);
625 }
626
627 /**
628 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.OutgoingFromFinal (visibility: PUBLIC, simpleName: OutgoingFromFinal, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.OutgoingFromFinal, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
629 * <b>not</b> at the class load time of the outer class,
630 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.OutgoingFromFinal (visibility: PUBLIC, simpleName: OutgoingFromFinal, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.OutgoingFromFinal, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
631 *
632 * <p> This workaround is required e.g. to support recursion.
633 *
634 */
635 private static class LazyHolder {
636 private final static OutgoingFromFinal INSTANCE = new OutgoingFromFinal();
637
638 /**
639 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
640 * This initialization order is required to support indirect recursion.
641 *
642 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
643 *
644 */
645 private final static Object STATIC_INITIALIZER = ensureInitialized();
646
647 public static Object ensureInitialized() {
648 INSTANCE.ensureInitializedInternal();
649 return null;
650 }
651 }
652
653 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
654 private final static OutgoingFromFinal.GeneratedPQuery INSTANCE = new GeneratedPQuery();
655
656 private final PParameter parameter_t = new PParameter("t", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Transition")), PParameterDirection.INOUT);
657
658 private final PParameter parameter_f = new PParameter("f", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.FinalState", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "FinalState")), PParameterDirection.INOUT);
659
660 private final List<PParameter> parameters = Arrays.asList(parameter_t, parameter_f);
661
662 private GeneratedPQuery() {
663 super(PVisibility.PUBLIC);
664 }
665
666 @Override
667 public String getFullyQualifiedName() {
668 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.outgoingFromFinal";
669 }
670
671 @Override
672 public List<String> getParameterNames() {
673 return Arrays.asList("t","f");
674 }
675
676 @Override
677 public List<PParameter> getParameters() {
678 return parameters;
679 }
680
681 @Override
682 public Set<PBody> doGetContainedBodies() {
683 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
684 Set<PBody> bodies = new LinkedHashSet<>();
685 {
686 PBody body = new PBody(this);
687 PVariable var_t = body.getOrCreateVariableByName("t");
688 PVariable var_f = body.getOrCreateVariableByName("f");
689 new TypeConstraint(body, Tuples.flatTupleOf(var_t), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
690 new TypeConstraint(body, Tuples.flatTupleOf(var_f), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "FinalState")));
691 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
692 new ExportedParameter(body, var_t, parameter_t),
693 new ExportedParameter(body, var_f, parameter_f)
694 ));
695 // FinalState.outgoingTransitions(f,t)
696 new TypeConstraint(body, Tuples.flatTupleOf(var_f), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "FinalState")));
697 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
698 new TypeConstraint(body, Tuples.flatTupleOf(var_f, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Vertex", "outgoingTransitions")));
699 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
700 new Equality(body, var__virtual_0_, var_t);
701 bodies.add(body);
702 }
703 {
704 PAnnotation annotation = new PAnnotation("Constraint");
705 annotation.addAttribute("severity", "error");
706 annotation.addAttribute("message", "error");
707 annotation.addAttribute("key", Arrays.asList(new Object[] {
708 new ParameterReference("f")
709 }));
710 addAnnotation(annotation);
711 }
712 return bodies;
713 }
714 }
715}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/StateInRegion.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/StateInRegion.java
deleted file mode 100644
index 0d1fd0e6..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/StateInRegion.java
+++ /dev/null
@@ -1,694 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Region;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.State;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
29import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
31import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
38import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
40import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
41
42/**
43 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
44 *
45 * <p>Original source:
46 * <code><pre>
47 * pattern StateInRegion(region: Region, state: State) {
48 * Region.vertices(region,state);
49 * }
50 * </pre></code>
51 *
52 * @see Matcher
53 * @see Match
54 *
55 */
56@SuppressWarnings("all")
57public final class StateInRegion extends BaseGeneratedEMFQuerySpecification<StateInRegion.Matcher> {
58 /**
59 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.StateInRegion pattern,
60 * to be used in conjunction with {@link Matcher}.
61 *
62 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
63 * Each instance is a (possibly partial) substitution of pattern parameters,
64 * usable to represent a match of the pattern in the result of a query,
65 * or to specify the bound (fixed) input parameters when issuing a query.
66 *
67 * @see Matcher
68 *
69 */
70 public static abstract class Match extends BasePatternMatch {
71 private Region fRegion;
72
73 private State fState;
74
75 private static List<String> parameterNames = makeImmutableList("region", "state");
76
77 private Match(final Region pRegion, final State pState) {
78 this.fRegion = pRegion;
79 this.fState = pState;
80 }
81
82 @Override
83 public Object get(final String parameterName) {
84 if ("region".equals(parameterName)) return this.fRegion;
85 if ("state".equals(parameterName)) return this.fState;
86 return null;
87 }
88
89 public Region getRegion() {
90 return this.fRegion;
91 }
92
93 public State getState() {
94 return this.fState;
95 }
96
97 @Override
98 public boolean set(final String parameterName, final Object newValue) {
99 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
100 if ("region".equals(parameterName) ) {
101 this.fRegion = (Region) newValue;
102 return true;
103 }
104 if ("state".equals(parameterName) ) {
105 this.fState = (State) newValue;
106 return true;
107 }
108 return false;
109 }
110
111 public void setRegion(final Region pRegion) {
112 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
113 this.fRegion = pRegion;
114 }
115
116 public void setState(final State pState) {
117 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
118 this.fState = pState;
119 }
120
121 @Override
122 public String patternName() {
123 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.StateInRegion";
124 }
125
126 @Override
127 public List<String> parameterNames() {
128 return StateInRegion.Match.parameterNames;
129 }
130
131 @Override
132 public Object[] toArray() {
133 return new Object[]{fRegion, fState};
134 }
135
136 @Override
137 public StateInRegion.Match toImmutable() {
138 return isMutable() ? newMatch(fRegion, fState) : this;
139 }
140
141 @Override
142 public String prettyPrint() {
143 StringBuilder result = new StringBuilder();
144 result.append("\"region\"=" + prettyPrintValue(fRegion) + ", ");
145 result.append("\"state\"=" + prettyPrintValue(fState));
146 return result.toString();
147 }
148
149 @Override
150 public int hashCode() {
151 return Objects.hash(fRegion, fState);
152 }
153
154 @Override
155 public boolean equals(final Object obj) {
156 if (this == obj)
157 return true;
158 if (obj == null) {
159 return false;
160 }
161 if ((obj instanceof StateInRegion.Match)) {
162 StateInRegion.Match other = (StateInRegion.Match) obj;
163 return Objects.equals(fRegion, other.fRegion) && Objects.equals(fState, other.fState);
164 } else {
165 // this should be infrequent
166 if (!(obj instanceof IPatternMatch)) {
167 return false;
168 }
169 IPatternMatch otherSig = (IPatternMatch) obj;
170 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
171 }
172 }
173
174 @Override
175 public StateInRegion specification() {
176 return StateInRegion.instance();
177 }
178
179 /**
180 * Returns an empty, mutable match.
181 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
182 *
183 * @return the empty match.
184 *
185 */
186 public static StateInRegion.Match newEmptyMatch() {
187 return new Mutable(null, null);
188 }
189
190 /**
191 * Returns a mutable (partial) match.
192 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
193 *
194 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
195 * @param pState the fixed value of pattern parameter state, or null if not bound.
196 * @return the new, mutable (partial) match object.
197 *
198 */
199 public static StateInRegion.Match newMutableMatch(final Region pRegion, final State pState) {
200 return new Mutable(pRegion, pState);
201 }
202
203 /**
204 * Returns a new (partial) match.
205 * This can be used e.g. to call the matcher with a partial match.
206 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
207 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
208 * @param pState the fixed value of pattern parameter state, or null if not bound.
209 * @return the (partial) match object.
210 *
211 */
212 public static StateInRegion.Match newMatch(final Region pRegion, final State pState) {
213 return new Immutable(pRegion, pState);
214 }
215
216 private static final class Mutable extends StateInRegion.Match {
217 Mutable(final Region pRegion, final State pState) {
218 super(pRegion, pState);
219 }
220
221 @Override
222 public boolean isMutable() {
223 return true;
224 }
225 }
226
227 private static final class Immutable extends StateInRegion.Match {
228 Immutable(final Region pRegion, final State pState) {
229 super(pRegion, pState);
230 }
231
232 @Override
233 public boolean isMutable() {
234 return false;
235 }
236 }
237 }
238
239 /**
240 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.StateInRegion pattern,
241 * providing pattern-specific query methods.
242 *
243 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
244 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
245 *
246 * <p>Matches of the pattern will be represented as {@link Match}.
247 *
248 * <p>Original source:
249 * <code><pre>
250 * pattern StateInRegion(region: Region, state: State) {
251 * Region.vertices(region,state);
252 * }
253 * </pre></code>
254 *
255 * @see Match
256 * @see StateInRegion
257 *
258 */
259 public static class Matcher extends BaseMatcher<StateInRegion.Match> {
260 /**
261 * Initializes the pattern matcher within an existing VIATRA Query engine.
262 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
263 *
264 * @param engine the existing VIATRA Query engine in which this matcher will be created.
265 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
266 *
267 */
268 public static StateInRegion.Matcher on(final ViatraQueryEngine engine) {
269 // check if matcher already exists
270 Matcher matcher = engine.getExistingMatcher(querySpecification());
271 if (matcher == null) {
272 matcher = (Matcher)engine.getMatcher(querySpecification());
273 }
274 return matcher;
275 }
276
277 /**
278 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
279 * @return an initialized matcher
280 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
281 *
282 */
283 public static StateInRegion.Matcher create() {
284 return new Matcher();
285 }
286
287 private final static int POSITION_REGION = 0;
288
289 private final static int POSITION_STATE = 1;
290
291 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(StateInRegion.Matcher.class);
292
293 /**
294 * Initializes the pattern matcher within an existing VIATRA Query engine.
295 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
296 *
297 * @param engine the existing VIATRA Query engine in which this matcher will be created.
298 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
299 *
300 */
301 private Matcher() {
302 super(querySpecification());
303 }
304
305 /**
306 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
307 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
308 * @param pState the fixed value of pattern parameter state, or null if not bound.
309 * @return matches represented as a Match object.
310 *
311 */
312 public Collection<StateInRegion.Match> getAllMatches(final Region pRegion, final State pState) {
313 return rawStreamAllMatches(new Object[]{pRegion, pState}).collect(Collectors.toSet());
314 }
315
316 /**
317 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
318 * </p>
319 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
320 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
321 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
322 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
323 * @param pState the fixed value of pattern parameter state, or null if not bound.
324 * @return a stream of matches represented as a Match object.
325 *
326 */
327 public Stream<StateInRegion.Match> streamAllMatches(final Region pRegion, final State pState) {
328 return rawStreamAllMatches(new Object[]{pRegion, pState});
329 }
330
331 /**
332 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
333 * Neither determinism nor randomness of selection is guaranteed.
334 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
335 * @param pState the fixed value of pattern parameter state, or null if not bound.
336 * @return a match represented as a Match object, or null if no match is found.
337 *
338 */
339 public Optional<StateInRegion.Match> getOneArbitraryMatch(final Region pRegion, final State pState) {
340 return rawGetOneArbitraryMatch(new Object[]{pRegion, pState});
341 }
342
343 /**
344 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
345 * under any possible substitution of the unspecified parameters (if any).
346 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
347 * @param pState the fixed value of pattern parameter state, or null if not bound.
348 * @return true if the input is a valid (partial) match of the pattern.
349 *
350 */
351 public boolean hasMatch(final Region pRegion, final State pState) {
352 return rawHasMatch(new Object[]{pRegion, pState});
353 }
354
355 /**
356 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
357 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
358 * @param pState the fixed value of pattern parameter state, or null if not bound.
359 * @return the number of pattern matches found.
360 *
361 */
362 public int countMatches(final Region pRegion, final State pState) {
363 return rawCountMatches(new Object[]{pRegion, pState});
364 }
365
366 /**
367 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
368 * Neither determinism nor randomness of selection is guaranteed.
369 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
370 * @param pState the fixed value of pattern parameter state, or null if not bound.
371 * @param processor the action that will process the selected match.
372 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
373 *
374 */
375 public boolean forOneArbitraryMatch(final Region pRegion, final State pState, final Consumer<? super StateInRegion.Match> processor) {
376 return rawForOneArbitraryMatch(new Object[]{pRegion, pState}, processor);
377 }
378
379 /**
380 * Returns a new (partial) match.
381 * This can be used e.g. to call the matcher with a partial match.
382 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
383 * @param pRegion the fixed value of pattern parameter region, or null if not bound.
384 * @param pState the fixed value of pattern parameter state, or null if not bound.
385 * @return the (partial) match object.
386 *
387 */
388 public StateInRegion.Match newMatch(final Region pRegion, final State pState) {
389 return StateInRegion.Match.newMatch(pRegion, pState);
390 }
391
392 /**
393 * Retrieve the set of values that occur in matches for region.
394 * @return the Set of all values or empty set if there are no matches
395 *
396 */
397 protected Stream<Region> rawStreamAllValuesOfregion(final Object[] parameters) {
398 return rawStreamAllValues(POSITION_REGION, parameters).map(Region.class::cast);
399 }
400
401 /**
402 * Retrieve the set of values that occur in matches for region.
403 * @return the Set of all values or empty set if there are no matches
404 *
405 */
406 public Set<Region> getAllValuesOfregion() {
407 return rawStreamAllValuesOfregion(emptyArray()).collect(Collectors.toSet());
408 }
409
410 /**
411 * Retrieve the set of values that occur in matches for region.
412 * @return the Set of all values or empty set if there are no matches
413 *
414 */
415 public Stream<Region> streamAllValuesOfregion() {
416 return rawStreamAllValuesOfregion(emptyArray());
417 }
418
419 /**
420 * Retrieve the set of values that occur in matches for region.
421 * </p>
422 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
423 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
424 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
425 *
426 * @return the Stream of all values or empty set if there are no matches
427 *
428 */
429 public Stream<Region> streamAllValuesOfregion(final StateInRegion.Match partialMatch) {
430 return rawStreamAllValuesOfregion(partialMatch.toArray());
431 }
432
433 /**
434 * Retrieve the set of values that occur in matches for region.
435 * </p>
436 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
437 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
438 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
439 *
440 * @return the Stream of all values or empty set if there are no matches
441 *
442 */
443 public Stream<Region> streamAllValuesOfregion(final State pState) {
444 return rawStreamAllValuesOfregion(new Object[]{null, pState});
445 }
446
447 /**
448 * Retrieve the set of values that occur in matches for region.
449 * @return the Set of all values or empty set if there are no matches
450 *
451 */
452 public Set<Region> getAllValuesOfregion(final StateInRegion.Match partialMatch) {
453 return rawStreamAllValuesOfregion(partialMatch.toArray()).collect(Collectors.toSet());
454 }
455
456 /**
457 * Retrieve the set of values that occur in matches for region.
458 * @return the Set of all values or empty set if there are no matches
459 *
460 */
461 public Set<Region> getAllValuesOfregion(final State pState) {
462 return rawStreamAllValuesOfregion(new Object[]{null, pState}).collect(Collectors.toSet());
463 }
464
465 /**
466 * Retrieve the set of values that occur in matches for state.
467 * @return the Set of all values or empty set if there are no matches
468 *
469 */
470 protected Stream<State> rawStreamAllValuesOfstate(final Object[] parameters) {
471 return rawStreamAllValues(POSITION_STATE, parameters).map(State.class::cast);
472 }
473
474 /**
475 * Retrieve the set of values that occur in matches for state.
476 * @return the Set of all values or empty set if there are no matches
477 *
478 */
479 public Set<State> getAllValuesOfstate() {
480 return rawStreamAllValuesOfstate(emptyArray()).collect(Collectors.toSet());
481 }
482
483 /**
484 * Retrieve the set of values that occur in matches for state.
485 * @return the Set of all values or empty set if there are no matches
486 *
487 */
488 public Stream<State> streamAllValuesOfstate() {
489 return rawStreamAllValuesOfstate(emptyArray());
490 }
491
492 /**
493 * Retrieve the set of values that occur in matches for state.
494 * </p>
495 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
496 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
497 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
498 *
499 * @return the Stream of all values or empty set if there are no matches
500 *
501 */
502 public Stream<State> streamAllValuesOfstate(final StateInRegion.Match partialMatch) {
503 return rawStreamAllValuesOfstate(partialMatch.toArray());
504 }
505
506 /**
507 * Retrieve the set of values that occur in matches for state.
508 * </p>
509 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
510 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
511 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
512 *
513 * @return the Stream of all values or empty set if there are no matches
514 *
515 */
516 public Stream<State> streamAllValuesOfstate(final Region pRegion) {
517 return rawStreamAllValuesOfstate(new Object[]{pRegion, null});
518 }
519
520 /**
521 * Retrieve the set of values that occur in matches for state.
522 * @return the Set of all values or empty set if there are no matches
523 *
524 */
525 public Set<State> getAllValuesOfstate(final StateInRegion.Match partialMatch) {
526 return rawStreamAllValuesOfstate(partialMatch.toArray()).collect(Collectors.toSet());
527 }
528
529 /**
530 * Retrieve the set of values that occur in matches for state.
531 * @return the Set of all values or empty set if there are no matches
532 *
533 */
534 public Set<State> getAllValuesOfstate(final Region pRegion) {
535 return rawStreamAllValuesOfstate(new Object[]{pRegion, null}).collect(Collectors.toSet());
536 }
537
538 @Override
539 protected StateInRegion.Match tupleToMatch(final Tuple t) {
540 try {
541 return StateInRegion.Match.newMatch((Region) t.get(POSITION_REGION), (State) t.get(POSITION_STATE));
542 } catch(ClassCastException e) {
543 LOGGER.error("Element(s) in tuple not properly typed!",e);
544 return null;
545 }
546 }
547
548 @Override
549 protected StateInRegion.Match arrayToMatch(final Object[] match) {
550 try {
551 return StateInRegion.Match.newMatch((Region) match[POSITION_REGION], (State) match[POSITION_STATE]);
552 } catch(ClassCastException e) {
553 LOGGER.error("Element(s) in array not properly typed!",e);
554 return null;
555 }
556 }
557
558 @Override
559 protected StateInRegion.Match arrayToMatchMutable(final Object[] match) {
560 try {
561 return StateInRegion.Match.newMutableMatch((Region) match[POSITION_REGION], (State) match[POSITION_STATE]);
562 } catch(ClassCastException e) {
563 LOGGER.error("Element(s) in array not properly typed!",e);
564 return null;
565 }
566 }
567
568 /**
569 * @return the singleton instance of the query specification of this pattern
570 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
571 *
572 */
573 public static IQuerySpecification<StateInRegion.Matcher> querySpecification() {
574 return StateInRegion.instance();
575 }
576 }
577
578 private StateInRegion() {
579 super(GeneratedPQuery.INSTANCE);
580 }
581
582 /**
583 * @return the singleton instance of the query specification
584 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
585 *
586 */
587 public static StateInRegion instance() {
588 try{
589 return LazyHolder.INSTANCE;
590 } catch (ExceptionInInitializerError err) {
591 throw processInitializerError(err);
592 }
593 }
594
595 @Override
596 protected StateInRegion.Matcher instantiate(final ViatraQueryEngine engine) {
597 return StateInRegion.Matcher.on(engine);
598 }
599
600 @Override
601 public StateInRegion.Matcher instantiate() {
602 return StateInRegion.Matcher.create();
603 }
604
605 @Override
606 public StateInRegion.Match newEmptyMatch() {
607 return StateInRegion.Match.newEmptyMatch();
608 }
609
610 @Override
611 public StateInRegion.Match newMatch(final Object... parameters) {
612 return StateInRegion.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Region) parameters[0], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.State) parameters[1]);
613 }
614
615 /**
616 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.StateInRegion (visibility: PUBLIC, simpleName: StateInRegion, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.StateInRegion, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
617 * <b>not</b> at the class load time of the outer class,
618 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.StateInRegion (visibility: PUBLIC, simpleName: StateInRegion, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.StateInRegion, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
619 *
620 * <p> This workaround is required e.g. to support recursion.
621 *
622 */
623 private static class LazyHolder {
624 private final static StateInRegion INSTANCE = new StateInRegion();
625
626 /**
627 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
628 * This initialization order is required to support indirect recursion.
629 *
630 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
631 *
632 */
633 private final static Object STATIC_INITIALIZER = ensureInitialized();
634
635 public static Object ensureInitialized() {
636 INSTANCE.ensureInitializedInternal();
637 return null;
638 }
639 }
640
641 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
642 private final static StateInRegion.GeneratedPQuery INSTANCE = new GeneratedPQuery();
643
644 private final PParameter parameter_region = new PParameter("region", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Region", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Region")), PParameterDirection.INOUT);
645
646 private final PParameter parameter_state = new PParameter("state", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "State")), PParameterDirection.INOUT);
647
648 private final List<PParameter> parameters = Arrays.asList(parameter_region, parameter_state);
649
650 private GeneratedPQuery() {
651 super(PVisibility.PUBLIC);
652 }
653
654 @Override
655 public String getFullyQualifiedName() {
656 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.StateInRegion";
657 }
658
659 @Override
660 public List<String> getParameterNames() {
661 return Arrays.asList("region","state");
662 }
663
664 @Override
665 public List<PParameter> getParameters() {
666 return parameters;
667 }
668
669 @Override
670 public Set<PBody> doGetContainedBodies() {
671 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
672 Set<PBody> bodies = new LinkedHashSet<>();
673 {
674 PBody body = new PBody(this);
675 PVariable var_region = body.getOrCreateVariableByName("region");
676 PVariable var_state = body.getOrCreateVariableByName("state");
677 new TypeConstraint(body, Tuples.flatTupleOf(var_region), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
678 new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "State")));
679 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
680 new ExportedParameter(body, var_region, parameter_region),
681 new ExportedParameter(body, var_state, parameter_state)
682 ));
683 // Region.vertices(region,state)
684 new TypeConstraint(body, Tuples.flatTupleOf(var_region), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
685 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
686 new TypeConstraint(body, Tuples.flatTupleOf(var_region, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices")));
687 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
688 new Equality(body, var__virtual_0_, var_state);
689 bodies.add(body);
690 }
691 return bodies;
692 }
693 }
694}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchHasNoIncoming.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchHasNoIncoming.java
deleted file mode 100644
index d59ab2d9..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchHasNoIncoming.java
+++ /dev/null
@@ -1,551 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
42
43/**
44 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
45 *
46 * <p>Original source:
47 * <code><pre>
48 * {@literal @}Constraint(severity="error", message="error", key = {s})
49 * pattern synchHasNoIncoming(s : Synchronization) {
50 * neg find transition(_, _, s);
51 * }
52 * </pre></code>
53 *
54 * @see Matcher
55 * @see Match
56 *
57 */
58@SuppressWarnings("all")
59public final class SynchHasNoIncoming extends BaseGeneratedEMFQuerySpecification<SynchHasNoIncoming.Matcher> {
60 /**
61 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchHasNoIncoming pattern,
62 * to be used in conjunction with {@link Matcher}.
63 *
64 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
65 * Each instance is a (possibly partial) substitution of pattern parameters,
66 * usable to represent a match of the pattern in the result of a query,
67 * or to specify the bound (fixed) input parameters when issuing a query.
68 *
69 * @see Matcher
70 *
71 */
72 public static abstract class Match extends BasePatternMatch {
73 private Synchronization fS;
74
75 private static List<String> parameterNames = makeImmutableList("s");
76
77 private Match(final Synchronization pS) {
78 this.fS = pS;
79 }
80
81 @Override
82 public Object get(final String parameterName) {
83 if ("s".equals(parameterName)) return this.fS;
84 return null;
85 }
86
87 public Synchronization getS() {
88 return this.fS;
89 }
90
91 @Override
92 public boolean set(final String parameterName, final Object newValue) {
93 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
94 if ("s".equals(parameterName) ) {
95 this.fS = (Synchronization) newValue;
96 return true;
97 }
98 return false;
99 }
100
101 public void setS(final Synchronization pS) {
102 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
103 this.fS = pS;
104 }
105
106 @Override
107 public String patternName() {
108 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchHasNoIncoming";
109 }
110
111 @Override
112 public List<String> parameterNames() {
113 return SynchHasNoIncoming.Match.parameterNames;
114 }
115
116 @Override
117 public Object[] toArray() {
118 return new Object[]{fS};
119 }
120
121 @Override
122 public SynchHasNoIncoming.Match toImmutable() {
123 return isMutable() ? newMatch(fS) : this;
124 }
125
126 @Override
127 public String prettyPrint() {
128 StringBuilder result = new StringBuilder();
129 result.append("\"s\"=" + prettyPrintValue(fS));
130 return result.toString();
131 }
132
133 @Override
134 public int hashCode() {
135 return Objects.hash(fS);
136 }
137
138 @Override
139 public boolean equals(final Object obj) {
140 if (this == obj)
141 return true;
142 if (obj == null) {
143 return false;
144 }
145 if ((obj instanceof SynchHasNoIncoming.Match)) {
146 SynchHasNoIncoming.Match other = (SynchHasNoIncoming.Match) obj;
147 return Objects.equals(fS, other.fS);
148 } else {
149 // this should be infrequent
150 if (!(obj instanceof IPatternMatch)) {
151 return false;
152 }
153 IPatternMatch otherSig = (IPatternMatch) obj;
154 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
155 }
156 }
157
158 @Override
159 public SynchHasNoIncoming specification() {
160 return SynchHasNoIncoming.instance();
161 }
162
163 /**
164 * Returns an empty, mutable match.
165 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
166 *
167 * @return the empty match.
168 *
169 */
170 public static SynchHasNoIncoming.Match newEmptyMatch() {
171 return new Mutable(null);
172 }
173
174 /**
175 * Returns a mutable (partial) match.
176 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
177 *
178 * @param pS the fixed value of pattern parameter s, or null if not bound.
179 * @return the new, mutable (partial) match object.
180 *
181 */
182 public static SynchHasNoIncoming.Match newMutableMatch(final Synchronization pS) {
183 return new Mutable(pS);
184 }
185
186 /**
187 * Returns a new (partial) match.
188 * This can be used e.g. to call the matcher with a partial match.
189 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
190 * @param pS the fixed value of pattern parameter s, or null if not bound.
191 * @return the (partial) match object.
192 *
193 */
194 public static SynchHasNoIncoming.Match newMatch(final Synchronization pS) {
195 return new Immutable(pS);
196 }
197
198 private static final class Mutable extends SynchHasNoIncoming.Match {
199 Mutable(final Synchronization pS) {
200 super(pS);
201 }
202
203 @Override
204 public boolean isMutable() {
205 return true;
206 }
207 }
208
209 private static final class Immutable extends SynchHasNoIncoming.Match {
210 Immutable(final Synchronization pS) {
211 super(pS);
212 }
213
214 @Override
215 public boolean isMutable() {
216 return false;
217 }
218 }
219 }
220
221 /**
222 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchHasNoIncoming pattern,
223 * providing pattern-specific query methods.
224 *
225 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
226 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
227 *
228 * <p>Matches of the pattern will be represented as {@link Match}.
229 *
230 * <p>Original source:
231 * <code><pre>
232 * {@literal @}Constraint(severity="error", message="error", key = {s})
233 * pattern synchHasNoIncoming(s : Synchronization) {
234 * neg find transition(_, _, s);
235 * }
236 * </pre></code>
237 *
238 * @see Match
239 * @see SynchHasNoIncoming
240 *
241 */
242 public static class Matcher extends BaseMatcher<SynchHasNoIncoming.Match> {
243 /**
244 * Initializes the pattern matcher within an existing VIATRA Query engine.
245 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
246 *
247 * @param engine the existing VIATRA Query engine in which this matcher will be created.
248 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
249 *
250 */
251 public static SynchHasNoIncoming.Matcher on(final ViatraQueryEngine engine) {
252 // check if matcher already exists
253 Matcher matcher = engine.getExistingMatcher(querySpecification());
254 if (matcher == null) {
255 matcher = (Matcher)engine.getMatcher(querySpecification());
256 }
257 return matcher;
258 }
259
260 /**
261 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
262 * @return an initialized matcher
263 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
264 *
265 */
266 public static SynchHasNoIncoming.Matcher create() {
267 return new Matcher();
268 }
269
270 private final static int POSITION_S = 0;
271
272 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SynchHasNoIncoming.Matcher.class);
273
274 /**
275 * Initializes the pattern matcher within an existing VIATRA Query engine.
276 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
277 *
278 * @param engine the existing VIATRA Query engine in which this matcher will be created.
279 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
280 *
281 */
282 private Matcher() {
283 super(querySpecification());
284 }
285
286 /**
287 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
288 * @param pS the fixed value of pattern parameter s, or null if not bound.
289 * @return matches represented as a Match object.
290 *
291 */
292 public Collection<SynchHasNoIncoming.Match> getAllMatches(final Synchronization pS) {
293 return rawStreamAllMatches(new Object[]{pS}).collect(Collectors.toSet());
294 }
295
296 /**
297 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
298 * </p>
299 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
300 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
301 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
302 * @param pS the fixed value of pattern parameter s, or null if not bound.
303 * @return a stream of matches represented as a Match object.
304 *
305 */
306 public Stream<SynchHasNoIncoming.Match> streamAllMatches(final Synchronization pS) {
307 return rawStreamAllMatches(new Object[]{pS});
308 }
309
310 /**
311 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
312 * Neither determinism nor randomness of selection is guaranteed.
313 * @param pS the fixed value of pattern parameter s, or null if not bound.
314 * @return a match represented as a Match object, or null if no match is found.
315 *
316 */
317 public Optional<SynchHasNoIncoming.Match> getOneArbitraryMatch(final Synchronization pS) {
318 return rawGetOneArbitraryMatch(new Object[]{pS});
319 }
320
321 /**
322 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
323 * under any possible substitution of the unspecified parameters (if any).
324 * @param pS the fixed value of pattern parameter s, or null if not bound.
325 * @return true if the input is a valid (partial) match of the pattern.
326 *
327 */
328 public boolean hasMatch(final Synchronization pS) {
329 return rawHasMatch(new Object[]{pS});
330 }
331
332 /**
333 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
334 * @param pS the fixed value of pattern parameter s, or null if not bound.
335 * @return the number of pattern matches found.
336 *
337 */
338 public int countMatches(final Synchronization pS) {
339 return rawCountMatches(new Object[]{pS});
340 }
341
342 /**
343 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
344 * Neither determinism nor randomness of selection is guaranteed.
345 * @param pS the fixed value of pattern parameter s, or null if not bound.
346 * @param processor the action that will process the selected match.
347 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
348 *
349 */
350 public boolean forOneArbitraryMatch(final Synchronization pS, final Consumer<? super SynchHasNoIncoming.Match> processor) {
351 return rawForOneArbitraryMatch(new Object[]{pS}, processor);
352 }
353
354 /**
355 * Returns a new (partial) match.
356 * This can be used e.g. to call the matcher with a partial match.
357 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
358 * @param pS the fixed value of pattern parameter s, or null if not bound.
359 * @return the (partial) match object.
360 *
361 */
362 public SynchHasNoIncoming.Match newMatch(final Synchronization pS) {
363 return SynchHasNoIncoming.Match.newMatch(pS);
364 }
365
366 /**
367 * Retrieve the set of values that occur in matches for s.
368 * @return the Set of all values or empty set if there are no matches
369 *
370 */
371 protected Stream<Synchronization> rawStreamAllValuesOfs(final Object[] parameters) {
372 return rawStreamAllValues(POSITION_S, parameters).map(Synchronization.class::cast);
373 }
374
375 /**
376 * Retrieve the set of values that occur in matches for s.
377 * @return the Set of all values or empty set if there are no matches
378 *
379 */
380 public Set<Synchronization> getAllValuesOfs() {
381 return rawStreamAllValuesOfs(emptyArray()).collect(Collectors.toSet());
382 }
383
384 /**
385 * Retrieve the set of values that occur in matches for s.
386 * @return the Set of all values or empty set if there are no matches
387 *
388 */
389 public Stream<Synchronization> streamAllValuesOfs() {
390 return rawStreamAllValuesOfs(emptyArray());
391 }
392
393 @Override
394 protected SynchHasNoIncoming.Match tupleToMatch(final Tuple t) {
395 try {
396 return SynchHasNoIncoming.Match.newMatch((Synchronization) t.get(POSITION_S));
397 } catch(ClassCastException e) {
398 LOGGER.error("Element(s) in tuple not properly typed!",e);
399 return null;
400 }
401 }
402
403 @Override
404 protected SynchHasNoIncoming.Match arrayToMatch(final Object[] match) {
405 try {
406 return SynchHasNoIncoming.Match.newMatch((Synchronization) match[POSITION_S]);
407 } catch(ClassCastException e) {
408 LOGGER.error("Element(s) in array not properly typed!",e);
409 return null;
410 }
411 }
412
413 @Override
414 protected SynchHasNoIncoming.Match arrayToMatchMutable(final Object[] match) {
415 try {
416 return SynchHasNoIncoming.Match.newMutableMatch((Synchronization) match[POSITION_S]);
417 } catch(ClassCastException e) {
418 LOGGER.error("Element(s) in array not properly typed!",e);
419 return null;
420 }
421 }
422
423 /**
424 * @return the singleton instance of the query specification of this pattern
425 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
426 *
427 */
428 public static IQuerySpecification<SynchHasNoIncoming.Matcher> querySpecification() {
429 return SynchHasNoIncoming.instance();
430 }
431 }
432
433 private SynchHasNoIncoming() {
434 super(GeneratedPQuery.INSTANCE);
435 }
436
437 /**
438 * @return the singleton instance of the query specification
439 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
440 *
441 */
442 public static SynchHasNoIncoming instance() {
443 try{
444 return LazyHolder.INSTANCE;
445 } catch (ExceptionInInitializerError err) {
446 throw processInitializerError(err);
447 }
448 }
449
450 @Override
451 protected SynchHasNoIncoming.Matcher instantiate(final ViatraQueryEngine engine) {
452 return SynchHasNoIncoming.Matcher.on(engine);
453 }
454
455 @Override
456 public SynchHasNoIncoming.Matcher instantiate() {
457 return SynchHasNoIncoming.Matcher.create();
458 }
459
460 @Override
461 public SynchHasNoIncoming.Match newEmptyMatch() {
462 return SynchHasNoIncoming.Match.newEmptyMatch();
463 }
464
465 @Override
466 public SynchHasNoIncoming.Match newMatch(final Object... parameters) {
467 return SynchHasNoIncoming.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization) parameters[0]);
468 }
469
470 /**
471 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchHasNoIncoming (visibility: PUBLIC, simpleName: SynchHasNoIncoming, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchHasNoIncoming, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
472 * <b>not</b> at the class load time of the outer class,
473 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchHasNoIncoming (visibility: PUBLIC, simpleName: SynchHasNoIncoming, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchHasNoIncoming, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
474 *
475 * <p> This workaround is required e.g. to support recursion.
476 *
477 */
478 private static class LazyHolder {
479 private final static SynchHasNoIncoming INSTANCE = new SynchHasNoIncoming();
480
481 /**
482 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
483 * This initialization order is required to support indirect recursion.
484 *
485 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
486 *
487 */
488 private final static Object STATIC_INITIALIZER = ensureInitialized();
489
490 public static Object ensureInitialized() {
491 INSTANCE.ensureInitializedInternal();
492 return null;
493 }
494 }
495
496 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
497 private final static SynchHasNoIncoming.GeneratedPQuery INSTANCE = new GeneratedPQuery();
498
499 private final PParameter parameter_s = new PParameter("s", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Synchronization")), PParameterDirection.INOUT);
500
501 private final List<PParameter> parameters = Arrays.asList(parameter_s);
502
503 private GeneratedPQuery() {
504 super(PVisibility.PUBLIC);
505 }
506
507 @Override
508 public String getFullyQualifiedName() {
509 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchHasNoIncoming";
510 }
511
512 @Override
513 public List<String> getParameterNames() {
514 return Arrays.asList("s");
515 }
516
517 @Override
518 public List<PParameter> getParameters() {
519 return parameters;
520 }
521
522 @Override
523 public Set<PBody> doGetContainedBodies() {
524 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
525 Set<PBody> bodies = new LinkedHashSet<>();
526 {
527 PBody body = new PBody(this);
528 PVariable var_s = body.getOrCreateVariableByName("s");
529 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
530 PVariable var___1_ = body.getOrCreateVariableByName("_<1>");
531 new TypeConstraint(body, Tuples.flatTupleOf(var_s), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
532 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
533 new ExportedParameter(body, var_s, parameter_s)
534 ));
535 // neg find transition(_, _, s)
536 new NegativePatternCall(body, Tuples.flatTupleOf(var___0_, var___1_, var_s), Transition.instance().getInternalQueryRepresentation());
537 bodies.add(body);
538 }
539 {
540 PAnnotation annotation = new PAnnotation("Constraint");
541 annotation.addAttribute("severity", "error");
542 annotation.addAttribute("message", "error");
543 annotation.addAttribute("key", Arrays.asList(new Object[] {
544 new ParameterReference("s")
545 }));
546 addAnnotation(annotation);
547 }
548 return bodies;
549 }
550 }
551}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchHasNoOutgoing.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchHasNoOutgoing.java
deleted file mode 100644
index e3ff69bd..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchHasNoOutgoing.java
+++ /dev/null
@@ -1,559 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition;
8import java.util.Arrays;
9import java.util.Collection;
10import java.util.LinkedHashSet;
11import java.util.List;
12import java.util.Objects;
13import java.util.Optional;
14import java.util.Set;
15import java.util.function.Consumer;
16import java.util.stream.Collectors;
17import java.util.stream.Stream;
18import org.apache.log4j.Logger;
19import org.eclipse.emf.ecore.EClass;
20import org.eclipse.viatra.query.runtime.api.IPatternMatch;
21import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
22import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
26import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
27import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
41import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
42
43/**
44 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
45 *
46 * <p>Original source:
47 * <code><pre>
48 * /////////
49 * // Synchronization
50 * /////////
51 *
52 * {@literal @}Constraint(severity="error", message="error", key = {s})
53 * pattern synchHasNoOutgoing(s : Synchronization) {
54 * neg find transition(_, s, _);
55 * }
56 * </pre></code>
57 *
58 * @see Matcher
59 * @see Match
60 *
61 */
62@SuppressWarnings("all")
63public final class SynchHasNoOutgoing extends BaseGeneratedEMFQuerySpecification<SynchHasNoOutgoing.Matcher> {
64 /**
65 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchHasNoOutgoing pattern,
66 * to be used in conjunction with {@link Matcher}.
67 *
68 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
69 * Each instance is a (possibly partial) substitution of pattern parameters,
70 * usable to represent a match of the pattern in the result of a query,
71 * or to specify the bound (fixed) input parameters when issuing a query.
72 *
73 * @see Matcher
74 *
75 */
76 public static abstract class Match extends BasePatternMatch {
77 private Synchronization fS;
78
79 private static List<String> parameterNames = makeImmutableList("s");
80
81 private Match(final Synchronization pS) {
82 this.fS = pS;
83 }
84
85 @Override
86 public Object get(final String parameterName) {
87 if ("s".equals(parameterName)) return this.fS;
88 return null;
89 }
90
91 public Synchronization getS() {
92 return this.fS;
93 }
94
95 @Override
96 public boolean set(final String parameterName, final Object newValue) {
97 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
98 if ("s".equals(parameterName) ) {
99 this.fS = (Synchronization) newValue;
100 return true;
101 }
102 return false;
103 }
104
105 public void setS(final Synchronization pS) {
106 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
107 this.fS = pS;
108 }
109
110 @Override
111 public String patternName() {
112 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchHasNoOutgoing";
113 }
114
115 @Override
116 public List<String> parameterNames() {
117 return SynchHasNoOutgoing.Match.parameterNames;
118 }
119
120 @Override
121 public Object[] toArray() {
122 return new Object[]{fS};
123 }
124
125 @Override
126 public SynchHasNoOutgoing.Match toImmutable() {
127 return isMutable() ? newMatch(fS) : this;
128 }
129
130 @Override
131 public String prettyPrint() {
132 StringBuilder result = new StringBuilder();
133 result.append("\"s\"=" + prettyPrintValue(fS));
134 return result.toString();
135 }
136
137 @Override
138 public int hashCode() {
139 return Objects.hash(fS);
140 }
141
142 @Override
143 public boolean equals(final Object obj) {
144 if (this == obj)
145 return true;
146 if (obj == null) {
147 return false;
148 }
149 if ((obj instanceof SynchHasNoOutgoing.Match)) {
150 SynchHasNoOutgoing.Match other = (SynchHasNoOutgoing.Match) obj;
151 return Objects.equals(fS, other.fS);
152 } else {
153 // this should be infrequent
154 if (!(obj instanceof IPatternMatch)) {
155 return false;
156 }
157 IPatternMatch otherSig = (IPatternMatch) obj;
158 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
159 }
160 }
161
162 @Override
163 public SynchHasNoOutgoing specification() {
164 return SynchHasNoOutgoing.instance();
165 }
166
167 /**
168 * Returns an empty, mutable match.
169 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
170 *
171 * @return the empty match.
172 *
173 */
174 public static SynchHasNoOutgoing.Match newEmptyMatch() {
175 return new Mutable(null);
176 }
177
178 /**
179 * Returns a mutable (partial) match.
180 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
181 *
182 * @param pS the fixed value of pattern parameter s, or null if not bound.
183 * @return the new, mutable (partial) match object.
184 *
185 */
186 public static SynchHasNoOutgoing.Match newMutableMatch(final Synchronization pS) {
187 return new Mutable(pS);
188 }
189
190 /**
191 * Returns a new (partial) match.
192 * This can be used e.g. to call the matcher with a partial match.
193 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
194 * @param pS the fixed value of pattern parameter s, or null if not bound.
195 * @return the (partial) match object.
196 *
197 */
198 public static SynchHasNoOutgoing.Match newMatch(final Synchronization pS) {
199 return new Immutable(pS);
200 }
201
202 private static final class Mutable extends SynchHasNoOutgoing.Match {
203 Mutable(final Synchronization pS) {
204 super(pS);
205 }
206
207 @Override
208 public boolean isMutable() {
209 return true;
210 }
211 }
212
213 private static final class Immutable extends SynchHasNoOutgoing.Match {
214 Immutable(final Synchronization pS) {
215 super(pS);
216 }
217
218 @Override
219 public boolean isMutable() {
220 return false;
221 }
222 }
223 }
224
225 /**
226 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchHasNoOutgoing pattern,
227 * providing pattern-specific query methods.
228 *
229 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
230 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
231 *
232 * <p>Matches of the pattern will be represented as {@link Match}.
233 *
234 * <p>Original source:
235 * <code><pre>
236 * /////////
237 * // Synchronization
238 * /////////
239 *
240 * {@literal @}Constraint(severity="error", message="error", key = {s})
241 * pattern synchHasNoOutgoing(s : Synchronization) {
242 * neg find transition(_, s, _);
243 * }
244 * </pre></code>
245 *
246 * @see Match
247 * @see SynchHasNoOutgoing
248 *
249 */
250 public static class Matcher extends BaseMatcher<SynchHasNoOutgoing.Match> {
251 /**
252 * Initializes the pattern matcher within an existing VIATRA Query engine.
253 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
254 *
255 * @param engine the existing VIATRA Query engine in which this matcher will be created.
256 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
257 *
258 */
259 public static SynchHasNoOutgoing.Matcher on(final ViatraQueryEngine engine) {
260 // check if matcher already exists
261 Matcher matcher = engine.getExistingMatcher(querySpecification());
262 if (matcher == null) {
263 matcher = (Matcher)engine.getMatcher(querySpecification());
264 }
265 return matcher;
266 }
267
268 /**
269 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
270 * @return an initialized matcher
271 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
272 *
273 */
274 public static SynchHasNoOutgoing.Matcher create() {
275 return new Matcher();
276 }
277
278 private final static int POSITION_S = 0;
279
280 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SynchHasNoOutgoing.Matcher.class);
281
282 /**
283 * Initializes the pattern matcher within an existing VIATRA Query engine.
284 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
285 *
286 * @param engine the existing VIATRA Query engine in which this matcher will be created.
287 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
288 *
289 */
290 private Matcher() {
291 super(querySpecification());
292 }
293
294 /**
295 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
296 * @param pS the fixed value of pattern parameter s, or null if not bound.
297 * @return matches represented as a Match object.
298 *
299 */
300 public Collection<SynchHasNoOutgoing.Match> getAllMatches(final Synchronization pS) {
301 return rawStreamAllMatches(new Object[]{pS}).collect(Collectors.toSet());
302 }
303
304 /**
305 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
306 * </p>
307 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
308 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
309 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
310 * @param pS the fixed value of pattern parameter s, or null if not bound.
311 * @return a stream of matches represented as a Match object.
312 *
313 */
314 public Stream<SynchHasNoOutgoing.Match> streamAllMatches(final Synchronization pS) {
315 return rawStreamAllMatches(new Object[]{pS});
316 }
317
318 /**
319 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
320 * Neither determinism nor randomness of selection is guaranteed.
321 * @param pS the fixed value of pattern parameter s, or null if not bound.
322 * @return a match represented as a Match object, or null if no match is found.
323 *
324 */
325 public Optional<SynchHasNoOutgoing.Match> getOneArbitraryMatch(final Synchronization pS) {
326 return rawGetOneArbitraryMatch(new Object[]{pS});
327 }
328
329 /**
330 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
331 * under any possible substitution of the unspecified parameters (if any).
332 * @param pS the fixed value of pattern parameter s, or null if not bound.
333 * @return true if the input is a valid (partial) match of the pattern.
334 *
335 */
336 public boolean hasMatch(final Synchronization pS) {
337 return rawHasMatch(new Object[]{pS});
338 }
339
340 /**
341 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
342 * @param pS the fixed value of pattern parameter s, or null if not bound.
343 * @return the number of pattern matches found.
344 *
345 */
346 public int countMatches(final Synchronization pS) {
347 return rawCountMatches(new Object[]{pS});
348 }
349
350 /**
351 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
352 * Neither determinism nor randomness of selection is guaranteed.
353 * @param pS the fixed value of pattern parameter s, or null if not bound.
354 * @param processor the action that will process the selected match.
355 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
356 *
357 */
358 public boolean forOneArbitraryMatch(final Synchronization pS, final Consumer<? super SynchHasNoOutgoing.Match> processor) {
359 return rawForOneArbitraryMatch(new Object[]{pS}, processor);
360 }
361
362 /**
363 * Returns a new (partial) match.
364 * This can be used e.g. to call the matcher with a partial match.
365 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
366 * @param pS the fixed value of pattern parameter s, or null if not bound.
367 * @return the (partial) match object.
368 *
369 */
370 public SynchHasNoOutgoing.Match newMatch(final Synchronization pS) {
371 return SynchHasNoOutgoing.Match.newMatch(pS);
372 }
373
374 /**
375 * Retrieve the set of values that occur in matches for s.
376 * @return the Set of all values or empty set if there are no matches
377 *
378 */
379 protected Stream<Synchronization> rawStreamAllValuesOfs(final Object[] parameters) {
380 return rawStreamAllValues(POSITION_S, parameters).map(Synchronization.class::cast);
381 }
382
383 /**
384 * Retrieve the set of values that occur in matches for s.
385 * @return the Set of all values or empty set if there are no matches
386 *
387 */
388 public Set<Synchronization> getAllValuesOfs() {
389 return rawStreamAllValuesOfs(emptyArray()).collect(Collectors.toSet());
390 }
391
392 /**
393 * Retrieve the set of values that occur in matches for s.
394 * @return the Set of all values or empty set if there are no matches
395 *
396 */
397 public Stream<Synchronization> streamAllValuesOfs() {
398 return rawStreamAllValuesOfs(emptyArray());
399 }
400
401 @Override
402 protected SynchHasNoOutgoing.Match tupleToMatch(final Tuple t) {
403 try {
404 return SynchHasNoOutgoing.Match.newMatch((Synchronization) t.get(POSITION_S));
405 } catch(ClassCastException e) {
406 LOGGER.error("Element(s) in tuple not properly typed!",e);
407 return null;
408 }
409 }
410
411 @Override
412 protected SynchHasNoOutgoing.Match arrayToMatch(final Object[] match) {
413 try {
414 return SynchHasNoOutgoing.Match.newMatch((Synchronization) match[POSITION_S]);
415 } catch(ClassCastException e) {
416 LOGGER.error("Element(s) in array not properly typed!",e);
417 return null;
418 }
419 }
420
421 @Override
422 protected SynchHasNoOutgoing.Match arrayToMatchMutable(final Object[] match) {
423 try {
424 return SynchHasNoOutgoing.Match.newMutableMatch((Synchronization) match[POSITION_S]);
425 } catch(ClassCastException e) {
426 LOGGER.error("Element(s) in array not properly typed!",e);
427 return null;
428 }
429 }
430
431 /**
432 * @return the singleton instance of the query specification of this pattern
433 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
434 *
435 */
436 public static IQuerySpecification<SynchHasNoOutgoing.Matcher> querySpecification() {
437 return SynchHasNoOutgoing.instance();
438 }
439 }
440
441 private SynchHasNoOutgoing() {
442 super(GeneratedPQuery.INSTANCE);
443 }
444
445 /**
446 * @return the singleton instance of the query specification
447 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
448 *
449 */
450 public static SynchHasNoOutgoing instance() {
451 try{
452 return LazyHolder.INSTANCE;
453 } catch (ExceptionInInitializerError err) {
454 throw processInitializerError(err);
455 }
456 }
457
458 @Override
459 protected SynchHasNoOutgoing.Matcher instantiate(final ViatraQueryEngine engine) {
460 return SynchHasNoOutgoing.Matcher.on(engine);
461 }
462
463 @Override
464 public SynchHasNoOutgoing.Matcher instantiate() {
465 return SynchHasNoOutgoing.Matcher.create();
466 }
467
468 @Override
469 public SynchHasNoOutgoing.Match newEmptyMatch() {
470 return SynchHasNoOutgoing.Match.newEmptyMatch();
471 }
472
473 @Override
474 public SynchHasNoOutgoing.Match newMatch(final Object... parameters) {
475 return SynchHasNoOutgoing.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization) parameters[0]);
476 }
477
478 /**
479 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchHasNoOutgoing (visibility: PUBLIC, simpleName: SynchHasNoOutgoing, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchHasNoOutgoing, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
480 * <b>not</b> at the class load time of the outer class,
481 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchHasNoOutgoing (visibility: PUBLIC, simpleName: SynchHasNoOutgoing, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchHasNoOutgoing, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
482 *
483 * <p> This workaround is required e.g. to support recursion.
484 *
485 */
486 private static class LazyHolder {
487 private final static SynchHasNoOutgoing INSTANCE = new SynchHasNoOutgoing();
488
489 /**
490 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
491 * This initialization order is required to support indirect recursion.
492 *
493 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
494 *
495 */
496 private final static Object STATIC_INITIALIZER = ensureInitialized();
497
498 public static Object ensureInitialized() {
499 INSTANCE.ensureInitializedInternal();
500 return null;
501 }
502 }
503
504 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
505 private final static SynchHasNoOutgoing.GeneratedPQuery INSTANCE = new GeneratedPQuery();
506
507 private final PParameter parameter_s = new PParameter("s", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Synchronization")), PParameterDirection.INOUT);
508
509 private final List<PParameter> parameters = Arrays.asList(parameter_s);
510
511 private GeneratedPQuery() {
512 super(PVisibility.PUBLIC);
513 }
514
515 @Override
516 public String getFullyQualifiedName() {
517 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchHasNoOutgoing";
518 }
519
520 @Override
521 public List<String> getParameterNames() {
522 return Arrays.asList("s");
523 }
524
525 @Override
526 public List<PParameter> getParameters() {
527 return parameters;
528 }
529
530 @Override
531 public Set<PBody> doGetContainedBodies() {
532 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
533 Set<PBody> bodies = new LinkedHashSet<>();
534 {
535 PBody body = new PBody(this);
536 PVariable var_s = body.getOrCreateVariableByName("s");
537 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
538 PVariable var___1_ = body.getOrCreateVariableByName("_<1>");
539 new TypeConstraint(body, Tuples.flatTupleOf(var_s), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
540 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
541 new ExportedParameter(body, var_s, parameter_s)
542 ));
543 // neg find transition(_, s, _)
544 new NegativePatternCall(body, Tuples.flatTupleOf(var___0_, var_s, var___1_), Transition.instance().getInternalQueryRepresentation());
545 bodies.add(body);
546 }
547 {
548 PAnnotation annotation = new PAnnotation("Constraint");
549 annotation.addAttribute("severity", "error");
550 annotation.addAttribute("message", "error");
551 annotation.addAttribute("key", Arrays.asList(new Object[] {
552 new ParameterReference("s")
553 }));
554 addAnnotation(annotation);
555 }
556 return bodies;
557 }
558 }
559}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchThree.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchThree.java
deleted file mode 100644
index 228db3a0..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchThree.java
+++ /dev/null
@@ -1,639 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization;
7import java.util.Arrays;
8import java.util.Collection;
9import java.util.LinkedHashSet;
10import java.util.List;
11import java.util.Objects;
12import java.util.Optional;
13import java.util.Set;
14import java.util.function.Consumer;
15import java.util.stream.Collectors;
16import java.util.stream.Stream;
17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.viatra.query.runtime.api.IPatternMatch;
20import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
27import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
32import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
38import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
39import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
40import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
41import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
42import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
43
44/**
45 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
46 *
47 * <p>Original source:
48 * <code><pre>
49 * Simplifying model generation
50 *
51 * {@literal @}Constraint(severity="error", message="error", key = {s})
52 * pattern synchThree(s: Synchronization) {
53 * Transition.target(t1,s);
54 * Transition.target(t2,s);
55 * Transition.target(t3,s);
56 * t1!=t2;
57 * t2!=t3;
58 * t1!=t3;
59 * } or {
60 * Transition.source(t1,s);
61 * Transition.source(t2,s);
62 * Transition.source(t3,s);
63 * t1!=t2;
64 * t2!=t3;
65 * t1!=t3;
66 * }
67 * </pre></code>
68 *
69 * @see Matcher
70 * @see Match
71 *
72 */
73@SuppressWarnings("all")
74public final class SynchThree extends BaseGeneratedEMFQuerySpecification<SynchThree.Matcher> {
75 /**
76 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchThree pattern,
77 * to be used in conjunction with {@link Matcher}.
78 *
79 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
80 * Each instance is a (possibly partial) substitution of pattern parameters,
81 * usable to represent a match of the pattern in the result of a query,
82 * or to specify the bound (fixed) input parameters when issuing a query.
83 *
84 * @see Matcher
85 *
86 */
87 public static abstract class Match extends BasePatternMatch {
88 private Synchronization fS;
89
90 private static List<String> parameterNames = makeImmutableList("s");
91
92 private Match(final Synchronization pS) {
93 this.fS = pS;
94 }
95
96 @Override
97 public Object get(final String parameterName) {
98 if ("s".equals(parameterName)) return this.fS;
99 return null;
100 }
101
102 public Synchronization getS() {
103 return this.fS;
104 }
105
106 @Override
107 public boolean set(final String parameterName, final Object newValue) {
108 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
109 if ("s".equals(parameterName) ) {
110 this.fS = (Synchronization) newValue;
111 return true;
112 }
113 return false;
114 }
115
116 public void setS(final Synchronization pS) {
117 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
118 this.fS = pS;
119 }
120
121 @Override
122 public String patternName() {
123 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchThree";
124 }
125
126 @Override
127 public List<String> parameterNames() {
128 return SynchThree.Match.parameterNames;
129 }
130
131 @Override
132 public Object[] toArray() {
133 return new Object[]{fS};
134 }
135
136 @Override
137 public SynchThree.Match toImmutable() {
138 return isMutable() ? newMatch(fS) : this;
139 }
140
141 @Override
142 public String prettyPrint() {
143 StringBuilder result = new StringBuilder();
144 result.append("\"s\"=" + prettyPrintValue(fS));
145 return result.toString();
146 }
147
148 @Override
149 public int hashCode() {
150 return Objects.hash(fS);
151 }
152
153 @Override
154 public boolean equals(final Object obj) {
155 if (this == obj)
156 return true;
157 if (obj == null) {
158 return false;
159 }
160 if ((obj instanceof SynchThree.Match)) {
161 SynchThree.Match other = (SynchThree.Match) obj;
162 return Objects.equals(fS, other.fS);
163 } else {
164 // this should be infrequent
165 if (!(obj instanceof IPatternMatch)) {
166 return false;
167 }
168 IPatternMatch otherSig = (IPatternMatch) obj;
169 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
170 }
171 }
172
173 @Override
174 public SynchThree specification() {
175 return SynchThree.instance();
176 }
177
178 /**
179 * Returns an empty, mutable match.
180 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
181 *
182 * @return the empty match.
183 *
184 */
185 public static SynchThree.Match newEmptyMatch() {
186 return new Mutable(null);
187 }
188
189 /**
190 * Returns a mutable (partial) match.
191 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
192 *
193 * @param pS the fixed value of pattern parameter s, or null if not bound.
194 * @return the new, mutable (partial) match object.
195 *
196 */
197 public static SynchThree.Match newMutableMatch(final Synchronization pS) {
198 return new Mutable(pS);
199 }
200
201 /**
202 * Returns a new (partial) match.
203 * This can be used e.g. to call the matcher with a partial match.
204 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
205 * @param pS the fixed value of pattern parameter s, or null if not bound.
206 * @return the (partial) match object.
207 *
208 */
209 public static SynchThree.Match newMatch(final Synchronization pS) {
210 return new Immutable(pS);
211 }
212
213 private static final class Mutable extends SynchThree.Match {
214 Mutable(final Synchronization pS) {
215 super(pS);
216 }
217
218 @Override
219 public boolean isMutable() {
220 return true;
221 }
222 }
223
224 private static final class Immutable extends SynchThree.Match {
225 Immutable(final Synchronization pS) {
226 super(pS);
227 }
228
229 @Override
230 public boolean isMutable() {
231 return false;
232 }
233 }
234 }
235
236 /**
237 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchThree pattern,
238 * providing pattern-specific query methods.
239 *
240 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
241 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
242 *
243 * <p>Matches of the pattern will be represented as {@link Match}.
244 *
245 * <p>Original source:
246 * <code><pre>
247 * Simplifying model generation
248 *
249 * {@literal @}Constraint(severity="error", message="error", key = {s})
250 * pattern synchThree(s: Synchronization) {
251 * Transition.target(t1,s);
252 * Transition.target(t2,s);
253 * Transition.target(t3,s);
254 * t1!=t2;
255 * t2!=t3;
256 * t1!=t3;
257 * } or {
258 * Transition.source(t1,s);
259 * Transition.source(t2,s);
260 * Transition.source(t3,s);
261 * t1!=t2;
262 * t2!=t3;
263 * t1!=t3;
264 * }
265 * </pre></code>
266 *
267 * @see Match
268 * @see SynchThree
269 *
270 */
271 public static class Matcher extends BaseMatcher<SynchThree.Match> {
272 /**
273 * Initializes the pattern matcher within an existing VIATRA Query engine.
274 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
275 *
276 * @param engine the existing VIATRA Query engine in which this matcher will be created.
277 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
278 *
279 */
280 public static SynchThree.Matcher on(final ViatraQueryEngine engine) {
281 // check if matcher already exists
282 Matcher matcher = engine.getExistingMatcher(querySpecification());
283 if (matcher == null) {
284 matcher = (Matcher)engine.getMatcher(querySpecification());
285 }
286 return matcher;
287 }
288
289 /**
290 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
291 * @return an initialized matcher
292 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
293 *
294 */
295 public static SynchThree.Matcher create() {
296 return new Matcher();
297 }
298
299 private final static int POSITION_S = 0;
300
301 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SynchThree.Matcher.class);
302
303 /**
304 * Initializes the pattern matcher within an existing VIATRA Query engine.
305 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
306 *
307 * @param engine the existing VIATRA Query engine in which this matcher will be created.
308 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
309 *
310 */
311 private Matcher() {
312 super(querySpecification());
313 }
314
315 /**
316 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
317 * @param pS the fixed value of pattern parameter s, or null if not bound.
318 * @return matches represented as a Match object.
319 *
320 */
321 public Collection<SynchThree.Match> getAllMatches(final Synchronization pS) {
322 return rawStreamAllMatches(new Object[]{pS}).collect(Collectors.toSet());
323 }
324
325 /**
326 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
327 * </p>
328 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
329 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
330 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
331 * @param pS the fixed value of pattern parameter s, or null if not bound.
332 * @return a stream of matches represented as a Match object.
333 *
334 */
335 public Stream<SynchThree.Match> streamAllMatches(final Synchronization pS) {
336 return rawStreamAllMatches(new Object[]{pS});
337 }
338
339 /**
340 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
341 * Neither determinism nor randomness of selection is guaranteed.
342 * @param pS the fixed value of pattern parameter s, or null if not bound.
343 * @return a match represented as a Match object, or null if no match is found.
344 *
345 */
346 public Optional<SynchThree.Match> getOneArbitraryMatch(final Synchronization pS) {
347 return rawGetOneArbitraryMatch(new Object[]{pS});
348 }
349
350 /**
351 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
352 * under any possible substitution of the unspecified parameters (if any).
353 * @param pS the fixed value of pattern parameter s, or null if not bound.
354 * @return true if the input is a valid (partial) match of the pattern.
355 *
356 */
357 public boolean hasMatch(final Synchronization pS) {
358 return rawHasMatch(new Object[]{pS});
359 }
360
361 /**
362 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
363 * @param pS the fixed value of pattern parameter s, or null if not bound.
364 * @return the number of pattern matches found.
365 *
366 */
367 public int countMatches(final Synchronization pS) {
368 return rawCountMatches(new Object[]{pS});
369 }
370
371 /**
372 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
373 * Neither determinism nor randomness of selection is guaranteed.
374 * @param pS the fixed value of pattern parameter s, or null if not bound.
375 * @param processor the action that will process the selected match.
376 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
377 *
378 */
379 public boolean forOneArbitraryMatch(final Synchronization pS, final Consumer<? super SynchThree.Match> processor) {
380 return rawForOneArbitraryMatch(new Object[]{pS}, processor);
381 }
382
383 /**
384 * Returns a new (partial) match.
385 * This can be used e.g. to call the matcher with a partial match.
386 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
387 * @param pS the fixed value of pattern parameter s, or null if not bound.
388 * @return the (partial) match object.
389 *
390 */
391 public SynchThree.Match newMatch(final Synchronization pS) {
392 return SynchThree.Match.newMatch(pS);
393 }
394
395 /**
396 * Retrieve the set of values that occur in matches for s.
397 * @return the Set of all values or empty set if there are no matches
398 *
399 */
400 protected Stream<Synchronization> rawStreamAllValuesOfs(final Object[] parameters) {
401 return rawStreamAllValues(POSITION_S, parameters).map(Synchronization.class::cast);
402 }
403
404 /**
405 * Retrieve the set of values that occur in matches for s.
406 * @return the Set of all values or empty set if there are no matches
407 *
408 */
409 public Set<Synchronization> getAllValuesOfs() {
410 return rawStreamAllValuesOfs(emptyArray()).collect(Collectors.toSet());
411 }
412
413 /**
414 * Retrieve the set of values that occur in matches for s.
415 * @return the Set of all values or empty set if there are no matches
416 *
417 */
418 public Stream<Synchronization> streamAllValuesOfs() {
419 return rawStreamAllValuesOfs(emptyArray());
420 }
421
422 @Override
423 protected SynchThree.Match tupleToMatch(final Tuple t) {
424 try {
425 return SynchThree.Match.newMatch((Synchronization) t.get(POSITION_S));
426 } catch(ClassCastException e) {
427 LOGGER.error("Element(s) in tuple not properly typed!",e);
428 return null;
429 }
430 }
431
432 @Override
433 protected SynchThree.Match arrayToMatch(final Object[] match) {
434 try {
435 return SynchThree.Match.newMatch((Synchronization) match[POSITION_S]);
436 } catch(ClassCastException e) {
437 LOGGER.error("Element(s) in array not properly typed!",e);
438 return null;
439 }
440 }
441
442 @Override
443 protected SynchThree.Match arrayToMatchMutable(final Object[] match) {
444 try {
445 return SynchThree.Match.newMutableMatch((Synchronization) match[POSITION_S]);
446 } catch(ClassCastException e) {
447 LOGGER.error("Element(s) in array not properly typed!",e);
448 return null;
449 }
450 }
451
452 /**
453 * @return the singleton instance of the query specification of this pattern
454 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
455 *
456 */
457 public static IQuerySpecification<SynchThree.Matcher> querySpecification() {
458 return SynchThree.instance();
459 }
460 }
461
462 private SynchThree() {
463 super(GeneratedPQuery.INSTANCE);
464 }
465
466 /**
467 * @return the singleton instance of the query specification
468 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
469 *
470 */
471 public static SynchThree instance() {
472 try{
473 return LazyHolder.INSTANCE;
474 } catch (ExceptionInInitializerError err) {
475 throw processInitializerError(err);
476 }
477 }
478
479 @Override
480 protected SynchThree.Matcher instantiate(final ViatraQueryEngine engine) {
481 return SynchThree.Matcher.on(engine);
482 }
483
484 @Override
485 public SynchThree.Matcher instantiate() {
486 return SynchThree.Matcher.create();
487 }
488
489 @Override
490 public SynchThree.Match newEmptyMatch() {
491 return SynchThree.Match.newEmptyMatch();
492 }
493
494 @Override
495 public SynchThree.Match newMatch(final Object... parameters) {
496 return SynchThree.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization) parameters[0]);
497 }
498
499 /**
500 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchThree (visibility: PUBLIC, simpleName: SynchThree, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchThree, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
501 * <b>not</b> at the class load time of the outer class,
502 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchThree (visibility: PUBLIC, simpleName: SynchThree, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchThree, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
503 *
504 * <p> This workaround is required e.g. to support recursion.
505 *
506 */
507 private static class LazyHolder {
508 private final static SynchThree INSTANCE = new SynchThree();
509
510 /**
511 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
512 * This initialization order is required to support indirect recursion.
513 *
514 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
515 *
516 */
517 private final static Object STATIC_INITIALIZER = ensureInitialized();
518
519 public static Object ensureInitialized() {
520 INSTANCE.ensureInitializedInternal();
521 return null;
522 }
523 }
524
525 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
526 private final static SynchThree.GeneratedPQuery INSTANCE = new GeneratedPQuery();
527
528 private final PParameter parameter_s = new PParameter("s", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Synchronization")), PParameterDirection.INOUT);
529
530 private final List<PParameter> parameters = Arrays.asList(parameter_s);
531
532 private GeneratedPQuery() {
533 super(PVisibility.PUBLIC);
534 }
535
536 @Override
537 public String getFullyQualifiedName() {
538 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.synchThree";
539 }
540
541 @Override
542 public List<String> getParameterNames() {
543 return Arrays.asList("s");
544 }
545
546 @Override
547 public List<PParameter> getParameters() {
548 return parameters;
549 }
550
551 @Override
552 public Set<PBody> doGetContainedBodies() {
553 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
554 Set<PBody> bodies = new LinkedHashSet<>();
555 {
556 PBody body = new PBody(this);
557 PVariable var_s = body.getOrCreateVariableByName("s");
558 PVariable var_t1 = body.getOrCreateVariableByName("t1");
559 PVariable var_t2 = body.getOrCreateVariableByName("t2");
560 PVariable var_t3 = body.getOrCreateVariableByName("t3");
561 new TypeConstraint(body, Tuples.flatTupleOf(var_s), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
562 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
563 new ExportedParameter(body, var_s, parameter_s)
564 ));
565 // Transition.target(t1,s)
566 new TypeConstraint(body, Tuples.flatTupleOf(var_t1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
567 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
568 new TypeConstraint(body, Tuples.flatTupleOf(var_t1, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Transition", "target")));
569 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
570 new Equality(body, var__virtual_0_, var_s);
571 // Transition.target(t2,s)
572 new TypeConstraint(body, Tuples.flatTupleOf(var_t2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
573 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
574 new TypeConstraint(body, Tuples.flatTupleOf(var_t2, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Transition", "target")));
575 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
576 new Equality(body, var__virtual_1_, var_s);
577 // Transition.target(t3,s)
578 new TypeConstraint(body, Tuples.flatTupleOf(var_t3), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
579 PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
580 new TypeConstraint(body, Tuples.flatTupleOf(var_t3, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Transition", "target")));
581 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
582 new Equality(body, var__virtual_2_, var_s);
583 // t1!=t2
584 new Inequality(body, var_t1, var_t2);
585 // t2!=t3
586 new Inequality(body, var_t2, var_t3);
587 // t1!=t3
588 new Inequality(body, var_t1, var_t3);
589 bodies.add(body);
590 }
591 {
592 PBody body = new PBody(this);
593 PVariable var_s = body.getOrCreateVariableByName("s");
594 PVariable var_t1 = body.getOrCreateVariableByName("t1");
595 PVariable var_t2 = body.getOrCreateVariableByName("t2");
596 PVariable var_t3 = body.getOrCreateVariableByName("t3");
597 new TypeConstraint(body, Tuples.flatTupleOf(var_s), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
598 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
599 new ExportedParameter(body, var_s, parameter_s)
600 ));
601 // Transition.source(t1,s)
602 new TypeConstraint(body, Tuples.flatTupleOf(var_t1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
603 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
604 new TypeConstraint(body, Tuples.flatTupleOf(var_t1, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Transition", "source")));
605 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
606 new Equality(body, var__virtual_0_, var_s);
607 // Transition.source(t2,s)
608 new TypeConstraint(body, Tuples.flatTupleOf(var_t2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
609 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
610 new TypeConstraint(body, Tuples.flatTupleOf(var_t2, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Transition", "source")));
611 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
612 new Equality(body, var__virtual_1_, var_s);
613 // Transition.source(t3,s)
614 new TypeConstraint(body, Tuples.flatTupleOf(var_t3), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
615 PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
616 new TypeConstraint(body, Tuples.flatTupleOf(var_t3, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Transition", "source")));
617 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
618 new Equality(body, var__virtual_2_, var_s);
619 // t1!=t2
620 new Inequality(body, var_t1, var_t2);
621 // t2!=t3
622 new Inequality(body, var_t2, var_t3);
623 // t1!=t3
624 new Inequality(body, var_t1, var_t3);
625 bodies.add(body);
626 }
627 {
628 PAnnotation annotation = new PAnnotation("Constraint");
629 annotation.addAttribute("severity", "error");
630 annotation.addAttribute("message", "error");
631 annotation.addAttribute("key", Arrays.asList(new Object[] {
632 new ParameterReference("s")
633 }));
634 addAnnotation(annotation);
635 }
636 return bodies;
637 }
638 }
639}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedIncomingInSameRegion.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedIncomingInSameRegion.java
deleted file mode 100644
index dabbe8c5..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedIncomingInSameRegion.java
+++ /dev/null
@@ -1,888 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex;
8import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition;
9import java.util.Arrays;
10import java.util.Collection;
11import java.util.LinkedHashSet;
12import java.util.List;
13import java.util.Objects;
14import java.util.Optional;
15import java.util.Set;
16import java.util.function.Consumer;
17import java.util.stream.Collectors;
18import java.util.stream.Stream;
19import org.apache.log4j.Logger;
20import org.eclipse.emf.ecore.EClass;
21import org.eclipse.viatra.query.runtime.api.IPatternMatch;
22import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
23import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
25import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
26import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
27import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
28import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
29import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
30import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
31import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
32import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
33import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
34import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
38import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
39import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
40import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
41import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
42import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
43import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
44import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
45import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
46
47/**
48 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
49 *
50 * <p>Original source:
51 * <code><pre>
52 * {@literal @}Constraint(severity="error", message="error", key = {s})
53 * pattern SynchronizedIncomingInSameRegion(s : Synchronization, v1 : Vertex, v2 : Vertex) {
54 * find transition(t1, v1, s);
55 * find transition(t2, v2, s);
56 * t1!=t2;
57 * Region.vertices(r, v1);
58 * Region.vertices(r, v2);
59 * } or {
60 * find transition(t1, s, v1);
61 * find transition(t2, s, v2);
62 * t1!=t2;
63 * Region.vertices(r, v1);
64 * Region.vertices(r, v2);
65 * }
66 * </pre></code>
67 *
68 * @see Matcher
69 * @see Match
70 *
71 */
72@SuppressWarnings("all")
73public final class SynchronizedIncomingInSameRegion extends BaseGeneratedEMFQuerySpecification<SynchronizedIncomingInSameRegion.Matcher> {
74 /**
75 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedIncomingInSameRegion pattern,
76 * to be used in conjunction with {@link Matcher}.
77 *
78 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
79 * Each instance is a (possibly partial) substitution of pattern parameters,
80 * usable to represent a match of the pattern in the result of a query,
81 * or to specify the bound (fixed) input parameters when issuing a query.
82 *
83 * @see Matcher
84 *
85 */
86 public static abstract class Match extends BasePatternMatch {
87 private Synchronization fS;
88
89 private Vertex fV1;
90
91 private Vertex fV2;
92
93 private static List<String> parameterNames = makeImmutableList("s", "v1", "v2");
94
95 private Match(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
96 this.fS = pS;
97 this.fV1 = pV1;
98 this.fV2 = pV2;
99 }
100
101 @Override
102 public Object get(final String parameterName) {
103 if ("s".equals(parameterName)) return this.fS;
104 if ("v1".equals(parameterName)) return this.fV1;
105 if ("v2".equals(parameterName)) return this.fV2;
106 return null;
107 }
108
109 public Synchronization getS() {
110 return this.fS;
111 }
112
113 public Vertex getV1() {
114 return this.fV1;
115 }
116
117 public Vertex getV2() {
118 return this.fV2;
119 }
120
121 @Override
122 public boolean set(final String parameterName, final Object newValue) {
123 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
124 if ("s".equals(parameterName) ) {
125 this.fS = (Synchronization) newValue;
126 return true;
127 }
128 if ("v1".equals(parameterName) ) {
129 this.fV1 = (Vertex) newValue;
130 return true;
131 }
132 if ("v2".equals(parameterName) ) {
133 this.fV2 = (Vertex) newValue;
134 return true;
135 }
136 return false;
137 }
138
139 public void setS(final Synchronization pS) {
140 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
141 this.fS = pS;
142 }
143
144 public void setV1(final Vertex pV1) {
145 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
146 this.fV1 = pV1;
147 }
148
149 public void setV2(final Vertex pV2) {
150 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
151 this.fV2 = pV2;
152 }
153
154 @Override
155 public String patternName() {
156 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedIncomingInSameRegion";
157 }
158
159 @Override
160 public List<String> parameterNames() {
161 return SynchronizedIncomingInSameRegion.Match.parameterNames;
162 }
163
164 @Override
165 public Object[] toArray() {
166 return new Object[]{fS, fV1, fV2};
167 }
168
169 @Override
170 public SynchronizedIncomingInSameRegion.Match toImmutable() {
171 return isMutable() ? newMatch(fS, fV1, fV2) : this;
172 }
173
174 @Override
175 public String prettyPrint() {
176 StringBuilder result = new StringBuilder();
177 result.append("\"s\"=" + prettyPrintValue(fS) + ", ");
178 result.append("\"v1\"=" + prettyPrintValue(fV1) + ", ");
179 result.append("\"v2\"=" + prettyPrintValue(fV2));
180 return result.toString();
181 }
182
183 @Override
184 public int hashCode() {
185 return Objects.hash(fS, fV1, fV2);
186 }
187
188 @Override
189 public boolean equals(final Object obj) {
190 if (this == obj)
191 return true;
192 if (obj == null) {
193 return false;
194 }
195 if ((obj instanceof SynchronizedIncomingInSameRegion.Match)) {
196 SynchronizedIncomingInSameRegion.Match other = (SynchronizedIncomingInSameRegion.Match) obj;
197 return Objects.equals(fS, other.fS) && Objects.equals(fV1, other.fV1) && Objects.equals(fV2, other.fV2);
198 } else {
199 // this should be infrequent
200 if (!(obj instanceof IPatternMatch)) {
201 return false;
202 }
203 IPatternMatch otherSig = (IPatternMatch) obj;
204 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
205 }
206 }
207
208 @Override
209 public SynchronizedIncomingInSameRegion specification() {
210 return SynchronizedIncomingInSameRegion.instance();
211 }
212
213 /**
214 * Returns an empty, mutable match.
215 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
216 *
217 * @return the empty match.
218 *
219 */
220 public static SynchronizedIncomingInSameRegion.Match newEmptyMatch() {
221 return new Mutable(null, null, null);
222 }
223
224 /**
225 * Returns a mutable (partial) match.
226 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
227 *
228 * @param pS the fixed value of pattern parameter s, or null if not bound.
229 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
230 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
231 * @return the new, mutable (partial) match object.
232 *
233 */
234 public static SynchronizedIncomingInSameRegion.Match newMutableMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
235 return new Mutable(pS, pV1, pV2);
236 }
237
238 /**
239 * Returns a new (partial) match.
240 * This can be used e.g. to call the matcher with a partial match.
241 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
242 * @param pS the fixed value of pattern parameter s, or null if not bound.
243 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
244 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
245 * @return the (partial) match object.
246 *
247 */
248 public static SynchronizedIncomingInSameRegion.Match newMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
249 return new Immutable(pS, pV1, pV2);
250 }
251
252 private static final class Mutable extends SynchronizedIncomingInSameRegion.Match {
253 Mutable(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
254 super(pS, pV1, pV2);
255 }
256
257 @Override
258 public boolean isMutable() {
259 return true;
260 }
261 }
262
263 private static final class Immutable extends SynchronizedIncomingInSameRegion.Match {
264 Immutable(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
265 super(pS, pV1, pV2);
266 }
267
268 @Override
269 public boolean isMutable() {
270 return false;
271 }
272 }
273 }
274
275 /**
276 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedIncomingInSameRegion pattern,
277 * providing pattern-specific query methods.
278 *
279 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
280 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
281 *
282 * <p>Matches of the pattern will be represented as {@link Match}.
283 *
284 * <p>Original source:
285 * <code><pre>
286 * {@literal @}Constraint(severity="error", message="error", key = {s})
287 * pattern SynchronizedIncomingInSameRegion(s : Synchronization, v1 : Vertex, v2 : Vertex) {
288 * find transition(t1, v1, s);
289 * find transition(t2, v2, s);
290 * t1!=t2;
291 * Region.vertices(r, v1);
292 * Region.vertices(r, v2);
293 * } or {
294 * find transition(t1, s, v1);
295 * find transition(t2, s, v2);
296 * t1!=t2;
297 * Region.vertices(r, v1);
298 * Region.vertices(r, v2);
299 * }
300 * </pre></code>
301 *
302 * @see Match
303 * @see SynchronizedIncomingInSameRegion
304 *
305 */
306 public static class Matcher extends BaseMatcher<SynchronizedIncomingInSameRegion.Match> {
307 /**
308 * Initializes the pattern matcher within an existing VIATRA Query engine.
309 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
310 *
311 * @param engine the existing VIATRA Query engine in which this matcher will be created.
312 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
313 *
314 */
315 public static SynchronizedIncomingInSameRegion.Matcher on(final ViatraQueryEngine engine) {
316 // check if matcher already exists
317 Matcher matcher = engine.getExistingMatcher(querySpecification());
318 if (matcher == null) {
319 matcher = (Matcher)engine.getMatcher(querySpecification());
320 }
321 return matcher;
322 }
323
324 /**
325 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
326 * @return an initialized matcher
327 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
328 *
329 */
330 public static SynchronizedIncomingInSameRegion.Matcher create() {
331 return new Matcher();
332 }
333
334 private final static int POSITION_S = 0;
335
336 private final static int POSITION_V1 = 1;
337
338 private final static int POSITION_V2 = 2;
339
340 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SynchronizedIncomingInSameRegion.Matcher.class);
341
342 /**
343 * Initializes the pattern matcher within an existing VIATRA Query engine.
344 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
345 *
346 * @param engine the existing VIATRA Query engine in which this matcher will be created.
347 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
348 *
349 */
350 private Matcher() {
351 super(querySpecification());
352 }
353
354 /**
355 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
356 * @param pS the fixed value of pattern parameter s, or null if not bound.
357 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
358 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
359 * @return matches represented as a Match object.
360 *
361 */
362 public Collection<SynchronizedIncomingInSameRegion.Match> getAllMatches(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
363 return rawStreamAllMatches(new Object[]{pS, pV1, pV2}).collect(Collectors.toSet());
364 }
365
366 /**
367 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
368 * </p>
369 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
370 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
371 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
372 * @param pS the fixed value of pattern parameter s, or null if not bound.
373 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
374 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
375 * @return a stream of matches represented as a Match object.
376 *
377 */
378 public Stream<SynchronizedIncomingInSameRegion.Match> streamAllMatches(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
379 return rawStreamAllMatches(new Object[]{pS, pV1, pV2});
380 }
381
382 /**
383 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
384 * Neither determinism nor randomness of selection is guaranteed.
385 * @param pS the fixed value of pattern parameter s, or null if not bound.
386 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
387 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
388 * @return a match represented as a Match object, or null if no match is found.
389 *
390 */
391 public Optional<SynchronizedIncomingInSameRegion.Match> getOneArbitraryMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
392 return rawGetOneArbitraryMatch(new Object[]{pS, pV1, pV2});
393 }
394
395 /**
396 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
397 * under any possible substitution of the unspecified parameters (if any).
398 * @param pS the fixed value of pattern parameter s, or null if not bound.
399 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
400 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
401 * @return true if the input is a valid (partial) match of the pattern.
402 *
403 */
404 public boolean hasMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
405 return rawHasMatch(new Object[]{pS, pV1, pV2});
406 }
407
408 /**
409 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
410 * @param pS the fixed value of pattern parameter s, or null if not bound.
411 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
412 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
413 * @return the number of pattern matches found.
414 *
415 */
416 public int countMatches(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
417 return rawCountMatches(new Object[]{pS, pV1, pV2});
418 }
419
420 /**
421 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
422 * Neither determinism nor randomness of selection is guaranteed.
423 * @param pS the fixed value of pattern parameter s, or null if not bound.
424 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
425 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
426 * @param processor the action that will process the selected match.
427 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
428 *
429 */
430 public boolean forOneArbitraryMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2, final Consumer<? super SynchronizedIncomingInSameRegion.Match> processor) {
431 return rawForOneArbitraryMatch(new Object[]{pS, pV1, pV2}, processor);
432 }
433
434 /**
435 * Returns a new (partial) match.
436 * This can be used e.g. to call the matcher with a partial match.
437 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
438 * @param pS the fixed value of pattern parameter s, or null if not bound.
439 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
440 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
441 * @return the (partial) match object.
442 *
443 */
444 public SynchronizedIncomingInSameRegion.Match newMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
445 return SynchronizedIncomingInSameRegion.Match.newMatch(pS, pV1, pV2);
446 }
447
448 /**
449 * Retrieve the set of values that occur in matches for s.
450 * @return the Set of all values or empty set if there are no matches
451 *
452 */
453 protected Stream<Synchronization> rawStreamAllValuesOfs(final Object[] parameters) {
454 return rawStreamAllValues(POSITION_S, parameters).map(Synchronization.class::cast);
455 }
456
457 /**
458 * Retrieve the set of values that occur in matches for s.
459 * @return the Set of all values or empty set if there are no matches
460 *
461 */
462 public Set<Synchronization> getAllValuesOfs() {
463 return rawStreamAllValuesOfs(emptyArray()).collect(Collectors.toSet());
464 }
465
466 /**
467 * Retrieve the set of values that occur in matches for s.
468 * @return the Set of all values or empty set if there are no matches
469 *
470 */
471 public Stream<Synchronization> streamAllValuesOfs() {
472 return rawStreamAllValuesOfs(emptyArray());
473 }
474
475 /**
476 * Retrieve the set of values that occur in matches for s.
477 * </p>
478 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
479 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
480 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
481 *
482 * @return the Stream of all values or empty set if there are no matches
483 *
484 */
485 public Stream<Synchronization> streamAllValuesOfs(final SynchronizedIncomingInSameRegion.Match partialMatch) {
486 return rawStreamAllValuesOfs(partialMatch.toArray());
487 }
488
489 /**
490 * Retrieve the set of values that occur in matches for s.
491 * </p>
492 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
493 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
494 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
495 *
496 * @return the Stream of all values or empty set if there are no matches
497 *
498 */
499 public Stream<Synchronization> streamAllValuesOfs(final Vertex pV1, final Vertex pV2) {
500 return rawStreamAllValuesOfs(new Object[]{null, pV1, pV2});
501 }
502
503 /**
504 * Retrieve the set of values that occur in matches for s.
505 * @return the Set of all values or empty set if there are no matches
506 *
507 */
508 public Set<Synchronization> getAllValuesOfs(final SynchronizedIncomingInSameRegion.Match partialMatch) {
509 return rawStreamAllValuesOfs(partialMatch.toArray()).collect(Collectors.toSet());
510 }
511
512 /**
513 * Retrieve the set of values that occur in matches for s.
514 * @return the Set of all values or empty set if there are no matches
515 *
516 */
517 public Set<Synchronization> getAllValuesOfs(final Vertex pV1, final Vertex pV2) {
518 return rawStreamAllValuesOfs(new Object[]{null, pV1, pV2}).collect(Collectors.toSet());
519 }
520
521 /**
522 * Retrieve the set of values that occur in matches for v1.
523 * @return the Set of all values or empty set if there are no matches
524 *
525 */
526 protected Stream<Vertex> rawStreamAllValuesOfv1(final Object[] parameters) {
527 return rawStreamAllValues(POSITION_V1, parameters).map(Vertex.class::cast);
528 }
529
530 /**
531 * Retrieve the set of values that occur in matches for v1.
532 * @return the Set of all values or empty set if there are no matches
533 *
534 */
535 public Set<Vertex> getAllValuesOfv1() {
536 return rawStreamAllValuesOfv1(emptyArray()).collect(Collectors.toSet());
537 }
538
539 /**
540 * Retrieve the set of values that occur in matches for v1.
541 * @return the Set of all values or empty set if there are no matches
542 *
543 */
544 public Stream<Vertex> streamAllValuesOfv1() {
545 return rawStreamAllValuesOfv1(emptyArray());
546 }
547
548 /**
549 * Retrieve the set of values that occur in matches for v1.
550 * </p>
551 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
552 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
553 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
554 *
555 * @return the Stream of all values or empty set if there are no matches
556 *
557 */
558 public Stream<Vertex> streamAllValuesOfv1(final SynchronizedIncomingInSameRegion.Match partialMatch) {
559 return rawStreamAllValuesOfv1(partialMatch.toArray());
560 }
561
562 /**
563 * Retrieve the set of values that occur in matches for v1.
564 * </p>
565 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
566 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
567 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
568 *
569 * @return the Stream of all values or empty set if there are no matches
570 *
571 */
572 public Stream<Vertex> streamAllValuesOfv1(final Synchronization pS, final Vertex pV2) {
573 return rawStreamAllValuesOfv1(new Object[]{pS, null, pV2});
574 }
575
576 /**
577 * Retrieve the set of values that occur in matches for v1.
578 * @return the Set of all values or empty set if there are no matches
579 *
580 */
581 public Set<Vertex> getAllValuesOfv1(final SynchronizedIncomingInSameRegion.Match partialMatch) {
582 return rawStreamAllValuesOfv1(partialMatch.toArray()).collect(Collectors.toSet());
583 }
584
585 /**
586 * Retrieve the set of values that occur in matches for v1.
587 * @return the Set of all values or empty set if there are no matches
588 *
589 */
590 public Set<Vertex> getAllValuesOfv1(final Synchronization pS, final Vertex pV2) {
591 return rawStreamAllValuesOfv1(new Object[]{pS, null, pV2}).collect(Collectors.toSet());
592 }
593
594 /**
595 * Retrieve the set of values that occur in matches for v2.
596 * @return the Set of all values or empty set if there are no matches
597 *
598 */
599 protected Stream<Vertex> rawStreamAllValuesOfv2(final Object[] parameters) {
600 return rawStreamAllValues(POSITION_V2, parameters).map(Vertex.class::cast);
601 }
602
603 /**
604 * Retrieve the set of values that occur in matches for v2.
605 * @return the Set of all values or empty set if there are no matches
606 *
607 */
608 public Set<Vertex> getAllValuesOfv2() {
609 return rawStreamAllValuesOfv2(emptyArray()).collect(Collectors.toSet());
610 }
611
612 /**
613 * Retrieve the set of values that occur in matches for v2.
614 * @return the Set of all values or empty set if there are no matches
615 *
616 */
617 public Stream<Vertex> streamAllValuesOfv2() {
618 return rawStreamAllValuesOfv2(emptyArray());
619 }
620
621 /**
622 * Retrieve the set of values that occur in matches for v2.
623 * </p>
624 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
625 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
626 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
627 *
628 * @return the Stream of all values or empty set if there are no matches
629 *
630 */
631 public Stream<Vertex> streamAllValuesOfv2(final SynchronizedIncomingInSameRegion.Match partialMatch) {
632 return rawStreamAllValuesOfv2(partialMatch.toArray());
633 }
634
635 /**
636 * Retrieve the set of values that occur in matches for v2.
637 * </p>
638 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
639 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
640 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
641 *
642 * @return the Stream of all values or empty set if there are no matches
643 *
644 */
645 public Stream<Vertex> streamAllValuesOfv2(final Synchronization pS, final Vertex pV1) {
646 return rawStreamAllValuesOfv2(new Object[]{pS, pV1, null});
647 }
648
649 /**
650 * Retrieve the set of values that occur in matches for v2.
651 * @return the Set of all values or empty set if there are no matches
652 *
653 */
654 public Set<Vertex> getAllValuesOfv2(final SynchronizedIncomingInSameRegion.Match partialMatch) {
655 return rawStreamAllValuesOfv2(partialMatch.toArray()).collect(Collectors.toSet());
656 }
657
658 /**
659 * Retrieve the set of values that occur in matches for v2.
660 * @return the Set of all values or empty set if there are no matches
661 *
662 */
663 public Set<Vertex> getAllValuesOfv2(final Synchronization pS, final Vertex pV1) {
664 return rawStreamAllValuesOfv2(new Object[]{pS, pV1, null}).collect(Collectors.toSet());
665 }
666
667 @Override
668 protected SynchronizedIncomingInSameRegion.Match tupleToMatch(final Tuple t) {
669 try {
670 return SynchronizedIncomingInSameRegion.Match.newMatch((Synchronization) t.get(POSITION_S), (Vertex) t.get(POSITION_V1), (Vertex) t.get(POSITION_V2));
671 } catch(ClassCastException e) {
672 LOGGER.error("Element(s) in tuple not properly typed!",e);
673 return null;
674 }
675 }
676
677 @Override
678 protected SynchronizedIncomingInSameRegion.Match arrayToMatch(final Object[] match) {
679 try {
680 return SynchronizedIncomingInSameRegion.Match.newMatch((Synchronization) match[POSITION_S], (Vertex) match[POSITION_V1], (Vertex) match[POSITION_V2]);
681 } catch(ClassCastException e) {
682 LOGGER.error("Element(s) in array not properly typed!",e);
683 return null;
684 }
685 }
686
687 @Override
688 protected SynchronizedIncomingInSameRegion.Match arrayToMatchMutable(final Object[] match) {
689 try {
690 return SynchronizedIncomingInSameRegion.Match.newMutableMatch((Synchronization) match[POSITION_S], (Vertex) match[POSITION_V1], (Vertex) match[POSITION_V2]);
691 } catch(ClassCastException e) {
692 LOGGER.error("Element(s) in array not properly typed!",e);
693 return null;
694 }
695 }
696
697 /**
698 * @return the singleton instance of the query specification of this pattern
699 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
700 *
701 */
702 public static IQuerySpecification<SynchronizedIncomingInSameRegion.Matcher> querySpecification() {
703 return SynchronizedIncomingInSameRegion.instance();
704 }
705 }
706
707 private SynchronizedIncomingInSameRegion() {
708 super(GeneratedPQuery.INSTANCE);
709 }
710
711 /**
712 * @return the singleton instance of the query specification
713 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
714 *
715 */
716 public static SynchronizedIncomingInSameRegion instance() {
717 try{
718 return LazyHolder.INSTANCE;
719 } catch (ExceptionInInitializerError err) {
720 throw processInitializerError(err);
721 }
722 }
723
724 @Override
725 protected SynchronizedIncomingInSameRegion.Matcher instantiate(final ViatraQueryEngine engine) {
726 return SynchronizedIncomingInSameRegion.Matcher.on(engine);
727 }
728
729 @Override
730 public SynchronizedIncomingInSameRegion.Matcher instantiate() {
731 return SynchronizedIncomingInSameRegion.Matcher.create();
732 }
733
734 @Override
735 public SynchronizedIncomingInSameRegion.Match newEmptyMatch() {
736 return SynchronizedIncomingInSameRegion.Match.newEmptyMatch();
737 }
738
739 @Override
740 public SynchronizedIncomingInSameRegion.Match newMatch(final Object... parameters) {
741 return SynchronizedIncomingInSameRegion.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization) parameters[0], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex) parameters[1], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex) parameters[2]);
742 }
743
744 /**
745 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedIncomingInSameRegion (visibility: PUBLIC, simpleName: SynchronizedIncomingInSameRegion, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedIncomingInSameRegion, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
746 * <b>not</b> at the class load time of the outer class,
747 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedIncomingInSameRegion (visibility: PUBLIC, simpleName: SynchronizedIncomingInSameRegion, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedIncomingInSameRegion, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
748 *
749 * <p> This workaround is required e.g. to support recursion.
750 *
751 */
752 private static class LazyHolder {
753 private final static SynchronizedIncomingInSameRegion INSTANCE = new SynchronizedIncomingInSameRegion();
754
755 /**
756 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
757 * This initialization order is required to support indirect recursion.
758 *
759 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
760 *
761 */
762 private final static Object STATIC_INITIALIZER = ensureInitialized();
763
764 public static Object ensureInitialized() {
765 INSTANCE.ensureInitializedInternal();
766 return null;
767 }
768 }
769
770 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
771 private final static SynchronizedIncomingInSameRegion.GeneratedPQuery INSTANCE = new GeneratedPQuery();
772
773 private final PParameter parameter_s = new PParameter("s", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Synchronization")), PParameterDirection.INOUT);
774
775 private final PParameter parameter_v1 = new PParameter("v1", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Vertex")), PParameterDirection.INOUT);
776
777 private final PParameter parameter_v2 = new PParameter("v2", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Vertex")), PParameterDirection.INOUT);
778
779 private final List<PParameter> parameters = Arrays.asList(parameter_s, parameter_v1, parameter_v2);
780
781 private GeneratedPQuery() {
782 super(PVisibility.PUBLIC);
783 }
784
785 @Override
786 public String getFullyQualifiedName() {
787 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedIncomingInSameRegion";
788 }
789
790 @Override
791 public List<String> getParameterNames() {
792 return Arrays.asList("s","v1","v2");
793 }
794
795 @Override
796 public List<PParameter> getParameters() {
797 return parameters;
798 }
799
800 @Override
801 public Set<PBody> doGetContainedBodies() {
802 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
803 Set<PBody> bodies = new LinkedHashSet<>();
804 {
805 PBody body = new PBody(this);
806 PVariable var_s = body.getOrCreateVariableByName("s");
807 PVariable var_v1 = body.getOrCreateVariableByName("v1");
808 PVariable var_v2 = body.getOrCreateVariableByName("v2");
809 PVariable var_t1 = body.getOrCreateVariableByName("t1");
810 PVariable var_t2 = body.getOrCreateVariableByName("t2");
811 PVariable var_r = body.getOrCreateVariableByName("r");
812 new TypeConstraint(body, Tuples.flatTupleOf(var_s), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
813 new TypeConstraint(body, Tuples.flatTupleOf(var_v1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
814 new TypeConstraint(body, Tuples.flatTupleOf(var_v2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
815 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
816 new ExportedParameter(body, var_s, parameter_s),
817 new ExportedParameter(body, var_v1, parameter_v1),
818 new ExportedParameter(body, var_v2, parameter_v2)
819 ));
820 // find transition(t1, v1, s)
821 new PositivePatternCall(body, Tuples.flatTupleOf(var_t1, var_v1, var_s), Transition.instance().getInternalQueryRepresentation());
822 // find transition(t2, v2, s)
823 new PositivePatternCall(body, Tuples.flatTupleOf(var_t2, var_v2, var_s), Transition.instance().getInternalQueryRepresentation());
824 // t1!=t2
825 new Inequality(body, var_t1, var_t2);
826 // Region.vertices(r, v1)
827 new TypeConstraint(body, Tuples.flatTupleOf(var_r), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
828 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
829 new TypeConstraint(body, Tuples.flatTupleOf(var_r, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices")));
830 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
831 new Equality(body, var__virtual_0_, var_v1);
832 // Region.vertices(r, v2)
833 new TypeConstraint(body, Tuples.flatTupleOf(var_r), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
834 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
835 new TypeConstraint(body, Tuples.flatTupleOf(var_r, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices")));
836 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
837 new Equality(body, var__virtual_1_, var_v2);
838 bodies.add(body);
839 }
840 {
841 PBody body = new PBody(this);
842 PVariable var_s = body.getOrCreateVariableByName("s");
843 PVariable var_v1 = body.getOrCreateVariableByName("v1");
844 PVariable var_v2 = body.getOrCreateVariableByName("v2");
845 PVariable var_t1 = body.getOrCreateVariableByName("t1");
846 PVariable var_t2 = body.getOrCreateVariableByName("t2");
847 PVariable var_r = body.getOrCreateVariableByName("r");
848 new TypeConstraint(body, Tuples.flatTupleOf(var_s), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
849 new TypeConstraint(body, Tuples.flatTupleOf(var_v1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
850 new TypeConstraint(body, Tuples.flatTupleOf(var_v2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
851 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
852 new ExportedParameter(body, var_s, parameter_s),
853 new ExportedParameter(body, var_v1, parameter_v1),
854 new ExportedParameter(body, var_v2, parameter_v2)
855 ));
856 // find transition(t1, s, v1)
857 new PositivePatternCall(body, Tuples.flatTupleOf(var_t1, var_s, var_v1), Transition.instance().getInternalQueryRepresentation());
858 // find transition(t2, s, v2)
859 new PositivePatternCall(body, Tuples.flatTupleOf(var_t2, var_s, var_v2), Transition.instance().getInternalQueryRepresentation());
860 // t1!=t2
861 new Inequality(body, var_t1, var_t2);
862 // Region.vertices(r, v1)
863 new TypeConstraint(body, Tuples.flatTupleOf(var_r), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
864 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
865 new TypeConstraint(body, Tuples.flatTupleOf(var_r, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices")));
866 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
867 new Equality(body, var__virtual_0_, var_v1);
868 // Region.vertices(r, v2)
869 new TypeConstraint(body, Tuples.flatTupleOf(var_r), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
870 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
871 new TypeConstraint(body, Tuples.flatTupleOf(var_r, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices")));
872 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
873 new Equality(body, var__virtual_1_, var_v2);
874 bodies.add(body);
875 }
876 {
877 PAnnotation annotation = new PAnnotation("Constraint");
878 annotation.addAttribute("severity", "error");
879 annotation.addAttribute("message", "error");
880 annotation.addAttribute("key", Arrays.asList(new Object[] {
881 new ParameterReference("s")
882 }));
883 addAnnotation(annotation);
884 }
885 return bodies;
886 }
887 }
888}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedRegionDoesNotHaveMultipleRegions.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedRegionDoesNotHaveMultipleRegions.java
deleted file mode 100644
index 28eecf9c..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedRegionDoesNotHaveMultipleRegions.java
+++ /dev/null
@@ -1,744 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex;
8import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Child;
9import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.HasMultipleRegions;
10import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition;
11import java.util.Arrays;
12import java.util.Collection;
13import java.util.LinkedHashSet;
14import java.util.List;
15import java.util.Objects;
16import java.util.Optional;
17import java.util.Set;
18import java.util.function.Consumer;
19import java.util.stream.Collectors;
20import java.util.stream.Stream;
21import org.apache.log4j.Logger;
22import org.eclipse.emf.ecore.EClass;
23import org.eclipse.viatra.query.runtime.api.IPatternMatch;
24import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
25import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
26import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
27import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
28import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
29import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
30import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
31import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
32import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
33import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
34import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
35import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
38import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
39import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
40import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
41import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
42import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
43import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
44import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
45import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
46
47/**
48 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
49 *
50 * <p>Original source:
51 * <code><pre>
52 * {@literal @}Constraint(severity="error", message="error", key = {s})
53 * pattern SynchronizedRegionDoesNotHaveMultipleRegions(s : Synchronization, v : Vertex) {
54 * find transition(_, v, s);
55 * find child(c,v);
56 * neg find hasMultipleRegions(c);
57 * } or {
58 * find transition(_, s, v);
59 * find child(c,v);
60 * neg find hasMultipleRegions(c);
61 * }
62 * </pre></code>
63 *
64 * @see Matcher
65 * @see Match
66 *
67 */
68@SuppressWarnings("all")
69public final class SynchronizedRegionDoesNotHaveMultipleRegions extends BaseGeneratedEMFQuerySpecification<SynchronizedRegionDoesNotHaveMultipleRegions.Matcher> {
70 /**
71 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionDoesNotHaveMultipleRegions pattern,
72 * to be used in conjunction with {@link Matcher}.
73 *
74 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
75 * Each instance is a (possibly partial) substitution of pattern parameters,
76 * usable to represent a match of the pattern in the result of a query,
77 * or to specify the bound (fixed) input parameters when issuing a query.
78 *
79 * @see Matcher
80 *
81 */
82 public static abstract class Match extends BasePatternMatch {
83 private Synchronization fS;
84
85 private Vertex fV;
86
87 private static List<String> parameterNames = makeImmutableList("s", "v");
88
89 private Match(final Synchronization pS, final Vertex pV) {
90 this.fS = pS;
91 this.fV = pV;
92 }
93
94 @Override
95 public Object get(final String parameterName) {
96 if ("s".equals(parameterName)) return this.fS;
97 if ("v".equals(parameterName)) return this.fV;
98 return null;
99 }
100
101 public Synchronization getS() {
102 return this.fS;
103 }
104
105 public Vertex getV() {
106 return this.fV;
107 }
108
109 @Override
110 public boolean set(final String parameterName, final Object newValue) {
111 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
112 if ("s".equals(parameterName) ) {
113 this.fS = (Synchronization) newValue;
114 return true;
115 }
116 if ("v".equals(parameterName) ) {
117 this.fV = (Vertex) newValue;
118 return true;
119 }
120 return false;
121 }
122
123 public void setS(final Synchronization pS) {
124 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
125 this.fS = pS;
126 }
127
128 public void setV(final Vertex pV) {
129 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
130 this.fV = pV;
131 }
132
133 @Override
134 public String patternName() {
135 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionDoesNotHaveMultipleRegions";
136 }
137
138 @Override
139 public List<String> parameterNames() {
140 return SynchronizedRegionDoesNotHaveMultipleRegions.Match.parameterNames;
141 }
142
143 @Override
144 public Object[] toArray() {
145 return new Object[]{fS, fV};
146 }
147
148 @Override
149 public SynchronizedRegionDoesNotHaveMultipleRegions.Match toImmutable() {
150 return isMutable() ? newMatch(fS, fV) : this;
151 }
152
153 @Override
154 public String prettyPrint() {
155 StringBuilder result = new StringBuilder();
156 result.append("\"s\"=" + prettyPrintValue(fS) + ", ");
157 result.append("\"v\"=" + prettyPrintValue(fV));
158 return result.toString();
159 }
160
161 @Override
162 public int hashCode() {
163 return Objects.hash(fS, fV);
164 }
165
166 @Override
167 public boolean equals(final Object obj) {
168 if (this == obj)
169 return true;
170 if (obj == null) {
171 return false;
172 }
173 if ((obj instanceof SynchronizedRegionDoesNotHaveMultipleRegions.Match)) {
174 SynchronizedRegionDoesNotHaveMultipleRegions.Match other = (SynchronizedRegionDoesNotHaveMultipleRegions.Match) obj;
175 return Objects.equals(fS, other.fS) && Objects.equals(fV, other.fV);
176 } else {
177 // this should be infrequent
178 if (!(obj instanceof IPatternMatch)) {
179 return false;
180 }
181 IPatternMatch otherSig = (IPatternMatch) obj;
182 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
183 }
184 }
185
186 @Override
187 public SynchronizedRegionDoesNotHaveMultipleRegions specification() {
188 return SynchronizedRegionDoesNotHaveMultipleRegions.instance();
189 }
190
191 /**
192 * Returns an empty, mutable match.
193 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
194 *
195 * @return the empty match.
196 *
197 */
198 public static SynchronizedRegionDoesNotHaveMultipleRegions.Match newEmptyMatch() {
199 return new Mutable(null, null);
200 }
201
202 /**
203 * Returns a mutable (partial) match.
204 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
205 *
206 * @param pS the fixed value of pattern parameter s, or null if not bound.
207 * @param pV the fixed value of pattern parameter v, or null if not bound.
208 * @return the new, mutable (partial) match object.
209 *
210 */
211 public static SynchronizedRegionDoesNotHaveMultipleRegions.Match newMutableMatch(final Synchronization pS, final Vertex pV) {
212 return new Mutable(pS, pV);
213 }
214
215 /**
216 * Returns a new (partial) match.
217 * This can be used e.g. to call the matcher with a partial match.
218 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
219 * @param pS the fixed value of pattern parameter s, or null if not bound.
220 * @param pV the fixed value of pattern parameter v, or null if not bound.
221 * @return the (partial) match object.
222 *
223 */
224 public static SynchronizedRegionDoesNotHaveMultipleRegions.Match newMatch(final Synchronization pS, final Vertex pV) {
225 return new Immutable(pS, pV);
226 }
227
228 private static final class Mutable extends SynchronizedRegionDoesNotHaveMultipleRegions.Match {
229 Mutable(final Synchronization pS, final Vertex pV) {
230 super(pS, pV);
231 }
232
233 @Override
234 public boolean isMutable() {
235 return true;
236 }
237 }
238
239 private static final class Immutable extends SynchronizedRegionDoesNotHaveMultipleRegions.Match {
240 Immutable(final Synchronization pS, final Vertex pV) {
241 super(pS, pV);
242 }
243
244 @Override
245 public boolean isMutable() {
246 return false;
247 }
248 }
249 }
250
251 /**
252 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionDoesNotHaveMultipleRegions pattern,
253 * providing pattern-specific query methods.
254 *
255 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
256 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
257 *
258 * <p>Matches of the pattern will be represented as {@link Match}.
259 *
260 * <p>Original source:
261 * <code><pre>
262 * {@literal @}Constraint(severity="error", message="error", key = {s})
263 * pattern SynchronizedRegionDoesNotHaveMultipleRegions(s : Synchronization, v : Vertex) {
264 * find transition(_, v, s);
265 * find child(c,v);
266 * neg find hasMultipleRegions(c);
267 * } or {
268 * find transition(_, s, v);
269 * find child(c,v);
270 * neg find hasMultipleRegions(c);
271 * }
272 * </pre></code>
273 *
274 * @see Match
275 * @see SynchronizedRegionDoesNotHaveMultipleRegions
276 *
277 */
278 public static class Matcher extends BaseMatcher<SynchronizedRegionDoesNotHaveMultipleRegions.Match> {
279 /**
280 * Initializes the pattern matcher within an existing VIATRA Query engine.
281 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
282 *
283 * @param engine the existing VIATRA Query engine in which this matcher will be created.
284 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
285 *
286 */
287 public static SynchronizedRegionDoesNotHaveMultipleRegions.Matcher on(final ViatraQueryEngine engine) {
288 // check if matcher already exists
289 Matcher matcher = engine.getExistingMatcher(querySpecification());
290 if (matcher == null) {
291 matcher = (Matcher)engine.getMatcher(querySpecification());
292 }
293 return matcher;
294 }
295
296 /**
297 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
298 * @return an initialized matcher
299 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
300 *
301 */
302 public static SynchronizedRegionDoesNotHaveMultipleRegions.Matcher create() {
303 return new Matcher();
304 }
305
306 private final static int POSITION_S = 0;
307
308 private final static int POSITION_V = 1;
309
310 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SynchronizedRegionDoesNotHaveMultipleRegions.Matcher.class);
311
312 /**
313 * Initializes the pattern matcher within an existing VIATRA Query engine.
314 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
315 *
316 * @param engine the existing VIATRA Query engine in which this matcher will be created.
317 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
318 *
319 */
320 private Matcher() {
321 super(querySpecification());
322 }
323
324 /**
325 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
326 * @param pS the fixed value of pattern parameter s, or null if not bound.
327 * @param pV the fixed value of pattern parameter v, or null if not bound.
328 * @return matches represented as a Match object.
329 *
330 */
331 public Collection<SynchronizedRegionDoesNotHaveMultipleRegions.Match> getAllMatches(final Synchronization pS, final Vertex pV) {
332 return rawStreamAllMatches(new Object[]{pS, pV}).collect(Collectors.toSet());
333 }
334
335 /**
336 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
337 * </p>
338 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
339 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
340 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
341 * @param pS the fixed value of pattern parameter s, or null if not bound.
342 * @param pV the fixed value of pattern parameter v, or null if not bound.
343 * @return a stream of matches represented as a Match object.
344 *
345 */
346 public Stream<SynchronizedRegionDoesNotHaveMultipleRegions.Match> streamAllMatches(final Synchronization pS, final Vertex pV) {
347 return rawStreamAllMatches(new Object[]{pS, pV});
348 }
349
350 /**
351 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
352 * Neither determinism nor randomness of selection is guaranteed.
353 * @param pS the fixed value of pattern parameter s, or null if not bound.
354 * @param pV the fixed value of pattern parameter v, or null if not bound.
355 * @return a match represented as a Match object, or null if no match is found.
356 *
357 */
358 public Optional<SynchronizedRegionDoesNotHaveMultipleRegions.Match> getOneArbitraryMatch(final Synchronization pS, final Vertex pV) {
359 return rawGetOneArbitraryMatch(new Object[]{pS, pV});
360 }
361
362 /**
363 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
364 * under any possible substitution of the unspecified parameters (if any).
365 * @param pS the fixed value of pattern parameter s, or null if not bound.
366 * @param pV the fixed value of pattern parameter v, or null if not bound.
367 * @return true if the input is a valid (partial) match of the pattern.
368 *
369 */
370 public boolean hasMatch(final Synchronization pS, final Vertex pV) {
371 return rawHasMatch(new Object[]{pS, pV});
372 }
373
374 /**
375 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
376 * @param pS the fixed value of pattern parameter s, or null if not bound.
377 * @param pV the fixed value of pattern parameter v, or null if not bound.
378 * @return the number of pattern matches found.
379 *
380 */
381 public int countMatches(final Synchronization pS, final Vertex pV) {
382 return rawCountMatches(new Object[]{pS, pV});
383 }
384
385 /**
386 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
387 * Neither determinism nor randomness of selection is guaranteed.
388 * @param pS the fixed value of pattern parameter s, or null if not bound.
389 * @param pV the fixed value of pattern parameter v, or null if not bound.
390 * @param processor the action that will process the selected match.
391 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
392 *
393 */
394 public boolean forOneArbitraryMatch(final Synchronization pS, final Vertex pV, final Consumer<? super SynchronizedRegionDoesNotHaveMultipleRegions.Match> processor) {
395 return rawForOneArbitraryMatch(new Object[]{pS, pV}, processor);
396 }
397
398 /**
399 * Returns a new (partial) match.
400 * This can be used e.g. to call the matcher with a partial match.
401 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
402 * @param pS the fixed value of pattern parameter s, or null if not bound.
403 * @param pV the fixed value of pattern parameter v, or null if not bound.
404 * @return the (partial) match object.
405 *
406 */
407 public SynchronizedRegionDoesNotHaveMultipleRegions.Match newMatch(final Synchronization pS, final Vertex pV) {
408 return SynchronizedRegionDoesNotHaveMultipleRegions.Match.newMatch(pS, pV);
409 }
410
411 /**
412 * Retrieve the set of values that occur in matches for s.
413 * @return the Set of all values or empty set if there are no matches
414 *
415 */
416 protected Stream<Synchronization> rawStreamAllValuesOfs(final Object[] parameters) {
417 return rawStreamAllValues(POSITION_S, parameters).map(Synchronization.class::cast);
418 }
419
420 /**
421 * Retrieve the set of values that occur in matches for s.
422 * @return the Set of all values or empty set if there are no matches
423 *
424 */
425 public Set<Synchronization> getAllValuesOfs() {
426 return rawStreamAllValuesOfs(emptyArray()).collect(Collectors.toSet());
427 }
428
429 /**
430 * Retrieve the set of values that occur in matches for s.
431 * @return the Set of all values or empty set if there are no matches
432 *
433 */
434 public Stream<Synchronization> streamAllValuesOfs() {
435 return rawStreamAllValuesOfs(emptyArray());
436 }
437
438 /**
439 * Retrieve the set of values that occur in matches for s.
440 * </p>
441 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
442 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
443 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
444 *
445 * @return the Stream of all values or empty set if there are no matches
446 *
447 */
448 public Stream<Synchronization> streamAllValuesOfs(final SynchronizedRegionDoesNotHaveMultipleRegions.Match partialMatch) {
449 return rawStreamAllValuesOfs(partialMatch.toArray());
450 }
451
452 /**
453 * Retrieve the set of values that occur in matches for s.
454 * </p>
455 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
456 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
457 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
458 *
459 * @return the Stream of all values or empty set if there are no matches
460 *
461 */
462 public Stream<Synchronization> streamAllValuesOfs(final Vertex pV) {
463 return rawStreamAllValuesOfs(new Object[]{null, pV});
464 }
465
466 /**
467 * Retrieve the set of values that occur in matches for s.
468 * @return the Set of all values or empty set if there are no matches
469 *
470 */
471 public Set<Synchronization> getAllValuesOfs(final SynchronizedRegionDoesNotHaveMultipleRegions.Match partialMatch) {
472 return rawStreamAllValuesOfs(partialMatch.toArray()).collect(Collectors.toSet());
473 }
474
475 /**
476 * Retrieve the set of values that occur in matches for s.
477 * @return the Set of all values or empty set if there are no matches
478 *
479 */
480 public Set<Synchronization> getAllValuesOfs(final Vertex pV) {
481 return rawStreamAllValuesOfs(new Object[]{null, pV}).collect(Collectors.toSet());
482 }
483
484 /**
485 * Retrieve the set of values that occur in matches for v.
486 * @return the Set of all values or empty set if there are no matches
487 *
488 */
489 protected Stream<Vertex> rawStreamAllValuesOfv(final Object[] parameters) {
490 return rawStreamAllValues(POSITION_V, parameters).map(Vertex.class::cast);
491 }
492
493 /**
494 * Retrieve the set of values that occur in matches for v.
495 * @return the Set of all values or empty set if there are no matches
496 *
497 */
498 public Set<Vertex> getAllValuesOfv() {
499 return rawStreamAllValuesOfv(emptyArray()).collect(Collectors.toSet());
500 }
501
502 /**
503 * Retrieve the set of values that occur in matches for v.
504 * @return the Set of all values or empty set if there are no matches
505 *
506 */
507 public Stream<Vertex> streamAllValuesOfv() {
508 return rawStreamAllValuesOfv(emptyArray());
509 }
510
511 /**
512 * Retrieve the set of values that occur in matches for v.
513 * </p>
514 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
515 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
516 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
517 *
518 * @return the Stream of all values or empty set if there are no matches
519 *
520 */
521 public Stream<Vertex> streamAllValuesOfv(final SynchronizedRegionDoesNotHaveMultipleRegions.Match partialMatch) {
522 return rawStreamAllValuesOfv(partialMatch.toArray());
523 }
524
525 /**
526 * Retrieve the set of values that occur in matches for v.
527 * </p>
528 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
529 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
530 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
531 *
532 * @return the Stream of all values or empty set if there are no matches
533 *
534 */
535 public Stream<Vertex> streamAllValuesOfv(final Synchronization pS) {
536 return rawStreamAllValuesOfv(new Object[]{pS, null});
537 }
538
539 /**
540 * Retrieve the set of values that occur in matches for v.
541 * @return the Set of all values or empty set if there are no matches
542 *
543 */
544 public Set<Vertex> getAllValuesOfv(final SynchronizedRegionDoesNotHaveMultipleRegions.Match partialMatch) {
545 return rawStreamAllValuesOfv(partialMatch.toArray()).collect(Collectors.toSet());
546 }
547
548 /**
549 * Retrieve the set of values that occur in matches for v.
550 * @return the Set of all values or empty set if there are no matches
551 *
552 */
553 public Set<Vertex> getAllValuesOfv(final Synchronization pS) {
554 return rawStreamAllValuesOfv(new Object[]{pS, null}).collect(Collectors.toSet());
555 }
556
557 @Override
558 protected SynchronizedRegionDoesNotHaveMultipleRegions.Match tupleToMatch(final Tuple t) {
559 try {
560 return SynchronizedRegionDoesNotHaveMultipleRegions.Match.newMatch((Synchronization) t.get(POSITION_S), (Vertex) t.get(POSITION_V));
561 } catch(ClassCastException e) {
562 LOGGER.error("Element(s) in tuple not properly typed!",e);
563 return null;
564 }
565 }
566
567 @Override
568 protected SynchronizedRegionDoesNotHaveMultipleRegions.Match arrayToMatch(final Object[] match) {
569 try {
570 return SynchronizedRegionDoesNotHaveMultipleRegions.Match.newMatch((Synchronization) match[POSITION_S], (Vertex) match[POSITION_V]);
571 } catch(ClassCastException e) {
572 LOGGER.error("Element(s) in array not properly typed!",e);
573 return null;
574 }
575 }
576
577 @Override
578 protected SynchronizedRegionDoesNotHaveMultipleRegions.Match arrayToMatchMutable(final Object[] match) {
579 try {
580 return SynchronizedRegionDoesNotHaveMultipleRegions.Match.newMutableMatch((Synchronization) match[POSITION_S], (Vertex) match[POSITION_V]);
581 } catch(ClassCastException e) {
582 LOGGER.error("Element(s) in array not properly typed!",e);
583 return null;
584 }
585 }
586
587 /**
588 * @return the singleton instance of the query specification of this pattern
589 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
590 *
591 */
592 public static IQuerySpecification<SynchronizedRegionDoesNotHaveMultipleRegions.Matcher> querySpecification() {
593 return SynchronizedRegionDoesNotHaveMultipleRegions.instance();
594 }
595 }
596
597 private SynchronizedRegionDoesNotHaveMultipleRegions() {
598 super(GeneratedPQuery.INSTANCE);
599 }
600
601 /**
602 * @return the singleton instance of the query specification
603 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
604 *
605 */
606 public static SynchronizedRegionDoesNotHaveMultipleRegions instance() {
607 try{
608 return LazyHolder.INSTANCE;
609 } catch (ExceptionInInitializerError err) {
610 throw processInitializerError(err);
611 }
612 }
613
614 @Override
615 protected SynchronizedRegionDoesNotHaveMultipleRegions.Matcher instantiate(final ViatraQueryEngine engine) {
616 return SynchronizedRegionDoesNotHaveMultipleRegions.Matcher.on(engine);
617 }
618
619 @Override
620 public SynchronizedRegionDoesNotHaveMultipleRegions.Matcher instantiate() {
621 return SynchronizedRegionDoesNotHaveMultipleRegions.Matcher.create();
622 }
623
624 @Override
625 public SynchronizedRegionDoesNotHaveMultipleRegions.Match newEmptyMatch() {
626 return SynchronizedRegionDoesNotHaveMultipleRegions.Match.newEmptyMatch();
627 }
628
629 @Override
630 public SynchronizedRegionDoesNotHaveMultipleRegions.Match newMatch(final Object... parameters) {
631 return SynchronizedRegionDoesNotHaveMultipleRegions.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization) parameters[0], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex) parameters[1]);
632 }
633
634 /**
635 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionDoesNotHaveMultipleRegions (visibility: PUBLIC, simpleName: SynchronizedRegionDoesNotHaveMultipleRegions, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionDoesNotHaveMultipleRegions, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
636 * <b>not</b> at the class load time of the outer class,
637 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionDoesNotHaveMultipleRegions (visibility: PUBLIC, simpleName: SynchronizedRegionDoesNotHaveMultipleRegions, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionDoesNotHaveMultipleRegions, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
638 *
639 * <p> This workaround is required e.g. to support recursion.
640 *
641 */
642 private static class LazyHolder {
643 private final static SynchronizedRegionDoesNotHaveMultipleRegions INSTANCE = new SynchronizedRegionDoesNotHaveMultipleRegions();
644
645 /**
646 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
647 * This initialization order is required to support indirect recursion.
648 *
649 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
650 *
651 */
652 private final static Object STATIC_INITIALIZER = ensureInitialized();
653
654 public static Object ensureInitialized() {
655 INSTANCE.ensureInitializedInternal();
656 return null;
657 }
658 }
659
660 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
661 private final static SynchronizedRegionDoesNotHaveMultipleRegions.GeneratedPQuery INSTANCE = new GeneratedPQuery();
662
663 private final PParameter parameter_s = new PParameter("s", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Synchronization")), PParameterDirection.INOUT);
664
665 private final PParameter parameter_v = new PParameter("v", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Vertex")), PParameterDirection.INOUT);
666
667 private final List<PParameter> parameters = Arrays.asList(parameter_s, parameter_v);
668
669 private GeneratedPQuery() {
670 super(PVisibility.PUBLIC);
671 }
672
673 @Override
674 public String getFullyQualifiedName() {
675 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionDoesNotHaveMultipleRegions";
676 }
677
678 @Override
679 public List<String> getParameterNames() {
680 return Arrays.asList("s","v");
681 }
682
683 @Override
684 public List<PParameter> getParameters() {
685 return parameters;
686 }
687
688 @Override
689 public Set<PBody> doGetContainedBodies() {
690 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
691 Set<PBody> bodies = new LinkedHashSet<>();
692 {
693 PBody body = new PBody(this);
694 PVariable var_s = body.getOrCreateVariableByName("s");
695 PVariable var_v = body.getOrCreateVariableByName("v");
696 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
697 PVariable var_c = body.getOrCreateVariableByName("c");
698 new TypeConstraint(body, Tuples.flatTupleOf(var_s), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
699 new TypeConstraint(body, Tuples.flatTupleOf(var_v), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
700 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
701 new ExportedParameter(body, var_s, parameter_s),
702 new ExportedParameter(body, var_v, parameter_v)
703 ));
704 // find transition(_, v, s)
705 new PositivePatternCall(body, Tuples.flatTupleOf(var___0_, var_v, var_s), Transition.instance().getInternalQueryRepresentation());
706 // find child(c,v)
707 new PositivePatternCall(body, Tuples.flatTupleOf(var_c, var_v), Child.instance().getInternalQueryRepresentation());
708 // neg find hasMultipleRegions(c)
709 new NegativePatternCall(body, Tuples.flatTupleOf(var_c), HasMultipleRegions.instance().getInternalQueryRepresentation());
710 bodies.add(body);
711 }
712 {
713 PBody body = new PBody(this);
714 PVariable var_s = body.getOrCreateVariableByName("s");
715 PVariable var_v = body.getOrCreateVariableByName("v");
716 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
717 PVariable var_c = body.getOrCreateVariableByName("c");
718 new TypeConstraint(body, Tuples.flatTupleOf(var_s), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
719 new TypeConstraint(body, Tuples.flatTupleOf(var_v), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
720 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
721 new ExportedParameter(body, var_s, parameter_s),
722 new ExportedParameter(body, var_v, parameter_v)
723 ));
724 // find transition(_, s, v)
725 new PositivePatternCall(body, Tuples.flatTupleOf(var___0_, var_s, var_v), Transition.instance().getInternalQueryRepresentation());
726 // find child(c,v)
727 new PositivePatternCall(body, Tuples.flatTupleOf(var_c, var_v), Child.instance().getInternalQueryRepresentation());
728 // neg find hasMultipleRegions(c)
729 new NegativePatternCall(body, Tuples.flatTupleOf(var_c), HasMultipleRegions.instance().getInternalQueryRepresentation());
730 bodies.add(body);
731 }
732 {
733 PAnnotation annotation = new PAnnotation("Constraint");
734 annotation.addAttribute("severity", "error");
735 annotation.addAttribute("message", "error");
736 annotation.addAttribute("key", Arrays.asList(new Object[] {
737 new ParameterReference("s")
738 }));
739 addAnnotation(annotation);
740 }
741 return bodies;
742 }
743 }
744}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedRegionsAreNotSiblings.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedRegionsAreNotSiblings.java
deleted file mode 100644
index 160c4aa0..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedRegionsAreNotSiblings.java
+++ /dev/null
@@ -1,902 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization;
7import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex;
8import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition;
9import java.util.Arrays;
10import java.util.Collection;
11import java.util.LinkedHashSet;
12import java.util.List;
13import java.util.Objects;
14import java.util.Optional;
15import java.util.Set;
16import java.util.function.Consumer;
17import java.util.stream.Collectors;
18import java.util.stream.Stream;
19import org.apache.log4j.Logger;
20import org.eclipse.emf.ecore.EClass;
21import org.eclipse.viatra.query.runtime.api.IPatternMatch;
22import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
23import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
24import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
25import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
26import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
27import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
28import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
29import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
30import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
31import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
32import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
33import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
34import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
35import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
36import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
37import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
38import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
39import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
40import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
41import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
42import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
43import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
44import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
45import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
46
47/**
48 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
49 *
50 * <p>Original source:
51 * <code><pre>
52 * {@literal @}Constraint(severity="error", message="error", key = {s})
53 * pattern SynchronizedRegionsAreNotSiblings(s : Synchronization, v1 : Vertex, v2 : Vertex) {
54 * find transition(_, v1, s);
55 * find transition(_, v2, s);
56 * CompositeElement.regions.vertices(r1, v1);
57 * CompositeElement.regions.vertices(r2, v2);
58 * r1 != r2;
59 * } or {
60 * find transition(_, s, v1);
61 * find transition(_, s, v2);
62 * CompositeElement.regions.vertices(r1, v1);
63 * CompositeElement.regions.vertices(r2, v2);
64 * r1 != r2;
65 * }
66 * </pre></code>
67 *
68 * @see Matcher
69 * @see Match
70 *
71 */
72@SuppressWarnings("all")
73public final class SynchronizedRegionsAreNotSiblings extends BaseGeneratedEMFQuerySpecification<SynchronizedRegionsAreNotSiblings.Matcher> {
74 /**
75 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings pattern,
76 * to be used in conjunction with {@link Matcher}.
77 *
78 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
79 * Each instance is a (possibly partial) substitution of pattern parameters,
80 * usable to represent a match of the pattern in the result of a query,
81 * or to specify the bound (fixed) input parameters when issuing a query.
82 *
83 * @see Matcher
84 *
85 */
86 public static abstract class Match extends BasePatternMatch {
87 private Synchronization fS;
88
89 private Vertex fV1;
90
91 private Vertex fV2;
92
93 private static List<String> parameterNames = makeImmutableList("s", "v1", "v2");
94
95 private Match(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
96 this.fS = pS;
97 this.fV1 = pV1;
98 this.fV2 = pV2;
99 }
100
101 @Override
102 public Object get(final String parameterName) {
103 if ("s".equals(parameterName)) return this.fS;
104 if ("v1".equals(parameterName)) return this.fV1;
105 if ("v2".equals(parameterName)) return this.fV2;
106 return null;
107 }
108
109 public Synchronization getS() {
110 return this.fS;
111 }
112
113 public Vertex getV1() {
114 return this.fV1;
115 }
116
117 public Vertex getV2() {
118 return this.fV2;
119 }
120
121 @Override
122 public boolean set(final String parameterName, final Object newValue) {
123 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
124 if ("s".equals(parameterName) ) {
125 this.fS = (Synchronization) newValue;
126 return true;
127 }
128 if ("v1".equals(parameterName) ) {
129 this.fV1 = (Vertex) newValue;
130 return true;
131 }
132 if ("v2".equals(parameterName) ) {
133 this.fV2 = (Vertex) newValue;
134 return true;
135 }
136 return false;
137 }
138
139 public void setS(final Synchronization pS) {
140 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
141 this.fS = pS;
142 }
143
144 public void setV1(final Vertex pV1) {
145 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
146 this.fV1 = pV1;
147 }
148
149 public void setV2(final Vertex pV2) {
150 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
151 this.fV2 = pV2;
152 }
153
154 @Override
155 public String patternName() {
156 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings";
157 }
158
159 @Override
160 public List<String> parameterNames() {
161 return SynchronizedRegionsAreNotSiblings.Match.parameterNames;
162 }
163
164 @Override
165 public Object[] toArray() {
166 return new Object[]{fS, fV1, fV2};
167 }
168
169 @Override
170 public SynchronizedRegionsAreNotSiblings.Match toImmutable() {
171 return isMutable() ? newMatch(fS, fV1, fV2) : this;
172 }
173
174 @Override
175 public String prettyPrint() {
176 StringBuilder result = new StringBuilder();
177 result.append("\"s\"=" + prettyPrintValue(fS) + ", ");
178 result.append("\"v1\"=" + prettyPrintValue(fV1) + ", ");
179 result.append("\"v2\"=" + prettyPrintValue(fV2));
180 return result.toString();
181 }
182
183 @Override
184 public int hashCode() {
185 return Objects.hash(fS, fV1, fV2);
186 }
187
188 @Override
189 public boolean equals(final Object obj) {
190 if (this == obj)
191 return true;
192 if (obj == null) {
193 return false;
194 }
195 if ((obj instanceof SynchronizedRegionsAreNotSiblings.Match)) {
196 SynchronizedRegionsAreNotSiblings.Match other = (SynchronizedRegionsAreNotSiblings.Match) obj;
197 return Objects.equals(fS, other.fS) && Objects.equals(fV1, other.fV1) && Objects.equals(fV2, other.fV2);
198 } else {
199 // this should be infrequent
200 if (!(obj instanceof IPatternMatch)) {
201 return false;
202 }
203 IPatternMatch otherSig = (IPatternMatch) obj;
204 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
205 }
206 }
207
208 @Override
209 public SynchronizedRegionsAreNotSiblings specification() {
210 return SynchronizedRegionsAreNotSiblings.instance();
211 }
212
213 /**
214 * Returns an empty, mutable match.
215 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
216 *
217 * @return the empty match.
218 *
219 */
220 public static SynchronizedRegionsAreNotSiblings.Match newEmptyMatch() {
221 return new Mutable(null, null, null);
222 }
223
224 /**
225 * Returns a mutable (partial) match.
226 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
227 *
228 * @param pS the fixed value of pattern parameter s, or null if not bound.
229 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
230 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
231 * @return the new, mutable (partial) match object.
232 *
233 */
234 public static SynchronizedRegionsAreNotSiblings.Match newMutableMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
235 return new Mutable(pS, pV1, pV2);
236 }
237
238 /**
239 * Returns a new (partial) match.
240 * This can be used e.g. to call the matcher with a partial match.
241 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
242 * @param pS the fixed value of pattern parameter s, or null if not bound.
243 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
244 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
245 * @return the (partial) match object.
246 *
247 */
248 public static SynchronizedRegionsAreNotSiblings.Match newMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
249 return new Immutable(pS, pV1, pV2);
250 }
251
252 private static final class Mutable extends SynchronizedRegionsAreNotSiblings.Match {
253 Mutable(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
254 super(pS, pV1, pV2);
255 }
256
257 @Override
258 public boolean isMutable() {
259 return true;
260 }
261 }
262
263 private static final class Immutable extends SynchronizedRegionsAreNotSiblings.Match {
264 Immutable(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
265 super(pS, pV1, pV2);
266 }
267
268 @Override
269 public boolean isMutable() {
270 return false;
271 }
272 }
273 }
274
275 /**
276 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings pattern,
277 * providing pattern-specific query methods.
278 *
279 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
280 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
281 *
282 * <p>Matches of the pattern will be represented as {@link Match}.
283 *
284 * <p>Original source:
285 * <code><pre>
286 * {@literal @}Constraint(severity="error", message="error", key = {s})
287 * pattern SynchronizedRegionsAreNotSiblings(s : Synchronization, v1 : Vertex, v2 : Vertex) {
288 * find transition(_, v1, s);
289 * find transition(_, v2, s);
290 * CompositeElement.regions.vertices(r1, v1);
291 * CompositeElement.regions.vertices(r2, v2);
292 * r1 != r2;
293 * } or {
294 * find transition(_, s, v1);
295 * find transition(_, s, v2);
296 * CompositeElement.regions.vertices(r1, v1);
297 * CompositeElement.regions.vertices(r2, v2);
298 * r1 != r2;
299 * }
300 * </pre></code>
301 *
302 * @see Match
303 * @see SynchronizedRegionsAreNotSiblings
304 *
305 */
306 public static class Matcher extends BaseMatcher<SynchronizedRegionsAreNotSiblings.Match> {
307 /**
308 * Initializes the pattern matcher within an existing VIATRA Query engine.
309 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
310 *
311 * @param engine the existing VIATRA Query engine in which this matcher will be created.
312 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
313 *
314 */
315 public static SynchronizedRegionsAreNotSiblings.Matcher on(final ViatraQueryEngine engine) {
316 // check if matcher already exists
317 Matcher matcher = engine.getExistingMatcher(querySpecification());
318 if (matcher == null) {
319 matcher = (Matcher)engine.getMatcher(querySpecification());
320 }
321 return matcher;
322 }
323
324 /**
325 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
326 * @return an initialized matcher
327 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
328 *
329 */
330 public static SynchronizedRegionsAreNotSiblings.Matcher create() {
331 return new Matcher();
332 }
333
334 private final static int POSITION_S = 0;
335
336 private final static int POSITION_V1 = 1;
337
338 private final static int POSITION_V2 = 2;
339
340 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SynchronizedRegionsAreNotSiblings.Matcher.class);
341
342 /**
343 * Initializes the pattern matcher within an existing VIATRA Query engine.
344 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
345 *
346 * @param engine the existing VIATRA Query engine in which this matcher will be created.
347 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
348 *
349 */
350 private Matcher() {
351 super(querySpecification());
352 }
353
354 /**
355 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
356 * @param pS the fixed value of pattern parameter s, or null if not bound.
357 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
358 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
359 * @return matches represented as a Match object.
360 *
361 */
362 public Collection<SynchronizedRegionsAreNotSiblings.Match> getAllMatches(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
363 return rawStreamAllMatches(new Object[]{pS, pV1, pV2}).collect(Collectors.toSet());
364 }
365
366 /**
367 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
368 * </p>
369 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
370 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
371 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
372 * @param pS the fixed value of pattern parameter s, or null if not bound.
373 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
374 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
375 * @return a stream of matches represented as a Match object.
376 *
377 */
378 public Stream<SynchronizedRegionsAreNotSiblings.Match> streamAllMatches(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
379 return rawStreamAllMatches(new Object[]{pS, pV1, pV2});
380 }
381
382 /**
383 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
384 * Neither determinism nor randomness of selection is guaranteed.
385 * @param pS the fixed value of pattern parameter s, or null if not bound.
386 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
387 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
388 * @return a match represented as a Match object, or null if no match is found.
389 *
390 */
391 public Optional<SynchronizedRegionsAreNotSiblings.Match> getOneArbitraryMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
392 return rawGetOneArbitraryMatch(new Object[]{pS, pV1, pV2});
393 }
394
395 /**
396 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
397 * under any possible substitution of the unspecified parameters (if any).
398 * @param pS the fixed value of pattern parameter s, or null if not bound.
399 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
400 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
401 * @return true if the input is a valid (partial) match of the pattern.
402 *
403 */
404 public boolean hasMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
405 return rawHasMatch(new Object[]{pS, pV1, pV2});
406 }
407
408 /**
409 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
410 * @param pS the fixed value of pattern parameter s, or null if not bound.
411 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
412 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
413 * @return the number of pattern matches found.
414 *
415 */
416 public int countMatches(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
417 return rawCountMatches(new Object[]{pS, pV1, pV2});
418 }
419
420 /**
421 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
422 * Neither determinism nor randomness of selection is guaranteed.
423 * @param pS the fixed value of pattern parameter s, or null if not bound.
424 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
425 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
426 * @param processor the action that will process the selected match.
427 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
428 *
429 */
430 public boolean forOneArbitraryMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2, final Consumer<? super SynchronizedRegionsAreNotSiblings.Match> processor) {
431 return rawForOneArbitraryMatch(new Object[]{pS, pV1, pV2}, processor);
432 }
433
434 /**
435 * Returns a new (partial) match.
436 * This can be used e.g. to call the matcher with a partial match.
437 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
438 * @param pS the fixed value of pattern parameter s, or null if not bound.
439 * @param pV1 the fixed value of pattern parameter v1, or null if not bound.
440 * @param pV2 the fixed value of pattern parameter v2, or null if not bound.
441 * @return the (partial) match object.
442 *
443 */
444 public SynchronizedRegionsAreNotSiblings.Match newMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
445 return SynchronizedRegionsAreNotSiblings.Match.newMatch(pS, pV1, pV2);
446 }
447
448 /**
449 * Retrieve the set of values that occur in matches for s.
450 * @return the Set of all values or empty set if there are no matches
451 *
452 */
453 protected Stream<Synchronization> rawStreamAllValuesOfs(final Object[] parameters) {
454 return rawStreamAllValues(POSITION_S, parameters).map(Synchronization.class::cast);
455 }
456
457 /**
458 * Retrieve the set of values that occur in matches for s.
459 * @return the Set of all values or empty set if there are no matches
460 *
461 */
462 public Set<Synchronization> getAllValuesOfs() {
463 return rawStreamAllValuesOfs(emptyArray()).collect(Collectors.toSet());
464 }
465
466 /**
467 * Retrieve the set of values that occur in matches for s.
468 * @return the Set of all values or empty set if there are no matches
469 *
470 */
471 public Stream<Synchronization> streamAllValuesOfs() {
472 return rawStreamAllValuesOfs(emptyArray());
473 }
474
475 /**
476 * Retrieve the set of values that occur in matches for s.
477 * </p>
478 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
479 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
480 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
481 *
482 * @return the Stream of all values or empty set if there are no matches
483 *
484 */
485 public Stream<Synchronization> streamAllValuesOfs(final SynchronizedRegionsAreNotSiblings.Match partialMatch) {
486 return rawStreamAllValuesOfs(partialMatch.toArray());
487 }
488
489 /**
490 * Retrieve the set of values that occur in matches for s.
491 * </p>
492 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
493 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
494 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
495 *
496 * @return the Stream of all values or empty set if there are no matches
497 *
498 */
499 public Stream<Synchronization> streamAllValuesOfs(final Vertex pV1, final Vertex pV2) {
500 return rawStreamAllValuesOfs(new Object[]{null, pV1, pV2});
501 }
502
503 /**
504 * Retrieve the set of values that occur in matches for s.
505 * @return the Set of all values or empty set if there are no matches
506 *
507 */
508 public Set<Synchronization> getAllValuesOfs(final SynchronizedRegionsAreNotSiblings.Match partialMatch) {
509 return rawStreamAllValuesOfs(partialMatch.toArray()).collect(Collectors.toSet());
510 }
511
512 /**
513 * Retrieve the set of values that occur in matches for s.
514 * @return the Set of all values or empty set if there are no matches
515 *
516 */
517 public Set<Synchronization> getAllValuesOfs(final Vertex pV1, final Vertex pV2) {
518 return rawStreamAllValuesOfs(new Object[]{null, pV1, pV2}).collect(Collectors.toSet());
519 }
520
521 /**
522 * Retrieve the set of values that occur in matches for v1.
523 * @return the Set of all values or empty set if there are no matches
524 *
525 */
526 protected Stream<Vertex> rawStreamAllValuesOfv1(final Object[] parameters) {
527 return rawStreamAllValues(POSITION_V1, parameters).map(Vertex.class::cast);
528 }
529
530 /**
531 * Retrieve the set of values that occur in matches for v1.
532 * @return the Set of all values or empty set if there are no matches
533 *
534 */
535 public Set<Vertex> getAllValuesOfv1() {
536 return rawStreamAllValuesOfv1(emptyArray()).collect(Collectors.toSet());
537 }
538
539 /**
540 * Retrieve the set of values that occur in matches for v1.
541 * @return the Set of all values or empty set if there are no matches
542 *
543 */
544 public Stream<Vertex> streamAllValuesOfv1() {
545 return rawStreamAllValuesOfv1(emptyArray());
546 }
547
548 /**
549 * Retrieve the set of values that occur in matches for v1.
550 * </p>
551 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
552 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
553 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
554 *
555 * @return the Stream of all values or empty set if there are no matches
556 *
557 */
558 public Stream<Vertex> streamAllValuesOfv1(final SynchronizedRegionsAreNotSiblings.Match partialMatch) {
559 return rawStreamAllValuesOfv1(partialMatch.toArray());
560 }
561
562 /**
563 * Retrieve the set of values that occur in matches for v1.
564 * </p>
565 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
566 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
567 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
568 *
569 * @return the Stream of all values or empty set if there are no matches
570 *
571 */
572 public Stream<Vertex> streamAllValuesOfv1(final Synchronization pS, final Vertex pV2) {
573 return rawStreamAllValuesOfv1(new Object[]{pS, null, pV2});
574 }
575
576 /**
577 * Retrieve the set of values that occur in matches for v1.
578 * @return the Set of all values or empty set if there are no matches
579 *
580 */
581 public Set<Vertex> getAllValuesOfv1(final SynchronizedRegionsAreNotSiblings.Match partialMatch) {
582 return rawStreamAllValuesOfv1(partialMatch.toArray()).collect(Collectors.toSet());
583 }
584
585 /**
586 * Retrieve the set of values that occur in matches for v1.
587 * @return the Set of all values or empty set if there are no matches
588 *
589 */
590 public Set<Vertex> getAllValuesOfv1(final Synchronization pS, final Vertex pV2) {
591 return rawStreamAllValuesOfv1(new Object[]{pS, null, pV2}).collect(Collectors.toSet());
592 }
593
594 /**
595 * Retrieve the set of values that occur in matches for v2.
596 * @return the Set of all values or empty set if there are no matches
597 *
598 */
599 protected Stream<Vertex> rawStreamAllValuesOfv2(final Object[] parameters) {
600 return rawStreamAllValues(POSITION_V2, parameters).map(Vertex.class::cast);
601 }
602
603 /**
604 * Retrieve the set of values that occur in matches for v2.
605 * @return the Set of all values or empty set if there are no matches
606 *
607 */
608 public Set<Vertex> getAllValuesOfv2() {
609 return rawStreamAllValuesOfv2(emptyArray()).collect(Collectors.toSet());
610 }
611
612 /**
613 * Retrieve the set of values that occur in matches for v2.
614 * @return the Set of all values or empty set if there are no matches
615 *
616 */
617 public Stream<Vertex> streamAllValuesOfv2() {
618 return rawStreamAllValuesOfv2(emptyArray());
619 }
620
621 /**
622 * Retrieve the set of values that occur in matches for v2.
623 * </p>
624 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
625 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
626 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
627 *
628 * @return the Stream of all values or empty set if there are no matches
629 *
630 */
631 public Stream<Vertex> streamAllValuesOfv2(final SynchronizedRegionsAreNotSiblings.Match partialMatch) {
632 return rawStreamAllValuesOfv2(partialMatch.toArray());
633 }
634
635 /**
636 * Retrieve the set of values that occur in matches for v2.
637 * </p>
638 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
639 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
640 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
641 *
642 * @return the Stream of all values or empty set if there are no matches
643 *
644 */
645 public Stream<Vertex> streamAllValuesOfv2(final Synchronization pS, final Vertex pV1) {
646 return rawStreamAllValuesOfv2(new Object[]{pS, pV1, null});
647 }
648
649 /**
650 * Retrieve the set of values that occur in matches for v2.
651 * @return the Set of all values or empty set if there are no matches
652 *
653 */
654 public Set<Vertex> getAllValuesOfv2(final SynchronizedRegionsAreNotSiblings.Match partialMatch) {
655 return rawStreamAllValuesOfv2(partialMatch.toArray()).collect(Collectors.toSet());
656 }
657
658 /**
659 * Retrieve the set of values that occur in matches for v2.
660 * @return the Set of all values or empty set if there are no matches
661 *
662 */
663 public Set<Vertex> getAllValuesOfv2(final Synchronization pS, final Vertex pV1) {
664 return rawStreamAllValuesOfv2(new Object[]{pS, pV1, null}).collect(Collectors.toSet());
665 }
666
667 @Override
668 protected SynchronizedRegionsAreNotSiblings.Match tupleToMatch(final Tuple t) {
669 try {
670 return SynchronizedRegionsAreNotSiblings.Match.newMatch((Synchronization) t.get(POSITION_S), (Vertex) t.get(POSITION_V1), (Vertex) t.get(POSITION_V2));
671 } catch(ClassCastException e) {
672 LOGGER.error("Element(s) in tuple not properly typed!",e);
673 return null;
674 }
675 }
676
677 @Override
678 protected SynchronizedRegionsAreNotSiblings.Match arrayToMatch(final Object[] match) {
679 try {
680 return SynchronizedRegionsAreNotSiblings.Match.newMatch((Synchronization) match[POSITION_S], (Vertex) match[POSITION_V1], (Vertex) match[POSITION_V2]);
681 } catch(ClassCastException e) {
682 LOGGER.error("Element(s) in array not properly typed!",e);
683 return null;
684 }
685 }
686
687 @Override
688 protected SynchronizedRegionsAreNotSiblings.Match arrayToMatchMutable(final Object[] match) {
689 try {
690 return SynchronizedRegionsAreNotSiblings.Match.newMutableMatch((Synchronization) match[POSITION_S], (Vertex) match[POSITION_V1], (Vertex) match[POSITION_V2]);
691 } catch(ClassCastException e) {
692 LOGGER.error("Element(s) in array not properly typed!",e);
693 return null;
694 }
695 }
696
697 /**
698 * @return the singleton instance of the query specification of this pattern
699 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
700 *
701 */
702 public static IQuerySpecification<SynchronizedRegionsAreNotSiblings.Matcher> querySpecification() {
703 return SynchronizedRegionsAreNotSiblings.instance();
704 }
705 }
706
707 private SynchronizedRegionsAreNotSiblings() {
708 super(GeneratedPQuery.INSTANCE);
709 }
710
711 /**
712 * @return the singleton instance of the query specification
713 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
714 *
715 */
716 public static SynchronizedRegionsAreNotSiblings instance() {
717 try{
718 return LazyHolder.INSTANCE;
719 } catch (ExceptionInInitializerError err) {
720 throw processInitializerError(err);
721 }
722 }
723
724 @Override
725 protected SynchronizedRegionsAreNotSiblings.Matcher instantiate(final ViatraQueryEngine engine) {
726 return SynchronizedRegionsAreNotSiblings.Matcher.on(engine);
727 }
728
729 @Override
730 public SynchronizedRegionsAreNotSiblings.Matcher instantiate() {
731 return SynchronizedRegionsAreNotSiblings.Matcher.create();
732 }
733
734 @Override
735 public SynchronizedRegionsAreNotSiblings.Match newEmptyMatch() {
736 return SynchronizedRegionsAreNotSiblings.Match.newEmptyMatch();
737 }
738
739 @Override
740 public SynchronizedRegionsAreNotSiblings.Match newMatch(final Object... parameters) {
741 return SynchronizedRegionsAreNotSiblings.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization) parameters[0], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex) parameters[1], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex) parameters[2]);
742 }
743
744 /**
745 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings (visibility: PUBLIC, simpleName: SynchronizedRegionsAreNotSiblings, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
746 * <b>not</b> at the class load time of the outer class,
747 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings (visibility: PUBLIC, simpleName: SynchronizedRegionsAreNotSiblings, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
748 *
749 * <p> This workaround is required e.g. to support recursion.
750 *
751 */
752 private static class LazyHolder {
753 private final static SynchronizedRegionsAreNotSiblings INSTANCE = new SynchronizedRegionsAreNotSiblings();
754
755 /**
756 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
757 * This initialization order is required to support indirect recursion.
758 *
759 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
760 *
761 */
762 private final static Object STATIC_INITIALIZER = ensureInitialized();
763
764 public static Object ensureInitialized() {
765 INSTANCE.ensureInitializedInternal();
766 return null;
767 }
768 }
769
770 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
771 private final static SynchronizedRegionsAreNotSiblings.GeneratedPQuery INSTANCE = new GeneratedPQuery();
772
773 private final PParameter parameter_s = new PParameter("s", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Synchronization")), PParameterDirection.INOUT);
774
775 private final PParameter parameter_v1 = new PParameter("v1", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Vertex")), PParameterDirection.INOUT);
776
777 private final PParameter parameter_v2 = new PParameter("v2", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Vertex")), PParameterDirection.INOUT);
778
779 private final List<PParameter> parameters = Arrays.asList(parameter_s, parameter_v1, parameter_v2);
780
781 private GeneratedPQuery() {
782 super(PVisibility.PUBLIC);
783 }
784
785 @Override
786 public String getFullyQualifiedName() {
787 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings";
788 }
789
790 @Override
791 public List<String> getParameterNames() {
792 return Arrays.asList("s","v1","v2");
793 }
794
795 @Override
796 public List<PParameter> getParameters() {
797 return parameters;
798 }
799
800 @Override
801 public Set<PBody> doGetContainedBodies() {
802 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
803 Set<PBody> bodies = new LinkedHashSet<>();
804 {
805 PBody body = new PBody(this);
806 PVariable var_s = body.getOrCreateVariableByName("s");
807 PVariable var_v1 = body.getOrCreateVariableByName("v1");
808 PVariable var_v2 = body.getOrCreateVariableByName("v2");
809 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
810 PVariable var___1_ = body.getOrCreateVariableByName("_<1>");
811 PVariable var_r1 = body.getOrCreateVariableByName("r1");
812 PVariable var_r2 = body.getOrCreateVariableByName("r2");
813 new TypeConstraint(body, Tuples.flatTupleOf(var_s), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
814 new TypeConstraint(body, Tuples.flatTupleOf(var_v1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
815 new TypeConstraint(body, Tuples.flatTupleOf(var_v2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
816 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
817 new ExportedParameter(body, var_s, parameter_s),
818 new ExportedParameter(body, var_v1, parameter_v1),
819 new ExportedParameter(body, var_v2, parameter_v2)
820 ));
821 // find transition(_, v1, s)
822 new PositivePatternCall(body, Tuples.flatTupleOf(var___0_, var_v1, var_s), Transition.instance().getInternalQueryRepresentation());
823 // find transition(_, v2, s)
824 new PositivePatternCall(body, Tuples.flatTupleOf(var___1_, var_v2, var_s), Transition.instance().getInternalQueryRepresentation());
825 // CompositeElement.regions.vertices(r1, v1)
826 new TypeConstraint(body, Tuples.flatTupleOf(var_r1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "CompositeElement")));
827 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
828 new TypeConstraint(body, Tuples.flatTupleOf(var_r1, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "CompositeElement", "regions")));
829 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
830 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
831 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices")));
832 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
833 new Equality(body, var__virtual_1_, var_v1);
834 // CompositeElement.regions.vertices(r2, v2)
835 new TypeConstraint(body, Tuples.flatTupleOf(var_r2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "CompositeElement")));
836 PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
837 new TypeConstraint(body, Tuples.flatTupleOf(var_r2, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "CompositeElement", "regions")));
838 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
839 PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}");
840 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices")));
841 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
842 new Equality(body, var__virtual_3_, var_v2);
843 // r1 != r2
844 new Inequality(body, var_r1, var_r2);
845 bodies.add(body);
846 }
847 {
848 PBody body = new PBody(this);
849 PVariable var_s = body.getOrCreateVariableByName("s");
850 PVariable var_v1 = body.getOrCreateVariableByName("v1");
851 PVariable var_v2 = body.getOrCreateVariableByName("v2");
852 PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
853 PVariable var___1_ = body.getOrCreateVariableByName("_<1>");
854 PVariable var_r1 = body.getOrCreateVariableByName("r1");
855 PVariable var_r2 = body.getOrCreateVariableByName("r2");
856 new TypeConstraint(body, Tuples.flatTupleOf(var_s), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
857 new TypeConstraint(body, Tuples.flatTupleOf(var_v1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
858 new TypeConstraint(body, Tuples.flatTupleOf(var_v2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
859 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
860 new ExportedParameter(body, var_s, parameter_s),
861 new ExportedParameter(body, var_v1, parameter_v1),
862 new ExportedParameter(body, var_v2, parameter_v2)
863 ));
864 // find transition(_, s, v1)
865 new PositivePatternCall(body, Tuples.flatTupleOf(var___0_, var_s, var_v1), Transition.instance().getInternalQueryRepresentation());
866 // find transition(_, s, v2)
867 new PositivePatternCall(body, Tuples.flatTupleOf(var___1_, var_s, var_v2), Transition.instance().getInternalQueryRepresentation());
868 // CompositeElement.regions.vertices(r1, v1)
869 new TypeConstraint(body, Tuples.flatTupleOf(var_r1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "CompositeElement")));
870 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
871 new TypeConstraint(body, Tuples.flatTupleOf(var_r1, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "CompositeElement", "regions")));
872 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
873 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
874 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices")));
875 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
876 new Equality(body, var__virtual_1_, var_v1);
877 // CompositeElement.regions.vertices(r2, v2)
878 new TypeConstraint(body, Tuples.flatTupleOf(var_r2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "CompositeElement")));
879 PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
880 new TypeConstraint(body, Tuples.flatTupleOf(var_r2, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "CompositeElement", "regions")));
881 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region")));
882 PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}");
883 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices")));
884 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
885 new Equality(body, var__virtual_3_, var_v2);
886 // r1 != r2
887 new Inequality(body, var_r1, var_r2);
888 bodies.add(body);
889 }
890 {
891 PAnnotation annotation = new PAnnotation("Constraint");
892 annotation.addAttribute("severity", "error");
893 annotation.addAttribute("message", "error");
894 annotation.addAttribute("key", Arrays.asList(new Object[] {
895 new ParameterReference("s")
896 }));
897 addAnnotation(annotation);
898 }
899 return bodies;
900 }
901 }
902}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/Transition.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/Transition.java
deleted file mode 100644
index 185f348e..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/Transition.java
+++ /dev/null
@@ -1,808 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex;
7import java.util.Arrays;
8import java.util.Collection;
9import java.util.LinkedHashSet;
10import java.util.List;
11import java.util.Objects;
12import java.util.Optional;
13import java.util.Set;
14import java.util.function.Consumer;
15import java.util.stream.Collectors;
16import java.util.stream.Stream;
17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.viatra.query.runtime.api.IPatternMatch;
20import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
27import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
28import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
30import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
31import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
34import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
37import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
38import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
39import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
40
41/**
42 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
43 *
44 * <p>Original source:
45 * <code><pre>
46 * pattern transition(t : Transition, src : Vertex, trg : Vertex) {
47 * Transition.source(t, src);
48 * Transition.target(t, trg);
49 * }
50 * </pre></code>
51 *
52 * @see Matcher
53 * @see Match
54 *
55 */
56@SuppressWarnings("all")
57public final class Transition extends BaseGeneratedEMFQuerySpecification<Transition.Matcher> {
58 /**
59 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.transition pattern,
60 * to be used in conjunction with {@link Matcher}.
61 *
62 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
63 * Each instance is a (possibly partial) substitution of pattern parameters,
64 * usable to represent a match of the pattern in the result of a query,
65 * or to specify the bound (fixed) input parameters when issuing a query.
66 *
67 * @see Matcher
68 *
69 */
70 public static abstract class Match extends BasePatternMatch {
71 private ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition fT;
72
73 private Vertex fSrc;
74
75 private Vertex fTrg;
76
77 private static List<String> parameterNames = makeImmutableList("t", "src", "trg");
78
79 private Match(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pSrc, final Vertex pTrg) {
80 this.fT = pT;
81 this.fSrc = pSrc;
82 this.fTrg = pTrg;
83 }
84
85 @Override
86 public Object get(final String parameterName) {
87 if ("t".equals(parameterName)) return this.fT;
88 if ("src".equals(parameterName)) return this.fSrc;
89 if ("trg".equals(parameterName)) return this.fTrg;
90 return null;
91 }
92
93 public ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition getT() {
94 return this.fT;
95 }
96
97 public Vertex getSrc() {
98 return this.fSrc;
99 }
100
101 public Vertex getTrg() {
102 return this.fTrg;
103 }
104
105 @Override
106 public boolean set(final String parameterName, final Object newValue) {
107 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
108 if ("t".equals(parameterName) ) {
109 this.fT = (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition) newValue;
110 return true;
111 }
112 if ("src".equals(parameterName) ) {
113 this.fSrc = (Vertex) newValue;
114 return true;
115 }
116 if ("trg".equals(parameterName) ) {
117 this.fTrg = (Vertex) newValue;
118 return true;
119 }
120 return false;
121 }
122
123 public void setT(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT) {
124 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
125 this.fT = pT;
126 }
127
128 public void setSrc(final Vertex pSrc) {
129 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
130 this.fSrc = pSrc;
131 }
132
133 public void setTrg(final Vertex pTrg) {
134 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
135 this.fTrg = pTrg;
136 }
137
138 @Override
139 public String patternName() {
140 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.transition";
141 }
142
143 @Override
144 public List<String> parameterNames() {
145 return Transition.Match.parameterNames;
146 }
147
148 @Override
149 public Object[] toArray() {
150 return new Object[]{fT, fSrc, fTrg};
151 }
152
153 @Override
154 public Transition.Match toImmutable() {
155 return isMutable() ? newMatch(fT, fSrc, fTrg) : this;
156 }
157
158 @Override
159 public String prettyPrint() {
160 StringBuilder result = new StringBuilder();
161 result.append("\"t\"=" + prettyPrintValue(fT) + ", ");
162 result.append("\"src\"=" + prettyPrintValue(fSrc) + ", ");
163 result.append("\"trg\"=" + prettyPrintValue(fTrg));
164 return result.toString();
165 }
166
167 @Override
168 public int hashCode() {
169 return Objects.hash(fT, fSrc, fTrg);
170 }
171
172 @Override
173 public boolean equals(final Object obj) {
174 if (this == obj)
175 return true;
176 if (obj == null) {
177 return false;
178 }
179 if ((obj instanceof Transition.Match)) {
180 Transition.Match other = (Transition.Match) obj;
181 return Objects.equals(fT, other.fT) && Objects.equals(fSrc, other.fSrc) && Objects.equals(fTrg, other.fTrg);
182 } else {
183 // this should be infrequent
184 if (!(obj instanceof IPatternMatch)) {
185 return false;
186 }
187 IPatternMatch otherSig = (IPatternMatch) obj;
188 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
189 }
190 }
191
192 @Override
193 public Transition specification() {
194 return Transition.instance();
195 }
196
197 /**
198 * Returns an empty, mutable match.
199 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
200 *
201 * @return the empty match.
202 *
203 */
204 public static Transition.Match newEmptyMatch() {
205 return new Mutable(null, null, null);
206 }
207
208 /**
209 * Returns a mutable (partial) match.
210 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
211 *
212 * @param pT the fixed value of pattern parameter t, or null if not bound.
213 * @param pSrc the fixed value of pattern parameter src, or null if not bound.
214 * @param pTrg the fixed value of pattern parameter trg, or null if not bound.
215 * @return the new, mutable (partial) match object.
216 *
217 */
218 public static Transition.Match newMutableMatch(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pSrc, final Vertex pTrg) {
219 return new Mutable(pT, pSrc, pTrg);
220 }
221
222 /**
223 * Returns a new (partial) match.
224 * This can be used e.g. to call the matcher with a partial match.
225 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
226 * @param pT the fixed value of pattern parameter t, or null if not bound.
227 * @param pSrc the fixed value of pattern parameter src, or null if not bound.
228 * @param pTrg the fixed value of pattern parameter trg, or null if not bound.
229 * @return the (partial) match object.
230 *
231 */
232 public static Transition.Match newMatch(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pSrc, final Vertex pTrg) {
233 return new Immutable(pT, pSrc, pTrg);
234 }
235
236 private static final class Mutable extends Transition.Match {
237 Mutable(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pSrc, final Vertex pTrg) {
238 super(pT, pSrc, pTrg);
239 }
240
241 @Override
242 public boolean isMutable() {
243 return true;
244 }
245 }
246
247 private static final class Immutable extends Transition.Match {
248 Immutable(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pSrc, final Vertex pTrg) {
249 super(pT, pSrc, pTrg);
250 }
251
252 @Override
253 public boolean isMutable() {
254 return false;
255 }
256 }
257 }
258
259 /**
260 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.transition pattern,
261 * providing pattern-specific query methods.
262 *
263 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
264 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
265 *
266 * <p>Matches of the pattern will be represented as {@link Match}.
267 *
268 * <p>Original source:
269 * <code><pre>
270 * pattern transition(t : Transition, src : Vertex, trg : Vertex) {
271 * Transition.source(t, src);
272 * Transition.target(t, trg);
273 * }
274 * </pre></code>
275 *
276 * @see Match
277 * @see Transition
278 *
279 */
280 public static class Matcher extends BaseMatcher<Transition.Match> {
281 /**
282 * Initializes the pattern matcher within an existing VIATRA Query engine.
283 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
284 *
285 * @param engine the existing VIATRA Query engine in which this matcher will be created.
286 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
287 *
288 */
289 public static Transition.Matcher on(final ViatraQueryEngine engine) {
290 // check if matcher already exists
291 Matcher matcher = engine.getExistingMatcher(querySpecification());
292 if (matcher == null) {
293 matcher = (Matcher)engine.getMatcher(querySpecification());
294 }
295 return matcher;
296 }
297
298 /**
299 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
300 * @return an initialized matcher
301 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
302 *
303 */
304 public static Transition.Matcher create() {
305 return new Matcher();
306 }
307
308 private final static int POSITION_T = 0;
309
310 private final static int POSITION_SRC = 1;
311
312 private final static int POSITION_TRG = 2;
313
314 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Transition.Matcher.class);
315
316 /**
317 * Initializes the pattern matcher within an existing VIATRA Query engine.
318 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
319 *
320 * @param engine the existing VIATRA Query engine in which this matcher will be created.
321 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
322 *
323 */
324 private Matcher() {
325 super(querySpecification());
326 }
327
328 /**
329 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
330 * @param pT the fixed value of pattern parameter t, or null if not bound.
331 * @param pSrc the fixed value of pattern parameter src, or null if not bound.
332 * @param pTrg the fixed value of pattern parameter trg, or null if not bound.
333 * @return matches represented as a Match object.
334 *
335 */
336 public Collection<Transition.Match> getAllMatches(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pSrc, final Vertex pTrg) {
337 return rawStreamAllMatches(new Object[]{pT, pSrc, pTrg}).collect(Collectors.toSet());
338 }
339
340 /**
341 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
342 * </p>
343 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
344 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
345 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
346 * @param pT the fixed value of pattern parameter t, or null if not bound.
347 * @param pSrc the fixed value of pattern parameter src, or null if not bound.
348 * @param pTrg the fixed value of pattern parameter trg, or null if not bound.
349 * @return a stream of matches represented as a Match object.
350 *
351 */
352 public Stream<Transition.Match> streamAllMatches(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pSrc, final Vertex pTrg) {
353 return rawStreamAllMatches(new Object[]{pT, pSrc, pTrg});
354 }
355
356 /**
357 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
358 * Neither determinism nor randomness of selection is guaranteed.
359 * @param pT the fixed value of pattern parameter t, or null if not bound.
360 * @param pSrc the fixed value of pattern parameter src, or null if not bound.
361 * @param pTrg the fixed value of pattern parameter trg, or null if not bound.
362 * @return a match represented as a Match object, or null if no match is found.
363 *
364 */
365 public Optional<Transition.Match> getOneArbitraryMatch(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pSrc, final Vertex pTrg) {
366 return rawGetOneArbitraryMatch(new Object[]{pT, pSrc, pTrg});
367 }
368
369 /**
370 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
371 * under any possible substitution of the unspecified parameters (if any).
372 * @param pT the fixed value of pattern parameter t, or null if not bound.
373 * @param pSrc the fixed value of pattern parameter src, or null if not bound.
374 * @param pTrg the fixed value of pattern parameter trg, or null if not bound.
375 * @return true if the input is a valid (partial) match of the pattern.
376 *
377 */
378 public boolean hasMatch(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pSrc, final Vertex pTrg) {
379 return rawHasMatch(new Object[]{pT, pSrc, pTrg});
380 }
381
382 /**
383 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
384 * @param pT the fixed value of pattern parameter t, or null if not bound.
385 * @param pSrc the fixed value of pattern parameter src, or null if not bound.
386 * @param pTrg the fixed value of pattern parameter trg, or null if not bound.
387 * @return the number of pattern matches found.
388 *
389 */
390 public int countMatches(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pSrc, final Vertex pTrg) {
391 return rawCountMatches(new Object[]{pT, pSrc, pTrg});
392 }
393
394 /**
395 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
396 * Neither determinism nor randomness of selection is guaranteed.
397 * @param pT the fixed value of pattern parameter t, or null if not bound.
398 * @param pSrc the fixed value of pattern parameter src, or null if not bound.
399 * @param pTrg the fixed value of pattern parameter trg, or null if not bound.
400 * @param processor the action that will process the selected match.
401 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
402 *
403 */
404 public boolean forOneArbitraryMatch(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pSrc, final Vertex pTrg, final Consumer<? super Transition.Match> processor) {
405 return rawForOneArbitraryMatch(new Object[]{pT, pSrc, pTrg}, processor);
406 }
407
408 /**
409 * Returns a new (partial) match.
410 * This can be used e.g. to call the matcher with a partial match.
411 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
412 * @param pT the fixed value of pattern parameter t, or null if not bound.
413 * @param pSrc the fixed value of pattern parameter src, or null if not bound.
414 * @param pTrg the fixed value of pattern parameter trg, or null if not bound.
415 * @return the (partial) match object.
416 *
417 */
418 public Transition.Match newMatch(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pSrc, final Vertex pTrg) {
419 return Transition.Match.newMatch(pT, pSrc, pTrg);
420 }
421
422 /**
423 * Retrieve the set of values that occur in matches for t.
424 * @return the Set of all values or empty set if there are no matches
425 *
426 */
427 protected Stream<ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition> rawStreamAllValuesOft(final Object[] parameters) {
428 return rawStreamAllValues(POSITION_T, parameters).map(ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition.class::cast);
429 }
430
431 /**
432 * Retrieve the set of values that occur in matches for t.
433 * @return the Set of all values or empty set if there are no matches
434 *
435 */
436 public Set<ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition> getAllValuesOft() {
437 return rawStreamAllValuesOft(emptyArray()).collect(Collectors.toSet());
438 }
439
440 /**
441 * Retrieve the set of values that occur in matches for t.
442 * @return the Set of all values or empty set if there are no matches
443 *
444 */
445 public Stream<ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition> streamAllValuesOft() {
446 return rawStreamAllValuesOft(emptyArray());
447 }
448
449 /**
450 * Retrieve the set of values that occur in matches for t.
451 * </p>
452 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
453 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
454 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
455 *
456 * @return the Stream of all values or empty set if there are no matches
457 *
458 */
459 public Stream<ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition> streamAllValuesOft(final Transition.Match partialMatch) {
460 return rawStreamAllValuesOft(partialMatch.toArray());
461 }
462
463 /**
464 * Retrieve the set of values that occur in matches for t.
465 * </p>
466 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
467 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
468 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
469 *
470 * @return the Stream of all values or empty set if there are no matches
471 *
472 */
473 public Stream<ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition> streamAllValuesOft(final Vertex pSrc, final Vertex pTrg) {
474 return rawStreamAllValuesOft(new Object[]{null, pSrc, pTrg});
475 }
476
477 /**
478 * Retrieve the set of values that occur in matches for t.
479 * @return the Set of all values or empty set if there are no matches
480 *
481 */
482 public Set<ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition> getAllValuesOft(final Transition.Match partialMatch) {
483 return rawStreamAllValuesOft(partialMatch.toArray()).collect(Collectors.toSet());
484 }
485
486 /**
487 * Retrieve the set of values that occur in matches for t.
488 * @return the Set of all values or empty set if there are no matches
489 *
490 */
491 public Set<ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition> getAllValuesOft(final Vertex pSrc, final Vertex pTrg) {
492 return rawStreamAllValuesOft(new Object[]{null, pSrc, pTrg}).collect(Collectors.toSet());
493 }
494
495 /**
496 * Retrieve the set of values that occur in matches for src.
497 * @return the Set of all values or empty set if there are no matches
498 *
499 */
500 protected Stream<Vertex> rawStreamAllValuesOfsrc(final Object[] parameters) {
501 return rawStreamAllValues(POSITION_SRC, parameters).map(Vertex.class::cast);
502 }
503
504 /**
505 * Retrieve the set of values that occur in matches for src.
506 * @return the Set of all values or empty set if there are no matches
507 *
508 */
509 public Set<Vertex> getAllValuesOfsrc() {
510 return rawStreamAllValuesOfsrc(emptyArray()).collect(Collectors.toSet());
511 }
512
513 /**
514 * Retrieve the set of values that occur in matches for src.
515 * @return the Set of all values or empty set if there are no matches
516 *
517 */
518 public Stream<Vertex> streamAllValuesOfsrc() {
519 return rawStreamAllValuesOfsrc(emptyArray());
520 }
521
522 /**
523 * Retrieve the set of values that occur in matches for src.
524 * </p>
525 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
526 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
527 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
528 *
529 * @return the Stream of all values or empty set if there are no matches
530 *
531 */
532 public Stream<Vertex> streamAllValuesOfsrc(final Transition.Match partialMatch) {
533 return rawStreamAllValuesOfsrc(partialMatch.toArray());
534 }
535
536 /**
537 * Retrieve the set of values that occur in matches for src.
538 * </p>
539 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
540 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
541 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
542 *
543 * @return the Stream of all values or empty set if there are no matches
544 *
545 */
546 public Stream<Vertex> streamAllValuesOfsrc(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pTrg) {
547 return rawStreamAllValuesOfsrc(new Object[]{pT, null, pTrg});
548 }
549
550 /**
551 * Retrieve the set of values that occur in matches for src.
552 * @return the Set of all values or empty set if there are no matches
553 *
554 */
555 public Set<Vertex> getAllValuesOfsrc(final Transition.Match partialMatch) {
556 return rawStreamAllValuesOfsrc(partialMatch.toArray()).collect(Collectors.toSet());
557 }
558
559 /**
560 * Retrieve the set of values that occur in matches for src.
561 * @return the Set of all values or empty set if there are no matches
562 *
563 */
564 public Set<Vertex> getAllValuesOfsrc(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pTrg) {
565 return rawStreamAllValuesOfsrc(new Object[]{pT, null, pTrg}).collect(Collectors.toSet());
566 }
567
568 /**
569 * Retrieve the set of values that occur in matches for trg.
570 * @return the Set of all values or empty set if there are no matches
571 *
572 */
573 protected Stream<Vertex> rawStreamAllValuesOftrg(final Object[] parameters) {
574 return rawStreamAllValues(POSITION_TRG, parameters).map(Vertex.class::cast);
575 }
576
577 /**
578 * Retrieve the set of values that occur in matches for trg.
579 * @return the Set of all values or empty set if there are no matches
580 *
581 */
582 public Set<Vertex> getAllValuesOftrg() {
583 return rawStreamAllValuesOftrg(emptyArray()).collect(Collectors.toSet());
584 }
585
586 /**
587 * Retrieve the set of values that occur in matches for trg.
588 * @return the Set of all values or empty set if there are no matches
589 *
590 */
591 public Stream<Vertex> streamAllValuesOftrg() {
592 return rawStreamAllValuesOftrg(emptyArray());
593 }
594
595 /**
596 * Retrieve the set of values that occur in matches for trg.
597 * </p>
598 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
599 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
600 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
601 *
602 * @return the Stream of all values or empty set if there are no matches
603 *
604 */
605 public Stream<Vertex> streamAllValuesOftrg(final Transition.Match partialMatch) {
606 return rawStreamAllValuesOftrg(partialMatch.toArray());
607 }
608
609 /**
610 * Retrieve the set of values that occur in matches for trg.
611 * </p>
612 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
613 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
614 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
615 *
616 * @return the Stream of all values or empty set if there are no matches
617 *
618 */
619 public Stream<Vertex> streamAllValuesOftrg(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pSrc) {
620 return rawStreamAllValuesOftrg(new Object[]{pT, pSrc, null});
621 }
622
623 /**
624 * Retrieve the set of values that occur in matches for trg.
625 * @return the Set of all values or empty set if there are no matches
626 *
627 */
628 public Set<Vertex> getAllValuesOftrg(final Transition.Match partialMatch) {
629 return rawStreamAllValuesOftrg(partialMatch.toArray()).collect(Collectors.toSet());
630 }
631
632 /**
633 * Retrieve the set of values that occur in matches for trg.
634 * @return the Set of all values or empty set if there are no matches
635 *
636 */
637 public Set<Vertex> getAllValuesOftrg(final ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition pT, final Vertex pSrc) {
638 return rawStreamAllValuesOftrg(new Object[]{pT, pSrc, null}).collect(Collectors.toSet());
639 }
640
641 @Override
642 protected Transition.Match tupleToMatch(final Tuple t) {
643 try {
644 return Transition.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition) t.get(POSITION_T), (Vertex) t.get(POSITION_SRC), (Vertex) t.get(POSITION_TRG));
645 } catch(ClassCastException e) {
646 LOGGER.error("Element(s) in tuple not properly typed!",e);
647 return null;
648 }
649 }
650
651 @Override
652 protected Transition.Match arrayToMatch(final Object[] match) {
653 try {
654 return Transition.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition) match[POSITION_T], (Vertex) match[POSITION_SRC], (Vertex) match[POSITION_TRG]);
655 } catch(ClassCastException e) {
656 LOGGER.error("Element(s) in array not properly typed!",e);
657 return null;
658 }
659 }
660
661 @Override
662 protected Transition.Match arrayToMatchMutable(final Object[] match) {
663 try {
664 return Transition.Match.newMutableMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition) match[POSITION_T], (Vertex) match[POSITION_SRC], (Vertex) match[POSITION_TRG]);
665 } catch(ClassCastException e) {
666 LOGGER.error("Element(s) in array not properly typed!",e);
667 return null;
668 }
669 }
670
671 /**
672 * @return the singleton instance of the query specification of this pattern
673 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
674 *
675 */
676 public static IQuerySpecification<Transition.Matcher> querySpecification() {
677 return Transition.instance();
678 }
679 }
680
681 private Transition() {
682 super(GeneratedPQuery.INSTANCE);
683 }
684
685 /**
686 * @return the singleton instance of the query specification
687 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
688 *
689 */
690 public static Transition instance() {
691 try{
692 return LazyHolder.INSTANCE;
693 } catch (ExceptionInInitializerError err) {
694 throw processInitializerError(err);
695 }
696 }
697
698 @Override
699 protected Transition.Matcher instantiate(final ViatraQueryEngine engine) {
700 return Transition.Matcher.on(engine);
701 }
702
703 @Override
704 public Transition.Matcher instantiate() {
705 return Transition.Matcher.create();
706 }
707
708 @Override
709 public Transition.Match newEmptyMatch() {
710 return Transition.Match.newEmptyMatch();
711 }
712
713 @Override
714 public Transition.Match newMatch(final Object... parameters) {
715 return Transition.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition) parameters[0], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex) parameters[1], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex) parameters[2]);
716 }
717
718 /**
719 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition (visibility: PUBLIC, simpleName: Transition, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
720 * <b>not</b> at the class load time of the outer class,
721 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition (visibility: PUBLIC, simpleName: Transition, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
722 *
723 * <p> This workaround is required e.g. to support recursion.
724 *
725 */
726 private static class LazyHolder {
727 private final static Transition INSTANCE = new Transition();
728
729 /**
730 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
731 * This initialization order is required to support indirect recursion.
732 *
733 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
734 *
735 */
736 private final static Object STATIC_INITIALIZER = ensureInitialized();
737
738 public static Object ensureInitialized() {
739 INSTANCE.ensureInitializedInternal();
740 return null;
741 }
742 }
743
744 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
745 private final static Transition.GeneratedPQuery INSTANCE = new GeneratedPQuery();
746
747 private final PParameter parameter_t = new PParameter("t", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Transition", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Transition")), PParameterDirection.INOUT);
748
749 private final PParameter parameter_src = new PParameter("src", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Vertex")), PParameterDirection.INOUT);
750
751 private final PParameter parameter_trg = new PParameter("trg", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Vertex")), PParameterDirection.INOUT);
752
753 private final List<PParameter> parameters = Arrays.asList(parameter_t, parameter_src, parameter_trg);
754
755 private GeneratedPQuery() {
756 super(PVisibility.PUBLIC);
757 }
758
759 @Override
760 public String getFullyQualifiedName() {
761 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.transition";
762 }
763
764 @Override
765 public List<String> getParameterNames() {
766 return Arrays.asList("t","src","trg");
767 }
768
769 @Override
770 public List<PParameter> getParameters() {
771 return parameters;
772 }
773
774 @Override
775 public Set<PBody> doGetContainedBodies() {
776 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
777 Set<PBody> bodies = new LinkedHashSet<>();
778 {
779 PBody body = new PBody(this);
780 PVariable var_t = body.getOrCreateVariableByName("t");
781 PVariable var_src = body.getOrCreateVariableByName("src");
782 PVariable var_trg = body.getOrCreateVariableByName("trg");
783 new TypeConstraint(body, Tuples.flatTupleOf(var_t), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
784 new TypeConstraint(body, Tuples.flatTupleOf(var_src), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
785 new TypeConstraint(body, Tuples.flatTupleOf(var_trg), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
786 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
787 new ExportedParameter(body, var_t, parameter_t),
788 new ExportedParameter(body, var_src, parameter_src),
789 new ExportedParameter(body, var_trg, parameter_trg)
790 ));
791 // Transition.source(t, src)
792 new TypeConstraint(body, Tuples.flatTupleOf(var_t), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
793 PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
794 new TypeConstraint(body, Tuples.flatTupleOf(var_t, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Transition", "source")));
795 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
796 new Equality(body, var__virtual_0_, var_src);
797 // Transition.target(t, trg)
798 new TypeConstraint(body, Tuples.flatTupleOf(var_t), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Transition")));
799 PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
800 new TypeConstraint(body, Tuples.flatTupleOf(var_t, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Transition", "target")));
801 new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex")));
802 new Equality(body, var__virtual_1_, var_trg);
803 bodies.add(body);
804 }
805 return bodies;
806 }
807 }
808}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/TwoSynch.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/TwoSynch.java
deleted file mode 100644
index 4595f6bc..00000000
--- a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/TwoSynch.java
+++ /dev/null
@@ -1,714 +0,0 @@
1/**
2 * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql
3 */
4package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries;
5
6import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization;
7import java.util.Arrays;
8import java.util.Collection;
9import java.util.LinkedHashSet;
10import java.util.List;
11import java.util.Objects;
12import java.util.Optional;
13import java.util.Set;
14import java.util.function.Consumer;
15import java.util.stream.Collectors;
16import java.util.stream.Stream;
17import org.apache.log4j.Logger;
18import org.eclipse.emf.ecore.EClass;
19import org.eclipse.viatra.query.runtime.api.IPatternMatch;
20import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
21import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
22import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
23import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
24import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
25import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
26import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
27import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
28import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
29import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
30import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
31import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
32import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
33import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
34import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
35import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
36import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
37import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
38import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
39import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
40import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
41
42/**
43 * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
44 *
45 * <p>Original source:
46 * <code><pre>
47 * Simplifying model generation
48 *
49 * {@literal @}Constraint(severity="error", message="error", key = {s1,s2})
50 * pattern twoSynch(s1 : Synchronization, s2 : Synchronization) {
51 * Synchronization(s1);
52 * Synchronization(s2);
53 * s1 != s2;
54 * }
55 * </pre></code>
56 *
57 * @see Matcher
58 * @see Match
59 *
60 */
61@SuppressWarnings("all")
62public final class TwoSynch extends BaseGeneratedEMFQuerySpecification<TwoSynch.Matcher> {
63 /**
64 * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.twoSynch pattern,
65 * to be used in conjunction with {@link Matcher}.
66 *
67 * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
68 * Each instance is a (possibly partial) substitution of pattern parameters,
69 * usable to represent a match of the pattern in the result of a query,
70 * or to specify the bound (fixed) input parameters when issuing a query.
71 *
72 * @see Matcher
73 *
74 */
75 public static abstract class Match extends BasePatternMatch {
76 private Synchronization fS1;
77
78 private Synchronization fS2;
79
80 private static List<String> parameterNames = makeImmutableList("s1", "s2");
81
82 private Match(final Synchronization pS1, final Synchronization pS2) {
83 this.fS1 = pS1;
84 this.fS2 = pS2;
85 }
86
87 @Override
88 public Object get(final String parameterName) {
89 if ("s1".equals(parameterName)) return this.fS1;
90 if ("s2".equals(parameterName)) return this.fS2;
91 return null;
92 }
93
94 public Synchronization getS1() {
95 return this.fS1;
96 }
97
98 public Synchronization getS2() {
99 return this.fS2;
100 }
101
102 @Override
103 public boolean set(final String parameterName, final Object newValue) {
104 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
105 if ("s1".equals(parameterName) ) {
106 this.fS1 = (Synchronization) newValue;
107 return true;
108 }
109 if ("s2".equals(parameterName) ) {
110 this.fS2 = (Synchronization) newValue;
111 return true;
112 }
113 return false;
114 }
115
116 public void setS1(final Synchronization pS1) {
117 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
118 this.fS1 = pS1;
119 }
120
121 public void setS2(final Synchronization pS2) {
122 if (!isMutable()) throw new java.lang.UnsupportedOperationException();
123 this.fS2 = pS2;
124 }
125
126 @Override
127 public String patternName() {
128 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.twoSynch";
129 }
130
131 @Override
132 public List<String> parameterNames() {
133 return TwoSynch.Match.parameterNames;
134 }
135
136 @Override
137 public Object[] toArray() {
138 return new Object[]{fS1, fS2};
139 }
140
141 @Override
142 public TwoSynch.Match toImmutable() {
143 return isMutable() ? newMatch(fS1, fS2) : this;
144 }
145
146 @Override
147 public String prettyPrint() {
148 StringBuilder result = new StringBuilder();
149 result.append("\"s1\"=" + prettyPrintValue(fS1) + ", ");
150 result.append("\"s2\"=" + prettyPrintValue(fS2));
151 return result.toString();
152 }
153
154 @Override
155 public int hashCode() {
156 return Objects.hash(fS1, fS2);
157 }
158
159 @Override
160 public boolean equals(final Object obj) {
161 if (this == obj)
162 return true;
163 if (obj == null) {
164 return false;
165 }
166 if ((obj instanceof TwoSynch.Match)) {
167 TwoSynch.Match other = (TwoSynch.Match) obj;
168 return Objects.equals(fS1, other.fS1) && Objects.equals(fS2, other.fS2);
169 } else {
170 // this should be infrequent
171 if (!(obj instanceof IPatternMatch)) {
172 return false;
173 }
174 IPatternMatch otherSig = (IPatternMatch) obj;
175 return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
176 }
177 }
178
179 @Override
180 public TwoSynch specification() {
181 return TwoSynch.instance();
182 }
183
184 /**
185 * Returns an empty, mutable match.
186 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
187 *
188 * @return the empty match.
189 *
190 */
191 public static TwoSynch.Match newEmptyMatch() {
192 return new Mutable(null, null);
193 }
194
195 /**
196 * Returns a mutable (partial) match.
197 * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
198 *
199 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
200 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
201 * @return the new, mutable (partial) match object.
202 *
203 */
204 public static TwoSynch.Match newMutableMatch(final Synchronization pS1, final Synchronization pS2) {
205 return new Mutable(pS1, pS2);
206 }
207
208 /**
209 * Returns a new (partial) match.
210 * This can be used e.g. to call the matcher with a partial match.
211 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
212 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
213 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
214 * @return the (partial) match object.
215 *
216 */
217 public static TwoSynch.Match newMatch(final Synchronization pS1, final Synchronization pS2) {
218 return new Immutable(pS1, pS2);
219 }
220
221 private static final class Mutable extends TwoSynch.Match {
222 Mutable(final Synchronization pS1, final Synchronization pS2) {
223 super(pS1, pS2);
224 }
225
226 @Override
227 public boolean isMutable() {
228 return true;
229 }
230 }
231
232 private static final class Immutable extends TwoSynch.Match {
233 Immutable(final Synchronization pS1, final Synchronization pS2) {
234 super(pS1, pS2);
235 }
236
237 @Override
238 public boolean isMutable() {
239 return false;
240 }
241 }
242 }
243
244 /**
245 * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.twoSynch pattern,
246 * providing pattern-specific query methods.
247 *
248 * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
249 * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
250 *
251 * <p>Matches of the pattern will be represented as {@link Match}.
252 *
253 * <p>Original source:
254 * <code><pre>
255 * Simplifying model generation
256 *
257 * {@literal @}Constraint(severity="error", message="error", key = {s1,s2})
258 * pattern twoSynch(s1 : Synchronization, s2 : Synchronization) {
259 * Synchronization(s1);
260 * Synchronization(s2);
261 * s1 != s2;
262 * }
263 * </pre></code>
264 *
265 * @see Match
266 * @see TwoSynch
267 *
268 */
269 public static class Matcher extends BaseMatcher<TwoSynch.Match> {
270 /**
271 * Initializes the pattern matcher within an existing VIATRA Query engine.
272 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
273 *
274 * @param engine the existing VIATRA Query engine in which this matcher will be created.
275 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
276 *
277 */
278 public static TwoSynch.Matcher on(final ViatraQueryEngine engine) {
279 // check if matcher already exists
280 Matcher matcher = engine.getExistingMatcher(querySpecification());
281 if (matcher == null) {
282 matcher = (Matcher)engine.getMatcher(querySpecification());
283 }
284 return matcher;
285 }
286
287 /**
288 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
289 * @return an initialized matcher
290 * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
291 *
292 */
293 public static TwoSynch.Matcher create() {
294 return new Matcher();
295 }
296
297 private final static int POSITION_S1 = 0;
298
299 private final static int POSITION_S2 = 1;
300
301 private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TwoSynch.Matcher.class);
302
303 /**
304 * Initializes the pattern matcher within an existing VIATRA Query engine.
305 * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
306 *
307 * @param engine the existing VIATRA Query engine in which this matcher will be created.
308 * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
309 *
310 */
311 private Matcher() {
312 super(querySpecification());
313 }
314
315 /**
316 * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
317 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
318 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
319 * @return matches represented as a Match object.
320 *
321 */
322 public Collection<TwoSynch.Match> getAllMatches(final Synchronization pS1, final Synchronization pS2) {
323 return rawStreamAllMatches(new Object[]{pS1, pS2}).collect(Collectors.toSet());
324 }
325
326 /**
327 * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
328 * </p>
329 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
330 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
331 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
332 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
333 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
334 * @return a stream of matches represented as a Match object.
335 *
336 */
337 public Stream<TwoSynch.Match> streamAllMatches(final Synchronization pS1, final Synchronization pS2) {
338 return rawStreamAllMatches(new Object[]{pS1, pS2});
339 }
340
341 /**
342 * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
343 * Neither determinism nor randomness of selection is guaranteed.
344 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
345 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
346 * @return a match represented as a Match object, or null if no match is found.
347 *
348 */
349 public Optional<TwoSynch.Match> getOneArbitraryMatch(final Synchronization pS1, final Synchronization pS2) {
350 return rawGetOneArbitraryMatch(new Object[]{pS1, pS2});
351 }
352
353 /**
354 * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
355 * under any possible substitution of the unspecified parameters (if any).
356 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
357 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
358 * @return true if the input is a valid (partial) match of the pattern.
359 *
360 */
361 public boolean hasMatch(final Synchronization pS1, final Synchronization pS2) {
362 return rawHasMatch(new Object[]{pS1, pS2});
363 }
364
365 /**
366 * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
367 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
368 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
369 * @return the number of pattern matches found.
370 *
371 */
372 public int countMatches(final Synchronization pS1, final Synchronization pS2) {
373 return rawCountMatches(new Object[]{pS1, pS2});
374 }
375
376 /**
377 * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
378 * Neither determinism nor randomness of selection is guaranteed.
379 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
380 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
381 * @param processor the action that will process the selected match.
382 * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
383 *
384 */
385 public boolean forOneArbitraryMatch(final Synchronization pS1, final Synchronization pS2, final Consumer<? super TwoSynch.Match> processor) {
386 return rawForOneArbitraryMatch(new Object[]{pS1, pS2}, processor);
387 }
388
389 /**
390 * Returns a new (partial) match.
391 * This can be used e.g. to call the matcher with a partial match.
392 * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
393 * @param pS1 the fixed value of pattern parameter s1, or null if not bound.
394 * @param pS2 the fixed value of pattern parameter s2, or null if not bound.
395 * @return the (partial) match object.
396 *
397 */
398 public TwoSynch.Match newMatch(final Synchronization pS1, final Synchronization pS2) {
399 return TwoSynch.Match.newMatch(pS1, pS2);
400 }
401
402 /**
403 * Retrieve the set of values that occur in matches for s1.
404 * @return the Set of all values or empty set if there are no matches
405 *
406 */
407 protected Stream<Synchronization> rawStreamAllValuesOfs1(final Object[] parameters) {
408 return rawStreamAllValues(POSITION_S1, parameters).map(Synchronization.class::cast);
409 }
410
411 /**
412 * Retrieve the set of values that occur in matches for s1.
413 * @return the Set of all values or empty set if there are no matches
414 *
415 */
416 public Set<Synchronization> getAllValuesOfs1() {
417 return rawStreamAllValuesOfs1(emptyArray()).collect(Collectors.toSet());
418 }
419
420 /**
421 * Retrieve the set of values that occur in matches for s1.
422 * @return the Set of all values or empty set if there are no matches
423 *
424 */
425 public Stream<Synchronization> streamAllValuesOfs1() {
426 return rawStreamAllValuesOfs1(emptyArray());
427 }
428
429 /**
430 * Retrieve the set of values that occur in matches for s1.
431 * </p>
432 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
433 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
434 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
435 *
436 * @return the Stream of all values or empty set if there are no matches
437 *
438 */
439 public Stream<Synchronization> streamAllValuesOfs1(final TwoSynch.Match partialMatch) {
440 return rawStreamAllValuesOfs1(partialMatch.toArray());
441 }
442
443 /**
444 * Retrieve the set of values that occur in matches for s1.
445 * </p>
446 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
447 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
448 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
449 *
450 * @return the Stream of all values or empty set if there are no matches
451 *
452 */
453 public Stream<Synchronization> streamAllValuesOfs1(final Synchronization pS2) {
454 return rawStreamAllValuesOfs1(new Object[]{null, pS2});
455 }
456
457 /**
458 * Retrieve the set of values that occur in matches for s1.
459 * @return the Set of all values or empty set if there are no matches
460 *
461 */
462 public Set<Synchronization> getAllValuesOfs1(final TwoSynch.Match partialMatch) {
463 return rawStreamAllValuesOfs1(partialMatch.toArray()).collect(Collectors.toSet());
464 }
465
466 /**
467 * Retrieve the set of values that occur in matches for s1.
468 * @return the Set of all values or empty set if there are no matches
469 *
470 */
471 public Set<Synchronization> getAllValuesOfs1(final Synchronization pS2) {
472 return rawStreamAllValuesOfs1(new Object[]{null, pS2}).collect(Collectors.toSet());
473 }
474
475 /**
476 * Retrieve the set of values that occur in matches for s2.
477 * @return the Set of all values or empty set if there are no matches
478 *
479 */
480 protected Stream<Synchronization> rawStreamAllValuesOfs2(final Object[] parameters) {
481 return rawStreamAllValues(POSITION_S2, parameters).map(Synchronization.class::cast);
482 }
483
484 /**
485 * Retrieve the set of values that occur in matches for s2.
486 * @return the Set of all values or empty set if there are no matches
487 *
488 */
489 public Set<Synchronization> getAllValuesOfs2() {
490 return rawStreamAllValuesOfs2(emptyArray()).collect(Collectors.toSet());
491 }
492
493 /**
494 * Retrieve the set of values that occur in matches for s2.
495 * @return the Set of all values or empty set if there are no matches
496 *
497 */
498 public Stream<Synchronization> streamAllValuesOfs2() {
499 return rawStreamAllValuesOfs2(emptyArray());
500 }
501
502 /**
503 * Retrieve the set of values that occur in matches for s2.
504 * </p>
505 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
506 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
507 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
508 *
509 * @return the Stream of all values or empty set if there are no matches
510 *
511 */
512 public Stream<Synchronization> streamAllValuesOfs2(final TwoSynch.Match partialMatch) {
513 return rawStreamAllValuesOfs2(partialMatch.toArray());
514 }
515
516 /**
517 * Retrieve the set of values that occur in matches for s2.
518 * </p>
519 * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed.
520 * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>.
521 * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
522 *
523 * @return the Stream of all values or empty set if there are no matches
524 *
525 */
526 public Stream<Synchronization> streamAllValuesOfs2(final Synchronization pS1) {
527 return rawStreamAllValuesOfs2(new Object[]{pS1, null});
528 }
529
530 /**
531 * Retrieve the set of values that occur in matches for s2.
532 * @return the Set of all values or empty set if there are no matches
533 *
534 */
535 public Set<Synchronization> getAllValuesOfs2(final TwoSynch.Match partialMatch) {
536 return rawStreamAllValuesOfs2(partialMatch.toArray()).collect(Collectors.toSet());
537 }
538
539 /**
540 * Retrieve the set of values that occur in matches for s2.
541 * @return the Set of all values or empty set if there are no matches
542 *
543 */
544 public Set<Synchronization> getAllValuesOfs2(final Synchronization pS1) {
545 return rawStreamAllValuesOfs2(new Object[]{pS1, null}).collect(Collectors.toSet());
546 }
547
548 @Override
549 protected TwoSynch.Match tupleToMatch(final Tuple t) {
550 try {
551 return TwoSynch.Match.newMatch((Synchronization) t.get(POSITION_S1), (Synchronization) t.get(POSITION_S2));
552 } catch(ClassCastException e) {
553 LOGGER.error("Element(s) in tuple not properly typed!",e);
554 return null;
555 }
556 }
557
558 @Override
559 protected TwoSynch.Match arrayToMatch(final Object[] match) {
560 try {
561 return TwoSynch.Match.newMatch((Synchronization) match[POSITION_S1], (Synchronization) match[POSITION_S2]);
562 } catch(ClassCastException e) {
563 LOGGER.error("Element(s) in array not properly typed!",e);
564 return null;
565 }
566 }
567
568 @Override
569 protected TwoSynch.Match arrayToMatchMutable(final Object[] match) {
570 try {
571 return TwoSynch.Match.newMutableMatch((Synchronization) match[POSITION_S1], (Synchronization) match[POSITION_S2]);
572 } catch(ClassCastException e) {
573 LOGGER.error("Element(s) in array not properly typed!",e);
574 return null;
575 }
576 }
577
578 /**
579 * @return the singleton instance of the query specification of this pattern
580 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
581 *
582 */
583 public static IQuerySpecification<TwoSynch.Matcher> querySpecification() {
584 return TwoSynch.instance();
585 }
586 }
587
588 private TwoSynch() {
589 super(GeneratedPQuery.INSTANCE);
590 }
591
592 /**
593 * @return the singleton instance of the query specification
594 * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
595 *
596 */
597 public static TwoSynch instance() {
598 try{
599 return LazyHolder.INSTANCE;
600 } catch (ExceptionInInitializerError err) {
601 throw processInitializerError(err);
602 }
603 }
604
605 @Override
606 protected TwoSynch.Matcher instantiate(final ViatraQueryEngine engine) {
607 return TwoSynch.Matcher.on(engine);
608 }
609
610 @Override
611 public TwoSynch.Matcher instantiate() {
612 return TwoSynch.Matcher.create();
613 }
614
615 @Override
616 public TwoSynch.Match newEmptyMatch() {
617 return TwoSynch.Match.newEmptyMatch();
618 }
619
620 @Override
621 public TwoSynch.Match newMatch(final Object... parameters) {
622 return TwoSynch.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization) parameters[0], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization) parameters[1]);
623 }
624
625 /**
626 * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.TwoSynch (visibility: PUBLIC, simpleName: TwoSynch, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.TwoSynch, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
627 * <b>not</b> at the class load time of the outer class,
628 * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.TwoSynch (visibility: PUBLIC, simpleName: TwoSynch, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.TwoSynch, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
629 *
630 * <p> This workaround is required e.g. to support recursion.
631 *
632 */
633 private static class LazyHolder {
634 private final static TwoSynch INSTANCE = new TwoSynch();
635
636 /**
637 * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
638 * This initialization order is required to support indirect recursion.
639 *
640 * <p> The static initializer is defined using a helper field to work around limitations of the code generator.
641 *
642 */
643 private final static Object STATIC_INITIALIZER = ensureInitialized();
644
645 public static Object ensureInitialized() {
646 INSTANCE.ensureInitializedInternal();
647 return null;
648 }
649 }
650
651 private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
652 private final static TwoSynch.GeneratedPQuery INSTANCE = new GeneratedPQuery();
653
654 private final PParameter parameter_s1 = new PParameter("s1", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Synchronization")), PParameterDirection.INOUT);
655
656 private final PParameter parameter_s2 = new PParameter("s2", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Synchronization")), PParameterDirection.INOUT);
657
658 private final List<PParameter> parameters = Arrays.asList(parameter_s1, parameter_s2);
659
660 private GeneratedPQuery() {
661 super(PVisibility.PUBLIC);
662 }
663
664 @Override
665 public String getFullyQualifiedName() {
666 return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.twoSynch";
667 }
668
669 @Override
670 public List<String> getParameterNames() {
671 return Arrays.asList("s1","s2");
672 }
673
674 @Override
675 public List<PParameter> getParameters() {
676 return parameters;
677 }
678
679 @Override
680 public Set<PBody> doGetContainedBodies() {
681 setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
682 Set<PBody> bodies = new LinkedHashSet<>();
683 {
684 PBody body = new PBody(this);
685 PVariable var_s1 = body.getOrCreateVariableByName("s1");
686 PVariable var_s2 = body.getOrCreateVariableByName("s2");
687 new TypeConstraint(body, Tuples.flatTupleOf(var_s1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
688 new TypeConstraint(body, Tuples.flatTupleOf(var_s2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
689 body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
690 new ExportedParameter(body, var_s1, parameter_s1),
691 new ExportedParameter(body, var_s2, parameter_s2)
692 ));
693 // Synchronization(s1)
694 new TypeConstraint(body, Tuples.flatTupleOf(var_s1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
695 // Synchronization(s2)
696 new TypeConstraint(body, Tuples.flatTupleOf(var_s2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization")));
697 // s1 != s2
698 new Inequality(body, var_s1, var_s2);
699 bodies.add(body);
700 }
701 {
702 PAnnotation annotation = new PAnnotation("Constraint");
703 annotation.addAttribute("severity", "error");
704 annotation.addAttribute("message", "error");
705 annotation.addAttribute("key", Arrays.asList(new Object[] {
706 new ParameterReference("s1"),
707 new ParameterReference("s2")
708 }));
709 addAnnotation(annotation);
710 }
711 return bodies;
712 }
713 }
714}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/META-INF/MANIFEST.MF b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/META-INF/MANIFEST.MF
index 1995ee52..2ea274a4 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/META-INF/MANIFEST.MF
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/META-INF/MANIFEST.MF
@@ -4,7 +4,8 @@ Bundle-Name: Test
4Bundle-SymbolicName: ca.mcgill.ecse.dslreasoner.vampire.test;singleton:=true 4Bundle-SymbolicName: ca.mcgill.ecse.dslreasoner.vampire.test;singleton:=true
5Bundle-Version: 1.0.0.qualifier 5Bundle-Version: 1.0.0.qualifier
6Export-Package: ca.mcgill.ecse.dslreasoner.vampire.queries 6Export-Package: ca.mcgill.ecse.dslreasoner.vampire.queries
7Require-Bundle: org.eclipse.emf.ecore, 7Require-Bundle: org.eclipse.viatra.addon.querybasedfeatures.runtime,
8 org.eclipse.emf.ecore,
8 org.eclipse.viatra.query.runtime.rete, 9 org.eclipse.viatra.query.runtime.rete,
9 org.eclipse.viatra.query.runtime.localsearch, 10 org.eclipse.viatra.query.runtime.localsearch,
10 com.google.guava, 11 com.google.guava,
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/output/FAMTest/Fam.logicproblem b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/output/FAMTest/Fam.logicproblem
index 85e09a0a..18e58ab0 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/output/FAMTest/Fam.logicproblem
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/output/FAMTest/Fam.logicproblem
@@ -557,7 +557,7 @@
557 <elements name="Root literal FunctionType" definedInType="//@types.9"/> 557 <elements name="Root literal FunctionType" definedInType="//@types.9"/>
558 <elements name="Intermediate literal FunctionType" definedInType="//@types.9"/> 558 <elements name="Intermediate literal FunctionType" definedInType="//@types.9"/>
559 <elements name="Leaf literal FunctionType" definedInType="//@types.9"/> 559 <elements name="Leaf literal FunctionType" definedInType="//@types.9"/>
560 <containmentHierarchies typesOrderedInHierarchy="//@types.3 //@types.8 //@types.0 //@types.4 //@types.2 //@types.1 //@types.6 //@types.7 //@types.5" containmentRelations="//@relations.0 //@relations.3 //@relations.4 //@relations.8 //@relations.11 //@relations.12"/> 560 <containmentHierarchies typesOrderedInHierarchy="//@types.8 //@types.5 //@types.4 //@types.6 //@types.1 //@types.7 //@types.3 //@types.2 //@types.0" containmentRelations="//@relations.0 //@relations.3 //@relations.4 //@relations.8 //@relations.11 //@relations.12"/>
561 <annotations xsi:type="ecore2logicannotations:UpperMultiplicityAssertion" target="//@assertions.0" relation="//@relations.0" upper="1"/> 561 <annotations xsi:type="ecore2logicannotations:UpperMultiplicityAssertion" target="//@assertions.0" relation="//@relations.0" upper="1"/>
562 <annotations xsi:type="ecore2logicannotations:LowerMultiplicityAssertion" target="//@assertions.1" relation="//@relations.1" lower="1"/> 562 <annotations xsi:type="ecore2logicannotations:LowerMultiplicityAssertion" target="//@assertions.1" relation="//@relations.1" lower="1"/>
563 <annotations xsi:type="ecore2logicannotations:UpperMultiplicityAssertion" target="//@assertions.2" relation="//@relations.1" upper="1"/> 563 <annotations xsi:type="ecore2logicannotations:UpperMultiplicityAssertion" target="//@assertions.2" relation="//@relations.1" upper="1"/>
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/output/FAMTest/vampireProblem.tptp b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/output/FAMTest/vampireProblem.tptp
index b4bb6700..3d49d42c 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/output/FAMTest/vampireProblem.tptp
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/output/FAMTest/vampireProblem.tptp
@@ -4,41 +4,21 @@ fof ( enumScope_FunctionType_Root , axiom , ! [ A ] : ( A = eo1 <=> e_Root_Funct
4fof ( enumScope_FunctionType_Intermediate , axiom , ! [ A ] : ( A = eo2 <=> e_Intermediate_FunctionType ( A ) ) ) . 4fof ( enumScope_FunctionType_Intermediate , axiom , ! [ A ] : ( A = eo2 <=> e_Intermediate_FunctionType ( A ) ) ) .
5fof ( enumScope_FunctionType_Leaf , axiom , ! [ A ] : ( A = eo3 <=> e_Leaf_FunctionType ( A ) ) ) . 5fof ( enumScope_FunctionType_Leaf , axiom , ! [ A ] : ( A = eo3 <=> e_Leaf_FunctionType ( A ) ) ) .
6fof ( notObjectHandler , axiom , ! [ A ] : ( ~ object ( A ) <=> ( ~ t_FunctionalElement ( A ) & ( ~ t_FunctionalArchitectureModel ( A ) & ( ~ t_Function ( A ) & ( ~ t_FAMTerminator ( A ) & ( ~ t_InformationLink ( A ) & ( ~ t_FunctionalInterface ( A ) & ( ~ t_FunctionalInput ( A ) & ( ~ t_FunctionalOutput ( A ) & ( ~ t_FunctionalData ( A ) & ~ t_FunctionType ( A ) ) ) ) ) ) ) ) ) ) ) ) . 6fof ( notObjectHandler , axiom , ! [ A ] : ( ~ object ( A ) <=> ( ~ t_FunctionalElement ( A ) & ( ~ t_FunctionalArchitectureModel ( A ) & ( ~ t_Function ( A ) & ( ~ t_FAMTerminator ( A ) & ( ~ t_InformationLink ( A ) & ( ~ t_FunctionalInterface ( A ) & ( ~ t_FunctionalInput ( A ) & ( ~ t_FunctionalOutput ( A ) & ( ~ t_FunctionalData ( A ) & ~ t_FunctionType ( A ) ) ) ) ) ) ) ) ) ) ) ) .
7fof ( inheritanceHierarchyHandler , axiom , ! [ A ] : ( object ( A ) <=> ( ( t_FAMTerminator ( A ) & ( ~ t_FunctionalData ( A ) & ( ~ t_FunctionalInterface ( A ) & ( ~ t_Function ( A ) & ( ~ t_InformationLink ( A ) & ( ~ t_FunctionalElement ( A ) & ( ~ t_FunctionalArchitectureModel ( A ) & ( ~ t_FunctionType ( A ) & ( ~ t_FunctionalInput ( A ) & ~ t_FunctionalOutput ( A ) ) ) ) ) ) ) ) ) ) | ( ( ~ t_FAMTerminator ( A ) & ( ~ t_FunctionalData ( A ) & ( t_FunctionalInterface ( A ) & ( ~ t_Function ( A ) & ( ~ t_InformationLink ( A ) & ( ~ t_FunctionalElement ( A ) & ( ~ t_FunctionalArchitectureModel ( A ) & ( ~ t_FunctionType ( A ) & ( ~ t_FunctionalInput ( A ) & ~ t_FunctionalOutput ( A ) ) ) ) ) ) ) ) ) ) | ( ( ~ t_FAMTerminator ( A ) & ( ~ t_FunctionalData ( A ) & ( ~ t_FunctionalInterface ( A ) & ( t_Function ( A ) & ( ~ t_InformationLink ( A ) & ( t_FunctionalElement ( A ) & ( ~ t_FunctionalArchitectureModel ( A ) & ( ~ t_FunctionType ( A ) & ( ~ t_FunctionalInput ( A ) & ~ t_FunctionalOutput ( A ) ) ) ) ) ) ) ) ) ) | ( ( ~ t_FAMTerminator ( A ) & ( ~ t_FunctionalData ( A ) & ( ~ t_FunctionalInterface ( A ) & ( ~ t_Function ( A ) & ( t_InformationLink ( A ) & ( ~ t_FunctionalElement ( A ) & ( ~ t_FunctionalArchitectureModel ( A ) & ( ~ t_FunctionType ( A ) & ( ~ t_FunctionalInput ( A ) & ~ t_FunctionalOutput ( A ) ) ) ) ) ) ) ) ) ) | ( ( ~ t_FAMTerminator ( A ) & ( ~ t_FunctionalData ( A ) & ( ~ t_FunctionalInterface ( A ) & ( ~ t_Function ( A ) & ( ~ t_InformationLink ( A ) & ( ~ t_FunctionalElement ( A ) & ( t_FunctionalArchitectureModel ( A ) & ( ~ t_FunctionType ( A ) & ( ~ t_FunctionalInput ( A ) & ~ t_FunctionalOutput ( A ) ) ) ) ) ) ) ) ) ) | ( ( ~ t_FAMTerminator ( A ) & ( ~ t_FunctionalData ( A ) & ( ~ t_FunctionalInterface ( A ) & ( ~ t_Function ( A ) & ( ~ t_InformationLink ( A ) & ( ~ t_FunctionalElement ( A ) & ( ~ t_FunctionalArchitectureModel ( A ) & ( t_FunctionType ( A ) & ( ~ t_FunctionalInput ( A ) & ~ t_FunctionalOutput ( A ) ) ) ) ) ) ) ) ) ) | ( ( ~ t_FAMTerminator ( A ) & ( t_FunctionalData ( A ) & ( ~ t_FunctionalInterface ( A ) & ( ~ t_Function ( A ) & ( ~ t_InformationLink ( A ) & ( ~ t_FunctionalElement ( A ) & ( ~ t_FunctionalArchitectureModel ( A ) & ( ~ t_FunctionType ( A ) & ( t_FunctionalInput ( A ) & ~ t_FunctionalOutput ( A ) ) ) ) ) ) ) ) ) ) | ( ~ t_FAMTerminator ( A ) & ( t_FunctionalData ( A ) & ( ~ t_FunctionalInterface ( A ) & ( ~ t_Function ( A ) & ( ~ t_InformationLink ( A ) & ( ~ t_FunctionalElement ( A ) & ( ~ t_FunctionalArchitectureModel ( A ) & ( ~ t_FunctionType ( A ) & ( ~ t_FunctionalInput ( A ) & t_FunctionalOutput ( A ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) . 7fof ( inheritanceHierarchyHandler , axiom , ! [ A ] : ( object ( A ) <=> ( ( t_FunctionalArchitectureModel ( A ) & ( ~ t_FunctionalInput ( A ) & ( ~ t_Function ( A ) & ( ~ t_FAMTerminator ( A ) & ( ~ t_FunctionType ( A ) & ( ~ t_FunctionalElement ( A ) & ( ~ t_FunctionalOutput ( A ) & ( ~ t_FunctionalData ( A ) & ( ~ t_InformationLink ( A ) & ~ t_FunctionalInterface ( A ) ) ) ) ) ) ) ) ) ) | ( ( ~ t_FunctionalArchitectureModel ( A ) & ( t_FunctionalInput ( A ) & ( ~ t_Function ( A ) & ( ~ t_FAMTerminator ( A ) & ( ~ t_FunctionType ( A ) & ( ~ t_FunctionalElement ( A ) & ( ~ t_FunctionalOutput ( A ) & ( t_FunctionalData ( A ) & ( ~ t_InformationLink ( A ) & ~ t_FunctionalInterface ( A ) ) ) ) ) ) ) ) ) ) | ( ( ~ t_FunctionalArchitectureModel ( A ) & ( ~ t_FunctionalInput ( A ) & ( t_Function ( A ) & ( ~ t_FAMTerminator ( A ) & ( ~ t_FunctionType ( A ) & ( t_FunctionalElement ( A ) & ( ~ t_FunctionalOutput ( A ) & ( ~ t_FunctionalData ( A ) & ( ~ t_InformationLink ( A ) & ~ t_FunctionalInterface ( A ) ) ) ) ) ) ) ) ) ) | ( ( ~ t_FunctionalArchitectureModel ( A ) & ( ~ t_FunctionalInput ( A ) & ( ~ t_Function ( A ) & ( t_FAMTerminator ( A ) & ( ~ t_FunctionType ( A ) & ( ~ t_FunctionalElement ( A ) & ( ~ t_FunctionalOutput ( A ) & ( ~ t_FunctionalData ( A ) & ( ~ t_InformationLink ( A ) & ~ t_FunctionalInterface ( A ) ) ) ) ) ) ) ) ) ) | ( ( ~ t_FunctionalArchitectureModel ( A ) & ( ~ t_FunctionalInput ( A ) & ( ~ t_Function ( A ) & ( ~ t_FAMTerminator ( A ) & ( t_FunctionType ( A ) & ( ~ t_FunctionalElement ( A ) & ( ~ t_FunctionalOutput ( A ) & ( ~ t_FunctionalData ( A ) & ( ~ t_InformationLink ( A ) & ~ t_FunctionalInterface ( A ) ) ) ) ) ) ) ) ) ) | ( ( ~ t_FunctionalArchitectureModel ( A ) & ( ~ t_FunctionalInput ( A ) & ( ~ t_Function ( A ) & ( ~ t_FAMTerminator ( A ) & ( ~ t_FunctionType ( A ) & ( ~ t_FunctionalElement ( A ) & ( t_FunctionalOutput ( A ) & ( t_FunctionalData ( A ) & ( ~ t_InformationLink ( A ) & ~ t_FunctionalInterface ( A ) ) ) ) ) ) ) ) ) ) | ( ( ~ t_FunctionalArchitectureModel ( A ) & ( ~ t_FunctionalInput ( A ) & ( ~ t_Function ( A ) & ( ~ t_FAMTerminator ( A ) & ( ~ t_FunctionType ( A ) & ( ~ t_FunctionalElement ( A ) & ( ~ t_FunctionalOutput ( A ) & ( ~ t_FunctionalData ( A ) & ( t_InformationLink ( A ) & ~ t_FunctionalInterface ( A ) ) ) ) ) ) ) ) ) ) | ( ~ t_FunctionalArchitectureModel ( A ) & ( ~ t_FunctionalInput ( A ) & ( ~ t_Function ( A ) & ( ~ t_FAMTerminator ( A ) & ( ~ t_FunctionType ( A ) & ( ~ t_FunctionalElement ( A ) & ( ~ t_FunctionalOutput ( A ) & ( ~ t_FunctionalData ( A ) & ( ~ t_InformationLink ( A ) & t_FunctionalInterface ( A ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) .
8fof ( typeScope_min_object , axiom , ! [ A ] : ( ( A = o1 | ( A = o2 | ( A = o3 | ( A = o4 | ( A = eo1 | ( A = eo2 | A = eo3 ) ) ) ) ) ) => object ( A ) ) ) . 8fof ( typeScope_min_object , axiom , ! [ A ] : ( ( A = o1 | ( A = o2 | ( A = o3 | ( A = o4 | ( A = eo1 | ( A = eo2 | A = eo3 ) ) ) ) ) ) => object ( A ) ) ) .
9fof ( typeScope_max_object , axiom , ! [ A ] : ( object ( A ) => ( A = eo1 | ( A = eo2 | ( A = eo3 | ( A = o1 | ( A = o2 | ( A = o3 | ( A = o4 | ( A = o5 | ( A = o6 | ( A = o7 | ( A = o8 | ( A = o9 | ( A = o10 | ( A = o11 | ( A = o12 | ( A = o13 | ( A = o14 | ( A = o15 | ( A = o16 | ( A = o17 | ( A = o18 | ( A = o19 | ( A = o20 | ( A = o21 | ( A = o22 | ( A = o23 | ( A = o24 | A = o25 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) . 9fof ( typeScope_max_object , axiom , ! [ A ] : ( object ( A ) => ( A = eo1 | ( A = eo2 | ( A = eo3 | ( A = o1 | ( A = o2 | ( A = o3 | ( A = o4 | A = o5 ) ) ) ) ) ) ) ) ) .
10fof ( typeScope_min_t_FunctionalInterface , axiom , ! [ A ] : ( ( A = o2 | A = o3 ) => ( t_FunctionalInterface ( A ) & object ( A ) ) ) ) . 10fof ( typeScope_min_t_Function , axiom , ! [ A ] : ( A = o2 => ( t_Function ( A ) & object ( A ) ) ) ) .
11fof ( typeScope_min_t_Function , axiom , ! [ A ] : ( A = o4 => ( t_Function ( A ) & object ( A ) ) ) ) . 11fof ( typeScope_min_t_FunctionalOutput , axiom , ! [ A ] : ( ( A = o3 | ( A = o4 | A = o5 ) ) => ( t_FunctionalOutput ( A ) & object ( A ) ) ) ) .
12fof ( typeScope_min_t_FunctionalOutput , axiom , ! [ A ] : ( ( A = o5 | ( A = o6 | A = o7 ) ) => ( t_FunctionalOutput ( A ) & object ( A ) ) ) ) . 12fof ( typeScope_min_t_FunctionalInterface , axiom , ! [ A ] : ( ( A = o6 | A = o7 ) => ( t_FunctionalInterface ( A ) & object ( A ) ) ) ) .
13fof ( typeScope_max_t_Function , axiom , ! [ A ] : ( ( t_Function ( A ) & object ( A ) ) => ( A = o4 | ( A = o8 | ( A = o9 | ( A = o10 | A = o11 ) ) ) ) ) ) . 13fof ( typeScope_max_t_Function , axiom , ! [ A ] : ( ( t_Function ( A ) & object ( A ) ) => A = o2 ) ) .
14fof ( typeScope_max_t_FunctionalOutput , axiom , ! [ A ] : ( ( t_FunctionalOutput ( A ) & object ( A ) ) => ( A = o5 | ( A = o6 | ( A = o7 | A = o8 ) ) ) ) ) . 14fof ( typeScope_max_t_FunctionalOutput , axiom , ! [ A ] : ( ( t_FunctionalOutput ( A ) & object ( A ) ) => ( A = o3 | ( A = o4 | A = o5 ) ) ) ) .
15fof ( t_uniqueness_eo1 , axiom , eo1 != eo2 & ( eo1 != eo3 & ( eo1 != o1 & ( eo1 != o2 & ( eo1 != o3 & ( eo1 != o4 & ( eo1 != o5 & ( eo1 != o6 & ( eo1 != o7 & ( eo1 != o8 & ( eo1 != o9 & ( eo1 != o10 & ( eo1 != o11 & ( eo1 != o12 & ( eo1 != o13 & ( eo1 != o14 & ( eo1 != o15 & ( eo1 != o16 & ( eo1 != o17 & ( eo1 != o18 & ( eo1 != o19 & ( eo1 != o20 & ( eo1 != o21 & ( eo1 != o22 & ( eo1 != o23 & ( eo1 != o24 & eo1 != o25 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) . 15fof ( t_uniqueness_eo1 , axiom , eo1 != eo2 & ( eo1 != eo3 & ( eo1 != o1 & ( eo1 != o2 & ( eo1 != o3 & ( eo1 != o4 & eo1 != o5 ) ) ) ) ) ) .
16fof ( t_uniqueness_eo2 , axiom , eo2 != eo3 & ( eo2 != o1 & ( eo2 != o2 & ( eo2 != o3 & ( eo2 != o4 & ( eo2 != o5 & ( eo2 != o6 & ( eo2 != o7 & ( eo2 != o8 & ( eo2 != o9 & ( eo2 != o10 & ( eo2 != o11 & ( eo2 != o12 & ( eo2 != o13 & ( eo2 != o14 & ( eo2 != o15 & ( eo2 != o16 & ( eo2 != o17 & ( eo2 != o18 & ( eo2 != o19 & ( eo2 != o20 & ( eo2 != o21 & ( eo2 != o22 & ( eo2 != o23 & ( eo2 != o24 & eo2 != o25 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) . 16fof ( t_uniqueness_eo2 , axiom , eo2 != eo3 & ( eo2 != o1 & ( eo2 != o2 & ( eo2 != o3 & ( eo2 != o4 & eo2 != o5 ) ) ) ) ) .
17fof ( t_uniqueness_eo3 , axiom , eo3 != o1 & ( eo3 != o2 & ( eo3 != o3 & ( eo3 != o4 & ( eo3 != o5 & ( eo3 != o6 & ( eo3 != o7 & ( eo3 != o8 & ( eo3 != o9 & ( eo3 != o10 & ( eo3 != o11 & ( eo3 != o12 & ( eo3 != o13 & ( eo3 != o14 & ( eo3 != o15 & ( eo3 != o16 & ( eo3 != o17 & ( eo3 != o18 & ( eo3 != o19 & ( eo3 != o20 & ( eo3 != o21 & ( eo3 != o22 & ( eo3 != o23 & ( eo3 != o24 & eo3 != o25 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) . 17fof ( t_uniqueness_eo3 , axiom , eo3 != o1 & ( eo3 != o2 & ( eo3 != o3 & ( eo3 != o4 & eo3 != o5 ) ) ) ) .
18fof ( t_uniqueness_o1 , axiom , o1 != o2 & ( o1 != o3 & ( o1 != o4 & ( o1 != o5 & ( o1 != o6 & ( o1 != o7 & ( o1 != o8 & ( o1 != o9 & ( o1 != o10 & ( o1 != o11 & ( o1 != o12 & ( o1 != o13 & ( o1 != o14 & ( o1 != o15 & ( o1 != o16 & ( o1 != o17 & ( o1 != o18 & ( o1 != o19 & ( o1 != o20 & ( o1 != o21 & ( o1 != o22 & ( o1 != o23 & ( o1 != o24 & o1 != o25 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) . 18fof ( t_uniqueness_o1 , axiom , o1 != o2 & ( o1 != o3 & ( o1 != o4 & o1 != o5 ) ) ) .
19fof ( t_uniqueness_o2 , axiom , o2 != o3 & ( o2 != o4 & ( o2 != o5 & ( o2 != o6 & ( o2 != o7 & ( o2 != o8 & ( o2 != o9 & ( o2 != o10 & ( o2 != o11 & ( o2 != o12 & ( o2 != o13 & ( o2 != o14 & ( o2 != o15 & ( o2 != o16 & ( o2 != o17 & ( o2 != o18 & ( o2 != o19 & ( o2 != o20 & ( o2 != o21 & ( o2 != o22 & ( o2 != o23 & ( o2 != o24 & o2 != o25 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) . 19fof ( t_uniqueness_o2 , axiom , o2 != o3 & ( o2 != o4 & o2 != o5 ) ) .
20fof ( t_uniqueness_o3 , axiom , o3 != o4 & ( o3 != o5 & ( o3 != o6 & ( o3 != o7 & ( o3 != o8 & ( o3 != o9 & ( o3 != o10 & ( o3 != o11 & ( o3 != o12 & ( o3 != o13 & ( o3 != o14 & ( o3 != o15 & ( o3 != o16 & ( o3 != o17 & ( o3 != o18 & ( o3 != o19 & ( o3 != o20 & ( o3 != o21 & ( o3 != o22 & ( o3 != o23 & ( o3 != o24 & o3 != o25 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) . 20fof ( t_uniqueness_o3 , axiom , o3 != o4 & o3 != o5 ) .
21fof ( t_uniqueness_o4 , axiom , o4 != o5 & ( o4 != o6 & ( o4 != o7 & ( o4 != o8 & ( o4 != o9 & ( o4 != o10 & ( o4 != o11 & ( o4 != o12 & ( o4 != o13 & ( o4 != o14 & ( o4 != o15 & ( o4 != o16 & ( o4 != o17 & ( o4 != o18 & ( o4 != o19 & ( o4 != o20 & ( o4 != o21 & ( o4 != o22 & ( o4 != o23 & ( o4 != o24 & o4 != o25 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) . 21fof ( t_uniqueness_o4 , axiom , o4 != o5 ) .
22fof ( t_uniqueness_o5 , axiom , o5 != o6 & ( o5 != o7 & ( o5 != o8 & ( o5 != o9 & ( o5 != o10 & ( o5 != o11 & ( o5 != o12 & ( o5 != o13 & ( o5 != o14 & ( o5 != o15 & ( o5 != o16 & ( o5 != o17 & ( o5 != o18 & ( o5 != o19 & ( o5 != o20 & ( o5 != o21 & ( o5 != o22 & ( o5 != o23 & ( o5 != o24 & o5 != o25 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) .
23fof ( t_uniqueness_o6 , axiom , o6 != o7 & ( o6 != o8 & ( o6 != o9 & ( o6 != o10 & ( o6 != o11 & ( o6 != o12 & ( o6 != o13 & ( o6 != o14 & ( o6 != o15 & ( o6 != o16 & ( o6 != o17 & ( o6 != o18 & ( o6 != o19 & ( o6 != o20 & ( o6 != o21 & ( o6 != o22 & ( o6 != o23 & ( o6 != o24 & o6 != o25 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) .
24fof ( t_uniqueness_o7 , axiom , o7 != o8 & ( o7 != o9 & ( o7 != o10 & ( o7 != o11 & ( o7 != o12 & ( o7 != o13 & ( o7 != o14 & ( o7 != o15 & ( o7 != o16 & ( o7 != o17 & ( o7 != o18 & ( o7 != o19 & ( o7 != o20 & ( o7 != o21 & ( o7 != o22 & ( o7 != o23 & ( o7 != o24 & o7 != o25 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) .
25fof ( t_uniqueness_o8 , axiom , o8 != o9 & ( o8 != o10 & ( o8 != o11 & ( o8 != o12 & ( o8 != o13 & ( o8 != o14 & ( o8 != o15 & ( o8 != o16 & ( o8 != o17 & ( o8 != o18 & ( o8 != o19 & ( o8 != o20 & ( o8 != o21 & ( o8 != o22 & ( o8 != o23 & ( o8 != o24 & o8 != o25 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) .
26fof ( t_uniqueness_o9 , axiom , o9 != o10 & ( o9 != o11 & ( o9 != o12 & ( o9 != o13 & ( o9 != o14 & ( o9 != o15 & ( o9 != o16 & ( o9 != o17 & ( o9 != o18 & ( o9 != o19 & ( o9 != o20 & ( o9 != o21 & ( o9 != o22 & ( o9 != o23 & ( o9 != o24 & o9 != o25 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) .
27fof ( t_uniqueness_o10 , axiom , o10 != o11 & ( o10 != o12 & ( o10 != o13 & ( o10 != o14 & ( o10 != o15 & ( o10 != o16 & ( o10 != o17 & ( o10 != o18 & ( o10 != o19 & ( o10 != o20 & ( o10 != o21 & ( o10 != o22 & ( o10 != o23 & ( o10 != o24 & o10 != o25 ) ) ) ) ) ) ) ) ) ) ) ) ) ) .
28fof ( t_uniqueness_o11 , axiom , o11 != o12 & ( o11 != o13 & ( o11 != o14 & ( o11 != o15 & ( o11 != o16 & ( o11 != o17 & ( o11 != o18 & ( o11 != o19 & ( o11 != o20 & ( o11 != o21 & ( o11 != o22 & ( o11 != o23 & ( o11 != o24 & o11 != o25 ) ) ) ) ) ) ) ) ) ) ) ) ) .
29fof ( t_uniqueness_o12 , axiom , o12 != o13 & ( o12 != o14 & ( o12 != o15 & ( o12 != o16 & ( o12 != o17 & ( o12 != o18 & ( o12 != o19 & ( o12 != o20 & ( o12 != o21 & ( o12 != o22 & ( o12 != o23 & ( o12 != o24 & o12 != o25 ) ) ) ) ) ) ) ) ) ) ) ) .
30fof ( t_uniqueness_o13 , axiom , o13 != o14 & ( o13 != o15 & ( o13 != o16 & ( o13 != o17 & ( o13 != o18 & ( o13 != o19 & ( o13 != o20 & ( o13 != o21 & ( o13 != o22 & ( o13 != o23 & ( o13 != o24 & o13 != o25 ) ) ) ) ) ) ) ) ) ) ) .
31fof ( t_uniqueness_o14 , axiom , o14 != o15 & ( o14 != o16 & ( o14 != o17 & ( o14 != o18 & ( o14 != o19 & ( o14 != o20 & ( o14 != o21 & ( o14 != o22 & ( o14 != o23 & ( o14 != o24 & o14 != o25 ) ) ) ) ) ) ) ) ) ) .
32fof ( t_uniqueness_o15 , axiom , o15 != o16 & ( o15 != o17 & ( o15 != o18 & ( o15 != o19 & ( o15 != o20 & ( o15 != o21 & ( o15 != o22 & ( o15 != o23 & ( o15 != o24 & o15 != o25 ) ) ) ) ) ) ) ) ) .
33fof ( t_uniqueness_o16 , axiom , o16 != o17 & ( o16 != o18 & ( o16 != o19 & ( o16 != o20 & ( o16 != o21 & ( o16 != o22 & ( o16 != o23 & ( o16 != o24 & o16 != o25 ) ) ) ) ) ) ) ) .
34fof ( t_uniqueness_o17 , axiom , o17 != o18 & ( o17 != o19 & ( o17 != o20 & ( o17 != o21 & ( o17 != o22 & ( o17 != o23 & ( o17 != o24 & o17 != o25 ) ) ) ) ) ) ) .
35fof ( t_uniqueness_o18 , axiom , o18 != o19 & ( o18 != o20 & ( o18 != o21 & ( o18 != o22 & ( o18 != o23 & ( o18 != o24 & o18 != o25 ) ) ) ) ) ) .
36fof ( t_uniqueness_o19 , axiom , o19 != o20 & ( o19 != o21 & ( o19 != o22 & ( o19 != o23 & ( o19 != o24 & o19 != o25 ) ) ) ) ) .
37fof ( t_uniqueness_o20 , axiom , o20 != o21 & ( o20 != o22 & ( o20 != o23 & ( o20 != o24 & o20 != o25 ) ) ) ) .
38fof ( t_uniqueness_o21 , axiom , o21 != o22 & ( o21 != o23 & ( o21 != o24 & o21 != o25 ) ) ) .
39fof ( t_uniqueness_o22 , axiom , o22 != o23 & ( o22 != o24 & o22 != o25 ) ) .
40fof ( t_uniqueness_o23 , axiom , o23 != o24 & o23 != o25 ) .
41fof ( t_uniqueness_o24 , axiom , o24 != o25 ) .
42fof ( compliance_interface_FunctionalElement , axiom , ! [ V_0 , V_1 ] : ( r_interface_FunctionalElement ( V_0 , V_1 ) => ( t_FunctionalElement ( V_0 ) & t_FunctionalInterface ( V_1 ) ) ) ) . 22fof ( compliance_interface_FunctionalElement , axiom , ! [ V_0 , V_1 ] : ( r_interface_FunctionalElement ( V_0 , V_1 ) => ( t_FunctionalElement ( V_0 ) & t_FunctionalInterface ( V_1 ) ) ) ) .
43fof ( compliance_model_FunctionalElement , axiom , ! [ V_0 , V_1 ] : ( r_model_FunctionalElement ( V_0 , V_1 ) => ( t_FunctionalElement ( V_0 ) & t_FunctionalArchitectureModel ( V_1 ) ) ) ) . 23fof ( compliance_model_FunctionalElement , axiom , ! [ V_0 , V_1 ] : ( r_model_FunctionalElement ( V_0 , V_1 ) => ( t_FunctionalElement ( V_0 ) & t_FunctionalArchitectureModel ( V_1 ) ) ) ) .
44fof ( compliance_parent_FunctionalElement , axiom , ! [ V_0 , V_1 ] : ( r_parent_FunctionalElement ( V_0 , V_1 ) => ( t_FunctionalElement ( V_0 ) & t_Function ( V_1 ) ) ) ) . 24fof ( compliance_parent_FunctionalElement , axiom , ! [ V_0 , V_1 ] : ( r_parent_FunctionalElement ( V_0 , V_1 ) => ( t_FunctionalElement ( V_0 ) & t_Function ( V_1 ) ) ) ) .
@@ -64,8 +44,8 @@ fof ( containment_noDup_r_terminator_FunctionalData , axiom , ? [ A , B ] : ( r_
64fof ( containment_t_FunctionalElement , axiom , ! [ A ] : ( t_FunctionalElement ( A ) => ? [ B ] : ( ( r_rootElements_FunctionalArchitectureModel ( B , A ) & ~ r_subElements_Function ( B , A ) ) | ( ~ r_rootElements_FunctionalArchitectureModel ( B , A ) & r_subElements_Function ( B , A ) ) ) ) ) . 44fof ( containment_t_FunctionalElement , axiom , ! [ A ] : ( t_FunctionalElement ( A ) => ? [ B ] : ( ( r_rootElements_FunctionalArchitectureModel ( B , A ) & ~ r_subElements_Function ( B , A ) ) | ( ~ r_rootElements_FunctionalArchitectureModel ( B , A ) & r_subElements_Function ( B , A ) ) ) ) ) .
65fof ( containment_t_FunctionalData , axiom , ! [ A ] : ( t_FunctionalData ( A ) => ? [ B ] : r_data_FunctionalInterface ( B , A ) ) ) . 45fof ( containment_t_FunctionalData , axiom , ! [ A ] : ( t_FunctionalData ( A ) => ? [ B ] : r_data_FunctionalInterface ( B , A ) ) ) .
66fof ( containment_t_InformationLink , axiom , ! [ A ] : ( t_InformationLink ( A ) => ? [ B ] : r_outgoingLinks_FunctionalOutput ( B , A ) ) ) . 46fof ( containment_t_InformationLink , axiom , ! [ A ] : ( t_InformationLink ( A ) => ? [ B ] : r_outgoingLinks_FunctionalOutput ( B , A ) ) ) .
67fof ( containment_t_FAMTerminator , axiom , ! [ A ] : ( t_FAMTerminator ( A ) => ? [ B ] : r_terminator_FunctionalData ( B , A ) ) ) .
68fof ( containment_t_FunctionalInterface , axiom , ! [ A ] : ( t_FunctionalInterface ( A ) => ? [ B ] : r_interface_FunctionalElement ( B , A ) ) ) . 47fof ( containment_t_FunctionalInterface , axiom , ! [ A ] : ( t_FunctionalInterface ( A ) => ? [ B ] : r_interface_FunctionalElement ( B , A ) ) ) .
48fof ( containment_t_FAMTerminator , axiom , ! [ A ] : ( t_FAMTerminator ( A ) => ? [ B ] : r_terminator_FunctionalData ( B , A ) ) ) .
69fof ( containment_noCycle_1 , axiom , ~ ? [ V1 ] : ( r_interface_FunctionalElement ( V1 , V1 ) | ( r_rootElements_FunctionalArchitectureModel ( V1 , V1 ) | ( r_subElements_Function ( V1 , V1 ) | ( r_data_FunctionalInterface ( V1 , V1 ) | ( r_outgoingLinks_FunctionalOutput ( V1 , V1 ) | r_terminator_FunctionalData ( V1 , V1 ) ) ) ) ) ) ) . 49fof ( containment_noCycle_1 , axiom , ~ ? [ V1 ] : ( r_interface_FunctionalElement ( V1 , V1 ) | ( r_rootElements_FunctionalArchitectureModel ( V1 , V1 ) | ( r_subElements_Function ( V1 , V1 ) | ( r_data_FunctionalInterface ( V1 , V1 ) | ( r_outgoingLinks_FunctionalOutput ( V1 , V1 ) | r_terminator_FunctionalData ( V1 , V1 ) ) ) ) ) ) ) .
70fof ( containment_noCycle_2 , axiom , ~ ? [ V1 , V2 ] : ( ( r_interface_FunctionalElement ( V1 , V2 ) | ( r_rootElements_FunctionalArchitectureModel ( V1 , V2 ) | ( r_subElements_Function ( V1 , V2 ) | ( r_data_FunctionalInterface ( V1 , V2 ) | ( r_outgoingLinks_FunctionalOutput ( V1 , V2 ) | r_terminator_FunctionalData ( V1 , V2 ) ) ) ) ) ) & ( r_interface_FunctionalElement ( V2 , V1 ) | ( r_rootElements_FunctionalArchitectureModel ( V2 , V1 ) | ( r_subElements_Function ( V2 , V1 ) | ( r_data_FunctionalInterface ( V2 , V1 ) | ( r_outgoingLinks_FunctionalOutput ( V2 , V1 ) | r_terminator_FunctionalData ( V2 , V1 ) ) ) ) ) ) ) ) . 50fof ( containment_noCycle_2 , axiom , ~ ? [ V1 , V2 ] : ( ( r_interface_FunctionalElement ( V1 , V2 ) | ( r_rootElements_FunctionalArchitectureModel ( V1 , V2 ) | ( r_subElements_Function ( V1 , V2 ) | ( r_data_FunctionalInterface ( V1 , V2 ) | ( r_outgoingLinks_FunctionalOutput ( V1 , V2 ) | r_terminator_FunctionalData ( V1 , V2 ) ) ) ) ) ) & ( r_interface_FunctionalElement ( V2 , V1 ) | ( r_rootElements_FunctionalArchitectureModel ( V2 , V1 ) | ( r_subElements_Function ( V2 , V1 ) | ( r_data_FunctionalInterface ( V2 , V1 ) | ( r_outgoingLinks_FunctionalOutput ( V2 , V1 ) | r_terminator_FunctionalData ( V2 , V1 ) ) ) ) ) ) ) ) .
71fof ( containment_noCycle_3 , axiom , ~ ? [ V1 , V2 , V3 ] : ( ( r_interface_FunctionalElement ( V1 , V2 ) | ( r_rootElements_FunctionalArchitectureModel ( V1 , V2 ) | ( r_subElements_Function ( V1 , V2 ) | ( r_data_FunctionalInterface ( V1 , V2 ) | ( r_outgoingLinks_FunctionalOutput ( V1 , V2 ) | r_terminator_FunctionalData ( V1 , V2 ) ) ) ) ) ) & ( ( r_interface_FunctionalElement ( V2 , V3 ) | ( r_rootElements_FunctionalArchitectureModel ( V2 , V3 ) | ( r_subElements_Function ( V2 , V3 ) | ( r_data_FunctionalInterface ( V2 , V3 ) | ( r_outgoingLinks_FunctionalOutput ( V2 , V3 ) | r_terminator_FunctionalData ( V2 , V3 ) ) ) ) ) ) & ( r_interface_FunctionalElement ( V3 , V1 ) | ( r_rootElements_FunctionalArchitectureModel ( V3 , V1 ) | ( r_subElements_Function ( V3 , V1 ) | ( r_data_FunctionalInterface ( V3 , V1 ) | ( r_outgoingLinks_FunctionalOutput ( V3 , V1 ) | r_terminator_FunctionalData ( V3 , V1 ) ) ) ) ) ) ) ) ) . 51fof ( containment_noCycle_3 , axiom , ~ ? [ V1 , V2 , V3 ] : ( ( r_interface_FunctionalElement ( V1 , V2 ) | ( r_rootElements_FunctionalArchitectureModel ( V1 , V2 ) | ( r_subElements_Function ( V1 , V2 ) | ( r_data_FunctionalInterface ( V1 , V2 ) | ( r_outgoingLinks_FunctionalOutput ( V1 , V2 ) | r_terminator_FunctionalData ( V1 , V2 ) ) ) ) ) ) & ( ( r_interface_FunctionalElement ( V2 , V3 ) | ( r_rootElements_FunctionalArchitectureModel ( V2 , V3 ) | ( r_subElements_Function ( V2 , V3 ) | ( r_data_FunctionalInterface ( V2 , V3 ) | ( r_outgoingLinks_FunctionalOutput ( V2 , V3 ) | r_terminator_FunctionalData ( V2 , V3 ) ) ) ) ) ) & ( r_interface_FunctionalElement ( V3 , V1 ) | ( r_rootElements_FunctionalArchitectureModel ( V3 , V1 ) | ( r_subElements_Function ( V3 , V1 ) | ( r_data_FunctionalInterface ( V3 , V1 ) | ( r_outgoingLinks_FunctionalOutput ( V3 , V1 ) | r_terminator_FunctionalData ( V3 , V1 ) ) ) ) ) ) ) ) ) .
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/plugin.xml b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/plugin.xml
index 38efb459..3770f0af 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/plugin.xml
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/plugin.xml
@@ -4,4 +4,14 @@
4 <query-specification fqn="ca.mcgill.ecse.dslreasoner.vampire.queries.terminatorAndInformation"/> 4 <query-specification fqn="ca.mcgill.ecse.dslreasoner.vampire.queries.terminatorAndInformation"/>
5 </group> 5 </group>
6 </extension> 6 </extension>
7 <extension id="ca.mcgill.ecse.dslreasoner.vampire.queries.FileSystemPatterns" point="org.eclipse.viatra.query.runtime.queryspecification">
8 <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:ca.mcgill.ecse.dslreasoner.vampire.queries.FileSystemPatterns" id="ca.mcgill.ecse.dslreasoner.vampire.queries.FileSystemPatterns">
9 <query-specification fqn="ca.mcgill.ecse.dslreasoner.vampire.queries.patternContent"/>
10 <query-specification fqn="ca.mcgill.ecse.dslreasoner.vampire.queries.live"/>
11 <query-specification fqn="ca.mcgill.ecse.dslreasoner.vampire.queries.contentInNotLive"/>
12 </group>
13 </extension>
14 <extension id="extension.derived.ca.mcgill.ecse.dslreasoner.vampire.queries.live" point="org.eclipse.viatra.query.runtime.base.wellbehaving.derived.features">
15 <wellbehaving-derived-feature classifier-name="FileSystem" feature-name="live" package-nsUri="FileSystemMetamodel"/>
16 </extension>
7</plugin> 17</plugin>
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.xtend b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.xtend
index ef2e0c2f..f66ad93c 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.xtend
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.xtend
@@ -1,36 +1,115 @@
1package ca.mcgill.ecse.dslreasoner.vampire.icse 1package ca.mcgill.ecse.dslreasoner.vampire.icse
2 2
3import ca.mcgill.ecse.dslreasoner.vampire.queries.FamPatterns 3import ca.mcgill.ecse.dslreasoner.vampire.queries.FamPatterns
4import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver
5import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration
6import functionalarchitecture.Function
7import functionalarchitecture.FunctionalInterface
8import functionalarchitecture.FunctionalOutput
4import functionalarchitecture.FunctionalarchitecturePackage 9import functionalarchitecture.FunctionalarchitecturePackage
10import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic
11import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration
12import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel
13import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner
14import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult
15import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic
16import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic
5import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace 17import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace
6import java.util.LinkedList 18import java.util.HashMap
7import org.eclipse.emf.ecore.EObject
8import org.eclipse.emf.ecore.resource.Resource 19import org.eclipse.emf.ecore.resource.Resource
9import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl 20import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
10 21
11class FAMTest { 22class FAMTest {
12 def static void main(String[] args) { 23 def static void main(String[] args) {
13 //Workspace setup 24 val Ecore2Logic ecore2Logic = new Ecore2Logic
25 val Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic)
26 val InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic
27
28 // Workspace setup
14 val inputs = new FileSystemWorkspace('''initialModels/''', "") 29 val inputs = new FileSystemWorkspace('''initialModels/''', "")
15 val workspace = new FileSystemWorkspace('''output/FAMTest/''', "") 30 val workspace = new FileSystemWorkspace('''output/FAMTest/''', "")
16 workspace.initAndClear 31 workspace.initAndClear
17 32
18 //Logicproblem writing setup 33 // Logicproblem writing setup
19 val reg = Resource.Factory.Registry.INSTANCE 34 val reg = Resource.Factory.Registry.INSTANCE
20 val map = reg.extensionToFactoryMap 35 val map = reg.extensionToFactoryMap
21 map.put("logicproblem", new XMIResourceFactoryImpl) 36 map.put("logicproblem", new XMIResourceFactoryImpl)
22
23 37
24 println("Input and output workspaces are created") 38 println("Input and output workspaces are created")
25 39
40 // Load DSL
26 val metamodel = GeneralTest.loadMetamodel(FunctionalarchitecturePackage.eINSTANCE) 41 val metamodel = GeneralTest.loadMetamodel(FunctionalarchitecturePackage.eINSTANCE)
27 val partialModel = GeneralTest.loadPartialModel(inputs, "FaModel.xmi") 42 val partialModel = GeneralTest.loadPartialModel(inputs, "FaModel.xmi")
28 val queries = GeneralTest.loadQueries(metamodel, FamPatterns.instance) 43 val queries = GeneralTest.loadQueries(metamodel, FamPatterns.instance)
29 44
30 println("DSL loaded") 45 println("DSL loaded")
46
47 val modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, new Ecore2LogicConfiguration())
48 var problem = modelGenerationProblem.output
49// problem = instanceModel2Logic.transform(modelGenerationProblem, partialModel).output
50// problem = viatra2Logic.transformQueries(queries, modelGenerationProblem, new Viatra2LogicConfiguration).output
51 workspace.writeModel(problem, "Fam.logicproblem")
52
53 println("Problem created")
54
55 //Start Time
56 var startTime = System.currentTimeMillis
57
58 var LogicReasoner reasoner
59 // *
60 reasoner = new VampireSolver
61
62 // /////////////////////////////////////////////////////
63 // Minimum Scope
64 val classMapMin = new HashMap<Class, Integer>
65 classMapMin.put(Function, 1)
66 classMapMin.put(FunctionalInterface, 2)
67 classMapMin.put(FunctionalOutput, 3)
31 68
32 GeneralTest.createAndSolveProblem(metamodel, partialModel, queries, workspace) 69 val typeMapMin = GeneralTest.getTypeMap(classMapMin, metamodel, ecore2Logic, modelGenerationProblem.trace)
70
71 // Maximum Scope
72 val classMapMax = new HashMap<Class, Integer>
73 classMapMax.put(Function, 5)
74 classMapMax.put(FunctionalInterface, 2)
75 classMapMax.put(FunctionalOutput, 4)
76
77 val typeMapMax = GeneralTest.getTypeMap(classMapMax, metamodel, ecore2Logic, modelGenerationProblem.trace)
78
79 // Define Config File
80 val vampireConfig = new VampireSolverConfiguration => [
81 // add configuration things, in config file first
82 it.documentationLevel = DocumentationLevel::FULL
83
84 it.typeScopes.minNewElements = 4
85 it.typeScopes.maxNewElements = 5
86 if(typeMapMin.size != 0) it.typeScopes.minNewElementsByType = typeMapMin
87 if(typeMapMin.size != 0) it.typeScopes.maxNewElementsByType = typeMapMax
88 it.contCycleLevel = 5
89 it.uniquenessDuplicates = false
90 ]
91
92 var LogicResult solution = reasoner.solve(problem, vampireConfig, workspace)
93
94 /*/
95 *
96 * reasoner = new AlloySolver
97 * val alloyConfig = new AlloySolverConfiguration => [
98 * it.typeScopes.maxNewElements = 7
99 * it.typeScopes.minNewElements = 3
100 * it.solutionScope.numberOfRequiredSolution = 1
101 * it.typeScopes.maxNewIntegers = 0
102 * it.documentationLevel = DocumentationLevel::NORMAL
103 * ]
104 * solution = reasoner.solve(problem, alloyConfig, workspace)
105 //*/
106 // /////////////////////////////////////////////////////
107
108 var totalTimeMin = (System.currentTimeMillis - startTime) / 60000
109 var totalTimeSec = ((System.currentTimeMillis - startTime) / 1000) % 60
110
111 println("Problem solved")
112 println("Time was: " + totalTimeMin + ":" + totalTimeSec)
33 } 113 }
34 114
35
36} 115}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FileSystemTest.xtend b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FileSystemTest.xtend
index 363b9356..50639577 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FileSystemTest.xtend
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/FileSystemTest.xtend
@@ -1,33 +1,108 @@
1package ca.mcgill.ecse.dslreasoner.vampire.icse 1package ca.mcgill.ecse.dslreasoner.vampire.icse
2 2
3import functionalarchitecture.FunctionalarchitecturePackage 3import ca.mcgill.ecse.dslreasoner.vampire.queries
4import hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns 4import ca.mcgill.ecse.dslreasoner.standalone.test.filesystem.filesystemPackage
5import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver
6import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration
7import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic
8import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration
9import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel
10import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner
11import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult
12import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic
13import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic
5import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace 14import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace
15import java.util.HashMap
6import org.eclipse.emf.ecore.resource.Resource 16import org.eclipse.emf.ecore.resource.Resource
7import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl 17import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
8 18
9class FileSystemTest { 19class FileSystemTest {
10 def static void main(String[] args) { 20 def static void main(String[] args) {
11 //Workspace setup 21 val Ecore2Logic ecore2Logic = new Ecore2Logic
22 val Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic)
23 val InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic
24
25 // Workspace setup
12 val inputs = new FileSystemWorkspace('''initialModels/''', "") 26 val inputs = new FileSystemWorkspace('''initialModels/''', "")
13 val workspace = new FileSystemWorkspace('''output/FAMTest/''', "") 27 val workspace = new FileSystemWorkspace('''output/FAMTest/''', "")
14 workspace.initAndClear 28 workspace.initAndClear
15 29
16 //Logicproblem writing setup 30 // Logicproblem writing setup
17 val reg = Resource.Factory.Registry.INSTANCE 31 val reg = Resource.Factory.Registry.INSTANCE
18 val map = reg.extensionToFactoryMap 32 val map = reg.extensionToFactoryMap
19 map.put("logicproblem", new XMIResourceFactoryImpl) 33 map.put("logicproblem", new XMIResourceFactoryImpl)
20 34
21 println("Input and output workspaces are created") 35 println("Input and output workspaces are created")
22 36
23 val metamodel = GeneralTest.loadMetamodel(FunctionalarchitecturePackage.eINSTANCE) 37 val metamodel = GeneralTest.loadMetamodel(filesystemPackage.eINSTANCE)
24 val partialModel = GeneralTest.loadPartialModel(inputs, "FunctionalArchitectureModel.xmi") 38 val partialModel = GeneralTest.loadPartialModel(inputs, "fs/filesystemInstance.xmi")
25 val queries = GeneralTest.loadQueries(metamodel, FamPatterns.instance) 39 //val queries = GeneralTest.loadQueries(metamodel, FileSystemPatterns.instance)
26 40
27 println("DSL loaded") 41 println("DSL loaded")
28 42
29 GeneralTest.createAndSolveProblem(metamodel, partialModel, queries, workspace) 43 val modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, new Ecore2LogicConfiguration())
44 var problem = modelGenerationProblem.output
45// problem = instanceModel2Logic.transform(modelGenerationProblem, partialModel).output
46// problem = viatra2Logic.transformQueries(queries, modelGenerationProblem, new Viatra2LogicConfiguration).output
47 workspace.writeModel(problem, "Fam.logicproblem")
48
49 println("Problem created")
50
51 // Start Time
52 var startTime = System.currentTimeMillis
53
54 var LogicReasoner reasoner
55 // *
56 reasoner = new VampireSolver
57
58 // /////////////////////////////////////////////////////
59 // Minimum Scope
60 val classMapMin = new HashMap<Class, Integer>
61// classMapMin.put(Function, 1)
62// classMapMin.put(FunctionalInterface, 2)
63// classMapMin.put(FunctionalOutput, 3)
64 val typeMapMin = GeneralTest.getTypeMap(classMapMin, metamodel, ecore2Logic, modelGenerationProblem.trace)
65
66 // Maximum Scope
67 val classMapMax = new HashMap<Class, Integer>
68// classMapMax.put(Function, 5)
69// classMapMax.put(FunctionalInterface, 2)
70// classMapMax.put(FunctionalOutput, 4)
71 val typeMapMax = GeneralTest.getTypeMap(classMapMax, metamodel, ecore2Logic, modelGenerationProblem.trace)
72
73 // Define Config File
74 val vampireConfig = new VampireSolverConfiguration => [
75 // add configuration things, in config file first
76 it.documentationLevel = DocumentationLevel::FULL
77
78 it.typeScopes.minNewElements = 4
79 it.typeScopes.maxNewElements = 5
80 if(typeMapMin.size != 0) it.typeScopes.minNewElementsByType = typeMapMin
81 if(typeMapMin.size != 0) it.typeScopes.maxNewElementsByType = typeMapMax
82 it.contCycleLevel = 5
83 it.uniquenessDuplicates = false
84 ]
85
86 var LogicResult solution = reasoner.solve(problem, vampireConfig, workspace)
87
88 /*/
89 *
90 * reasoner = new AlloySolver
91 * val alloyConfig = new AlloySolverConfiguration => [
92 * it.typeScopes.maxNewElements = 7
93 * it.typeScopes.minNewElements = 3
94 * it.solutionScope.numberOfRequiredSolution = 1
95 * it.typeScopes.maxNewIntegers = 0
96 * it.documentationLevel = DocumentationLevel::NORMAL
97 * ]
98 * solution = reasoner.solve(problem, alloyConfig, workspace)
99 //*/
100 // /////////////////////////////////////////////////////
101 var totalTimeMin = (System.currentTimeMillis - startTime) / 60000
102 var totalTimeSec = ((System.currentTimeMillis - startTime) / 1000) % 60
103
104 println("Problem solved")
105 println("Time was: " + totalTimeMin + ":" + totalTimeSec)
30 } 106 }
31 107
32
33} 108}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.xtend b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.xtend
index 949abe87..89375801 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.xtend
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.xtend
@@ -1,25 +1,14 @@
1package ca.mcgill.ecse.dslreasoner.vampire.icse 1package ca.mcgill.ecse.dslreasoner.vampire.icse
2 2
3import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver
4import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration
5import ca.mcgill.ecse.dslreasoner.vampireLanguage.VampireLanguageFactory
6import functionalarchitecture.Function
7import functionalarchitecture.FunctionalInterface
8import functionalarchitecture.FunctionalOutput
9import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic 3import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic
10import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration 4import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace
11import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor 5import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor
12import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner
13import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type 6import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type
14import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult
15import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore
16import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic
17import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor 7import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor
18import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic
19import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace
20import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace 8import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace
21import java.util.HashMap 9import java.util.HashMap
22import java.util.List 10import java.util.List
11import java.util.Map
23import org.eclipse.emf.ecore.EAttribute 12import org.eclipse.emf.ecore.EAttribute
24import org.eclipse.emf.ecore.EClass 13import org.eclipse.emf.ecore.EClass
25import org.eclipse.emf.ecore.EEnum 14import org.eclipse.emf.ecore.EEnum
@@ -30,100 +19,18 @@ import org.eclipse.emf.ecore.EReference
30import org.eclipse.emf.ecore.resource.Resource 19import org.eclipse.emf.ecore.resource.Resource
31import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl 20import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
32import org.eclipse.viatra.query.runtime.api.IQueryGroup 21import org.eclipse.viatra.query.runtime.api.IQueryGroup
33import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel
34 22
35class GeneralTest { 23class GeneralTest {
36 def static String createAndSolveProblem(EcoreMetamodelDescriptor metamodel, List<EObject> partialModel, 24 def static Map<Type, Integer> getTypeMap(Map<Class, Integer> classMap, EcoreMetamodelDescriptor metamodel, Ecore2Logic e2l, Ecore2Logic_Trace trace) {
37 ViatraQuerySetDescriptor queries, FileSystemWorkspace workspace) { 25 val typeMap = new HashMap<Type, Integer>
38 val extension VampireLanguageFactory factory = VampireLanguageFactory.eINSTANCE 26 val listMap = metamodel.classes.toMap[s|s.name]
39 val Ecore2Logic ecore2Logic = new Ecore2Logic
40 val Logic2Ecore logic2Ecore = new Logic2Ecore(ecore2Logic)
41 val Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic)
42 val InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic
43
44 val modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, new Ecore2LogicConfiguration())
45 var problem = modelGenerationProblem.output
46// problem = instanceModel2Logic.transform(modelGenerationProblem, partialModel).output
47// problem = viatra2Logic.transformQueries(queries, modelGenerationProblem, new Viatra2LogicConfiguration).output
48 workspace.writeModel(problem, "Fam.logicproblem")
49
50 println("Problem created")
51
52 var startTime = System.currentTimeMillis
53
54 var LogicResult solution
55 var LogicReasoner reasoner
56
57 // *
58 reasoner = new VampireSolver
59
60 // Setting up scope
61 val typeMapMin = new HashMap<Type, Integer>
62 val typeMapMax = new HashMap<Type, Integer>
63 val list2MapMin = metamodel.classes.toMap[s|s.name]
64 val list2MapMax = metamodel.classes.toMap[s|s.name]
65
66 // Minimum Scope
67 typeMapMin.put(ecore2Logic.TypeofEClass(modelGenerationProblem.trace,
68 list2MapMin.get(Function.simpleName)
69 ), 1)
70 typeMapMin.put(ecore2Logic.TypeofEClass(modelGenerationProblem.trace,
71 list2MapMin.get(FunctionalInterface.simpleName)
72 ), 2)
73 typeMapMin.put(ecore2Logic.TypeofEClass(modelGenerationProblem.trace,
74 list2MapMin.get(FunctionalOutput.simpleName)
75 ), 3)
76
77 // Maximum Scope
78 typeMapMax.put(ecore2Logic.TypeofEClass(
79 modelGenerationProblem.trace,
80 list2MapMax.get(Function.simpleName)
81 ), 5)
82 typeMapMax.put(ecore2Logic.TypeofEClass(
83 modelGenerationProblem.trace,
84 list2MapMax.get(FunctionalInterface.simpleName)
85 ), 2)
86 typeMapMax.put(ecore2Logic.TypeofEClass(
87 modelGenerationProblem.trace,
88 list2MapMax.get(FunctionalOutput.simpleName)
89 ), 4)
90
91 // Configuration
92 val vampireConfig = new VampireSolverConfiguration => [
93 // add configuration things, in config file first
94 it.documentationLevel = DocumentationLevel::FULL
95 it.typeScopes.minNewElements = 4
96 it.typeScopes.maxNewElements = 25
97 it.typeScopes.minNewElementsByType = typeMapMin
98 it.typeScopes.maxNewElementsByType = typeMapMax
99 it.contCycleLevel = 5
100 it.uniquenessDuplicates = false
101 ]
102 solution = reasoner.solve(problem, vampireConfig, workspace)
103
104 /*/
105 *
106 * reasoner = new AlloySolver
107 * val alloyConfig = new AlloySolverConfiguration => [
108 * it.typeScopes.maxNewElements = 7
109 * it.typeScopes.minNewElements = 3
110 * it.solutionScope.numberOfRequiredSolution = 1
111 * it.typeScopes.maxNewIntegers = 0
112 * it.documentationLevel = DocumentationLevel::NORMAL
113 * ]
114 * solution = reasoner.solve(problem, alloyConfig, workspace)
115 //*/
116
117
118 var totalTimeMin = (System.currentTimeMillis - startTime)/60000
119 var totalTimeSec = ((System.currentTimeMillis - startTime)/1000)% 60
120
121 println("Problem solved")
122 println("Time was: " + totalTimeMin + ":" + totalTimeSec)
123
124
125
126 27
28 for (Class elem : classMap.keySet) {
29 typeMap.put(e2l.TypeofEClass(
30 trace, listMap.get(elem.simpleName)
31 ), classMap.get(elem))
32 }
33 return typeMap
127 } 34 }
128 35
129 def static loadMetamodel(EPackage pckg) { 36 def static loadMetamodel(EPackage pckg) {
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/YakinduTest.xtend b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/YakinduTest.xtend
index eb3f4b14..1fac968b 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/YakinduTest.xtend
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/src/ca/mcgill/ecse/dslreasoner/vampire/icse/YakinduTest.xtend
@@ -1,34 +1,108 @@
1package ca.mcgill.ecse.dslreasoner.vampire.icse 1package ca.mcgill.ecse.dslreasoner.vampire.icse
2 2
3import functionalarchitecture.FunctionalarchitecturePackage 3import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.yakinduPackage
4import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver
5import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration
6import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic
7import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration
8import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel
9import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner
10import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult
11import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic
12import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic
4import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace 13import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace
14import java.util.HashMap
5import org.eclipse.emf.ecore.resource.Resource 15import org.eclipse.emf.ecore.resource.Resource
6import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl 16import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
7import hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage
8import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.YakinduPatterns
9 17
10class YakinduTest { 18class YakinduTest {
11 def static void main(String[] args) { 19 def static void main(String[] args) {
12 //Workspace setup 20 val Ecore2Logic ecore2Logic = new Ecore2Logic
21 val Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic)
22 val InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic
23
24 // Workspace setup
13 val inputs = new FileSystemWorkspace('''initialModels/''', "") 25 val inputs = new FileSystemWorkspace('''initialModels/''', "")
14 val workspace = new FileSystemWorkspace('''output/YakinduTest/''', "") 26 val workspace = new FileSystemWorkspace('''output/YakinduTest/''', "")
15 workspace.initAndClear 27 workspace.initAndClear
16 28
17 //Logicproblem writing setup 29 // Logicproblem writing setup
18 val reg = Resource.Factory.Registry.INSTANCE 30 val reg = Resource.Factory.Registry.INSTANCE
19 val map = reg.extensionToFactoryMap 31 val map = reg.extensionToFactoryMap
20 map.put("logicproblem", new XMIResourceFactoryImpl) 32 map.put("logicproblem", new XMIResourceFactoryImpl)
21 33
22 println("Input and output workspaces are created") 34 println("Input and output workspaces are created")
23 35
24 val metamodel = GeneralTest.loadMetamodel(YakindummPackage.eINSTANCE) 36 val metamodel = GeneralTest.loadMetamodel(yakinduPackage.eINSTANCE)
25 val partialModel = GeneralTest.loadPartialModel(inputs, "Yakindu.xmi") 37 val partialModel = GeneralTest.loadPartialModel(inputs, "yakindu/yakinduinstance.xmi")
26// val queries = GeneralTest.loadQueries(metamodel, FamPa 38// val queries = GeneralTest.loadQueries(metamodel, FamPa
39 val queries = null
27 40
28 println("DSL loaded") 41 println("DSL loaded")
29 42
30// GeneralTest.createAndSolveProblem(metamodel, partialModel, queries, workspace) 43 val modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, new Ecore2LogicConfiguration())
44 var problem = modelGenerationProblem.output
45// problem = instanceModel2Logic.transform(modelGenerationProblem, partialModel).output
46// problem = viatra2Logic.transformQueries(queries, modelGenerationProblem, new Viatra2LogicConfiguration).output
47 workspace.writeModel(problem, "Yakindu.logicproblem")
48
49 println("Problem created")
50
51 // Start Time
52 var startTime = System.currentTimeMillis
53
54 var LogicReasoner reasoner
55 // *
56 reasoner = new VampireSolver
57
58 // /////////////////////////////////////////////////////
59 // Minimum Scope
60 val classMapMin = new HashMap<Class, Integer>
61// classMapMin.put(Function, 1)
62// classMapMin.put(FunctionalInterface, 2)
63// classMapMin.put(FunctionalOutput, 3)
64 val typeMapMin = GeneralTest.getTypeMap(classMapMin, metamodel, ecore2Logic, modelGenerationProblem.trace)
65
66 // Maximum Scope
67 val classMapMax = new HashMap<Class, Integer>
68// classMapMax.put(Function, 5)
69// classMapMax.put(FunctionalInterface, 2)
70// classMapMax.put(FunctionalOutput, 4)
71 val typeMapMax = GeneralTest.getTypeMap(classMapMax, metamodel, ecore2Logic, modelGenerationProblem.trace)
72
73 // Define Config File
74 val vampireConfig = new VampireSolverConfiguration => [
75 // add configuration things, in config file first
76 it.documentationLevel = DocumentationLevel::FULL
77
78 it.typeScopes.minNewElements = 20
79 it.typeScopes.maxNewElements = 30
80 if(typeMapMin.size != 0) it.typeScopes.minNewElementsByType = typeMapMin
81 if(typeMapMin.size != 0) it.typeScopes.maxNewElementsByType = typeMapMax
82 it.contCycleLevel = 5
83 it.uniquenessDuplicates = false
84 ]
85
86 var LogicResult solution = reasoner.solve(problem, vampireConfig, workspace)
87
88 /*/
89 *
90 * reasoner = new AlloySolver
91 * val alloyConfig = new AlloySolverConfiguration => [
92 * it.typeScopes.maxNewElements = 7
93 * it.typeScopes.minNewElements = 3
94 * it.solutionScope.numberOfRequiredSolution = 1
95 * it.typeScopes.maxNewIntegers = 0
96 * it.documentationLevel = DocumentationLevel::NORMAL
97 * ]
98 * solution = reasoner.solve(problem, alloyConfig, workspace)
99 //*/
100 // /////////////////////////////////////////////////////
101 var totalTimeMin = (System.currentTimeMillis - startTime) / 60000
102 var totalTimeSec = ((System.currentTimeMillis - startTime) / 1000) % 60
103
104 println("Problem solved")
105 println("Time was: " + totalTimeMin + ":" + totalTimeSec)
31 } 106 }
32 107
33
34} 108}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.EcoreTest.xtendbin b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.EcoreTest.xtendbin
index 7f92eba4..55d90ac7 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.EcoreTest.xtendbin
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.EcoreTest.xtendbin
Binary files differ
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.FAMTest.xtendbin b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.FAMTest.xtendbin
index 67bf34bd..8eeb2d28 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.FAMTest.xtendbin
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.FAMTest.xtendbin
Binary files differ
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.FileSystemTest.xtendbin b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.FileSystemTest.xtendbin
index 093855d8..ab6aaf6e 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.FileSystemTest.xtendbin
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.FileSystemTest.xtendbin
Binary files differ
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.GeneralTest.xtendbin b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.GeneralTest.xtendbin
index 2df2ba62..cd75a66c 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.GeneralTest.xtendbin
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.GeneralTest.xtendbin
Binary files differ
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.YakinduTest.xtendbin b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.YakinduTest.xtendbin
index 0c97e8d1..1b920064 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.YakinduTest.xtendbin
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/.YakinduTest.xtendbin
Binary files differ
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.java b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.java
index 7b4bb578..5fc2a391 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.java
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FAMTest.java
@@ -2,37 +2,110 @@ package ca.mcgill.ecse.dslreasoner.vampire.icse;
2 2
3import ca.mcgill.ecse.dslreasoner.vampire.icse.GeneralTest; 3import ca.mcgill.ecse.dslreasoner.vampire.icse.GeneralTest;
4import ca.mcgill.ecse.dslreasoner.vampire.queries.FamPatterns; 4import ca.mcgill.ecse.dslreasoner.vampire.queries.FamPatterns;
5import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver;
6import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration;
7import functionalarchitecture.Function;
8import functionalarchitecture.FunctionalOutput;
5import functionalarchitecture.FunctionalarchitecturePackage; 9import functionalarchitecture.FunctionalarchitecturePackage;
10import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic;
11import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration;
12import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace;
6import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; 13import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor;
14import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel;
15import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner;
16import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput;
17import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type;
18import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem;
19import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult;
20import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic;
7import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor; 21import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor;
22import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic;
8import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace; 23import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace;
24import java.util.HashMap;
9import java.util.Map; 25import java.util.Map;
10import org.eclipse.emf.common.util.EList; 26import org.eclipse.emf.common.util.EList;
11import org.eclipse.emf.ecore.EObject; 27import org.eclipse.emf.ecore.EObject;
12import org.eclipse.emf.ecore.resource.Resource; 28import org.eclipse.emf.ecore.resource.Resource;
13import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; 29import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
14import org.eclipse.xtend2.lib.StringConcatenation; 30import org.eclipse.xtend2.lib.StringConcatenation;
31import org.eclipse.xtext.xbase.lib.Exceptions;
15import org.eclipse.xtext.xbase.lib.InputOutput; 32import org.eclipse.xtext.xbase.lib.InputOutput;
33import org.eclipse.xtext.xbase.lib.ObjectExtensions;
34import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
16 35
17@SuppressWarnings("all") 36@SuppressWarnings("all")
18public class FAMTest { 37public class FAMTest {
19 public static void main(final String[] args) { 38 public static void main(final String[] args) {
20 StringConcatenation _builder = new StringConcatenation(); 39 try {
21 _builder.append("initialModels/"); 40 final Ecore2Logic ecore2Logic = new Ecore2Logic();
22 final FileSystemWorkspace inputs = new FileSystemWorkspace(_builder.toString(), ""); 41 final Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic);
23 StringConcatenation _builder_1 = new StringConcatenation(); 42 final InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic();
24 _builder_1.append("output/FAMTest/"); 43 StringConcatenation _builder = new StringConcatenation();
25 final FileSystemWorkspace workspace = new FileSystemWorkspace(_builder_1.toString(), ""); 44 _builder.append("initialModels/");
26 workspace.initAndClear(); 45 final FileSystemWorkspace inputs = new FileSystemWorkspace(_builder.toString(), "");
27 final Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; 46 StringConcatenation _builder_1 = new StringConcatenation();
28 final Map<String, Object> map = reg.getExtensionToFactoryMap(); 47 _builder_1.append("output/FAMTest/");
29 XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); 48 final FileSystemWorkspace workspace = new FileSystemWorkspace(_builder_1.toString(), "");
30 map.put("logicproblem", _xMIResourceFactoryImpl); 49 workspace.initAndClear();
31 InputOutput.<String>println("Input and output workspaces are created"); 50 final Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
32 final EcoreMetamodelDescriptor metamodel = GeneralTest.loadMetamodel(FunctionalarchitecturePackage.eINSTANCE); 51 final Map<String, Object> map = reg.getExtensionToFactoryMap();
33 final EList<EObject> partialModel = GeneralTest.loadPartialModel(inputs, "FaModel.xmi"); 52 XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl();
34 final ViatraQuerySetDescriptor queries = GeneralTest.loadQueries(metamodel, FamPatterns.instance()); 53 map.put("logicproblem", _xMIResourceFactoryImpl);
35 InputOutput.<String>println("DSL loaded"); 54 InputOutput.<String>println("Input and output workspaces are created");
36 GeneralTest.createAndSolveProblem(metamodel, partialModel, queries, workspace); 55 final EcoreMetamodelDescriptor metamodel = GeneralTest.loadMetamodel(FunctionalarchitecturePackage.eINSTANCE);
56 final EList<EObject> partialModel = GeneralTest.loadPartialModel(inputs, "FaModel.xmi");
57 final ViatraQuerySetDescriptor queries = GeneralTest.loadQueries(metamodel, FamPatterns.instance());
58 InputOutput.<String>println("DSL loaded");
59 Ecore2LogicConfiguration _ecore2LogicConfiguration = new Ecore2LogicConfiguration();
60 final TracedOutput<LogicProblem, Ecore2Logic_Trace> modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, _ecore2LogicConfiguration);
61 LogicProblem problem = modelGenerationProblem.getOutput();
62 workspace.writeModel(problem, "Fam.logicproblem");
63 InputOutput.<String>println("Problem created");
64 long startTime = System.currentTimeMillis();
65 LogicReasoner reasoner = null;
66 VampireSolver _vampireSolver = new VampireSolver();
67 reasoner = _vampireSolver;
68 final HashMap<Class, Integer> classMapMin = new HashMap<Class, Integer>();
69 classMapMin.put(Function.class, Integer.valueOf(1));
70 classMapMin.put(functionalarchitecture.FunctionalInterface.class, Integer.valueOf(2));
71 classMapMin.put(FunctionalOutput.class, Integer.valueOf(3));
72 final Map<Type, Integer> typeMapMin = GeneralTest.getTypeMap(classMapMin, metamodel, ecore2Logic, modelGenerationProblem.getTrace());
73 final HashMap<Class, Integer> classMapMax = new HashMap<Class, Integer>();
74 classMapMax.put(Function.class, Integer.valueOf(5));
75 classMapMax.put(functionalarchitecture.FunctionalInterface.class, Integer.valueOf(2));
76 classMapMax.put(FunctionalOutput.class, Integer.valueOf(4));
77 final Map<Type, Integer> typeMapMax = GeneralTest.getTypeMap(classMapMax, metamodel, ecore2Logic, modelGenerationProblem.getTrace());
78 VampireSolverConfiguration _vampireSolverConfiguration = new VampireSolverConfiguration();
79 final Procedure1<VampireSolverConfiguration> _function = (VampireSolverConfiguration it) -> {
80 it.documentationLevel = DocumentationLevel.FULL;
81 it.typeScopes.minNewElements = 4;
82 it.typeScopes.maxNewElements = 5;
83 int _size = typeMapMin.size();
84 boolean _notEquals = (_size != 0);
85 if (_notEquals) {
86 it.typeScopes.minNewElementsByType = typeMapMin;
87 }
88 int _size_1 = typeMapMin.size();
89 boolean _notEquals_1 = (_size_1 != 0);
90 if (_notEquals_1) {
91 it.typeScopes.maxNewElementsByType = typeMapMax;
92 }
93 it.contCycleLevel = 5;
94 it.uniquenessDuplicates = false;
95 };
96 final VampireSolverConfiguration vampireConfig = ObjectExtensions.<VampireSolverConfiguration>operator_doubleArrow(_vampireSolverConfiguration, _function);
97 LogicResult solution = reasoner.solve(problem, vampireConfig, workspace);
98 long _currentTimeMillis = System.currentTimeMillis();
99 long _minus = (_currentTimeMillis - startTime);
100 long totalTimeMin = (_minus / 60000);
101 long _currentTimeMillis_1 = System.currentTimeMillis();
102 long _minus_1 = (_currentTimeMillis_1 - startTime);
103 long _divide = (_minus_1 / 1000);
104 long totalTimeSec = (_divide % 60);
105 InputOutput.<String>println("Problem solved");
106 InputOutput.<String>println(((("Time was: " + Long.valueOf(totalTimeMin)) + ":") + Long.valueOf(totalTimeSec)));
107 } catch (Throwable _e) {
108 throw Exceptions.sneakyThrow(_e);
109 }
37 } 110 }
38} 111}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FileSystemTest.java b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FileSystemTest.java
index 5994b4b4..eedec995 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FileSystemTest.java
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/FileSystemTest.java
@@ -1,38 +1,100 @@
1package ca.mcgill.ecse.dslreasoner.vampire.icse; 1package ca.mcgill.ecse.dslreasoner.vampire.icse;
2 2
3import ca.mcgill.ecse.dslreasoner.standalone.test.filesystem.filesystemPackage;
3import ca.mcgill.ecse.dslreasoner.vampire.icse.GeneralTest; 4import ca.mcgill.ecse.dslreasoner.vampire.icse.GeneralTest;
4import functionalarchitecture.FunctionalarchitecturePackage; 5import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver;
5import hu.bme.mit.inf.dslreasoner.domains.transima.fam.FamPatterns; 6import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration;
7import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic;
8import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration;
9import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace;
6import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; 10import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor;
7import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor; 11import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel;
12import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner;
13import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput;
14import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type;
15import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem;
16import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult;
17import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic;
18import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic;
8import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace; 19import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace;
20import java.util.HashMap;
9import java.util.Map; 21import java.util.Map;
10import org.eclipse.emf.common.util.EList; 22import org.eclipse.emf.common.util.EList;
11import org.eclipse.emf.ecore.EObject; 23import org.eclipse.emf.ecore.EObject;
12import org.eclipse.emf.ecore.resource.Resource; 24import org.eclipse.emf.ecore.resource.Resource;
13import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; 25import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
14import org.eclipse.xtend2.lib.StringConcatenation; 26import org.eclipse.xtend2.lib.StringConcatenation;
27import org.eclipse.xtext.xbase.lib.Exceptions;
15import org.eclipse.xtext.xbase.lib.InputOutput; 28import org.eclipse.xtext.xbase.lib.InputOutput;
29import org.eclipse.xtext.xbase.lib.ObjectExtensions;
30import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
16 31
17@SuppressWarnings("all") 32@SuppressWarnings("all")
18public class FileSystemTest { 33public class FileSystemTest {
19 public static void main(final String[] args) { 34 public static void main(final String[] args) {
20 StringConcatenation _builder = new StringConcatenation(); 35 try {
21 _builder.append("initialModels/"); 36 final Ecore2Logic ecore2Logic = new Ecore2Logic();
22 final FileSystemWorkspace inputs = new FileSystemWorkspace(_builder.toString(), ""); 37 final Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic);
23 StringConcatenation _builder_1 = new StringConcatenation(); 38 final InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic();
24 _builder_1.append("output/FAMTest/"); 39 StringConcatenation _builder = new StringConcatenation();
25 final FileSystemWorkspace workspace = new FileSystemWorkspace(_builder_1.toString(), ""); 40 _builder.append("initialModels/");
26 workspace.initAndClear(); 41 final FileSystemWorkspace inputs = new FileSystemWorkspace(_builder.toString(), "");
27 final Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; 42 StringConcatenation _builder_1 = new StringConcatenation();
28 final Map<String, Object> map = reg.getExtensionToFactoryMap(); 43 _builder_1.append("output/FAMTest/");
29 XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); 44 final FileSystemWorkspace workspace = new FileSystemWorkspace(_builder_1.toString(), "");
30 map.put("logicproblem", _xMIResourceFactoryImpl); 45 workspace.initAndClear();
31 InputOutput.<String>println("Input and output workspaces are created"); 46 final Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
32 final EcoreMetamodelDescriptor metamodel = GeneralTest.loadMetamodel(FunctionalarchitecturePackage.eINSTANCE); 47 final Map<String, Object> map = reg.getExtensionToFactoryMap();
33 final EList<EObject> partialModel = GeneralTest.loadPartialModel(inputs, "FunctionalArchitectureModel.xmi"); 48 XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl();
34 final ViatraQuerySetDescriptor queries = GeneralTest.loadQueries(metamodel, FamPatterns.instance()); 49 map.put("logicproblem", _xMIResourceFactoryImpl);
35 InputOutput.<String>println("DSL loaded"); 50 InputOutput.<String>println("Input and output workspaces are created");
36 GeneralTest.createAndSolveProblem(metamodel, partialModel, queries, workspace); 51 final EcoreMetamodelDescriptor metamodel = GeneralTest.loadMetamodel(filesystemPackage.eINSTANCE);
52 final EList<EObject> partialModel = GeneralTest.loadPartialModel(inputs, "fs/filesystemInstance.xmi");
53 InputOutput.<String>println("DSL loaded");
54 Ecore2LogicConfiguration _ecore2LogicConfiguration = new Ecore2LogicConfiguration();
55 final TracedOutput<LogicProblem, Ecore2Logic_Trace> modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, _ecore2LogicConfiguration);
56 LogicProblem problem = modelGenerationProblem.getOutput();
57 workspace.writeModel(problem, "Fam.logicproblem");
58 InputOutput.<String>println("Problem created");
59 long startTime = System.currentTimeMillis();
60 LogicReasoner reasoner = null;
61 VampireSolver _vampireSolver = new VampireSolver();
62 reasoner = _vampireSolver;
63 final HashMap<Class, Integer> classMapMin = new HashMap<Class, Integer>();
64 final Map<Type, Integer> typeMapMin = GeneralTest.getTypeMap(classMapMin, metamodel, ecore2Logic, modelGenerationProblem.getTrace());
65 final HashMap<Class, Integer> classMapMax = new HashMap<Class, Integer>();
66 final Map<Type, Integer> typeMapMax = GeneralTest.getTypeMap(classMapMax, metamodel, ecore2Logic, modelGenerationProblem.getTrace());
67 VampireSolverConfiguration _vampireSolverConfiguration = new VampireSolverConfiguration();
68 final Procedure1<VampireSolverConfiguration> _function = (VampireSolverConfiguration it) -> {
69 it.documentationLevel = DocumentationLevel.FULL;
70 it.typeScopes.minNewElements = 4;
71 it.typeScopes.maxNewElements = 5;
72 int _size = typeMapMin.size();
73 boolean _notEquals = (_size != 0);
74 if (_notEquals) {
75 it.typeScopes.minNewElementsByType = typeMapMin;
76 }
77 int _size_1 = typeMapMin.size();
78 boolean _notEquals_1 = (_size_1 != 0);
79 if (_notEquals_1) {
80 it.typeScopes.maxNewElementsByType = typeMapMax;
81 }
82 it.contCycleLevel = 5;
83 it.uniquenessDuplicates = false;
84 };
85 final VampireSolverConfiguration vampireConfig = ObjectExtensions.<VampireSolverConfiguration>operator_doubleArrow(_vampireSolverConfiguration, _function);
86 LogicResult solution = reasoner.solve(problem, vampireConfig, workspace);
87 long _currentTimeMillis = System.currentTimeMillis();
88 long _minus = (_currentTimeMillis - startTime);
89 long totalTimeMin = (_minus / 60000);
90 long _currentTimeMillis_1 = System.currentTimeMillis();
91 long _minus_1 = (_currentTimeMillis_1 - startTime);
92 long _divide = (_minus_1 / 1000);
93 long totalTimeSec = (_divide % 60);
94 InputOutput.<String>println("Problem solved");
95 InputOutput.<String>println(((("Time was: " + Long.valueOf(totalTimeMin)) + ":") + Long.valueOf(totalTimeSec)));
96 } catch (Throwable _e) {
97 throw Exceptions.sneakyThrow(_e);
98 }
37 } 99 }
38} 100}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.java b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.java
index 0150ef1d..0bb8f76e 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.java
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/GeneralTest.java
@@ -1,27 +1,12 @@
1package ca.mcgill.ecse.dslreasoner.vampire.icse; 1package ca.mcgill.ecse.dslreasoner.vampire.icse;
2 2
3import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver;
4import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration;
5import ca.mcgill.ecse.dslreasoner.vampireLanguage.VampireLanguageFactory;
6import com.google.common.base.Objects; 3import com.google.common.base.Objects;
7import com.google.common.collect.Iterables; 4import com.google.common.collect.Iterables;
8import functionalarchitecture.Function;
9import functionalarchitecture.FunctionalOutput;
10import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic; 5import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic;
11import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration;
12import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace; 6import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace;
13import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; 7import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor;
14import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel;
15import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner;
16import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput;
17import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type; 8import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type;
18import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem;
19import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult;
20import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore;
21import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic;
22import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor; 9import hu.bme.mit.inf.dslreasoner.viatra2logic.ViatraQuerySetDescriptor;
23import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic;
24import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace;
25import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace; 10import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace;
26import java.util.Collections; 11import java.util.Collections;
27import java.util.HashMap; 12import java.util.HashMap;
@@ -43,94 +28,24 @@ import org.eclipse.viatra.query.runtime.api.IQueryGroup;
43import org.eclipse.viatra.query.runtime.api.IQuerySpecification; 28import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
44import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; 29import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
45import org.eclipse.xtext.xbase.lib.CollectionLiterals; 30import org.eclipse.xtext.xbase.lib.CollectionLiterals;
46import org.eclipse.xtext.xbase.lib.Exceptions;
47import org.eclipse.xtext.xbase.lib.Extension;
48import org.eclipse.xtext.xbase.lib.Functions.Function1; 31import org.eclipse.xtext.xbase.lib.Functions.Function1;
49import org.eclipse.xtext.xbase.lib.InputOutput;
50import org.eclipse.xtext.xbase.lib.IterableExtensions; 32import org.eclipse.xtext.xbase.lib.IterableExtensions;
51import org.eclipse.xtext.xbase.lib.ListExtensions; 33import org.eclipse.xtext.xbase.lib.ListExtensions;
52import org.eclipse.xtext.xbase.lib.ObjectExtensions;
53import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
54 34
55@SuppressWarnings("all") 35@SuppressWarnings("all")
56public class GeneralTest { 36public class GeneralTest {
57 public static String createAndSolveProblem(final EcoreMetamodelDescriptor metamodel, final List<EObject> partialModel, final ViatraQuerySetDescriptor queries, final FileSystemWorkspace workspace) { 37 public static Map<Type, Integer> getTypeMap(final Map<Class, Integer> classMap, final EcoreMetamodelDescriptor metamodel, final Ecore2Logic e2l, final Ecore2Logic_Trace trace) {
58 try { 38 final HashMap<Type, Integer> typeMap = new HashMap<Type, Integer>();
59 String _xblockexpression = null; 39 final Function1<EClass, String> _function = (EClass s) -> {
60 { 40 return s.getName();
61 @Extension 41 };
62 final VampireLanguageFactory factory = VampireLanguageFactory.eINSTANCE; 42 final Map<String, EClass> listMap = IterableExtensions.<String, EClass>toMap(metamodel.getClasses(), _function);
63 final Ecore2Logic ecore2Logic = new Ecore2Logic(); 43 Set<Class> _keySet = classMap.keySet();
64 final Logic2Ecore logic2Ecore = new Logic2Ecore(ecore2Logic); 44 for (final Class elem : _keySet) {
65 final Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic); 45 typeMap.put(
66 final InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic(); 46 e2l.TypeofEClass(trace, listMap.get(elem.getSimpleName())), classMap.get(elem));
67 Ecore2LogicConfiguration _ecore2LogicConfiguration = new Ecore2LogicConfiguration();
68 final TracedOutput<LogicProblem, Ecore2Logic_Trace> modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, _ecore2LogicConfiguration);
69 LogicProblem problem = modelGenerationProblem.getOutput();
70 workspace.writeModel(problem, "Fam.logicproblem");
71 InputOutput.<String>println("Problem created");
72 long startTime = System.currentTimeMillis();
73 LogicResult solution = null;
74 LogicReasoner reasoner = null;
75 VampireSolver _vampireSolver = new VampireSolver();
76 reasoner = _vampireSolver;
77 final HashMap<Type, Integer> typeMapMin = new HashMap<Type, Integer>();
78 final HashMap<Type, Integer> typeMapMax = new HashMap<Type, Integer>();
79 final Function1<EClass, String> _function = (EClass s) -> {
80 return s.getName();
81 };
82 final Map<String, EClass> list2MapMin = IterableExtensions.<String, EClass>toMap(metamodel.getClasses(), _function);
83 final Function1<EClass, String> _function_1 = (EClass s) -> {
84 return s.getName();
85 };
86 final Map<String, EClass> list2MapMax = IterableExtensions.<String, EClass>toMap(metamodel.getClasses(), _function_1);
87 typeMapMin.put(
88 ecore2Logic.TypeofEClass(modelGenerationProblem.getTrace(),
89 list2MapMin.get(Function.class.getSimpleName())), Integer.valueOf(1));
90 typeMapMin.put(
91 ecore2Logic.TypeofEClass(modelGenerationProblem.getTrace(),
92 list2MapMin.get(functionalarchitecture.FunctionalInterface.class.getSimpleName())), Integer.valueOf(2));
93 typeMapMin.put(
94 ecore2Logic.TypeofEClass(modelGenerationProblem.getTrace(),
95 list2MapMin.get(FunctionalOutput.class.getSimpleName())), Integer.valueOf(3));
96 typeMapMax.put(
97 ecore2Logic.TypeofEClass(
98 modelGenerationProblem.getTrace(),
99 list2MapMax.get(Function.class.getSimpleName())), Integer.valueOf(5));
100 typeMapMax.put(
101 ecore2Logic.TypeofEClass(
102 modelGenerationProblem.getTrace(),
103 list2MapMax.get(functionalarchitecture.FunctionalInterface.class.getSimpleName())), Integer.valueOf(2));
104 typeMapMax.put(
105 ecore2Logic.TypeofEClass(
106 modelGenerationProblem.getTrace(),
107 list2MapMax.get(FunctionalOutput.class.getSimpleName())), Integer.valueOf(4));
108 VampireSolverConfiguration _vampireSolverConfiguration = new VampireSolverConfiguration();
109 final Procedure1<VampireSolverConfiguration> _function_2 = (VampireSolverConfiguration it) -> {
110 it.documentationLevel = DocumentationLevel.FULL;
111 it.typeScopes.minNewElements = 4;
112 it.typeScopes.maxNewElements = 25;
113 it.typeScopes.minNewElementsByType = typeMapMin;
114 it.typeScopes.maxNewElementsByType = typeMapMax;
115 it.contCycleLevel = 5;
116 it.uniquenessDuplicates = false;
117 };
118 final VampireSolverConfiguration vampireConfig = ObjectExtensions.<VampireSolverConfiguration>operator_doubleArrow(_vampireSolverConfiguration, _function_2);
119 solution = reasoner.solve(problem, vampireConfig, workspace);
120 long _currentTimeMillis = System.currentTimeMillis();
121 long _minus = (_currentTimeMillis - startTime);
122 long totalTimeMin = (_minus / 60000);
123 long _currentTimeMillis_1 = System.currentTimeMillis();
124 long _minus_1 = (_currentTimeMillis_1 - startTime);
125 long _divide = (_minus_1 / 1000);
126 long totalTimeSec = (_divide % 60);
127 InputOutput.<String>println("Problem solved");
128 _xblockexpression = InputOutput.<String>println(((("Time was: " + Long.valueOf(totalTimeMin)) + ":") + Long.valueOf(totalTimeSec)));
129 }
130 return _xblockexpression;
131 } catch (Throwable _e) {
132 throw Exceptions.sneakyThrow(_e);
133 } 47 }
48 return typeMap;
134 } 49 }
135 50
136 public static EcoreMetamodelDescriptor loadMetamodel(final EPackage pckg) { 51 public static EcoreMetamodelDescriptor loadMetamodel(final EPackage pckg) {
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/YakinduTest.java b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/YakinduTest.java
index bea4e8a6..81079764 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/YakinduTest.java
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/icse/YakinduTest.java
@@ -1,34 +1,101 @@
1package ca.mcgill.ecse.dslreasoner.vampire.icse; 1package ca.mcgill.ecse.dslreasoner.vampire.icse;
2 2
3import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.yakinduPackage;
3import ca.mcgill.ecse.dslreasoner.vampire.icse.GeneralTest; 4import ca.mcgill.ecse.dslreasoner.vampire.icse.GeneralTest;
4import hu.bme.mit.inf.dslreasoner.domains.yakindu.sgraph.yakindumm.YakindummPackage; 5import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver;
6import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration;
7import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic;
8import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration;
9import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace;
5import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; 10import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor;
11import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel;
12import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner;
13import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput;
14import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type;
15import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem;
16import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult;
17import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic;
18import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic;
6import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace; 19import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace;
20import java.util.HashMap;
7import java.util.Map; 21import java.util.Map;
8import org.eclipse.emf.common.util.EList; 22import org.eclipse.emf.common.util.EList;
9import org.eclipse.emf.ecore.EObject; 23import org.eclipse.emf.ecore.EObject;
10import org.eclipse.emf.ecore.resource.Resource; 24import org.eclipse.emf.ecore.resource.Resource;
11import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; 25import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
12import org.eclipse.xtend2.lib.StringConcatenation; 26import org.eclipse.xtend2.lib.StringConcatenation;
27import org.eclipse.xtext.xbase.lib.Exceptions;
13import org.eclipse.xtext.xbase.lib.InputOutput; 28import org.eclipse.xtext.xbase.lib.InputOutput;
29import org.eclipse.xtext.xbase.lib.ObjectExtensions;
30import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
14 31
15@SuppressWarnings("all") 32@SuppressWarnings("all")
16public class YakinduTest { 33public class YakinduTest {
17 public static void main(final String[] args) { 34 public static void main(final String[] args) {
18 StringConcatenation _builder = new StringConcatenation(); 35 try {
19 _builder.append("initialModels/"); 36 final Ecore2Logic ecore2Logic = new Ecore2Logic();
20 final FileSystemWorkspace inputs = new FileSystemWorkspace(_builder.toString(), ""); 37 final Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic);
21 StringConcatenation _builder_1 = new StringConcatenation(); 38 final InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic();
22 _builder_1.append("output/YakinduTest/"); 39 StringConcatenation _builder = new StringConcatenation();
23 final FileSystemWorkspace workspace = new FileSystemWorkspace(_builder_1.toString(), ""); 40 _builder.append("initialModels/");
24 workspace.initAndClear(); 41 final FileSystemWorkspace inputs = new FileSystemWorkspace(_builder.toString(), "");
25 final Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; 42 StringConcatenation _builder_1 = new StringConcatenation();
26 final Map<String, Object> map = reg.getExtensionToFactoryMap(); 43 _builder_1.append("output/YakinduTest/");
27 XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); 44 final FileSystemWorkspace workspace = new FileSystemWorkspace(_builder_1.toString(), "");
28 map.put("logicproblem", _xMIResourceFactoryImpl); 45 workspace.initAndClear();
29 InputOutput.<String>println("Input and output workspaces are created"); 46 final Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
30 final EcoreMetamodelDescriptor metamodel = GeneralTest.loadMetamodel(YakindummPackage.eINSTANCE); 47 final Map<String, Object> map = reg.getExtensionToFactoryMap();
31 final EList<EObject> partialModel = GeneralTest.loadPartialModel(inputs, "Yakindu.xmi"); 48 XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl();
32 InputOutput.<String>println("DSL loaded"); 49 map.put("logicproblem", _xMIResourceFactoryImpl);
50 InputOutput.<String>println("Input and output workspaces are created");
51 final EcoreMetamodelDescriptor metamodel = GeneralTest.loadMetamodel(yakinduPackage.eINSTANCE);
52 final EList<EObject> partialModel = GeneralTest.loadPartialModel(inputs, "yakindu/yakinduinstance.xmi");
53 final Object queries = null;
54 InputOutput.<String>println("DSL loaded");
55 Ecore2LogicConfiguration _ecore2LogicConfiguration = new Ecore2LogicConfiguration();
56 final TracedOutput<LogicProblem, Ecore2Logic_Trace> modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, _ecore2LogicConfiguration);
57 LogicProblem problem = modelGenerationProblem.getOutput();
58 workspace.writeModel(problem, "Yakindu.logicproblem");
59 InputOutput.<String>println("Problem created");
60 long startTime = System.currentTimeMillis();
61 LogicReasoner reasoner = null;
62 VampireSolver _vampireSolver = new VampireSolver();
63 reasoner = _vampireSolver;
64 final HashMap<Class, Integer> classMapMin = new HashMap<Class, Integer>();
65 final Map<Type, Integer> typeMapMin = GeneralTest.getTypeMap(classMapMin, metamodel, ecore2Logic, modelGenerationProblem.getTrace());
66 final HashMap<Class, Integer> classMapMax = new HashMap<Class, Integer>();
67 final Map<Type, Integer> typeMapMax = GeneralTest.getTypeMap(classMapMax, metamodel, ecore2Logic, modelGenerationProblem.getTrace());
68 VampireSolverConfiguration _vampireSolverConfiguration = new VampireSolverConfiguration();
69 final Procedure1<VampireSolverConfiguration> _function = (VampireSolverConfiguration it) -> {
70 it.documentationLevel = DocumentationLevel.FULL;
71 it.typeScopes.minNewElements = 20;
72 it.typeScopes.maxNewElements = 30;
73 int _size = typeMapMin.size();
74 boolean _notEquals = (_size != 0);
75 if (_notEquals) {
76 it.typeScopes.minNewElementsByType = typeMapMin;
77 }
78 int _size_1 = typeMapMin.size();
79 boolean _notEquals_1 = (_size_1 != 0);
80 if (_notEquals_1) {
81 it.typeScopes.maxNewElementsByType = typeMapMax;
82 }
83 it.contCycleLevel = 5;
84 it.uniquenessDuplicates = false;
85 };
86 final VampireSolverConfiguration vampireConfig = ObjectExtensions.<VampireSolverConfiguration>operator_doubleArrow(_vampireSolverConfiguration, _function);
87 LogicResult solution = reasoner.solve(problem, vampireConfig, workspace);
88 long _currentTimeMillis = System.currentTimeMillis();
89 long _minus = (_currentTimeMillis - startTime);
90 long totalTimeMin = (_minus / 60000);
91 long _currentTimeMillis_1 = System.currentTimeMillis();
92 long _minus_1 = (_currentTimeMillis_1 - startTime);
93 long _divide = (_minus_1 / 1000);
94 long totalTimeSec = (_divide % 60);
95 InputOutput.<String>println("Problem solved");
96 InputOutput.<String>println(((("Time was: " + Long.valueOf(totalTimeMin)) + ":") + Long.valueOf(totalTimeSec)));
97 } catch (Throwable _e) {
98 throw Exceptions.sneakyThrow(_e);
99 }
33 } 100 }
34} 101}
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.MedicalSystem.xtendbin b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.MedicalSystem.xtendbin
index c0481fd8..29f8df00 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.MedicalSystem.xtendbin
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.MedicalSystem.xtendbin
Binary files differ
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.SimpleRun.xtendbin b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.SimpleRun.xtendbin
index 53dc2a03..72d33e5d 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.SimpleRun.xtendbin
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.SimpleRun.xtendbin
Binary files differ
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.VampireTest.xtendbin b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.VampireTest.xtendbin
index 6c84f917..e9c4c0a4 100644
--- a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.VampireTest.xtendbin
+++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/.VampireTest.xtendbin
Binary files differ