diff --git a/com.incquerylabs.v4md.snapshotmaker/.gitignore b/com.incquerylabs.v4md.snapshotmaker/.gitignore deleted file mode 100644 index 2789a5f..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -build -javadoc -out -target -bin -/.classpath -.gradle -.idea -META-INF -*.iml -*.mdxml.bak -*.jresult -*.diff -rebel.xml -.DS_Store -*._trace diff --git a/com.incquerylabs.v4md.snapshotmaker/.project b/com.incquerylabs.v4md.snapshotmaker/.project deleted file mode 100644 index 9dd5fce..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/.project +++ /dev/null @@ -1,41 +0,0 @@ - - - com.incquerylabs.v4md.snapshotmaker - - - - org.eclipse.jdt.core.javanature - org.eclipse.xtext.ui.shared.xtextNature - org.eclipse.buildship.core.gradleprojectnature - org.eclipse.pde.PluginNature - org.eclipse.viatra.query.projectnature - - - - org.eclipse.jdt.core.javabuilder - - - - org.eclipse.xtext.ui.shared.xtextBuilder - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - org.eclipse.viatra.query.tooling.ui.projectbuilder - - - - org.eclipse.pde.ManifestBuilder - - - - org.eclipse.pde.SchemaBuilder - - - - - - diff --git a/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.buildship.core.prefs b/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index e889521..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,2 +0,0 @@ -connection.project.dir= -eclipse.preferences.version=1 diff --git a/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.jdt.core.prefs b/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index eda06f9..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -# -#Fri Oct 19 16:49:07 CEST 2018 -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.source=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error diff --git a/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguage.prefs b/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguage.prefs deleted file mode 100644 index 062546c..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguage.prefs +++ /dev/null @@ -1,29 +0,0 @@ -//outlet.DEFAULT_OUTPUT.sourceFolder.build/xtend/main.directory= -//outlet.DEFAULT_OUTPUT.sourceFolder.build/xtend/main.ignore= -//outlet.DEFAULT_OUTPUT.sourceFolder.src/main/java.directory= -//outlet.DEFAULT_OUTPUT.sourceFolder.src/main/java.ignore= -BuilderConfiguration.is_project_specific=true -autobuilding=true -eclipse.preferences.version=1 -generateEclipseExtensions=true -generateGeneratedAnnotation=false -generateManifestEntries=true -generateMatchProcessors=false -generateMatchers=NESTED_CLASS -generateSuppressWarnings=true -generatedAnnotationComment= -includeDateInGenerated=false -outlet.DEFAULT_OUTPUT.cleanDirectory=false -outlet.DEFAULT_OUTPUT.cleanupDerived=true -outlet.DEFAULT_OUTPUT.createDirectory=true -outlet.DEFAULT_OUTPUT.derived=true -outlet.DEFAULT_OUTPUT.directory=./src/generated/vql -outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true -outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false -outlet.DEFAULT_OUTPUT.keepLocalHistory=true -outlet.DEFAULT_OUTPUT.override=true -outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.directory= -outlet.DEFAULT_OUTPUT.sourceFolder.src-gen.ignore= -outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder= -targetJavaVersion=JAVA5 -useJavaCompilerCompliance=true diff --git a/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.xtend.core.Xtend.prefs b/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.xtend.core.Xtend.prefs deleted file mode 100644 index 446d5e7..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.xtend.core.Xtend.prefs +++ /dev/null @@ -1,31 +0,0 @@ -#Fri Oct 19 16:49:07 CEST 2018 -//outlet.DEFAULT_OUTPUT.sourceFolder.src/main/java.directory=build/xtend/main -generatedAnnotationComment= -//outlet.DEFAULT_OUTPUT.sourceFolder.build/xtend/main.ignore= -outlet.DEFAULT_OUTPUT.cleanupDerived=true -outlet.DEFAULT_OUTPUT.override=true -eclipse.preferences.version=1 -//outlet.DEFAULT_OUTPUT.sourceFolder.src/main/xtend-gen.ignore= -//outlet.DEFAULT_OUTPUT.sourceFolder.src/main/resources.directory=build/xtend/main -//outlet.DEFAULT_OUTPUT.sourceFolder.src/main/xtend-gen.directory= -outlet.DEFAULT_OUTPUT.directory=../../build/xtend/main -outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true -outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true -//outlet.DEFAULT_OUTPUT.sourceFolder.src/main/java.ignore= -generateGeneratedAnnotation=false -//outlet.DEFAULT_OUTPUT.sourceFolder.src/generated/vql.directory=build/xtend/main -autobuilding=true -includeDateInGenerated=false -targetJavaVersion=Java8 -generateSuppressWarnings=true -BuilderConfiguration.is_project_specific=true -outlet.DEFAULT_OUTPUT.keepLocalHistory=false -outlet.DEFAULT_OUTPUT.cleanDirectory=true -//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=build/xtend/test -outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false -//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/resources.directory=build/xtend/test -outlet.DEFAULT_OUTPUT.createDirectory=true -ValidatorConfiguration.is_project_specific=true -//outlet.DEFAULT_OUTPUT.sourceFolder.build/xtend/main.directory= -useJavaCompilerCompliance=false -outlet.DEFAULT_OUTPUT.derived=true diff --git a/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.xtext.java.Java.prefs b/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.xtext.java.Java.prefs deleted file mode 100644 index eefb23e..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/.settings/org.eclipse.xtext.java.Java.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Fri Oct 19 16:49:07 CEST 2018 -includeDateInGenerated=false -BuilderConfiguration.is_project_specific=true -eclipse.preferences.version=1 -generateGeneratedAnnotation=false -useJavaCompilerCompliance=false -generateSuppressWarnings=true -ValidatorConfiguration.is_project_specific=true -targetJavaVersion=Java8 diff --git a/com.incquerylabs.v4md.snapshotmaker/build.gradle b/com.incquerylabs.v4md.snapshotmaker/build.gradle deleted file mode 100644 index 8a272a7..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/build.gradle +++ /dev/null @@ -1,297 +0,0 @@ -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter -import java.util.stream.Collectors -import java.util.zip.ZipFile - -plugins { - id "org.xtext.xtend" version "2.0.1" -} - -xtext.version = "2.15.0" - -String buildNumber = project.hasProperty('buildNumber') ? project.getProperty('buildNumber') : System.currentTimeSeconds() -String timestamp = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH:mm").format(LocalDateTime.now()) - -//This is the part that is painful to maintain, as MD releases tend to move around these library jars -String[] classpathLibraries = [ - 'lib/patch.jar', - 'lib/md.jar', - 'lib/md_api.jar', - 'lib/md_common.jar', - 'lib/md_common_api.jar', - 'lib/md_common_test.jar', - 'lib/tw_common.jar', - 'lib/tw_common_api.jar', - 'lib/launcher.jar', - 'lib/activation.jar' -] - - -// Apply the java-library plugin to add support for Java Library - -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: 'java' -apply plugin: 'distribution' - -sourceSets { - main { - java { - srcDir 'src/main/java' - srcDir 'src/generated/vql' - } - } -} - -// In this section you declare where to find the dependencies of your project -repositories { - ivy { - url 'http://download1.nomagic.com/' - layout 'pattern', { - artifact '/[module][revision]/[classifier].[ext]' - } - } - - jcenter() - mavenCentral() - jcenter() - maven { url "https://repo.eclipse.org/content/groups/viatra/" } - maven { url 'https://build.incquerylabs.com/nexus/repository/v4md/' } -} - -configurations { - preCompile -} - -dependencies { - preCompile group: 'com.nomagic', name: 'magicdraw', version: '190sp2', classifier: 'MagicDraw_190_sp2_no_install', ext: 'zip' - preCompile group: 'com.nomagic', name: 'sysml', version: '190sp2', classifier: 'SysML_Plugin_190_sp2_bundle', ext: 'zip' - preCompile group: 'com.incquerylabs.v4md', name: 'com.incquerylabs.v4md', version: v4mdVersion, classifier: 'plugin', ext: 'zip' - - // This ensures classpath load order to match the MagicDraw provided order and then includes extras needed for non-OpenAPI stuff. - compile files(classpathLibraries.collect { 'build/dependency-cache/extracted/' + it }) - compile fileTree(dir: 'build/dependency-cache/extracted', include: ['lib/**/*.jar', 'plugins/**/*.jar'], exclude: ([ classpathLibraries, ['plugins/com.nomagic.collaborator.publisher/**/*.jar', 'plugins/com.nomagic.magicdraw.emfuml2xmi*/**/*.jar'] ]).flatten()) - compile fileTree(dir: 'lib', include: ['**/*.jar']) - - compile group: 'org.eclipse.viatra', name: 'viatra-query-testing', version: viatraVersion - -} - -task extractDependencies { - configurations.preCompile.resolvedConfiguration.resolvedArtifacts.each { artifact -> - inputs.file artifact.file - def zipFile = new ZipFile(artifact.file) - zipFile.entries().each { entry -> - if (!entry.isDirectory()) { - outputs.file 'build/dependency-cache/extracted/' + entry.getName() - } - } - } - doLast { - inputs.files.each { archive -> - copy { - from zipTree(archive) - into 'build/dependency-cache/extracted' - } - } - fileTree(dir: 'build/dependency-cache/extracted', include: '*.zip').each { archive -> - copy { - from zipTree(archive) - into 'build/dependency-cache/extracted' - } - } - } -} -compileJava.dependsOn extractDependencies - -processResources { - doFirst { - delete "build/resources" - } -} - -javadoc { - options.addStringOption("sourcepath", "") - options.tags = [ "generated", "noreference" ] -} - -if (JavaVersion.current().isJava8Compatible()) { - tasks.withType(Javadoc) { - // disable the crazy super-strict doclint tool in Java 8 - //noinspection SpellCheckingInspection - options.addStringOption('Xdoclint:none', '-quiet') - } -} - -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' - from sourceSets.main.allSource -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -task javadocZip(type: Zip, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -class PreDist extends DefaultTask { - String humanVersion - String internalVersion - String groupName - String buildTimestamp - String descriptor - - @TaskAction - void executeTask() { - project.copy { - from 'src/main/dist' - exclude 'template' - exclude 'settings' - from 'src/main/dist/template' - exclude 'plugins' - from 'src/main/dist/template/plugins' - exclude '${group}' - into 'build/generated-dist' - } - project.copy { - from project.configurations.compile.resolvedConfiguration.resolvedArtifacts.file - from 'lib' - from project.jar - into "build/generated-dist/plugins/${groupName}" - } - project.copy { - from 'src/main/dist/settings' - into "build/generated-dist/plugins/${groupName}/settings" - } - project.copy { - from project.getTasks().getByName('javadocZip') - into "build/generated-dist/plugins/${groupName}/javadoc" - } - project.fileTree(dir: 'build/generated-dist', include: '**/*${group}*/**').each { file -> - file.renameTo(project.file(file.getAbsolutePath().replace('${group}', "${groupName}"))) - } - - String pluginLibraries = '' - project.fileTree(dir: "build/generated-dist/plugins/${groupName}", include: '**/*.jar').each { file -> - pluginLibraries += '\t\t' + System.lineSeparator() - } - project.copy { - from 'src/main/dist/template/plugins/${group}/plugin.xml' - filter { String line -> line.replace('', '' + System.lineSeparator() + System.lineSeparator() + pluginLibraries) } - filter { String line -> line.replace('${human.version}', humanVersion) } - filter { String line -> line.replace('${internal.version}', internalVersion) } - into "build/generated-dist/plugins/${groupName}" - } - - String descriptorFiles = '' - project.fileTree(dir: 'build/generated-dist').each { file -> - String relativePath = file.absolutePath.replaceAll(/.*build\/generated-dist\//, '') - descriptorFiles += '\t\t' + System.lineSeparator() - } - project.copy { - from "src/main/dist/template/data/resourcemanager/${descriptor}" - filter { String line -> line.replace('', '' + System.lineSeparator() + System.lineSeparator() + descriptorFiles) } - filter { String line -> line.replace('${human.version}', humanVersion) } - filter { String line -> line.replace('${internal.version}', internalVersion) } - filter { String line -> line.replace('${build.timestamp}', buildTimestamp) } - into 'build/generated-dist/data/resourcemanager' - } - } -} - -task preDist(type: PreDist) { - humanVersion = version - internalVersion = buildNumber - groupName = magicdDrawGroupName - buildTimestamp = timestamp - descriptor = descriptorFile -} -preDist.dependsOn jar -preDist.dependsOn javadocZip - -distributions { - main { - contents { - exclude 'template' - from 'build/generated-dist' - } - } -} - -distZip { - includeEmptyDirs false - duplicatesStrategy DuplicatesStrategy.EXCLUDE - eachFile { file -> - file.setPath(path.substring(path.indexOf("/") + 1, path.length())) - } -} -distZip.dependsOn preDist - -installDist { - destinationDir = file('build/plugin') - doLast { - copy { - fileMode 0755 - from 'build/dependency-cache/extracted' - from 'build/plugin' - into 'build/install' - } - } -} -installDist.dependsOn distZip - -def os = org.gradle.internal.os.OperatingSystem.current() -def platformConfigSetting = - (os.isWindows()) - ? ['-DWINCONFIG=true'] - : ((os.isMacOsX()) - ? ['-DWINCONFIG=false', '-Xdock:name=MagicDraw', '-Xdock:icon=bin/md.icns', '-Dapple.laf.useScreenMenuBar=true'] -: ['-DWINCONFIG=false']) - -tasks.withType(JavaExec) { - doFirst { - classpath fileTree(dir: 'build/install', include: ['lib/**/*.jar']) - } - - workingDir 'build/install' - ignoreExitValue true - - standardOutput = System.out - errorOutput = System.err - - main = 'com.nomagic.osgi.launcher.ProductionFrameworkLauncher' - jvmArgs = platformConfigSetting + ['-Xmx8192M', '-Xss512M', '-noverify', '-splash:data/splash.png','-Dmd.class.path=$java.class.path'] - args 'DEVELOPER' -} - -task runJava(type: JavaExec) { -} -runJava.dependsOn installDist - -task debugJava(type: JavaExec) { - jvmArgs += ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9099', '-Dcom.sun.management.jmxremote.port=1099', '-Dcom.sun.management.jmxremote.authenticate=false', '-Dcom.sun.management.jmxremote.ssl=false'] -} -debugJava.dependsOn installDist - - -task preparePluginDistributions { - configurations.preCompile.resolvedConfiguration.resolvedArtifacts.each { artifact -> - if(artifact.getName().contains('v4md')){ - copy{ - from artifact.getFile().getParentFile() - include '*v4md*.zip' - rename { String fileName -> - fileName.replace("-SNAPSHOT-no-install", "") - } - into 'build/distributions/' - } - } - } -} -preparePluginDistributions.dependsOn installDist - - diff --git a/com.incquerylabs.v4md.snapshotmaker/gradle.properties b/com.incquerylabs.v4md.snapshotmaker/gradle.properties deleted file mode 100644 index 3b9138a..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/gradle.properties +++ /dev/null @@ -1,6 +0,0 @@ -version=0.1.0 -group=com.incquerylabs.magicdraw.plugin.example -descriptorFile=MDR_Example_Plugin_18351_descriptor.xml -magicdDrawGroupName=com.incquerylabs.magicdraw.plugin.example -viatraVersion=2.1.0.M3 -v4mdVersion=2.1.0-SNAPSHOT \ No newline at end of file diff --git a/com.incquerylabs.v4md.snapshotmaker/gradle/wrapper/gradle-wrapper.jar b/com.incquerylabs.v4md.snapshotmaker/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 27768f1..0000000 Binary files a/com.incquerylabs.v4md.snapshotmaker/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/com.incquerylabs.v4md.snapshotmaker/gradle/wrapper/gradle-wrapper.properties b/com.incquerylabs.v4md.snapshotmaker/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 92165ee..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-bin.zip diff --git a/com.incquerylabs.v4md.snapshotmaker/gradlew b/com.incquerylabs.v4md.snapshotmaker/gradlew deleted file mode 100644 index cccdd3d..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/com.incquerylabs.v4md.snapshotmaker/gradlew.bat b/com.incquerylabs.v4md.snapshotmaker/gradlew.bat deleted file mode 100644 index f955316..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/com.incquerylabs.v4md.snapshotmaker/settings.gradle b/com.incquerylabs.v4md.snapshotmaker/settings.gradle deleted file mode 100644 index eb20410..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/settings.gradle +++ /dev/null @@ -1,18 +0,0 @@ -/* - * This settings file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * In a single project build this file can be empty or even removed. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user guide at https://docs.gradle.org/4.3/userguide/multi_project_builds.html - */ - -/* -// To declare projects as part of a multi-project build use the 'include' method -include 'shared' -include 'api' -include 'services:webservice' -*/ - -rootProject.name = 'com.incquerylabs.v4md.snapshotmaker' diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/CompnoentsWithName.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/CompnoentsWithName.java deleted file mode 100644 index d3a00fe..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/CompnoentsWithName.java +++ /dev/null @@ -1,697 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/queries/UMLTestQueries.vql - */ -package com.incquerylabs.v4md.snapshotmaker.queries; - -import com.nomagic.uml2.ext.magicdraw.components.mdbasiccomponents.Component; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         pattern CompnoentsWithName(component : Component, name: java String) {
- *         	Component.name(component, name);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class CompnoentsWithName extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.snapshotmaker.queries.CompnoentsWithName pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pComponent the fixed value of pattern parameter component, or null if not bound. - * @param pName the fixed value of pattern parameter name, or null if not bound. - * @return the (partial) match object. - * - */ - public CompnoentsWithName.Match newMatch(final Component pComponent, final String pName) { - return CompnoentsWithName.Match.newMatch(pComponent, pName); - } - - /** - * Retrieve the set of values that occur in matches for component. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfcomponent(final Object[] parameters) { - return rawStreamAllValues(POSITION_COMPONENT, parameters).map(Component.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for component. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfcomponent() { - return rawStreamAllValuesOfcomponent(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for component. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfcomponent() { - return rawStreamAllValuesOfcomponent(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for component. - *

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

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

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

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

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

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

Original source: - *

- *         pattern DeduciblePortType(port : Port, type : Type){
- *         	neg find PortWithSpecifiedType(port);
- *         	find ConnectedPort(port, other);
- *         	Port.type(other, type);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class DeduciblePortType extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.snapshotmaker.queries.DeduciblePortType pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

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

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

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

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

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

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static DeduciblePortType.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_port = new PParameter("port", "com.nomagic.uml2.ext.magicdraw.compositestructures.mdports.Port", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5", "Port")), PParameterDirection.INOUT); - - private final PParameter parameter_type = new PParameter("type", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Type", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5", "Type")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_port, parameter_type); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.snapshotmaker.queries.DeduciblePortType"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("port","type"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_port = body.getOrCreateVariableByName("port"); - PVariable var_type = body.getOrCreateVariableByName("type"); - PVariable var_other = body.getOrCreateVariableByName("other"); - new TypeConstraint(body, Tuples.flatTupleOf(var_port), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "Port"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_type), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "Type"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_port, parameter_port), - new ExportedParameter(body, var_type, parameter_type) - )); - // neg find PortWithSpecifiedType(port) - new NegativePatternCall(body, Tuples.flatTupleOf(var_port), PortWithSpecifiedType.instance().getInternalQueryRepresentation()); - // find ConnectedPort(port, other) - new PositivePatternCall(body, Tuples.flatTupleOf(var_port, var_other), ConnectedPort.instance().getInternalQueryRepresentation()); - // Port.type(other, type) - new TypeConstraint(body, Tuples.flatTupleOf(var_other), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "Port"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_other, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "TypedElement", "type"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "Type"))); - new Equality(body, var__virtual_0_, var_type); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/SearchQueries.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/SearchQueries.java deleted file mode 100644 index ac82151..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/SearchQueries.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/queries/SearchQueries.vql - */ -package com.incquerylabs.v4md.snapshotmaker.queries; - -import com.incquerylabs.v4md.snapshotmaker.queries.DeduciblePortType; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in SearchQueries.vql. - * - *

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

From package com.incquerylabs.v4md.snapshotmaker.queries, the group contains the definition of the following patterns:

    - *
  • DeduciblePortType
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class SearchQueries extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static SearchQueries instance() { - if (INSTANCE == null) { - INSTANCE = new SearchQueries(); - } - return INSTANCE; - } - - private static SearchQueries INSTANCE; - - private SearchQueries() { - querySpecifications.add(DeduciblePortType.instance()); - } - - public DeduciblePortType getDeduciblePortType() { - return DeduciblePortType.instance(); - } - - public DeduciblePortType.Matcher getDeduciblePortType(final ViatraQueryEngine engine) { - return DeduciblePortType.Matcher.on(engine); - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/UMLTestQueries.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/UMLTestQueries.java deleted file mode 100644 index 6c21145..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/UMLTestQueries.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/queries/UMLTestQueries.vql - */ -package com.incquerylabs.v4md.snapshotmaker.queries; - -import com.incquerylabs.v4md.snapshotmaker.queries.CompnoentsWithName; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in UMLTestQueries.vql. - * - *

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

From package com.incquerylabs.v4md.snapshotmaker.queries, the group contains the definition of the following patterns:

    - *
  • CompnoentsWithName
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class UMLTestQueries extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static UMLTestQueries instance() { - if (INSTANCE == null) { - INSTANCE = new UMLTestQueries(); - } - return INSTANCE; - } - - private static UMLTestQueries INSTANCE; - - private UMLTestQueries() { - querySpecifications.add(CompnoentsWithName.instance()); - } - - public CompnoentsWithName getCompnoentsWithName() { - return CompnoentsWithName.instance(); - } - - public CompnoentsWithName.Matcher getCompnoentsWithName(final ViatraQueryEngine engine) { - return CompnoentsWithName.Matcher.on(engine); - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/internal/ConnectedPort.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/internal/ConnectedPort.java deleted file mode 100644 index 7db73b1..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/internal/ConnectedPort.java +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/queries/SearchQueries.vql - */ -package com.incquerylabs.v4md.snapshotmaker.queries.internal; - -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

Original source: - *

- *         private pattern ConnectedPort(one : Port, other : Port) {
- *         	Port.end(one, oneEnd);
- *         	ConnectorEnd._connectorOfEnd(oneEnd, conn);
- *         	Connector.end(conn, otherEnd);
- *         	oneEnd != otherEnd;
- *         	Port.end(other, otherEnd);
- *         }
- * 
- * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class ConnectedPort extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private ConnectedPort() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static ConnectedPort instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * Inner class allowing the singleton instance of {@link JvmGenericType: com.incquerylabs.v4md.snapshotmaker.queries.internal.ConnectedPort (visibility: PUBLIC, simpleName: ConnectedPort, identifier: com.incquerylabs.v4md.snapshotmaker.queries.internal.ConnectedPort, deprecated: ) (abstract: false, static: false, final: true, packageName: com.incquerylabs.v4md.snapshotmaker.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link JvmGenericType: com.incquerylabs.v4md.snapshotmaker.queries.internal.ConnectedPort (visibility: PUBLIC, simpleName: ConnectedPort, identifier: com.incquerylabs.v4md.snapshotmaker.queries.internal.ConnectedPort, deprecated: ) (abstract: false, static: false, final: true, packageName: com.incquerylabs.v4md.snapshotmaker.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static ConnectedPort.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_one = new PParameter("one", "com.nomagic.uml2.ext.magicdraw.compositestructures.mdports.Port", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5", "Port")), PParameterDirection.INOUT); - - private final PParameter parameter_other = new PParameter("other", "com.nomagic.uml2.ext.magicdraw.compositestructures.mdports.Port", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5", "Port")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_one, parameter_other); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.snapshotmaker.queries.ConnectedPort"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("one","other"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_one = body.getOrCreateVariableByName("one"); - PVariable var_other = body.getOrCreateVariableByName("other"); - PVariable var_oneEnd = body.getOrCreateVariableByName("oneEnd"); - PVariable var_conn = body.getOrCreateVariableByName("conn"); - PVariable var_otherEnd = body.getOrCreateVariableByName("otherEnd"); - new TypeConstraint(body, Tuples.flatTupleOf(var_one), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "Port"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_other), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "Port"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_one, parameter_one), - new ExportedParameter(body, var_other, parameter_other) - )); - // Port.end(one, oneEnd) - new TypeConstraint(body, Tuples.flatTupleOf(var_one), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "Port"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_one, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "ConnectableElement", "end"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "ConnectorEnd"))); - new Equality(body, var__virtual_0_, var_oneEnd); - // ConnectorEnd._connectorOfEnd(oneEnd, conn) - new TypeConstraint(body, Tuples.flatTupleOf(var_oneEnd), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "ConnectorEnd"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_oneEnd, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "ConnectorEnd", "_connectorOfEnd"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "Connector"))); - new Equality(body, var__virtual_1_, var_conn); - // Connector.end(conn, otherEnd) - new TypeConstraint(body, Tuples.flatTupleOf(var_conn), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "Connector"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_conn, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "Connector", "end"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "ConnectorEnd"))); - new Equality(body, var__virtual_2_, var_otherEnd); - // oneEnd != otherEnd - new Inequality(body, var_oneEnd, var_otherEnd); - // Port.end(other, otherEnd) - new TypeConstraint(body, Tuples.flatTupleOf(var_other), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "Port"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_other, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "ConnectableElement", "end"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "ConnectorEnd"))); - new Equality(body, var__virtual_3_, var_otherEnd); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/internal/PortWithSpecifiedType.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/internal/PortWithSpecifiedType.java deleted file mode 100644 index a6f8926..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/internal/PortWithSpecifiedType.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/queries/SearchQueries.vql - */ -package com.incquerylabs.v4md.snapshotmaker.queries.internal; - -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; - -/** - * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. - * - *

Original source: - *

- *         private pattern PortWithSpecifiedType(port : Port) {
- *         	Port.type(port, _);
- *         }
- * 
- * - * @see GenericPatternMatcher - * @see GenericPatternMatch - * - */ -@SuppressWarnings("all") -public final class PortWithSpecifiedType extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { - private PortWithSpecifiedType() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static PortWithSpecifiedType instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - /** - * Inner class allowing the singleton instance of {@link JvmGenericType: com.incquerylabs.v4md.snapshotmaker.queries.internal.PortWithSpecifiedType (visibility: PUBLIC, simpleName: PortWithSpecifiedType, identifier: com.incquerylabs.v4md.snapshotmaker.queries.internal.PortWithSpecifiedType, deprecated: ) (abstract: false, static: false, final: true, packageName: com.incquerylabs.v4md.snapshotmaker.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link JvmGenericType: com.incquerylabs.v4md.snapshotmaker.queries.internal.PortWithSpecifiedType (visibility: PUBLIC, simpleName: PortWithSpecifiedType, identifier: com.incquerylabs.v4md.snapshotmaker.queries.internal.PortWithSpecifiedType, deprecated: ) (abstract: false, static: false, final: true, packageName: com.incquerylabs.v4md.snapshotmaker.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static PortWithSpecifiedType.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_port = new PParameter("port", "com.nomagic.uml2.ext.magicdraw.compositestructures.mdports.Port", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5", "Port")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_port); - - private GeneratedPQuery() { - super(PVisibility.PRIVATE); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.snapshotmaker.queries.PortWithSpecifiedType"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("port"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_port = body.getOrCreateVariableByName("port"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_port), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "Port"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_port, parameter_port) - )); - // Port.type(port, _) - new TypeConstraint(body, Tuples.flatTupleOf(var_port), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "Port"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_port, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "TypedElement", "type"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5", "Type"))); - new Equality(body, var__virtual_0_, var___0_); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/internal/SearchQueriesAll.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/internal/SearchQueriesAll.java deleted file mode 100644 index 551727d..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/snapshotmaker/queries/internal/SearchQueriesAll.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/queries/SearchQueries.vql - */ -package com.incquerylabs.v4md.snapshotmaker.queries.internal; - -import com.incquerylabs.v4md.snapshotmaker.queries.DeduciblePortType; -import com.incquerylabs.v4md.snapshotmaker.queries.internal.ConnectedPort; -import com.incquerylabs.v4md.snapshotmaker.queries.internal.PortWithSpecifiedType; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all patterns defined in SearchQueries.vql. - * - *

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

From package com.incquerylabs.v4md.snapshotmaker.queries, the group contains the definition of the following patterns:

    - *
  • DeduciblePortType
  • - *
  • PortWithSpecifiedType
  • - *
  • ConnectedPort
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class SearchQueriesAll extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static SearchQueriesAll instance() { - if (INSTANCE == null) { - INSTANCE = new SearchQueriesAll(); - } - return INSTANCE; - } - - private static SearchQueriesAll INSTANCE; - - private SearchQueriesAll() { - querySpecifications.add(DeduciblePortType.instance()); - querySpecifications.add(PortWithSpecifiedType.instance()); - querySpecifications.add(ConnectedPort.instance()); - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Aggregator_Functions.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Aggregator_Functions.java deleted file mode 100644 index 04e5dd4..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Aggregator_Functions.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Aggregator_Functions.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.AverageNumberOfAttributes; -import com.incquerylabs.v4md.test.queries.ClassAttributes; -import com.incquerylabs.v4md.test.queries.ClassNumberOfAttributes; -import com.incquerylabs.v4md.test.queries.ClassWithMaxNumberOfAttributes; -import com.incquerylabs.v4md.test.queries.Classes; -import com.incquerylabs.v4md.test.queries.SumOfClassAttributes; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in Aggregator_Functions.vql. - * - *

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

From package com.incquerylabs.v4md.test.queries, the group contains the definition of the following patterns:

    - *
  • classes
  • - *
  • classAttributes
  • - *
  • classNumberOfAttributes
  • - *
  • classWithMaxNumberOfAttributes
  • - *
  • sumOfClassAttributes
  • - *
  • averageNumberOfAttributes
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class Aggregator_Functions extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static Aggregator_Functions instance() { - if (INSTANCE == null) { - INSTANCE = new Aggregator_Functions(); - } - return INSTANCE; - } - - private static Aggregator_Functions INSTANCE; - - private Aggregator_Functions() { - querySpecifications.add(Classes.instance()); - querySpecifications.add(ClassAttributes.instance()); - querySpecifications.add(ClassNumberOfAttributes.instance()); - querySpecifications.add(ClassWithMaxNumberOfAttributes.instance()); - querySpecifications.add(SumOfClassAttributes.instance()); - querySpecifications.add(AverageNumberOfAttributes.instance()); - } - - public Classes getClasses() { - return Classes.instance(); - } - - public Classes.Matcher getClasses(final ViatraQueryEngine engine) { - return Classes.Matcher.on(engine); - } - - public ClassAttributes getClassAttributes() { - return ClassAttributes.instance(); - } - - public ClassAttributes.Matcher getClassAttributes(final ViatraQueryEngine engine) { - return ClassAttributes.Matcher.on(engine); - } - - public ClassNumberOfAttributes getClassNumberOfAttributes() { - return ClassNumberOfAttributes.instance(); - } - - public ClassNumberOfAttributes.Matcher getClassNumberOfAttributes(final ViatraQueryEngine engine) { - return ClassNumberOfAttributes.Matcher.on(engine); - } - - public ClassWithMaxNumberOfAttributes getClassWithMaxNumberOfAttributes() { - return ClassWithMaxNumberOfAttributes.instance(); - } - - public ClassWithMaxNumberOfAttributes.Matcher getClassWithMaxNumberOfAttributes(final ViatraQueryEngine engine) { - return ClassWithMaxNumberOfAttributes.Matcher.on(engine); - } - - public SumOfClassAttributes getSumOfClassAttributes() { - return SumOfClassAttributes.instance(); - } - - public SumOfClassAttributes.Matcher getSumOfClassAttributes(final ViatraQueryEngine engine) { - return SumOfClassAttributes.Matcher.on(engine); - } - - public AverageNumberOfAttributes getAverageNumberOfAttributes() { - return AverageNumberOfAttributes.instance(); - } - - public AverageNumberOfAttributes.Matcher getAverageNumberOfAttributes(final ViatraQueryEngine engine) { - return AverageNumberOfAttributes.Matcher.on(engine); - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/AverageNumberOfAttributes.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/AverageNumberOfAttributes.java deleted file mode 100644 index 26ee8b7..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/AverageNumberOfAttributes.java +++ /dev/null @@ -1,854 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Aggregator_Functions.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.ClassNumberOfAttributes; -import com.incquerylabs.v4md.test.queries.Classes; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; -import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         //Calculates average number of attributes per class in the model
- *         pattern averageNumberOfAttributes(number : java Float, s : java Integer, c : java Integer) {
- *         	//calculates sum
- *         	s == sum find classNumberOfAttributes(_c, #tempNumber);
- *         	//determines the number of classes
- *         	c == count find classes(_c2);
- *         	//Calculates average in an eval() expression
- *         	//similar to check() in an eval expression standard Java code can be used
- *         	number == eval(s.floatValue/c.floatValue);
- *             
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class AverageNumberOfAttributes extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.averageNumberOfAttributes pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pNumber the fixed value of pattern parameter number, or null if not bound. - * @param pS the fixed value of pattern parameter s, or null if not bound. - * @param pC the fixed value of pattern parameter c, or null if not bound. - * @return the (partial) match object. - * - */ - public static AverageNumberOfAttributes.Match newMatch(final Float pNumber, final Integer pS, final Integer pC) { - return new Immutable(pNumber, pS, pC); - } - - private static final class Mutable extends AverageNumberOfAttributes.Match { - Mutable(final Float pNumber, final Integer pS, final Integer pC) { - super(pNumber, pS, pC); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends AverageNumberOfAttributes.Match { - Immutable(final Float pNumber, final Integer pS, final Integer pC) { - super(pNumber, pS, pC); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.v4md.test.queries.averageNumberOfAttributes pattern, - * providing pattern-specific query methods. - * - *

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

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

Original source: - *

-   * //Calculates average number of attributes per class in the model
-   * pattern averageNumberOfAttributes(number : java Float, s : java Integer, c : java Integer) {
-   * 	//calculates sum
-   * 	s == sum find classNumberOfAttributes(_c, #tempNumber);
-   * 	//determines the number of classes
-   * 	c == count find classes(_c2);
-   * 	//Calculates average in an eval() expression
-   * 	//similar to check() in an eval expression standard Java code can be used
-   * 	number == eval(s.floatValue/c.floatValue);
-   *     
-   * }
-   * 
- * - * @see Match - * @see AverageNumberOfAttributes - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static AverageNumberOfAttributes.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static AverageNumberOfAttributes.Matcher create() { - return new Matcher(); - } - - private final static int POSITION_NUMBER = 0; - - private final static int POSITION_S = 1; - - private final static int POSITION_C = 2; - - private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(AverageNumberOfAttributes.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pNumber the fixed value of pattern parameter number, or null if not bound. - * @param pS the fixed value of pattern parameter s, or null if not bound. - * @param pC the fixed value of pattern parameter c, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Float pNumber, final Integer pS, final Integer pC) { - return rawStreamAllMatches(new Object[]{pNumber, pS, pC}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

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

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pNumber the fixed value of pattern parameter number, or null if not bound. - * @param pS the fixed value of pattern parameter s, or null if not bound. - * @param pC the fixed value of pattern parameter c, or null if not bound. - * @return the (partial) match object. - * - */ - public AverageNumberOfAttributes.Match newMatch(final Float pNumber, final Integer pS, final Integer pC) { - return AverageNumberOfAttributes.Match.newMatch(pNumber, pS, pC); - } - - /** - * Retrieve the set of values that occur in matches for number. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfnumber(final Object[] parameters) { - return rawStreamAllValues(POSITION_NUMBER, parameters).map(Float.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for number. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfnumber() { - return rawStreamAllValuesOfnumber(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for number. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfnumber() { - return rawStreamAllValuesOfnumber(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for number. - *

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfnumber(final Integer pS, final Integer pC) { - return rawStreamAllValuesOfnumber(new Object[]{null, pS, pC}); - } - - /** - * Retrieve the set of values that occur in matches for number. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfnumber(final AverageNumberOfAttributes.Match partialMatch) { - return rawStreamAllValuesOfnumber(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for number. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfnumber(final Integer pS, final Integer pC) { - return rawStreamAllValuesOfnumber(new Object[]{null, pS, pC}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for s. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfs(final Object[] parameters) { - return rawStreamAllValues(POSITION_S, parameters).map(Integer.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for s. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfs() { - return rawStreamAllValuesOfs(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for s. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfs() { - return rawStreamAllValuesOfs(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for s. - *

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfs(final Float pNumber, final Integer pC) { - return rawStreamAllValuesOfs(new Object[]{pNumber, null, pC}); - } - - /** - * Retrieve the set of values that occur in matches for s. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfs(final AverageNumberOfAttributes.Match partialMatch) { - return rawStreamAllValuesOfs(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for s. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfs(final Float pNumber, final Integer pC) { - return rawStreamAllValuesOfs(new Object[]{pNumber, null, pC}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for c. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfc(final Object[] parameters) { - return rawStreamAllValues(POSITION_C, parameters).map(Integer.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for c. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfc() { - return rawStreamAllValuesOfc(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for c. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfc() { - return rawStreamAllValuesOfc(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for c. - *

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfc(final Float pNumber, final Integer pS) { - return rawStreamAllValuesOfc(new Object[]{pNumber, pS, null}); - } - - /** - * Retrieve the set of values that occur in matches for c. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfc(final AverageNumberOfAttributes.Match partialMatch) { - return rawStreamAllValuesOfc(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for c. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfc(final Float pNumber, final Integer pS) { - return rawStreamAllValuesOfc(new Object[]{pNumber, pS, null}).collect(Collectors.toSet()); - } - - @Override - protected AverageNumberOfAttributes.Match tupleToMatch(final Tuple t) { - try { - return AverageNumberOfAttributes.Match.newMatch((Float) t.get(POSITION_NUMBER), (Integer) t.get(POSITION_S), (Integer) t.get(POSITION_C)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected AverageNumberOfAttributes.Match arrayToMatch(final Object[] match) { - try { - return AverageNumberOfAttributes.Match.newMatch((Float) match[POSITION_NUMBER], (Integer) match[POSITION_S], (Integer) match[POSITION_C]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected AverageNumberOfAttributes.Match arrayToMatchMutable(final Object[] match) { - try { - return AverageNumberOfAttributes.Match.newMutableMatch((Float) match[POSITION_NUMBER], (Integer) match[POSITION_S], (Integer) match[POSITION_C]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return AverageNumberOfAttributes.instance(); - } - } - - private AverageNumberOfAttributes() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static AverageNumberOfAttributes instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected AverageNumberOfAttributes.Matcher instantiate(final ViatraQueryEngine engine) { - return AverageNumberOfAttributes.Matcher.on(engine); - } - - @Override - public AverageNumberOfAttributes.Matcher instantiate() { - return AverageNumberOfAttributes.Matcher.create(); - } - - @Override - public AverageNumberOfAttributes.Match newEmptyMatch() { - return AverageNumberOfAttributes.Match.newEmptyMatch(); - } - - @Override - public AverageNumberOfAttributes.Match newMatch(final Object... parameters) { - return AverageNumberOfAttributes.Match.newMatch((java.lang.Float) parameters[0], (java.lang.Integer) parameters[1], (java.lang.Integer) parameters[2]); - } - - /** - * Inner class allowing the singleton instance of {@link JvmGenericType: com.incquerylabs.v4md.test.queries.AverageNumberOfAttributes (visibility: PUBLIC, simpleName: AverageNumberOfAttributes, identifier: com.incquerylabs.v4md.test.queries.AverageNumberOfAttributes, deprecated: ) (abstract: false, static: false, final: true, packageName: com.incquerylabs.v4md.test.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link JvmGenericType: com.incquerylabs.v4md.test.queries.AverageNumberOfAttributes (visibility: PUBLIC, simpleName: AverageNumberOfAttributes, identifier: com.incquerylabs.v4md.test.queries.AverageNumberOfAttributes, deprecated: ) (abstract: false, static: false, final: true, packageName: com.incquerylabs.v4md.test.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static AverageNumberOfAttributes.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_number = new PParameter("number", "java.lang.Float", new JavaTransitiveInstancesKey(java.lang.Float.class), PParameterDirection.INOUT); - - private final PParameter parameter_s = new PParameter("s", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); - - private final PParameter parameter_c = new PParameter("c", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_number, parameter_s, parameter_c); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.averageNumberOfAttributes"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("number","s","c"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_number = body.getOrCreateVariableByName("number"); - PVariable var_s = body.getOrCreateVariableByName("s"); - PVariable var_c = body.getOrCreateVariableByName("c"); - PVariable var__c = body.getOrCreateVariableByName("_c"); - PVariable var__tempNumber = body.getOrCreateVariableByName("#tempNumber"); - PVariable var__c2 = body.getOrCreateVariableByName("_c2"); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_number), new JavaTransitiveInstancesKey(java.lang.Float.class)); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_s), new JavaTransitiveInstancesKey(java.lang.Integer.class)); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_c), new JavaTransitiveInstancesKey(java.lang.Integer.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_number, parameter_number), - new ExportedParameter(body, var_s, parameter_s), - new ExportedParameter(body, var_c, parameter_c) - )); - // //calculates sum s == sum find classNumberOfAttributes(_c, #tempNumber) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new AggregatorConstraint(new sum().getAggregatorLogic(Integer.class), body, Tuples.flatTupleOf(var__c, var__tempNumber), ClassNumberOfAttributes.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); - new Equality(body, var_s, var__virtual_0_); - // //determines the number of classes c == count find classes(_c2) - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new PatternMatchCounter(body, Tuples.flatTupleOf(var__c2), Classes.instance().getInternalQueryRepresentation(), var__virtual_1_); - new Equality(body, var_c, var__virtual_1_); - // //Calculates average in an eval() expression //similar to check() in an eval expression standard Java code can be used number == eval(s.floatValue/c.floatValue) - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern averageNumberOfAttributes"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("c", "s");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - Integer c = (Integer) provider.getValue("c"); - Integer s = (Integer) provider.getValue("s"); - return evaluateExpression_1_1(c, s); - } - }, var__virtual_2_ ); - new Equality(body, var_number, var__virtual_2_); - bodies.add(body); - } - return bodies; - } - } - - private static float evaluateExpression_1_1(final Integer c, final Integer s) { - float _floatValue = s.floatValue(); - float _floatValue_1 = c.floatValue(); - float _divide = (_floatValue / _floatValue_1); - return _divide; - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Block_With_More_than_1_Parent.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Block_With_More_than_1_Parent.java deleted file mode 100644 index 8ae4f57..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Block_With_More_than_1_Parent.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Block_With_More_than_1_Parent.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.BlocksWithDeepGeneralizationHierarchy; -import com.incquerylabs.v4md.test.queries.GetSuperClasses; -import com.incquerylabs.v4md.test.queries.MultipleInheritanceBlock; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in Block_With_More_than_1_Parent.vql. - * - *

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

From package com.incquerylabs.v4md.test.queries, the group contains the definition of the following patterns:

    - *
  • BlocksWithDeepGeneralizationHierarchy
  • - *
  • MultipleInheritanceBlock
  • - *
  • getSuperClasses
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class Block_With_More_than_1_Parent extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static Block_With_More_than_1_Parent instance() { - if (INSTANCE == null) { - INSTANCE = new Block_With_More_than_1_Parent(); - } - return INSTANCE; - } - - private static Block_With_More_than_1_Parent INSTANCE; - - private Block_With_More_than_1_Parent() { - querySpecifications.add(BlocksWithDeepGeneralizationHierarchy.instance()); - querySpecifications.add(MultipleInheritanceBlock.instance()); - querySpecifications.add(GetSuperClasses.instance()); - } - - public BlocksWithDeepGeneralizationHierarchy getBlocksWithDeepGeneralizationHierarchy() { - return BlocksWithDeepGeneralizationHierarchy.instance(); - } - - public BlocksWithDeepGeneralizationHierarchy.Matcher getBlocksWithDeepGeneralizationHierarchy(final ViatraQueryEngine engine) { - return BlocksWithDeepGeneralizationHierarchy.Matcher.on(engine); - } - - public MultipleInheritanceBlock getMultipleInheritanceBlock() { - return MultipleInheritanceBlock.instance(); - } - - public MultipleInheritanceBlock.Matcher getMultipleInheritanceBlock(final ViatraQueryEngine engine) { - return MultipleInheritanceBlock.Matcher.on(engine); - } - - public GetSuperClasses getGetSuperClasses() { - return GetSuperClasses.instance(); - } - - public GetSuperClasses.Matcher getGetSuperClasses(final ViatraQueryEngine engine) { - return GetSuperClasses.Matcher.on(engine); - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Blocks.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Blocks.java deleted file mode 100644 index 8886506..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Blocks.java +++ /dev/null @@ -1,552 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Subpattern_Calls.vql - */ -package com.incquerylabs.v4md.test.queries; - -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         pattern blocks(class : Class){
- *         	//constraint that queries every class that has an instance of the "Block" stereotype
- *         	Class.appliedStereotypeInstance.classifier.name(class, "Block");
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class Blocks extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.blocks pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

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

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

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

Original source: - *

- *         pattern BlocksWithDeepGeneralizationHierarchy(block : Class, superClass : Class) {
- *         	Class.appliedStereotypeInstance.classifier.name(block, "Block");
- *             parents == count find getSuperClasses(block, _);
- *             find getSuperClasses(block, superClass);
- *             check(parents {@literal >} 1);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class BlocksWithDeepGeneralizationHierarchy extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.BlocksWithDeepGeneralizationHierarchy pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

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

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfblock(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSuperClass) { - return rawStreamAllValuesOfblock(new Object[]{null, pSuperClass}); - } - - /** - * Retrieve the set of values that occur in matches for block. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfblock(final BlocksWithDeepGeneralizationHierarchy.Match partialMatch) { - return rawStreamAllValuesOfblock(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for block. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfblock(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSuperClass) { - return rawStreamAllValuesOfblock(new Object[]{null, pSuperClass}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfsuperClass(final Object[] parameters) { - return rawStreamAllValues(POSITION_SUPERCLASS, parameters).map(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsuperClass() { - return rawStreamAllValuesOfsuperClass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsuperClass() { - return rawStreamAllValuesOfsuperClass(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - *

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

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

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static BlocksWithDeepGeneralizationHierarchy.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_block = new PParameter("block", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final PParameter parameter_superClass = new PParameter("superClass", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_block, parameter_superClass); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.BlocksWithDeepGeneralizationHierarchy"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("block","superClass"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_block = body.getOrCreateVariableByName("block"); - PVariable var_superClass = body.getOrCreateVariableByName("superClass"); - PVariable var_parents = body.getOrCreateVariableByName("parents"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_block), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_superClass), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_block, parameter_block), - new ExportedParameter(body, var_superClass, parameter_superClass) - )); - // Class.appliedStereotypeInstance.classifier.name(block, "Block") - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, "Block"); - new TypeConstraint(body, Tuples.flatTupleOf(var_block), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_block, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Element", "appliedStereotypeInstance"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification", "classifier"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_3_, var__virtual_0_); - // parents == count find getSuperClasses(block, _) - PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); - new PatternMatchCounter(body, Tuples.flatTupleOf(var_block, var___0_), GetSuperClasses.instance().getInternalQueryRepresentation(), var__virtual_4_); - new Equality(body, var_parents, var__virtual_4_); - // find getSuperClasses(block, superClass) - new PositivePatternCall(body, Tuples.flatTupleOf(var_block, var_superClass), GetSuperClasses.instance().getInternalQueryRepresentation()); - // check(parents > 1) - new ExpressionEvaluation(body, new IExpressionEvaluator() { - - @Override - public String getShortDescription() { - return "Expression evaluation from pattern BlocksWithDeepGeneralizationHierarchy"; - } - - @Override - public Iterable getInputParameterNames() { - return Arrays.asList("parents");} - - @Override - public Object evaluateExpression(IValueProvider provider) throws Exception { - Integer parents = (Integer) provider.getValue("parents"); - return evaluateExpression_1_1(parents); - } - }, null); - bodies.add(body); - } - return bodies; - } - } - - private static boolean evaluateExpression_1_1(final Integer parents) { - return ((parents).intValue() > 1); - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/BlocksWithNonEmptyName.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/BlocksWithNonEmptyName.java deleted file mode 100644 index e4b3614..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/BlocksWithNonEmptyName.java +++ /dev/null @@ -1,551 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Subpattern_Calls.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.Blocks; -import com.incquerylabs.v4md.test.queries.ClassesWithEmptyName; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         //Main pattern that queries every block in the model with a non emty name
- *         //Note that you  dont need to check the subpatterns to be able to execute the main query,
- *         // as during runtime queries are flattened, meaning that subpattern calls are replaced with the body of the called query
- *         pattern blocksWithNonEmptyName(class : Class){
- *         	//Filter for block
- *         	find blocks(class);
- *         	//Negative subpattern call --{@literal >} true for classes that do not have an empty name
- *         	neg find classesWithEmptyName(class);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class BlocksWithNonEmptyName extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.blocksWithNonEmptyName pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

-   * //Main pattern that queries every block in the model with a non emty name
-   * //Note that you  dont need to check the subpatterns to be able to execute the main query,
-   * // as during runtime queries are flattened, meaning that subpattern calls are replaced with the body of the called query
-   * pattern blocksWithNonEmptyName(class : Class){
-   * 	//Filter for block
-   * 	find blocks(class);
-   * 	//Negative subpattern call --{@literal >} true for classes that do not have an empty name
-   * 	neg find classesWithEmptyName(class);
-   * }
-   * 
- * - * @see Match - * @see BlocksWithNonEmptyName - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static BlocksWithNonEmptyName.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static BlocksWithNonEmptyName.Matcher create() { - return new Matcher(); - } - - private final static int POSITION_CLASS = 0; - - private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(BlocksWithNonEmptyName.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass) { - return rawStreamAllMatches(new Object[]{pClass}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

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

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

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static BlocksWithNonEmptyName.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_class = new PParameter("class", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_class); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.blocksWithNonEmptyName"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("class"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class) - )); - // //Filter for block find blocks(class) - new PositivePatternCall(body, Tuples.flatTupleOf(var_class), Blocks.instance().getInternalQueryRepresentation()); - // //Negative subpattern call --> true for classes that do not have an empty name neg find classesWithEmptyName(class) - new NegativePatternCall(body, Tuples.flatTupleOf(var_class), ClassesWithEmptyName.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Check_Expression.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Check_Expression.java deleted file mode 100644 index afbac3c..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Check_Expression.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Check_Expression.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.ClassesWithNameThatContainsID; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in Check_Expression.vql. - * - *

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

From package com.incquerylabs.v4md.test.queries, the group contains the definition of the following patterns:

    - *
  • classesWithNameThatContainsID
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class Check_Expression extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static Check_Expression instance() { - if (INSTANCE == null) { - INSTANCE = new Check_Expression(); - } - return INSTANCE; - } - - private static Check_Expression INSTANCE; - - private Check_Expression() { - querySpecifications.add(ClassesWithNameThatContainsID.instance()); - } - - public ClassesWithNameThatContainsID getClassesWithNameThatContainsID() { - return ClassesWithNameThatContainsID.instance(); - } - - public ClassesWithNameThatContainsID.Matcher getClassesWithNameThatContainsID(final ViatraQueryEngine engine) { - return ClassesWithNameThatContainsID.Matcher.on(engine); - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/CircularDependencyError.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/CircularDependencyError.java deleted file mode 100644 index c32847f..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/CircularDependencyError.java +++ /dev/null @@ -1,542 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Circular_Dependency.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.DependencyChain; -import com.nomagic.uml2.ext.magicdraw.classes.mddependencies.Dependency; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Pattern responsible for detecting circular dependency chains in UML models
- *          
- *         pattern CircularDependencyError(dep : Dependency) {
- *             //Call transitive closure of sub-pattern 'DependencyChain'
- *             find DependencyChain+(dep, dep);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class CircularDependencyError extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.CircularDependencyError pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

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

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static CircularDependencyError.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_dep = new PParameter("dep", "com.nomagic.uml2.ext.magicdraw.classes.mddependencies.Dependency", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_dep); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.CircularDependencyError"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("dep"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_dep = body.getOrCreateVariableByName("dep"); - new TypeConstraint(body, Tuples.flatTupleOf(var_dep), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_dep, parameter_dep) - )); - // //Call transitive closure of sub-pattern 'DependencyChain' find DependencyChain+(dep, dep) - new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_dep, var_dep), DependencyChain.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Circular_Dependency.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Circular_Dependency.java deleted file mode 100644 index c5fce5c..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Circular_Dependency.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Circular_Dependency.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.CircularDependencyError; -import com.incquerylabs.v4md.test.queries.DependencyChain; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in Circular_Dependency.vql. - * - *

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

From package com.incquerylabs.v4md.test.queries, the group contains the definition of the following patterns:

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

Original source: - *

- *         //Maps classes to their owned properties
- *         pattern classAttributes(class : Class, attribute : Property){
- *         	Class.ownedAttribute(class, attribute);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class ClassAttributes extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.classAttributes pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

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

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass(final Property pAttribute) { - return rawStreamAllValuesOfclass(new Object[]{null, pAttribute}); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass(final ClassAttributes.Match partialMatch) { - return rawStreamAllValuesOfclass(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass(final Property pAttribute) { - return rawStreamAllValuesOfclass(new Object[]{null, pAttribute}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for attribute. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfattribute(final Object[] parameters) { - return rawStreamAllValues(POSITION_ATTRIBUTE, parameters).map(Property.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for attribute. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfattribute() { - return rawStreamAllValuesOfattribute(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for attribute. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfattribute() { - return rawStreamAllValuesOfattribute(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for attribute. - *

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

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

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

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

Original source: - *

- *         //Counts the number of properties of classes
- *         pattern classNumberOfAttributes(class : Class, number :  java Integer){
- *         	//Counts the number of matches of 'classAttributes' for each class
- *         	number == count find classAttributes(class, _);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class ClassNumberOfAttributes extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.classNumberOfAttributes pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

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

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

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

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

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

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static ClassNumberOfAttributes.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_class = new PParameter("class", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final PParameter parameter_number = new PParameter("number", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_class, parameter_number); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.classNumberOfAttributes"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("class","number"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - PVariable var_number = body.getOrCreateVariableByName("number"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_number), new JavaTransitiveInstancesKey(java.lang.Integer.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class), - new ExportedParameter(body, var_number, parameter_number) - )); - // //Counts the number of matches of 'classAttributes' for each class number == count find classAttributes(class, _) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new PatternMatchCounter(body, Tuples.flatTupleOf(var_class, var___0_), ClassAttributes.instance().getInternalQueryRepresentation(), var__virtual_0_); - new Equality(body, var_number, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/ClassWithMaxNumberOfAttributes.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/ClassWithMaxNumberOfAttributes.java deleted file mode 100644 index 70a8c31..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/ClassWithMaxNumberOfAttributes.java +++ /dev/null @@ -1,711 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Aggregator_Functions.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.ClassNumberOfAttributes; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.aggregators.max; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         //Queries the class with the most number of attributes
- *         pattern classWithMaxNumberOfAttributes(class : Class, number : java Integer) {
- *             	//Calculates the largest class number
- *         	//Note use # to determine which parameter should be used for aggregation
- *         	//in this case to calculate max
- *         	number == max find classNumberOfAttributes(_, #tempNumber);
- *         	//Queries the class with the highest number
- *         	find classNumberOfAttributes(class, number);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class ClassWithMaxNumberOfAttributes extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.classWithMaxNumberOfAttributes pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

-   * //Queries the class with the most number of attributes
-   * pattern classWithMaxNumberOfAttributes(class : Class, number : java Integer) {
-   *     	//Calculates the largest class number
-   * 	//Note use # to determine which parameter should be used for aggregation
-   * 	//in this case to calculate max
-   * 	number == max find classNumberOfAttributes(_, #tempNumber);
-   * 	//Queries the class with the highest number
-   * 	find classNumberOfAttributes(class, number);
-   * }
-   * 
- * - * @see Match - * @see ClassWithMaxNumberOfAttributes - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static ClassWithMaxNumberOfAttributes.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static ClassWithMaxNumberOfAttributes.Matcher create() { - return new Matcher(); - } - - private final static int POSITION_CLASS = 0; - - private final static int POSITION_NUMBER = 1; - - private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ClassWithMaxNumberOfAttributes.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @param pNumber the fixed value of pattern parameter number, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass, final Integer pNumber) { - return rawStreamAllMatches(new Object[]{pClass, pNumber}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

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

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

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

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

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

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

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static ClassWithMaxNumberOfAttributes.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_class = new PParameter("class", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final PParameter parameter_number = new PParameter("number", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_class, parameter_number); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.classWithMaxNumberOfAttributes"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("class","number"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - PVariable var_number = body.getOrCreateVariableByName("number"); - PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); - PVariable var__tempNumber = body.getOrCreateVariableByName("#tempNumber"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_number), new JavaTransitiveInstancesKey(java.lang.Integer.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class), - new ExportedParameter(body, var_number, parameter_number) - )); - // //Calculates the largest class number //Note use # to determine which parameter should be used for aggregation //in this case to calculate max number == max find classNumberOfAttributes(_, #tempNumber) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new AggregatorConstraint(new max().getAggregatorLogic(Integer.class), body, Tuples.flatTupleOf(var___0_, var__tempNumber), ClassNumberOfAttributes.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); - new Equality(body, var_number, var__virtual_0_); - // //Queries the class with the highest number find classNumberOfAttributes(class, number) - new PositivePatternCall(body, Tuples.flatTupleOf(var_class, var_number), ClassNumberOfAttributes.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Classes.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Classes.java deleted file mode 100644 index 586b31d..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Classes.java +++ /dev/null @@ -1,535 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Aggregator_Functions.vql - */ -package com.incquerylabs.v4md.test.queries; - -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

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

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

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

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

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

Original source: - *

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

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

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

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

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

Original source: - *

- *         pattern classesWithEmptyName(class : Class){
- *         	//simple pattern constraint --{@literal >} maps classes to their names
- *         	Class.name(class, name);
- *         	//check expression --{@literal >} checks if the name is an empty string
- *         	check(name.equals(""));
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class ClassesWithEmptyName extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.classesWithEmptyName pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

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

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

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

Original source: - *

- *         pattern classesWithNameThatContainsID(class : Class){
- *         	Class.name(class, name);
- *         	//Check expression that checks if the class' name contains the substring 'id'
- *         	//Inside a check expression standard java code can be used (in this case String.equals)
- *         	check(name.contains("id"));
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class ClassesWithNameThatContainsID extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.classesWithNameThatContainsID pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

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

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

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

Original source: - *

- *         //Classes that have attributes that have the same name
- *         pattern classesWithSameNamedProperty(class1 : Class, class2 : Class, name : java String){
- *         	//using the 'name' parameter in both places will ensure that the name is the same
- *         	Class.ownedAttribute.name(class1, name);
- *         	Class.ownedAttribute.name(class2, name);
- *         	//Ensure that they are not the same class
- *         	class1 != class2;
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class ClassesWithSameNamedProperty extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.classesWithSameNamedProperty pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

-   * //Classes that have attributes that have the same name
-   * pattern classesWithSameNamedProperty(class1 : Class, class2 : Class, name : java String){
-   * 	//using the 'name' parameter in both places will ensure that the name is the same
-   * 	Class.ownedAttribute.name(class1, name);
-   * 	Class.ownedAttribute.name(class2, name);
-   * 	//Ensure that they are not the same class
-   * 	class1 != class2;
-   * }
-   * 
- * - * @see Match - * @see ClassesWithSameNamedProperty - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static ClassesWithSameNamedProperty.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static ClassesWithSameNamedProperty.Matcher create() { - return new Matcher(); - } - - private final static int POSITION_CLASS1 = 0; - - private final static int POSITION_CLASS2 = 1; - - private final static int POSITION_NAME = 2; - - private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ClassesWithSameNamedProperty.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass1 the fixed value of pattern parameter class1, or null if not bound. - * @param pClass2 the fixed value of pattern parameter class2, or null if not bound. - * @param pName the fixed value of pattern parameter name, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass1, final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass2, final String pName) { - return rawStreamAllMatches(new Object[]{pClass1, pClass2, pName}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

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

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

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass1(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass2, final String pName) { - return rawStreamAllValuesOfclass1(new Object[]{null, pClass2, pName}); - } - - /** - * Retrieve the set of values that occur in matches for class1. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass1(final ClassesWithSameNamedProperty.Match partialMatch) { - return rawStreamAllValuesOfclass1(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class1. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass1(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass2, final String pName) { - return rawStreamAllValuesOfclass1(new Object[]{null, pClass2, pName}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class2. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfclass2(final Object[] parameters) { - return rawStreamAllValues(POSITION_CLASS2, parameters).map(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for class2. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass2() { - return rawStreamAllValuesOfclass2(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class2. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass2() { - return rawStreamAllValuesOfclass2(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for class2. - *

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

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

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

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

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static ClassesWithSameNamedProperty.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_class1 = new PParameter("class1", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final PParameter parameter_class2 = new PParameter("class2", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final PParameter parameter_name = new PParameter("name", "java.lang.String", new JavaTransitiveInstancesKey(java.lang.String.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_class1, parameter_class2, parameter_name); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.classesWithSameNamedProperty"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("class1","class2","name"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_class1 = body.getOrCreateVariableByName("class1"); - PVariable var_class2 = body.getOrCreateVariableByName("class2"); - PVariable var_name = body.getOrCreateVariableByName("name"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_class2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_name), new JavaTransitiveInstancesKey(java.lang.String.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class1, parameter_class1), - new ExportedParameter(body, var_class2, parameter_class2), - new ExportedParameter(body, var_name, parameter_name) - )); - // //using the 'name' parameter in both places will ensure that the name is the same Class.ownedAttribute.name(class1, name) - new TypeConstraint(body, Tuples.flatTupleOf(var_class1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class1, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "StructuredClassifier", "ownedAttribute"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Property"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_1_, var_name); - // Class.ownedAttribute.name(class2, name) - new TypeConstraint(body, Tuples.flatTupleOf(var_class2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class2, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "StructuredClassifier", "ownedAttribute"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Property"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_3_, var_name); - // //Ensure that they are not the same class class1 != class2 - new Inequality(body, var_class1, var_class2); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/DependencyChain.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/DependencyChain.java deleted file mode 100644 index 039c1c7..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/DependencyChain.java +++ /dev/null @@ -1,706 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Circular_Dependency.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.nomagic.uml2.ext.magicdraw.classes.mddependencies.Dependency; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

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

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

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

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

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

Original source: - *

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

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

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

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

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

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

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

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

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

Original source: - *

- *         Get superclasses of a class
- *           maps a class to its superclass --{@literal >} the main pattern uses this subpattern to produce a class generalization hierarchy
- *          
- *         pattern getSuperClass(class : Classifier, superClass: Classifier) {
- *         	Generalization.general(gen, superClass);
- *         	Generalization.specific(gen, class);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class GetSuperClass extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.getSuperClass pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

-   * Get superclasses of a class
-   *   maps a class to its superclass --{@literal >} the main pattern uses this subpattern to produce a class generalization hierarchy
-   *  
-   * pattern getSuperClass(class : Classifier, superClass: Classifier) {
-   * 	Generalization.general(gen, superClass);
-   * 	Generalization.specific(gen, class);
-   * }
-   * 
- * - * @see Match - * @see GetSuperClass - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static GetSuperClass.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static GetSuperClass.Matcher create() { - return new Matcher(); - } - - private final static int POSITION_CLASS = 0; - - private final static int POSITION_SUPERCLASS = 1; - - private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(GetSuperClass.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @param pSuperClass the fixed value of pattern parameter superClass, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Classifier pClass, final Classifier pSuperClass) { - return rawStreamAllMatches(new Object[]{pClass, pSuperClass}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

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

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @param pSuperClass the fixed value of pattern parameter superClass, or null if not bound. - * @return the (partial) match object. - * - */ - public GetSuperClass.Match newMatch(final Classifier pClass, final Classifier pSuperClass) { - return GetSuperClass.Match.newMatch(pClass, pSuperClass); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfclass(final Object[] parameters) { - return rawStreamAllValues(POSITION_CLASS, parameters).map(Classifier.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for class. - *

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass(final Classifier pSuperClass) { - return rawStreamAllValuesOfclass(new Object[]{null, pSuperClass}); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass(final GetSuperClass.Match partialMatch) { - return rawStreamAllValuesOfclass(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass(final Classifier pSuperClass) { - return rawStreamAllValuesOfclass(new Object[]{null, pSuperClass}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfsuperClass(final Object[] parameters) { - return rawStreamAllValues(POSITION_SUPERCLASS, parameters).map(Classifier.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsuperClass() { - return rawStreamAllValuesOfsuperClass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsuperClass() { - return rawStreamAllValuesOfsuperClass(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - *

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

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

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

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

Original source: - *

- *         Produce Class inheritance hierarchy
- *           'or' keyword represents an or relation between bodies --{@literal >} one of them needs to apply to the parameters for them to produce a match
- *           note that the transitive closure does not appear as parameters of a single match, but a number of matches in a following way:
- *           class1 --{@literal >} parent1
- *           class1 --{@literal >} parent2 
- *           ...
- *          
- *         pattern getSuperClassOrSelf(class : Classifier, superClass: Classifier) {
- *         	//  semantics for transitive closure can be implemented this way
- *         	// by default the transitive closure does not add the trivial relation to the TC
- *         	class == superClass;
- *         } or {
- *         	//transitive closure
- *         	find getSuperClass+(class, superClass);
- *         	
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class GetSuperClassOrSelf extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.getSuperClassOrSelf pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

-   * Produce Class inheritance hierarchy
-   *   'or' keyword represents an or relation between bodies --{@literal >} one of them needs to apply to the parameters for them to produce a match
-   *   note that the transitive closure does not appear as parameters of a single match, but a number of matches in a following way:
-   *   class1 --{@literal >} parent1
-   *   class1 --{@literal >} parent2 
-   *   ...
-   *  
-   * pattern getSuperClassOrSelf(class : Classifier, superClass: Classifier) {
-   * 	//  semantics for transitive closure can be implemented this way
-   * 	// by default the transitive closure does not add the trivial relation to the TC
-   * 	class == superClass;
-   * } or {
-   * 	//transitive closure
-   * 	find getSuperClass+(class, superClass);
-   * 	
-   * }
-   * 
- * - * @see Match - * @see GetSuperClassOrSelf - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static GetSuperClassOrSelf.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static GetSuperClassOrSelf.Matcher create() { - return new Matcher(); - } - - private final static int POSITION_CLASS = 0; - - private final static int POSITION_SUPERCLASS = 1; - - private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(GetSuperClassOrSelf.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @param pSuperClass the fixed value of pattern parameter superClass, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Classifier pClass, final Classifier pSuperClass) { - return rawStreamAllMatches(new Object[]{pClass, pSuperClass}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

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

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @param pSuperClass the fixed value of pattern parameter superClass, or null if not bound. - * @return the (partial) match object. - * - */ - public GetSuperClassOrSelf.Match newMatch(final Classifier pClass, final Classifier pSuperClass) { - return GetSuperClassOrSelf.Match.newMatch(pClass, pSuperClass); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfclass(final Object[] parameters) { - return rawStreamAllValues(POSITION_CLASS, parameters).map(Classifier.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for class. - *

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass(final Classifier pSuperClass) { - return rawStreamAllValuesOfclass(new Object[]{null, pSuperClass}); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass(final GetSuperClassOrSelf.Match partialMatch) { - return rawStreamAllValuesOfclass(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass(final Classifier pSuperClass) { - return rawStreamAllValuesOfclass(new Object[]{null, pSuperClass}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfsuperClass(final Object[] parameters) { - return rawStreamAllValues(POSITION_SUPERCLASS, parameters).map(Classifier.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsuperClass() { - return rawStreamAllValuesOfsuperClass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsuperClass() { - return rawStreamAllValuesOfsuperClass(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - *

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

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

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static GetSuperClassOrSelf.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_class = new PParameter("class", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Classifier", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier")), PParameterDirection.INOUT); - - private final PParameter parameter_superClass = new PParameter("superClass", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Classifier", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_class, parameter_superClass); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.getSuperClassOrSelf"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("class","superClass"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - PVariable var_superClass = body.getOrCreateVariableByName("superClass"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_superClass), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class), - new ExportedParameter(body, var_superClass, parameter_superClass) - )); - // // * semantics for transitive closure can be implemented this way // by default the transitive closure does not add the trivial relation to the TC class == superClass - new Equality(body, var_class, var_superClass); - bodies.add(body); - } - { - PBody body = new PBody(this); - PVariable var_class = body.getOrCreateVariableByName("class"); - PVariable var_superClass = body.getOrCreateVariableByName("superClass"); - new TypeConstraint(body, Tuples.flatTupleOf(var_class), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_superClass), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_class, parameter_class), - new ExportedParameter(body, var_superClass, parameter_superClass) - )); - // //transitive closure find getSuperClass+(class, superClass) - new BinaryTransitiveClosure(body, Tuples.flatTupleOf(var_class, var_superClass), GetSuperClass.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/GetSuperClasses.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/GetSuperClasses.java deleted file mode 100644 index d814090..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/GetSuperClasses.java +++ /dev/null @@ -1,689 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Block_With_More_than_1_Parent.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.GetSuperClass; -import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Classifier; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         pattern getSuperClasses(class : Classifier, superClass: Classifier){
- *         	find getSuperClass+(class, superClass); 
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class GetSuperClasses extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.getSuperClasses pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pClass the fixed value of pattern parameter class, or null if not bound. - * @param pSuperClass the fixed value of pattern parameter superClass, or null if not bound. - * @return the (partial) match object. - * - */ - public GetSuperClasses.Match newMatch(final Classifier pClass, final Classifier pSuperClass) { - return GetSuperClasses.Match.newMatch(pClass, pSuperClass); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfclass(final Object[] parameters) { - return rawStreamAllValues(POSITION_CLASS, parameters).map(Classifier.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass() { - return rawStreamAllValuesOfclass(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for class. - *

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfclass(final Classifier pSuperClass) { - return rawStreamAllValuesOfclass(new Object[]{null, pSuperClass}); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass(final GetSuperClasses.Match partialMatch) { - return rawStreamAllValuesOfclass(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for class. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfclass(final Classifier pSuperClass) { - return rawStreamAllValuesOfclass(new Object[]{null, pSuperClass}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfsuperClass(final Object[] parameters) { - return rawStreamAllValues(POSITION_SUPERCLASS, parameters).map(Classifier.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfsuperClass() { - return rawStreamAllValuesOfsuperClass(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfsuperClass() { - return rawStreamAllValuesOfsuperClass(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for superClass. - *

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

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

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

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

Original source: - *

- *         Pattern responsible for detecting duplicate ID Property tagged values 
- *          
- *         pattern IDStringPropertyEqualityError(elem : NamedElement, property : Property){
- *         	find PropertyStringValueEquals(elem, otherElement, property);
- *         	elem != otherElement;
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class IDStringPropertyEqualityError extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.IDStringPropertyEqualityError pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pElem the fixed value of pattern parameter elem, or null if not bound. - * @param pProperty the fixed value of pattern parameter property, or null if not bound. - * @return the (partial) match object. - * - */ - public IDStringPropertyEqualityError.Match newMatch(final NamedElement pElem, final Property pProperty) { - return IDStringPropertyEqualityError.Match.newMatch(pElem, pProperty); - } - - /** - * Retrieve the set of values that occur in matches for elem. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfelem(final Object[] parameters) { - return rawStreamAllValues(POSITION_ELEM, parameters).map(NamedElement.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for elem. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfelem() { - return rawStreamAllValuesOfelem(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for elem. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfelem() { - return rawStreamAllValuesOfelem(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for elem. - *

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfelem(final Property pProperty) { - return rawStreamAllValuesOfelem(new Object[]{null, pProperty}); - } - - /** - * Retrieve the set of values that occur in matches for elem. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfelem(final IDStringPropertyEqualityError.Match partialMatch) { - return rawStreamAllValuesOfelem(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for elem. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfelem(final Property pProperty) { - return rawStreamAllValuesOfelem(new Object[]{null, pProperty}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for property. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfproperty(final Object[] parameters) { - return rawStreamAllValues(POSITION_PROPERTY, parameters).map(Property.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for property. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfproperty() { - return rawStreamAllValuesOfproperty(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for property. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfproperty() { - return rawStreamAllValuesOfproperty(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for property. - *

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

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

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static IDStringPropertyEqualityError.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_elem = new PParameter("elem", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement")), PParameterDirection.INOUT); - - private final PParameter parameter_property = new PParameter("property", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Property", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Property")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_elem, parameter_property); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.IDStringPropertyEqualityError"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("elem","property"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_elem = body.getOrCreateVariableByName("elem"); - PVariable var_property = body.getOrCreateVariableByName("property"); - PVariable var_otherElement = body.getOrCreateVariableByName("otherElement"); - new TypeConstraint(body, Tuples.flatTupleOf(var_elem), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_property), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Property"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_elem, parameter_elem), - new ExportedParameter(body, var_property, parameter_property) - )); - // find PropertyStringValueEquals(elem, otherElement, property) - new PositivePatternCall(body, Tuples.flatTupleOf(var_elem, var_otherElement, var_property), PropertyStringValueEquals.instance().getInternalQueryRepresentation()); - // elem != otherElement - new Inequality(body, var_elem, var_otherElement); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/MultipleInheritanceBlock.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/MultipleInheritanceBlock.java deleted file mode 100644 index 5c99150..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/MultipleInheritanceBlock.java +++ /dev/null @@ -1,719 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Block_With_More_than_1_Parent.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.GetSuperClass; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         pattern MultipleInheritanceBlock(block : Class, parent1 : Class){
- *         	Class.appliedStereotypeInstance.classifier.name(block, "Block");
- *         	find getSuperClass(block, parent1);
- *         	find getSuperClass(block, parent2);
- *         	parent1 != parent2;
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class MultipleInheritanceBlock extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.MultipleInheritanceBlock pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

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

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfblock(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pParent1) { - return rawStreamAllValuesOfblock(new Object[]{null, pParent1}); - } - - /** - * Retrieve the set of values that occur in matches for block. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfblock(final MultipleInheritanceBlock.Match partialMatch) { - return rawStreamAllValuesOfblock(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for block. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfblock(final com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pParent1) { - return rawStreamAllValuesOfblock(new Object[]{null, pParent1}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for parent1. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfparent1(final Object[] parameters) { - return rawStreamAllValues(POSITION_PARENT1, parameters).map(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for parent1. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfparent1() { - return rawStreamAllValuesOfparent1(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for parent1. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfparent1() { - return rawStreamAllValuesOfparent1(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for parent1. - *

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

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

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static MultipleInheritanceBlock.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_block = new PParameter("block", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final PParameter parameter_parent1 = new PParameter("parent1", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_block, parameter_parent1); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.MultipleInheritanceBlock"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("block","parent1"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_block = body.getOrCreateVariableByName("block"); - PVariable var_parent1 = body.getOrCreateVariableByName("parent1"); - PVariable var_parent2 = body.getOrCreateVariableByName("parent2"); - new TypeConstraint(body, Tuples.flatTupleOf(var_block), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_parent1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_block, parameter_block), - new ExportedParameter(body, var_parent1, parameter_parent1) - )); - // Class.appliedStereotypeInstance.classifier.name(block, "Block") - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, "Block"); - new TypeConstraint(body, Tuples.flatTupleOf(var_block), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_block, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Element", "appliedStereotypeInstance"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification", "classifier"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_3_, var__virtual_0_); - // find getSuperClass(block, parent1) - new PositivePatternCall(body, Tuples.flatTupleOf(var_block, var_parent1), GetSuperClass.instance().getInternalQueryRepresentation()); - // find getSuperClass(block, parent2) - new PositivePatternCall(body, Tuples.flatTupleOf(var_block, var_parent2), GetSuperClass.instance().getInternalQueryRepresentation()); - // parent1 != parent2 - new Inequality(body, var_parent1, var_parent2); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Non_Unique_Names.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Non_Unique_Names.java deleted file mode 100644 index 9e30e0c..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Non_Unique_Names.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Non_Unique_Names.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.IDStringPropertyEqualityError; -import com.incquerylabs.v4md.test.queries.PropertyStringValueEquals; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in Non_Unique_Names.vql. - * - *

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

From package com.incquerylabs.v4md.test.queries, the group contains the definition of the following patterns:

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

Original source: - *

- *         pattern notReachableFromInit(state : State){
- *             neg find reachableFromInitState(state);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class NotReachableFromInit extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.notReachableFromInit pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

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

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static NotReachableFromInit.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_state = new PParameter("state", "com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "State")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_state); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.notReachableFromInit"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("state"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_state = body.getOrCreateVariableByName("state"); - new TypeConstraint(body, Tuples.flatTupleOf(var_state), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "State"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_state, parameter_state) - )); - // neg find reachableFromInitState(state) - new NegativePatternCall(body, Tuples.flatTupleOf(var_state), ReachableFromInitState.instance().getInternalQueryRepresentation()); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Pattern_Constraints.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Pattern_Constraints.java deleted file mode 100644 index d312733..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Pattern_Constraints.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Pattern_Constraints.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.ClassesWithSameNamedProperty; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in Pattern_Constraints.vql. - * - *

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

From package com.incquerylabs.v4md.test.queries, the group contains the definition of the following patterns:

    - *
  • classesWithSameNamedProperty
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class Pattern_Constraints extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static Pattern_Constraints instance() { - if (INSTANCE == null) { - INSTANCE = new Pattern_Constraints(); - } - return INSTANCE; - } - - private static Pattern_Constraints INSTANCE; - - private Pattern_Constraints() { - querySpecifications.add(ClassesWithSameNamedProperty.instance()); - } - - public ClassesWithSameNamedProperty getClassesWithSameNamedProperty() { - return ClassesWithSameNamedProperty.instance(); - } - - public ClassesWithSameNamedProperty.Matcher getClassesWithSameNamedProperty(final ViatraQueryEngine engine) { - return ClassesWithSameNamedProperty.Matcher.on(engine); - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/PortConnections.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/PortConnections.java deleted file mode 100644 index 61c2c69..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/PortConnections.java +++ /dev/null @@ -1,836 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Port_Connections.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.nomagic.uml2.ext.magicdraw.compositestructures.mdinternalstructures.Connector; -import com.nomagic.uml2.ext.magicdraw.compositestructures.mdports.Port; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         pattern PortConnections(port1 : Port, connector : Connector, port2 : Port) {
- *             Connector.end(connector, end1);
- *             Connector.end(connector, end2);
- *             
- *             Port.end(port1, end1);
- *             Port.end(port2, end2);
- *             
- *             port1 != port2;
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class PortConnections extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.PortConnections pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pPort1 the fixed value of pattern parameter port1, or null if not bound. - * @param pConnector the fixed value of pattern parameter connector, or null if not bound. - * @param pPort2 the fixed value of pattern parameter port2, or null if not bound. - * @return the (partial) match object. - * - */ - public static PortConnections.Match newMatch(final Port pPort1, final Connector pConnector, final Port pPort2) { - return new Immutable(pPort1, pConnector, pPort2); - } - - private static final class Mutable extends PortConnections.Match { - Mutable(final Port pPort1, final Connector pConnector, final Port pPort2) { - super(pPort1, pConnector, pPort2); - } - - @Override - public boolean isMutable() { - return true; - } - } - - private static final class Immutable extends PortConnections.Match { - Immutable(final Port pPort1, final Connector pConnector, final Port pPort2) { - super(pPort1, pConnector, pPort2); - } - - @Override - public boolean isMutable() { - return false; - } - } - } - - /** - * Generated pattern matcher API of the com.incquerylabs.v4md.test.queries.PortConnections pattern, - * providing pattern-specific query methods. - * - *

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

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

Original source: - *

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

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

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pPort1 the fixed value of pattern parameter port1, or null if not bound. - * @param pConnector the fixed value of pattern parameter connector, or null if not bound. - * @param pPort2 the fixed value of pattern parameter port2, or null if not bound. - * @return the (partial) match object. - * - */ - public PortConnections.Match newMatch(final Port pPort1, final Connector pConnector, final Port pPort2) { - return PortConnections.Match.newMatch(pPort1, pConnector, pPort2); - } - - /** - * Retrieve the set of values that occur in matches for port1. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfport1(final Object[] parameters) { - return rawStreamAllValues(POSITION_PORT1, parameters).map(Port.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for port1. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfport1() { - return rawStreamAllValuesOfport1(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for port1. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfport1() { - return rawStreamAllValuesOfport1(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for port1. - *

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfport1(final Connector pConnector, final Port pPort2) { - return rawStreamAllValuesOfport1(new Object[]{null, pConnector, pPort2}); - } - - /** - * Retrieve the set of values that occur in matches for port1. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfport1(final PortConnections.Match partialMatch) { - return rawStreamAllValuesOfport1(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for port1. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfport1(final Connector pConnector, final Port pPort2) { - return rawStreamAllValuesOfport1(new Object[]{null, pConnector, pPort2}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for connector. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfconnector(final Object[] parameters) { - return rawStreamAllValues(POSITION_CONNECTOR, parameters).map(Connector.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for connector. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfconnector() { - return rawStreamAllValuesOfconnector(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for connector. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfconnector() { - return rawStreamAllValuesOfconnector(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for connector. - *

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfconnector(final Port pPort1, final Port pPort2) { - return rawStreamAllValuesOfconnector(new Object[]{pPort1, null, pPort2}); - } - - /** - * Retrieve the set of values that occur in matches for connector. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfconnector(final PortConnections.Match partialMatch) { - return rawStreamAllValuesOfconnector(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for connector. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfconnector(final Port pPort1, final Port pPort2) { - return rawStreamAllValuesOfconnector(new Object[]{pPort1, null, pPort2}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for port2. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfport2(final Object[] parameters) { - return rawStreamAllValues(POSITION_PORT2, parameters).map(Port.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for port2. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfport2() { - return rawStreamAllValuesOfport2(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for port2. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfport2() { - return rawStreamAllValuesOfport2(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for port2. - *

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfport2(final Port pPort1, final Connector pConnector) { - return rawStreamAllValuesOfport2(new Object[]{pPort1, pConnector, null}); - } - - /** - * Retrieve the set of values that occur in matches for port2. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfport2(final PortConnections.Match partialMatch) { - return rawStreamAllValuesOfport2(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for port2. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfport2(final Port pPort1, final Connector pConnector) { - return rawStreamAllValuesOfport2(new Object[]{pPort1, pConnector, null}).collect(Collectors.toSet()); - } - - @Override - protected PortConnections.Match tupleToMatch(final Tuple t) { - try { - return PortConnections.Match.newMatch((Port) t.get(POSITION_PORT1), (Connector) t.get(POSITION_CONNECTOR), (Port) t.get(POSITION_PORT2)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected PortConnections.Match arrayToMatch(final Object[] match) { - try { - return PortConnections.Match.newMatch((Port) match[POSITION_PORT1], (Connector) match[POSITION_CONNECTOR], (Port) match[POSITION_PORT2]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected PortConnections.Match arrayToMatchMutable(final Object[] match) { - try { - return PortConnections.Match.newMutableMatch((Port) match[POSITION_PORT1], (Connector) match[POSITION_CONNECTOR], (Port) match[POSITION_PORT2]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return PortConnections.instance(); - } - } - - private PortConnections() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static PortConnections instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected PortConnections.Matcher instantiate(final ViatraQueryEngine engine) { - return PortConnections.Matcher.on(engine); - } - - @Override - public PortConnections.Matcher instantiate() { - return PortConnections.Matcher.create(); - } - - @Override - public PortConnections.Match newEmptyMatch() { - return PortConnections.Match.newEmptyMatch(); - } - - @Override - public PortConnections.Match newMatch(final Object... parameters) { - return PortConnections.Match.newMatch((com.nomagic.uml2.ext.magicdraw.compositestructures.mdports.Port) parameters[0], (com.nomagic.uml2.ext.magicdraw.compositestructures.mdinternalstructures.Connector) parameters[1], (com.nomagic.uml2.ext.magicdraw.compositestructures.mdports.Port) parameters[2]); - } - - /** - * Inner class allowing the singleton instance of {@link JvmGenericType: com.incquerylabs.v4md.test.queries.PortConnections (visibility: PUBLIC, simpleName: PortConnections, identifier: com.incquerylabs.v4md.test.queries.PortConnections, deprecated: ) (abstract: false, static: false, final: true, packageName: com.incquerylabs.v4md.test.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link JvmGenericType: com.incquerylabs.v4md.test.queries.PortConnections (visibility: PUBLIC, simpleName: PortConnections, identifier: com.incquerylabs.v4md.test.queries.PortConnections, deprecated: ) (abstract: false, static: false, final: true, packageName: com.incquerylabs.v4md.test.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static PortConnections.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_port1 = new PParameter("port1", "com.nomagic.uml2.ext.magicdraw.compositestructures.mdports.Port", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Port")), PParameterDirection.INOUT); - - private final PParameter parameter_connector = new PParameter("connector", "com.nomagic.uml2.ext.magicdraw.compositestructures.mdinternalstructures.Connector", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Connector")), PParameterDirection.INOUT); - - private final PParameter parameter_port2 = new PParameter("port2", "com.nomagic.uml2.ext.magicdraw.compositestructures.mdports.Port", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Port")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_port1, parameter_connector, parameter_port2); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.PortConnections"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("port1","connector","port2"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_port1 = body.getOrCreateVariableByName("port1"); - PVariable var_connector = body.getOrCreateVariableByName("connector"); - PVariable var_port2 = body.getOrCreateVariableByName("port2"); - PVariable var_end1 = body.getOrCreateVariableByName("end1"); - PVariable var_end2 = body.getOrCreateVariableByName("end2"); - new TypeConstraint(body, Tuples.flatTupleOf(var_port1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Port"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_connector), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Connector"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_port2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Port"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_port1, parameter_port1), - new ExportedParameter(body, var_connector, parameter_connector), - new ExportedParameter(body, var_port2, parameter_port2) - )); - // Connector.end(connector, end1) - new TypeConstraint(body, Tuples.flatTupleOf(var_connector), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Connector"))); - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_connector, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Connector", "end"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "ConnectorEnd"))); - new Equality(body, var__virtual_0_, var_end1); - // Connector.end(connector, end2) - new TypeConstraint(body, Tuples.flatTupleOf(var_connector), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Connector"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_connector, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Connector", "end"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "ConnectorEnd"))); - new Equality(body, var__virtual_1_, var_end2); - // Port.end(port1, end1) - new TypeConstraint(body, Tuples.flatTupleOf(var_port1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Port"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_port1, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "ConnectableElement", "end"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "ConnectorEnd"))); - new Equality(body, var__virtual_2_, var_end1); - // Port.end(port2, end2) - new TypeConstraint(body, Tuples.flatTupleOf(var_port2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Port"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_port2, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "ConnectableElement", "end"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "ConnectorEnd"))); - new Equality(body, var__virtual_3_, var_end2); - // port1 != port2 - new Inequality(body, var_port1, var_port2); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Port_Connections.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Port_Connections.java deleted file mode 100644 index b8b4a2a..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Port_Connections.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Port_Connections.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.PortConnections; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in Port_Connections.vql. - * - *

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

From package com.incquerylabs.v4md.test.queries, the group contains the definition of the following patterns:

    - *
  • PortConnections
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class Port_Connections extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static Port_Connections instance() { - if (INSTANCE == null) { - INSTANCE = new Port_Connections(); - } - return INSTANCE; - } - - private static Port_Connections INSTANCE; - - private Port_Connections() { - querySpecifications.add(PortConnections.instance()); - } - - public PortConnections getPortConnections() { - return PortConnections.instance(); - } - - public PortConnections.Matcher getPortConnections(final ViatraQueryEngine engine) { - return PortConnections.Matcher.on(engine); - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/PropertyStringValueEquals.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/PropertyStringValueEquals.java deleted file mode 100644 index b23a53d..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/PropertyStringValueEquals.java +++ /dev/null @@ -1,905 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Non_Unique_Names.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement; -import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Property; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         Detects NamedElement pairs, where the values of the same STRING ID property are equal
- *          
- *         pattern PropertyStringValueEquals(element : NamedElement, element2 : NamedElement, property : Property){
- *         	element != element2;
- *         	Property.isID(property, true);
- *         	NamedElement.appliedStereotypeInstance.slot(element, slot);
- *         	Slot.definingFeature(slot, property);
- *         	
- *         	NamedElement.appliedStereotypeInstance.slot(element2, slot2);
- *         	Slot.definingFeature(slot2, property);
- *         	
- *         	Slot.value(slot, spec1);
- *         	Slot.value(slot2, spec2);
- *         	
- *         	LiteralString.value(spec1, val1);
- *         	LiteralString.value(spec2, val2);
- *         	val1 == val2;
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class PropertyStringValueEquals extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.PropertyStringValueEquals pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

-   * Detects NamedElement pairs, where the values of the same STRING ID property are equal
-   *  
-   * pattern PropertyStringValueEquals(element : NamedElement, element2 : NamedElement, property : Property){
-   * 	element != element2;
-   * 	Property.isID(property, true);
-   * 	NamedElement.appliedStereotypeInstance.slot(element, slot);
-   * 	Slot.definingFeature(slot, property);
-   * 	
-   * 	NamedElement.appliedStereotypeInstance.slot(element2, slot2);
-   * 	Slot.definingFeature(slot2, property);
-   * 	
-   * 	Slot.value(slot, spec1);
-   * 	Slot.value(slot2, spec2);
-   * 	
-   * 	LiteralString.value(spec1, val1);
-   * 	LiteralString.value(spec2, val2);
-   * 	val1 == val2;
-   * }
-   * 
- * - * @see Match - * @see PropertyStringValueEquals - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static PropertyStringValueEquals.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static PropertyStringValueEquals.Matcher create() { - return new Matcher(); - } - - private final static int POSITION_ELEMENT = 0; - - private final static int POSITION_ELEMENT2 = 1; - - private final static int POSITION_PROPERTY = 2; - - private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(PropertyStringValueEquals.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pElement the fixed value of pattern parameter element, or null if not bound. - * @param pElement2 the fixed value of pattern parameter element2, or null if not bound. - * @param pProperty the fixed value of pattern parameter property, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final NamedElement pElement, final NamedElement pElement2, final Property pProperty) { - return rawStreamAllMatches(new Object[]{pElement, pElement2, pProperty}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

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

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

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

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

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

- * NOTE: It is important not to modify the source model while the stream is being processed. - * If the match set of the pattern changes during processing, the contents of the stream is undefined. - * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. - * - * @return the Stream of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfelement2(final NamedElement pElement, final Property pProperty) { - return rawStreamAllValuesOfelement2(new Object[]{pElement, null, pProperty}); - } - - /** - * Retrieve the set of values that occur in matches for element2. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfelement2(final PropertyStringValueEquals.Match partialMatch) { - return rawStreamAllValuesOfelement2(partialMatch.toArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for element2. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfelement2(final NamedElement pElement, final Property pProperty) { - return rawStreamAllValuesOfelement2(new Object[]{pElement, null, pProperty}).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for property. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfproperty(final Object[] parameters) { - return rawStreamAllValues(POSITION_PROPERTY, parameters).map(Property.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for property. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfproperty() { - return rawStreamAllValuesOfproperty(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for property. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfproperty() { - return rawStreamAllValuesOfproperty(emptyArray()); - } - - /** - * Retrieve the set of values that occur in matches for property. - *

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

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

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static PropertyStringValueEquals.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_element = new PParameter("element", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement")), PParameterDirection.INOUT); - - private final PParameter parameter_element2 = new PParameter("element2", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement")), PParameterDirection.INOUT); - - private final PParameter parameter_property = new PParameter("property", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Property", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Property")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_element, parameter_element2, parameter_property); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.PropertyStringValueEquals"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("element","element2","property"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_element = body.getOrCreateVariableByName("element"); - PVariable var_element2 = body.getOrCreateVariableByName("element2"); - PVariable var_property = body.getOrCreateVariableByName("property"); - PVariable var_slot = body.getOrCreateVariableByName("slot"); - PVariable var_slot2 = body.getOrCreateVariableByName("slot2"); - PVariable var_spec1 = body.getOrCreateVariableByName("spec1"); - PVariable var_spec2 = body.getOrCreateVariableByName("spec2"); - PVariable var_val1 = body.getOrCreateVariableByName("val1"); - PVariable var_val2 = body.getOrCreateVariableByName("val2"); - new TypeConstraint(body, Tuples.flatTupleOf(var_element), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_element2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_property), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Property"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_element, parameter_element), - new ExportedParameter(body, var_element2, parameter_element2), - new ExportedParameter(body, var_property, parameter_property) - )); - // element != element2 - new Inequality(body, var_element, var_element2); - // Property.isID(property, true) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, true); - new TypeConstraint(body, Tuples.flatTupleOf(var_property), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Property"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_property, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Property", "isID"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Boolean"))); - new Equality(body, var__virtual_1_, var__virtual_0_); - // NamedElement.appliedStereotypeInstance.slot(element, slot) - new TypeConstraint(body, Tuples.flatTupleOf(var_element), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_element, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Element", "appliedStereotypeInstance"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification", "slot"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Slot"))); - new Equality(body, var__virtual_3_, var_slot); - // Slot.definingFeature(slot, property) - new TypeConstraint(body, Tuples.flatTupleOf(var_slot), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Slot"))); - PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_slot, var__virtual_4_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Slot", "definingFeature"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_4_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "StructuralFeature"))); - new Equality(body, var__virtual_4_, var_property); - // NamedElement.appliedStereotypeInstance.slot(element2, slot2) - new TypeConstraint(body, Tuples.flatTupleOf(var_element2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - PVariable var__virtual_5_ = body.getOrCreateVariableByName(".virtual{5}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_element2, var__virtual_5_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Element", "appliedStereotypeInstance"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_5_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification"))); - PVariable var__virtual_6_ = body.getOrCreateVariableByName(".virtual{6}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_5_, var__virtual_6_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification", "slot"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_6_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Slot"))); - new Equality(body, var__virtual_6_, var_slot2); - // Slot.definingFeature(slot2, property) - new TypeConstraint(body, Tuples.flatTupleOf(var_slot2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Slot"))); - PVariable var__virtual_7_ = body.getOrCreateVariableByName(".virtual{7}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_slot2, var__virtual_7_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Slot", "definingFeature"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_7_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "StructuralFeature"))); - new Equality(body, var__virtual_7_, var_property); - // Slot.value(slot, spec1) - new TypeConstraint(body, Tuples.flatTupleOf(var_slot), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Slot"))); - PVariable var__virtual_8_ = body.getOrCreateVariableByName(".virtual{8}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_slot, var__virtual_8_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Slot", "value"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_8_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "ValueSpecification"))); - new Equality(body, var__virtual_8_, var_spec1); - // Slot.value(slot2, spec2) - new TypeConstraint(body, Tuples.flatTupleOf(var_slot2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Slot"))); - PVariable var__virtual_9_ = body.getOrCreateVariableByName(".virtual{9}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_slot2, var__virtual_9_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Slot", "value"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_9_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "ValueSpecification"))); - new Equality(body, var__virtual_9_, var_spec2); - // LiteralString.value(spec1, val1) - new TypeConstraint(body, Tuples.flatTupleOf(var_spec1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "LiteralString"))); - PVariable var__virtual_10_ = body.getOrCreateVariableByName(".virtual{10}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_spec1, var__virtual_10_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "LiteralString", "value"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_10_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_10_, var_val1); - // LiteralString.value(spec2, val2) - new TypeConstraint(body, Tuples.flatTupleOf(var_spec2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "LiteralString"))); - PVariable var__virtual_11_ = body.getOrCreateVariableByName(".virtual{11}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_spec2, var__virtual_11_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "LiteralString", "value"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_11_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_11_, var_val2); - // val1 == val2 - new Equality(body, var_val1, var_val2); - bodies.add(body); - } - return bodies; - } - } - - private static boolean evaluateExpression_1_1() { - return true; - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/ReachableFromInitState.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/ReachableFromInitState.java deleted file mode 100644 index 4c23dbe..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/ReachableFromInitState.java +++ /dev/null @@ -1,552 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Unreachable_States.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.ReachableState; -import com.nomagic.uml2.ext.magicdraw.statemachines.mdbehaviorstatemachines.State; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey; -import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         pattern reachableFromInitState(state :State){
- *         	Pseudostate.kind(initnode, ::initial);
- *         	find reachableState+(initnode, state);	
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class ReachableFromInitState extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.reachableFromInitState pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

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

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

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

Original source: - *

- *         pattern reachableState(sourceState : Vertex, targetState : Vertex) {
- *             Transition.source(transition, sourceState);
- *             Transition.target(transition, targetState);
- *             sourceState != targetState;
- *             
- *             
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class ReachableState extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.reachableState pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

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

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

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

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

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

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

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

Original source: - *

- *         pattern RequirementRealization(requirement : Class, realizingElement : NamedElement) {
- *         	Class.appliedStereotypeInstance.classifier.name(requirement, "Requirement");
- *         	
- *         	Dependency.appliedStereotypeInstance.classifier.name(dep, "Satisfy");
- *         	Dependency.supplier(dep, requirement);
- *         	Dependency.client(dep, realizingElement);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class RequirementRealization extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.RequirementRealization pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

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

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

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

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

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

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

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

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static RequirementRealization.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_requirement = new PParameter("requirement", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class")), PParameterDirection.INOUT); - - private final PParameter parameter_realizingElement = new PParameter("realizingElement", "com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement")), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_requirement, parameter_realizingElement); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.RequirementRealization"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("requirement","realizingElement"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_requirement = body.getOrCreateVariableByName("requirement"); - PVariable var_realizingElement = body.getOrCreateVariableByName("realizingElement"); - PVariable var_dep = body.getOrCreateVariableByName("dep"); - new TypeConstraint(body, Tuples.flatTupleOf(var_requirement), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - new TypeConstraint(body, Tuples.flatTupleOf(var_realizingElement), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_requirement, parameter_requirement), - new ExportedParameter(body, var_realizingElement, parameter_realizingElement) - )); - // Class.appliedStereotypeInstance.classifier.name(requirement, "Requirement") - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new ConstantValue(body, var__virtual_0_, "Requirement"); - new TypeConstraint(body, Tuples.flatTupleOf(var_requirement), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Class"))); - PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_requirement, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Element", "appliedStereotypeInstance"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification"))); - PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification", "classifier"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier"))); - PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_3_, var__virtual_0_); - // Dependency.appliedStereotypeInstance.classifier.name(dep, "Satisfy") - PVariable var__virtual_4_ = body.getOrCreateVariableByName(".virtual{4}"); - new ConstantValue(body, var__virtual_4_, "Satisfy"); - new TypeConstraint(body, Tuples.flatTupleOf(var_dep), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency"))); - PVariable var__virtual_5_ = body.getOrCreateVariableByName(".virtual{5}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_dep, var__virtual_5_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Element", "appliedStereotypeInstance"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_5_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification"))); - PVariable var__virtual_6_ = body.getOrCreateVariableByName(".virtual{6}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_5_, var__virtual_6_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "InstanceSpecification", "classifier"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_6_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Classifier"))); - PVariable var__virtual_7_ = body.getOrCreateVariableByName(".virtual{7}"); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_6_, var__virtual_7_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement", "name"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_7_), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "String"))); - new Equality(body, var__virtual_7_, var__virtual_4_); - // Dependency.supplier(dep, requirement) - new TypeConstraint(body, Tuples.flatTupleOf(var_dep), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency"))); - PVariable var__virtual_8_ = body.getOrCreateVariableByName(".virtual{8}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_dep, var__virtual_8_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency", "supplier"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_8_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new Equality(body, var__virtual_8_, var_requirement); - // Dependency.client(dep, realizingElement) - new TypeConstraint(body, Tuples.flatTupleOf(var_dep), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency"))); - PVariable var__virtual_9_ = body.getOrCreateVariableByName(".virtual{9}"); - new TypeConstraint(body, Tuples.flatTupleOf(var_dep, var__virtual_9_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "Dependency", "client"))); - new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_9_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.nomagic.com/magicdraw/UML/2.5.1", "NamedElement"))); - new Equality(body, var__virtual_9_, var_realizingElement); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Requirement_Realization.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Requirement_Realization.java deleted file mode 100644 index 93ccd0e..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Requirement_Realization.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Requirement_Realization.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.RequirementRealization; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in Requirement_Realization.vql. - * - *

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

From package com.incquerylabs.v4md.test.queries, the group contains the definition of the following patterns:

    - *
  • RequirementRealization
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class Requirement_Realization extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static Requirement_Realization instance() { - if (INSTANCE == null) { - INSTANCE = new Requirement_Realization(); - } - return INSTANCE; - } - - private static Requirement_Realization INSTANCE; - - private Requirement_Realization() { - querySpecifications.add(RequirementRealization.instance()); - } - - public RequirementRealization getRequirementRealization() { - return RequirementRealization.instance(); - } - - public RequirementRealization.Matcher getRequirementRealization(final ViatraQueryEngine engine) { - return RequirementRealization.Matcher.on(engine); - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Subpattern_Calls.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Subpattern_Calls.java deleted file mode 100644 index a747377..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Subpattern_Calls.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Subpattern_Calls.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.Blocks; -import com.incquerylabs.v4md.test.queries.BlocksWithNonEmptyName; -import com.incquerylabs.v4md.test.queries.ClassesWithEmptyName; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in Subpattern_Calls.vql. - * - *

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

From package com.incquerylabs.v4md.test.queries, the group contains the definition of the following patterns:

    - *
  • blocksWithNonEmptyName
  • - *
  • classesWithEmptyName
  • - *
  • blocks
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class Subpattern_Calls extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static Subpattern_Calls instance() { - if (INSTANCE == null) { - INSTANCE = new Subpattern_Calls(); - } - return INSTANCE; - } - - private static Subpattern_Calls INSTANCE; - - private Subpattern_Calls() { - querySpecifications.add(BlocksWithNonEmptyName.instance()); - querySpecifications.add(ClassesWithEmptyName.instance()); - querySpecifications.add(Blocks.instance()); - } - - public BlocksWithNonEmptyName getBlocksWithNonEmptyName() { - return BlocksWithNonEmptyName.instance(); - } - - public BlocksWithNonEmptyName.Matcher getBlocksWithNonEmptyName(final ViatraQueryEngine engine) { - return BlocksWithNonEmptyName.Matcher.on(engine); - } - - public ClassesWithEmptyName getClassesWithEmptyName() { - return ClassesWithEmptyName.instance(); - } - - public ClassesWithEmptyName.Matcher getClassesWithEmptyName(final ViatraQueryEngine engine) { - return ClassesWithEmptyName.Matcher.on(engine); - } - - public Blocks getBlocks() { - return Blocks.instance(); - } - - public Blocks.Matcher getBlocks(final ViatraQueryEngine engine) { - return Blocks.Matcher.on(engine); - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/SumOfClassAttributes.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/SumOfClassAttributes.java deleted file mode 100644 index aaf6a24..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/SumOfClassAttributes.java +++ /dev/null @@ -1,544 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Aggregator_Functions.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.ClassNumberOfAttributes; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.log4j.Logger; -import org.eclipse.viatra.query.runtime.api.IPatternMatch; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; -import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; -import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; -import org.eclipse.viatra.query.runtime.matchers.aggregators.sum; -import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; -import org.eclipse.viatra.query.runtime.matchers.context.common.JavaTransitiveInstancesKey; -import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; -import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; -import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; -import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; -import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; - -/** - * A pattern-specific query specification that can instantiate Matcher in a type-safe way. - * - *

Original source: - *

- *         //Sums the number of overall attributes of classes in the model
- *         pattern sumOfClassAttributes(s : java Integer) {
- *         	//use # to determine which parameter should be summarized
- *         	s == sum find classNumberOfAttributes(_c, #tempNumber);
- *         }
- * 
- * - * @see Matcher - * @see Match - * - */ -@SuppressWarnings("all") -public final class SumOfClassAttributes extends BaseGeneratedEMFQuerySpecification { - /** - * Pattern-specific match representation of the com.incquerylabs.v4md.test.queries.sumOfClassAttributes pattern, - * to be used in conjunction with {@link Matcher}. - * - *

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

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

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

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

Original source: - *

-   * //Sums the number of overall attributes of classes in the model
-   * pattern sumOfClassAttributes(s : java Integer) {
-   * 	//use # to determine which parameter should be summarized
-   * 	s == sum find classNumberOfAttributes(_c, #tempNumber);
-   * }
-   * 
- * - * @see Match - * @see SumOfClassAttributes - * - */ - public static class Matcher extends BaseMatcher { - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - public static SumOfClassAttributes.Matcher on(final ViatraQueryEngine engine) { - // check if matcher already exists - Matcher matcher = engine.getExistingMatcher(querySpecification()); - if (matcher == null) { - matcher = (Matcher)engine.getMatcher(querySpecification()); - } - return matcher; - } - - /** - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * @return an initialized matcher - * @noreference This method is for internal matcher initialization by the framework, do not call it manually. - * - */ - public static SumOfClassAttributes.Matcher create() { - return new Matcher(); - } - - private final static int POSITION_S = 0; - - private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SumOfClassAttributes.Matcher.class); - - /** - * Initializes the pattern matcher within an existing VIATRA Query engine. - * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. - * - * @param engine the existing VIATRA Query engine in which this matcher will be created. - * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation - * - */ - private Matcher() { - super(querySpecification()); - } - - /** - * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. - * @param pS the fixed value of pattern parameter s, or null if not bound. - * @return matches represented as a Match object. - * - */ - public Collection getAllMatches(final Integer pS) { - return rawStreamAllMatches(new Object[]{pS}).collect(Collectors.toSet()); - } - - /** - * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. - *

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

The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. - * @param pS the fixed value of pattern parameter s, or null if not bound. - * @return the (partial) match object. - * - */ - public SumOfClassAttributes.Match newMatch(final Integer pS) { - return SumOfClassAttributes.Match.newMatch(pS); - } - - /** - * Retrieve the set of values that occur in matches for s. - * @return the Set of all values or empty set if there are no matches - * - */ - protected Stream rawStreamAllValuesOfs(final Object[] parameters) { - return rawStreamAllValues(POSITION_S, parameters).map(Integer.class::cast); - } - - /** - * Retrieve the set of values that occur in matches for s. - * @return the Set of all values or empty set if there are no matches - * - */ - public Set getAllValuesOfs() { - return rawStreamAllValuesOfs(emptyArray()).collect(Collectors.toSet()); - } - - /** - * Retrieve the set of values that occur in matches for s. - * @return the Set of all values or empty set if there are no matches - * - */ - public Stream streamAllValuesOfs() { - return rawStreamAllValuesOfs(emptyArray()); - } - - @Override - protected SumOfClassAttributes.Match tupleToMatch(final Tuple t) { - try { - return SumOfClassAttributes.Match.newMatch((Integer) t.get(POSITION_S)); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in tuple not properly typed!",e); - return null; - } - } - - @Override - protected SumOfClassAttributes.Match arrayToMatch(final Object[] match) { - try { - return SumOfClassAttributes.Match.newMatch((Integer) match[POSITION_S]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - @Override - protected SumOfClassAttributes.Match arrayToMatchMutable(final Object[] match) { - try { - return SumOfClassAttributes.Match.newMutableMatch((Integer) match[POSITION_S]); - } catch(ClassCastException e) { - LOGGER.error("Element(s) in array not properly typed!",e); - return null; - } - } - - /** - * @return the singleton instance of the query specification of this pattern - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static IQuerySpecification querySpecification() { - return SumOfClassAttributes.instance(); - } - } - - private SumOfClassAttributes() { - super(GeneratedPQuery.INSTANCE); - } - - /** - * @return the singleton instance of the query specification - * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded - * - */ - public static SumOfClassAttributes instance() { - try{ - return LazyHolder.INSTANCE; - } catch (ExceptionInInitializerError err) { - throw processInitializerError(err); - } - } - - @Override - protected SumOfClassAttributes.Matcher instantiate(final ViatraQueryEngine engine) { - return SumOfClassAttributes.Matcher.on(engine); - } - - @Override - public SumOfClassAttributes.Matcher instantiate() { - return SumOfClassAttributes.Matcher.create(); - } - - @Override - public SumOfClassAttributes.Match newEmptyMatch() { - return SumOfClassAttributes.Match.newEmptyMatch(); - } - - @Override - public SumOfClassAttributes.Match newMatch(final Object... parameters) { - return SumOfClassAttributes.Match.newMatch((java.lang.Integer) parameters[0]); - } - - /** - * Inner class allowing the singleton instance of {@link JvmGenericType: com.incquerylabs.v4md.test.queries.SumOfClassAttributes (visibility: PUBLIC, simpleName: SumOfClassAttributes, identifier: com.incquerylabs.v4md.test.queries.SumOfClassAttributes, deprecated: ) (abstract: false, static: false, final: true, packageName: com.incquerylabs.v4md.test.queries) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created - * not at the class load time of the outer class, - * but rather at the first call to {@link JvmGenericType: com.incquerylabs.v4md.test.queries.SumOfClassAttributes (visibility: PUBLIC, simpleName: SumOfClassAttributes, identifier: com.incquerylabs.v4md.test.queries.SumOfClassAttributes, deprecated: ) (abstract: false, static: false, final: true, packageName: com.incquerylabs.v4md.test.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. - * - *

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

The static initializer is defined using a helper field to work around limitations of the code generator. - * - */ - private final static Object STATIC_INITIALIZER = ensureInitialized(); - - public static Object ensureInitialized() { - INSTANCE.ensureInitializedInternal(); - return null; - } - } - - private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { - private final static SumOfClassAttributes.GeneratedPQuery INSTANCE = new GeneratedPQuery(); - - private final PParameter parameter_s = new PParameter("s", "java.lang.Integer", new JavaTransitiveInstancesKey(java.lang.Integer.class), PParameterDirection.INOUT); - - private final List parameters = Arrays.asList(parameter_s); - - private GeneratedPQuery() { - super(PVisibility.PUBLIC); - } - - @Override - public String getFullyQualifiedName() { - return "com.incquerylabs.v4md.test.queries.sumOfClassAttributes"; - } - - @Override - public List getParameterNames() { - return Arrays.asList("s"); - } - - @Override - public List getParameters() { - return parameters; - } - - @Override - public Set doGetContainedBodies() { - setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); - Set bodies = new LinkedHashSet<>(); - { - PBody body = new PBody(this); - PVariable var_s = body.getOrCreateVariableByName("s"); - PVariable var__c = body.getOrCreateVariableByName("_c"); - PVariable var__tempNumber = body.getOrCreateVariableByName("#tempNumber"); - new TypeFilterConstraint(body, Tuples.flatTupleOf(var_s), new JavaTransitiveInstancesKey(java.lang.Integer.class)); - body.setSymbolicParameters(Arrays.asList( - new ExportedParameter(body, var_s, parameter_s) - )); - // //use # to determine which parameter should be summarized s == sum find classNumberOfAttributes(_c, #tempNumber) - PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); - new AggregatorConstraint(new sum().getAggregatorLogic(Integer.class), body, Tuples.flatTupleOf(var__c, var__tempNumber), ClassNumberOfAttributes.instance().getInternalQueryRepresentation(), var__virtual_0_, 1); - new Equality(body, var_s, var__virtual_0_); - bodies.add(body); - } - return bodies; - } - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Transitive_Closure.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Transitive_Closure.java deleted file mode 100644 index 11f5c0f..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Transitive_Closure.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Transitive_Closure.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.GetSuperClass; -import com.incquerylabs.v4md.test.queries.GetSuperClassOrSelf; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in Transitive_Closure.vql. - * - *

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

From package com.incquerylabs.v4md.test.queries, the group contains the definition of the following patterns:

    - *
  • getSuperClassOrSelf
  • - *
  • getSuperClass
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class Transitive_Closure extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static Transitive_Closure instance() { - if (INSTANCE == null) { - INSTANCE = new Transitive_Closure(); - } - return INSTANCE; - } - - private static Transitive_Closure INSTANCE; - - private Transitive_Closure() { - querySpecifications.add(GetSuperClassOrSelf.instance()); - querySpecifications.add(GetSuperClass.instance()); - } - - public GetSuperClassOrSelf getGetSuperClassOrSelf() { - return GetSuperClassOrSelf.instance(); - } - - public GetSuperClassOrSelf.Matcher getGetSuperClassOrSelf(final ViatraQueryEngine engine) { - return GetSuperClassOrSelf.Matcher.on(engine); - } - - public GetSuperClass getGetSuperClass() { - return GetSuperClass.instance(); - } - - public GetSuperClass.Matcher getGetSuperClass(final ViatraQueryEngine engine) { - return GetSuperClass.Matcher.on(engine); - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Unreachable_States.java b/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Unreachable_States.java deleted file mode 100644 index 4b32579..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/generated/vql/com/incquerylabs/v4md/test/queries/Unreachable_States.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Generated from platform:/resource/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Unreachable_States.vql - */ -package com.incquerylabs.v4md.test.queries; - -import com.incquerylabs.v4md.test.queries.NotReachableFromInit; -import com.incquerylabs.v4md.test.queries.ReachableFromInitState; -import com.incquerylabs.v4md.test.queries.ReachableState; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup; - -/** - * A pattern group formed of all public patterns defined in Unreachable_States.vql. - * - *

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

From package com.incquerylabs.v4md.test.queries, the group contains the definition of the following patterns:

    - *
  • notReachableFromInit
  • - *
  • reachableFromInitState
  • - *
  • reachableState
  • - *
- * - * @see IQueryGroup - * - */ -@SuppressWarnings("all") -public final class Unreachable_States extends BaseGeneratedPatternGroup { - /** - * Access the pattern group. - * - * @return the singleton instance of the group - * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications - * - */ - public static Unreachable_States instance() { - if (INSTANCE == null) { - INSTANCE = new Unreachable_States(); - } - return INSTANCE; - } - - private static Unreachable_States INSTANCE; - - private Unreachable_States() { - querySpecifications.add(NotReachableFromInit.instance()); - querySpecifications.add(ReachableFromInitState.instance()); - querySpecifications.add(ReachableState.instance()); - } - - public NotReachableFromInit getNotReachableFromInit() { - return NotReachableFromInit.instance(); - } - - public NotReachableFromInit.Matcher getNotReachableFromInit(final ViatraQueryEngine engine) { - return NotReachableFromInit.Matcher.on(engine); - } - - public ReachableFromInitState getReachableFromInitState() { - return ReachableFromInitState.instance(); - } - - public ReachableFromInitState.Matcher getReachableFromInitState(final ViatraQueryEngine engine) { - return ReachableFromInitState.Matcher.on(engine); - } - - public ReachableState getReachableState() { - return ReachableState.instance(); - } - - public ReachableState.Matcher getReachableState(final ViatraQueryEngine engine) { - return ReachableState.Matcher.on(engine); - } -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/dist/template/data/resourcemanager/MDR_Example_Plugin_18351_descriptor.xml b/com.incquerylabs.v4md.snapshotmaker/src/main/dist/template/data/resourcemanager/MDR_Example_Plugin_18351_descriptor.xml deleted file mode 100644 index 1c9be8e..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/dist/template/data/resourcemanager/MDR_Example_Plugin_18351_descriptor.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - Reader - Community - Standard - Professional Java - Professional C++ - Professional C# - Professional ArcStyler - Professional EFFS ArcStyler - OptimalJ - Professional - Architect - Enterprise - - - - - - - - diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/dist/template/plugins/${group}/plugin.xml b/com.incquerylabs.v4md.snapshotmaker/src/main/dist/template/plugins/${group}/plugin.xml deleted file mode 100644 index eef4c88..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/dist/template/plugins/${group}/plugin.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/QueryGroups.xtend b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/QueryGroups.xtend deleted file mode 100644 index a1041fe..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/QueryGroups.xtend +++ /dev/null @@ -1,21 +0,0 @@ -package com.incquerylabs.v4md.snapshotmaker - -import com.incquerylabs.v4md.test.queries.* - -class QueryGroups { - public static def groups(){ - #{ - Aggregator_Functions.instance, - Block_With_More_than_1_Parent.instance, - Check_Expression.instance, - Circular_Dependency.instance, - Non_Unique_Names.instance, - Pattern_Constraints.instance, - Port_Connections.instance, - Requirement_Realization.instance, - Subpattern_Calls.instance, - Transitive_Closure.instance, - Unreachable_States.instance - } - } -} \ No newline at end of file diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/SnapshotMakerPlugin.java b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/SnapshotMakerPlugin.java deleted file mode 100644 index 408edf6..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/SnapshotMakerPlugin.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.incquerylabs.v4md.snapshotmaker; - -import com.incquerylabs.v4md.snapshotmaker.ui.SnapshotmakerMainMenuConfigurator; -import com.nomagic.magicdraw.actions.ActionsConfiguratorsManager; -import com.nomagic.magicdraw.plugins.Plugin; - -public class SnapshotMakerPlugin extends Plugin { - @Override - public boolean close() { - return true; - } - - @Override - public void init() { - - ActionsConfiguratorsManager manager = ActionsConfiguratorsManager.getInstance(); - manager.addMainMenuConfigurator(new SnapshotmakerMainMenuConfigurator()); - - } - - @Override - public boolean isSupported() { - return true; - } - - - -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/ui/SnapshotmakerMainMenuConfigurator.java b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/ui/SnapshotmakerMainMenuConfigurator.java deleted file mode 100644 index e1e117d..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/ui/SnapshotmakerMainMenuConfigurator.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * - * Copyright (c) 2002 NoMagic, Inc. All Rights Reserved. - */ - -package com.incquerylabs.v4md.snapshotmaker.ui; - -import com.incquerylabs.v4md.snapshotmaker.ui.action.MakeSnapshot; -import com.nomagic.actions.AMConfigurator; -import com.nomagic.actions.ActionsCategory; -import com.nomagic.actions.ActionsManager; -import com.nomagic.magicdraw.actions.MDActionsCategory; - -public class SnapshotmakerMainMenuConfigurator implements AMConfigurator { - - String SNAPSHOT_MAKER = "SnapshotMaker"; - - public SnapshotmakerMainMenuConfigurator() { - } - - - - @Override - public void configure(ActionsManager manager) { - // searching for Examples action category - ActionsCategory category = (ActionsCategory) manager.getActionFor(SNAPSHOT_MAKER); - - if (category == null) { - // creating new category - category = new MDActionsCategory(SNAPSHOT_MAKER, SNAPSHOT_MAKER); - category.setNested(true); - manager.addCategory(category); - } - - category.addAction(new MakeSnapshot("MAKE_SNAPSHOT", "Make Snapshots")); - } - - @Override - public int getPriority() { - return AMConfigurator.MEDIUM_PRIORITY; - } - -} \ No newline at end of file diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/ui/action/MakeSnapshot.java b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/ui/action/MakeSnapshot.java deleted file mode 100644 index c07bf2a..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/snapshotmaker/ui/action/MakeSnapshot.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.incquerylabs.v4md.snapshotmaker.ui.action; - -import java.awt.event.ActionEvent; -import java.io.File; -import java.io.IOException; -import java.util.Set; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.viatra.query.runtime.api.IQueryGroup; -import org.eclipse.viatra.query.runtime.api.IQuerySpecification; -import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; -import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher; -import org.eclipse.viatra.query.testing.core.SnapshotHelper; -import org.eclipse.viatra.query.testing.snapshot.QuerySnapshot; -import org.eclipse.viatra.query.testing.snapshot.SnapshotFactory; - -import com.google.common.collect.Sets; -import com.incquerylabs.v4md.ViatraQueryAdapter; -import com.incquerylabs.v4md.snapshotmaker.QueryGroups; -import com.nomagic.magicdraw.actions.MDAction; -import com.nomagic.magicdraw.core.Application; -import com.nomagic.magicdraw.core.Project; - -public class MakeSnapshot extends MDAction{ - - static final long serialVersionUID = 1L; - - private Set> specsToSave = Sets.newHashSet(); - private Set groupsToSave = Sets.newHashSet(); - - static String installroot = ""; - static final String SNAPSHOT_FOLDER = "query_snapshots"; - - public MakeSnapshot(String id, String name) { - super(id, name, null, null); - installroot = Application.environment().getInstallRoot(); - - groupsToSave.addAll(QueryGroups.groups()); - - } - - private void createAndSaveSnapshot(ViatraQueryEngine engine, IQuerySpecification spec) throws IOException{ - - SnapshotHelper helper = new SnapshotHelper(); - QuerySnapshot snap = SnapshotFactory.eINSTANCE.createQuerySnapshot(); - - helper.saveMatchesToSnapshot((ViatraQueryMatcher)engine.getMatcher(spec), snap); - ResourceSet resourceSet = new ResourceSetImpl(); - Resource resource = resourceSet.createResource(URI.createFileURI(new File(installroot + "\\" + SNAPSHOT_FOLDER +"\\" + spec.getSimpleName()+".snapshot").getAbsolutePath())); - resource.getContents().add(snap); - - resource.save(null); - - } - - private void createAndSaveSnapshot(ViatraQueryEngine engine, IQueryGroup group) throws IOException { - SnapshotHelper helper = new SnapshotHelper(); - QuerySnapshot snap = SnapshotFactory.eINSTANCE.createQuerySnapshot(); - - group.getSpecifications().forEach( spec -> helper.saveMatchesToSnapshot((ViatraQueryMatcher)engine.getMatcher(spec), snap)); - - ResourceSet resourceSet = new ResourceSetImpl(); - Resource resource = resourceSet.createResource(URI.createFileURI(new File(installroot + "\\" + SNAPSHOT_FOLDER +"\\groups\\" + group.getClass().getSimpleName()+".snapshot").getAbsolutePath())); - resource.getContents().add(snap); - - resource.save(null); - - } - - @Override - public void actionPerformed(ActionEvent actionEvent) { - Project project = Application.getInstance().getProject(); - ViatraQueryEngine engine = ViatraQueryAdapter.getOrCreateAdapter(project).getEngine(); - - try { - for (IQuerySpecification spec: specsToSave) { - createAndSaveSnapshot(engine, spec); - } - - for (IQueryGroup g: groupsToSave) { - createAndSaveSnapshot(engine, g); - } - - Application.getInstance().getGUILog().showMessage("Snapshots successfully created and saved to: " + installroot + "\\" + SNAPSHOT_FOLDER); - - } catch (IOException e) { - Application.getInstance().getGUILog().showError(e.getMessage()); - } - } - -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Aggregator_Functions.vql b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Aggregator_Functions.vql deleted file mode 100644 index 7a36913..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Aggregator_Functions.vql +++ /dev/null @@ -1,47 +0,0 @@ -package com.incquerylabs.v4md.test.queries - -import "http://www.nomagic.com/magicdraw/UML/2.5.1" - -//Queries classes -pattern classes(class : Class){ - Class(class); -} - -//Maps classes to their owned properties -pattern classAttributes(class : Class, attribute : Property){ - Class.ownedAttribute(class, attribute); -} - -//Counts the number of properties of classes -pattern classNumberOfAttributes(class : Class, number : java Integer){ - //Counts the number of matches of 'classAttributes' for each class - number == count find classAttributes(class, _); -} - -//Queries the class with the most number of attributes -pattern classWithMaxNumberOfAttributes(class : Class, number : java Integer) { - //Calculates the largest class number - //Note use # to determine which parameter should be used for aggregation - //in this case to calculate max - number == max find classNumberOfAttributes(_, #tempNumber); - //Queries the class with the highest number - find classNumberOfAttributes(class, number); -} - -//Sums the number of overall attributes of classes in the model -pattern sumOfClassAttributes(s : java Integer) { - //use # to determine which parameter should be summarized - s == sum find classNumberOfAttributes(_c, #tempNumber); -} - -//Calculates average number of attributes per class in the model -pattern averageNumberOfAttributes(number : java Float, s : java Integer, c : java Integer) { - //calculates sum - s == sum find classNumberOfAttributes(_c, #tempNumber); - //determines the number of classes - c == count find classes(_c2); - //Calculates average in an eval() expression - //similar to check() in an eval expression standard Java code can be used - number == eval(s.floatValue/c.floatValue); - -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Block_With_More_than_1_Parent.vql b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Block_With_More_than_1_Parent.vql deleted file mode 100644 index bbee02d..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Block_With_More_than_1_Parent.vql +++ /dev/null @@ -1,24 +0,0 @@ -package com.incquerylabs.v4md.test.queries - -import "http://www.nomagic.com/magicdraw/UML/2.5.1" - -pattern BlocksWithDeepGeneralizationHierarchy(block : Class, superClass : Class) { - Class.appliedStereotypeInstance.classifier.name(block, "Block"); - parents == count find getSuperClasses(block, _); - find getSuperClasses(block, superClass); - check(parents > 1); -} - - -pattern MultipleInheritanceBlock(block : Class, parent1 : Class){ - Class.appliedStereotypeInstance.classifier.name(block, "Block"); - find getSuperClass(block, parent1); - find getSuperClass(block, parent2); - parent1 != parent2; -} - - -pattern getSuperClasses(class : Classifier, superClass: Classifier){ - find getSuperClass+(class, superClass); -} - diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Check_Expression.vql b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Check_Expression.vql deleted file mode 100644 index 1615e36..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Check_Expression.vql +++ /dev/null @@ -1,10 +0,0 @@ -package com.incquerylabs.v4md.test.queries - -import "http://www.nomagic.com/magicdraw/UML/2.5.1" - -pattern classesWithNameThatContainsID(class : Class){ - Class.name(class, name); - //Check expression that checks if the class' name contains the substring 'id' - //Inside a check expression standard java code can be used (in this case String.equals) - check(name.contains("id")); -} \ No newline at end of file diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Circular_Dependency.vql b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Circular_Dependency.vql deleted file mode 100644 index 0f44a0e..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Circular_Dependency.vql +++ /dev/null @@ -1,19 +0,0 @@ -package com.incquerylabs.v4md.test.queries - - -import "http://www.nomagic.com/magicdraw/UML/2.5.1" -/* - * Pattern responsible for detecting circular dependency chains in UML models - */ -pattern CircularDependencyError(dep : Dependency) { - //Call transitive closure of sub-pattern 'DependencyChain' - find DependencyChain+(dep, dep); -} - -/** - * Pattern describing succession relation between two dependencies - */ -pattern DependencyChain(source : Dependency, target : Dependency) { - Dependency.supplier(source, elem); - Dependency.client(target, elem); -} \ No newline at end of file diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Non_Unique_Names.vql b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Non_Unique_Names.vql deleted file mode 100644 index 4c5558c..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Non_Unique_Names.vql +++ /dev/null @@ -1,31 +0,0 @@ -package com.incquerylabs.v4md.test.queries - -import "http://www.nomagic.com/magicdraw/UML/2.5.1" - -/** - * Pattern responsible for detecting duplicate ID Property tagged values - */ -pattern IDStringPropertyEqualityError(elem : NamedElement, property : Property){ - find PropertyStringValueEquals(elem, otherElement, property); - elem != otherElement; -} - -/** - * Detects NamedElement pairs, where the values of the same STRING ID property are equal - */ -pattern PropertyStringValueEquals(element : NamedElement, element2 : NamedElement, property : Property){ - element != element2; - Property.isID(property, true); - NamedElement.appliedStereotypeInstance.slot(element, slot); - Slot.definingFeature(slot, property); - - NamedElement.appliedStereotypeInstance.slot(element2, slot2); - Slot.definingFeature(slot2, property); - - Slot.value(slot, spec1); - Slot.value(slot2, spec2); - - LiteralString.value(spec1, val1); - LiteralString.value(spec2, val2); - val1 == val2; -} \ No newline at end of file diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Pattern_Constraints.vql b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Pattern_Constraints.vql deleted file mode 100644 index 90e1097..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Pattern_Constraints.vql +++ /dev/null @@ -1,12 +0,0 @@ -package com.incquerylabs.v4md.test.queries - -import "http://www.nomagic.com/magicdraw/UML/2.5.1" - -//Classes that have attributes that have the same name -pattern classesWithSameNamedProperty(class1 : Class, class2 : Class, name : java String){ - //using the 'name' parameter in both places will ensure that the name is the same - Class.ownedAttribute.name(class1, name); - Class.ownedAttribute.name(class2, name); - //Ensure that they are not the same class - class1 != class2; -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Port_Connections.vql b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Port_Connections.vql deleted file mode 100644 index 0980707..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Port_Connections.vql +++ /dev/null @@ -1,13 +0,0 @@ -package com.incquerylabs.v4md.test.queries - -import "http://www.nomagic.com/magicdraw/UML/2.5.1" - -pattern PortConnections(port1 : Port, connector : Connector, port2 : Port) { - Connector.end(connector, end1); - Connector.end(connector, end2); - - Port.end(port1, end1); - Port.end(port2, end2); - - port1 != port2; -} \ No newline at end of file diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Requirement_Realization.vql b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Requirement_Realization.vql deleted file mode 100644 index 56c9920..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Requirement_Realization.vql +++ /dev/null @@ -1,11 +0,0 @@ -package com.incquerylabs.v4md.test.queries - -import "http://www.nomagic.com/magicdraw/UML/2.5.1" - -pattern RequirementRealization(requirement : Class, realizingElement : NamedElement) { - Class.appliedStereotypeInstance.classifier.name(requirement, "Requirement"); - - Dependency.appliedStereotypeInstance.classifier.name(dep, "Satisfy"); - Dependency.supplier(dep, requirement); - Dependency.client(dep, realizingElement); -} \ No newline at end of file diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Subpattern_Calls.vql b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Subpattern_Calls.vql deleted file mode 100644 index 7ece11d..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Subpattern_Calls.vql +++ /dev/null @@ -1,24 +0,0 @@ -package com.incquerylabs.v4md.test.queries - -import "http://www.nomagic.com/magicdraw/UML/2.5.1" -//Main pattern that queries every block in the model with a non emty name -//Note that you dont need to check the subpatterns to be able to execute the main query, -// as during runtime queries are flattened, meaning that subpattern calls are replaced with the body of the called query -pattern blocksWithNonEmptyName(class : Class){ - //Filter for block - find blocks(class); - //Negative subpattern call --> true for classes that do not have an empty name - neg find classesWithEmptyName(class); -} - -pattern classesWithEmptyName(class : Class){ - //simple pattern constraint --> maps classes to their names - Class.name(class, name); - //check expression --> checks if the name is an empty string - check(name.equals("")); -} - -pattern blocks(class : Class){ - //constraint that queries every class that has an instance of the "Block" stereotype - Class.appliedStereotypeInstance.classifier.name(class, "Block"); -} \ No newline at end of file diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Transitive_Closure.vql b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Transitive_Closure.vql deleted file mode 100644 index c64cf58..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Transitive_Closure.vql +++ /dev/null @@ -1,29 +0,0 @@ -package com.incquerylabs.v4md.test.queries - -import "http://www.nomagic.com/magicdraw/UML/2.5.1" -/* - * Produce Class inheritance hierarchy - * 'or' keyword represents an or relation between bodies --> one of them needs to apply to the parameters for them to produce a match - * note that the transitive closure does not appear as parameters of a single match, but a number of matches in a following way: - * class1 --> parent1 - * class1 --> parent2 - * ... - */ -pattern getSuperClassOrSelf(class : Classifier, superClass: Classifier) { - // * semantics for transitive closure can be implemented this way - // by default the transitive closure does not add the trivial relation to the TC - class == superClass; -} or { - //transitive closure - find getSuperClass+(class, superClass); - -} - -/* - * Get superclasses of a class - * maps a class to its superclass --> the main pattern uses this subpattern to produce a class generalization hierarchy - */ -pattern getSuperClass(class : Classifier, superClass: Classifier) { - Generalization.general(gen, superClass); - Generalization.specific(gen, class); -} diff --git a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Unreachable_States.vql b/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Unreachable_States.vql deleted file mode 100644 index af22505..0000000 --- a/com.incquerylabs.v4md.snapshotmaker/src/main/java/com/incquerylabs/v4md/test/queries/Unreachable_States.vql +++ /dev/null @@ -1,22 +0,0 @@ -package com.incquerylabs.v4md.test.queries - -import "http://www.nomagic.com/magicdraw/UML/2.5.1" - -pattern notReachableFromInit(state : State){ - neg find reachableFromInitState(state); -} - - -pattern reachableFromInitState(state :State){ - Pseudostate.kind(initnode, ::initial); - find reachableState+(initnode, state); -} - -pattern reachableState(sourceState : Vertex, targetState : Vertex) { - Transition.source(transition, sourceState); - Transition.target(transition, targetState); - sourceState != targetState; - - -} - diff --git a/com.incquerylabs.v4md/build.gradle b/com.incquerylabs.v4md/build.gradle index 736dcfb..5be25c5 100644 --- a/com.incquerylabs.v4md/build.gradle +++ b/com.incquerylabs.v4md/build.gradle @@ -344,7 +344,6 @@ publishing { version "$version" from components.java artifact tasks.sourceJar - artifact distZip { classifier "plugin" @@ -407,6 +406,12 @@ task runTest(type: JavaExec) { } runTest.dependsOn configureTest +task runSnapshotGeneration(type: JavaExec) { + args 'generateQuerySnapshots' + jvmArgs += testArgs +} +runSnapshotGeneration.dependsOn configureTest + task debugTest(type: JavaExec) { jvmArgs += testArgs jvmArgs += debugArgs diff --git a/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/QueryTests.java b/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/QueryTests.java index 673d6eb..611e6d2 100644 --- a/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/QueryTests.java +++ b/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/QueryTests.java @@ -28,6 +28,11 @@ import com.incquerylabs.v4md.test.queries.Subpattern_Calls; import com.incquerylabs.v4md.test.queries.Transitive_Closure; import com.incquerylabs.v4md.test.queries.Unreachable_States; +import com.incquerylabs.v4md.test.runner.TestRunner; +import com.incquerylabs.v4md.test.snapshot.ISnapshotManager; +import com.incquerylabs.v4md.test.snapshot.SnapshotAnalyzer; +import com.incquerylabs.v4md.test.snapshot.SnapshotCreator; +import com.nomagic.ci.persistence.local.proxy.SnapshotManager; import com.nomagic.magicdraw.core.Application; import com.nomagic.magicdraw.core.Project; import com.nomagic.magicdraw.tests.MagicDrawTestCase; @@ -35,10 +40,9 @@ public class QueryTests extends MagicDrawTestCase { - protected static String snapshotLibrary = "snapshots/"; protected Project project; protected static String projectToUse = "CustomQueryAndValidationExample.mdzip"; - + public QueryTests() {} @@ -59,98 +63,54 @@ protected EMFScope getScopeForProject(Project project) { return (EMFScope) engine.getScope(); } - protected QuerySnapshot getSnapshotResource(Project project, String snapshotToUse) throws IOException { - //initialize SnapshotPackage - SnapshotPackage.eINSTANCE.getNsURI(); - String snapshotPath = new File(TestEnvironment.getResourceDir(), snapshotLibrary + snapshotToUse).getCanonicalPath(); - URI uri = URI.createFileURI(snapshotPath); - ResourceSet rs = project.getModel().eResource().getResourceSet(); - Resource r = rs.createResource(uri); - r.load(null); - - return (QuerySnapshot) r.getContents().get(0); - } - @Override protected void tearDownTest() throws Exception { closeAllProjects(); super.tearDownTest(); } - protected ViatraQueryTestCase createTestCaseForSnapshot(String snapshotName) throws IOException { - QuerySnapshot snapshot = getSnapshotResource(project, snapshotName + ".snapshot"); - ViatraQueryAdapter adapter = ViatraQueryAdapter.getOrCreateAdapter(project); - ViatraQueryTestCase vqtc = new ViatraQueryTestCase(); - vqtc.addMatchSetModelProvider(new V4MDPatternBasedMatchSetProvider(adapter)); - vqtc.addMatchSetModelProvider(new InitializedSnapshotMatchSetModelProvider(snapshot)); - return vqtc; - } - - public void testNonUniqueNames() throws IOException { - ViatraQueryTestCase vqtc = createTestCaseForSnapshot("Non_Unique_Names"); - vqtc.assertMatchSetsEqual(Non_Unique_Names.instance()); - vqtc.dispose(); + TestRunner.snapshotManager.assertQueryResult(project, Non_Unique_Names.instance(), "Non_Unique_Names"); } public void testAggragatorFunctions() throws IOException{ - ViatraQueryTestCase vqtc = createTestCaseForSnapshot("Aggregator_Functions"); - vqtc.assertMatchSetsEqual(Aggregator_Functions.instance()); - vqtc.dispose(); + TestRunner.snapshotManager.assertQueryResult(project, Aggregator_Functions.instance(), "Aggregator_Functions"); } public void testBlockWithMoreThanOneParent() throws IOException { - ViatraQueryTestCase vqtc = createTestCaseForSnapshot("Block_With_More_than_1_Parent"); - vqtc.assertMatchSetsEqual(Block_With_More_than_1_Parent.instance()); - vqtc.dispose(); + TestRunner.snapshotManager.assertQueryResult(project, Block_With_More_than_1_Parent.instance(), "Block_With_More_than_1_Parent"); } public void testCheckExpression() throws IOException { - ViatraQueryTestCase vqtc = createTestCaseForSnapshot("Check_Expression"); - vqtc.assertMatchSetsEqual(Check_Expression.instance()); - vqtc.dispose(); + TestRunner.snapshotManager.assertQueryResult(project, Check_Expression.instance(), "Check_Expression"); } public void testCircularDependency() throws IOException { - ViatraQueryTestCase vqtc = createTestCaseForSnapshot("Circular_Dependency"); - vqtc.assertMatchSetsEqual(Circular_Dependency.instance()); - vqtc.dispose(); + TestRunner.snapshotManager.assertQueryResult(project, Circular_Dependency.instance(), "Circular_Dependency"); } public void testPatternConstraints() throws IOException { - ViatraQueryTestCase vqtc = createTestCaseForSnapshot("Pattern_Constraints"); - vqtc.assertMatchSetsEqual(Pattern_Constraints.instance()); - vqtc.dispose(); + TestRunner.snapshotManager.assertQueryResult(project, Pattern_Constraints.instance(), "Pattern_Constraints"); } public void testPortConnections() throws IOException { - ViatraQueryTestCase vqtc = createTestCaseForSnapshot("Port_Connections"); - vqtc.assertMatchSetsEqual(Port_Connections.instance()); - vqtc.dispose(); + TestRunner.snapshotManager.assertQueryResult(project, Port_Connections.instance(), "Port_Connections"); } public void testRequirementRealization() throws IOException { - ViatraQueryTestCase vqtc = createTestCaseForSnapshot("Requirement_Realization"); - vqtc.assertMatchSetsEqual(Requirement_Realization.instance()); - vqtc.dispose(); + TestRunner.snapshotManager.assertQueryResult(project, Requirement_Realization.instance(), "Requirement_Realization"); } public void testSubpatternCalls() throws IOException { - ViatraQueryTestCase vqtc = createTestCaseForSnapshot("Subpattern_Calls"); - vqtc.assertMatchSetsEqual(Subpattern_Calls.instance()); - vqtc.dispose(); + TestRunner.snapshotManager.assertQueryResult(project, Subpattern_Calls.instance(), "Subpattern_Calls"); } public void testTransitiveClosure() throws IOException { - ViatraQueryTestCase vqtc = createTestCaseForSnapshot("Transitive_Closure"); - vqtc.assertMatchSetsEqual(Transitive_Closure.instance()); - vqtc.dispose(); + TestRunner.snapshotManager.assertQueryResult(project, Transitive_Closure.instance(), "Transitive_Closure"); } public void testUnreachableStates() throws IOException { - ViatraQueryTestCase vqtc = createTestCaseForSnapshot("Unreachable_States"); - vqtc.assertMatchSetsEqual(Unreachable_States.instance()); - vqtc.dispose(); + TestRunner.snapshotManager.assertQueryResult(project, Unreachable_States.instance(), "Unreachable_States"); } } diff --git a/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/provider/V4MDPatternBasedMatchSetProvider.java b/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/provider/V4MDPatternBasedMatchSetProvider.java index b37e1c9..8614734 100644 --- a/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/provider/V4MDPatternBasedMatchSetProvider.java +++ b/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/provider/V4MDPatternBasedMatchSetProvider.java @@ -15,13 +15,20 @@ public class V4MDPatternBasedMatchSetProvider implements IMatchSetModelProvider { private ViatraQueryAdapter adapter; - private SnapshotHelper helper = new SnapshotHelper(); + private SnapshotHelper helper; public V4MDPatternBasedMatchSetProvider(ViatraQueryAdapter adapter) { this.adapter = adapter; + this.helper = new SnapshotHelper(); } + public V4MDPatternBasedMatchSetProvider(ViatraQueryAdapter adapter, SnapshotHelper snapshotHelper) { + this.adapter = adapter; + this.helper = snapshotHelper; + } + + @Override public MatchSetRecord getMatchSetRecord(EMFScope scope, IQuerySpecification> querySpecification, Match filter) { diff --git a/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/runner/TestRunner.java b/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/runner/TestRunner.java index 7dbc760..4af2b0a 100644 --- a/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/runner/TestRunner.java +++ b/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/runner/TestRunner.java @@ -10,18 +10,29 @@ import org.junit.runner.JUnitCore; import com.incquerylabs.v4md.test.AllTests; +import com.incquerylabs.v4md.test.snapshot.ISnapshotManager; +import com.incquerylabs.v4md.test.snapshot.SnapshotAnalyzer; +import com.incquerylabs.v4md.test.snapshot.SnapshotCreator; import com.nomagic.magicdraw.commandline.CommandLineAction; +import edu.emory.mathcs.backport.java.util.Arrays; + public class TestRunner implements CommandLineAction{ + public static ISnapshotManager snapshotManager = new SnapshotAnalyzer(); + private StartupReportConfiguration getConfiguration() { return StartupReportConfiguration.defaultValue(); } @Override public byte execute(String[] args) { + if(Arrays.asList(args).contains("generateQuerySnapshots")) { + TestRunner.snapshotManager = new SnapshotCreator(); + } + JUnitCore core = new JUnitCore(); RunListener reporter = new DefaultReporterFactory(getConfiguration()).createReporter(); final ReportEntry report = new SimpleReportEntry(AllTests.class.getName(), AllTests.class.getName()); diff --git a/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/snapshot/ISnapshotManager.java b/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/snapshot/ISnapshotManager.java new file mode 100644 index 0000000..8c0afe8 --- /dev/null +++ b/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/snapshot/ISnapshotManager.java @@ -0,0 +1,11 @@ +package com.incquerylabs.v4md.test.snapshot; + +import org.eclipse.viatra.query.runtime.api.IQueryGroup; + +import com.nomagic.magicdraw.core.Project; + +public interface ISnapshotManager { + final static String snapshotLibrary = "snapshots/"; + + void assertQueryResult(Project project, IQueryGroup queryGroup, String snapshotFileName); +} diff --git a/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/snapshot/SnapshotAnalyzer.java b/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/snapshot/SnapshotAnalyzer.java new file mode 100644 index 0000000..8f83176 --- /dev/null +++ b/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/snapshot/SnapshotAnalyzer.java @@ -0,0 +1,63 @@ +package com.incquerylabs.v4md.test.snapshot; + +import java.io.File; +import java.io.IOException; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.viatra.query.runtime.api.IQueryGroup; +import org.eclipse.viatra.query.testing.core.InitializedSnapshotMatchSetModelProvider; +import org.eclipse.viatra.query.testing.core.SnapshotHelper; +import org.eclipse.viatra.query.testing.core.ViatraQueryTestCase; +import org.eclipse.viatra.query.testing.snapshot.QuerySnapshot; +import org.eclipse.viatra.query.testing.snapshot.SnapshotPackage; + +import com.incquerylabs.v4md.ViatraQueryAdapter; +import com.incquerylabs.v4md.test.provider.V4MDPatternBasedMatchSetProvider; +import com.incquerylabs.v4md.test.queries.Non_Unique_Names; +import com.nomagic.magicdraw.core.Project; +import com.nomagic.magicdraw.tests.common.TestEnvironment; + +import org.junit.Assert; + +public class SnapshotAnalyzer implements ISnapshotManager { + + protected QuerySnapshot getSnapshotResource(Project project, String snapshotToUse) throws IOException { + //initialize SnapshotPackage + SnapshotPackage.eINSTANCE.getNsURI(); + String snapshotPath = new File(TestEnvironment.getResourceDir(), snapshotLibrary + snapshotToUse).getCanonicalPath(); + URI uri = URI.createFileURI(snapshotPath); + ResourceSet rs = project.getModel().eResource().getResourceSet(); + Resource r = rs.createResource(uri); + r.load(null); + + return (QuerySnapshot) r.getContents().get(0); + } + + private ViatraQueryTestCase createTestCaseForSnapshot(Project project, String snapshotName) throws IOException { + QuerySnapshot snapshot = getSnapshotResource(project, snapshotName + ".snapshot"); + ViatraQueryAdapter adapter = ViatraQueryAdapter.getOrCreateAdapter(project); + SnapshotHelper snapshotHelper = new TestSnapshotHelperFactory().createSnapshotHelper(); + ViatraQueryTestCase vqtc = new ViatraQueryTestCase(snapshotHelper); + vqtc.addMatchSetModelProvider(new V4MDPatternBasedMatchSetProvider(adapter, snapshotHelper)); + vqtc.addMatchSetModelProvider(new InitializedSnapshotMatchSetModelProvider(snapshot)); + return vqtc; + } + + @Override + public void assertQueryResult(Project project, IQueryGroup queryGroup, String snapshotFileName) { + ViatraQueryTestCase vqtc = null; + try { + vqtc = createTestCaseForSnapshot(project, snapshotFileName); + vqtc.assertMatchSetsEqual(queryGroup); + } catch (IOException e) { + Assert.fail(e.getMessage()); + } finally { + if(vqtc != null) { + vqtc.dispose(); + } + } + } + +} diff --git a/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/snapshot/SnapshotCreator.java b/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/snapshot/SnapshotCreator.java new file mode 100644 index 0000000..0667ad2 --- /dev/null +++ b/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/snapshot/SnapshotCreator.java @@ -0,0 +1,47 @@ +package com.incquerylabs.v4md.test.snapshot; + +import java.io.File; +import java.io.IOException; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.viatra.query.runtime.api.IQueryGroup; +import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; +import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher; +import org.eclipse.viatra.query.testing.core.SnapshotHelper; +import org.eclipse.viatra.query.testing.snapshot.QuerySnapshot; +import org.eclipse.viatra.query.testing.snapshot.SnapshotFactory; +import org.junit.Assert; + +import com.incquerylabs.v4md.ViatraQueryAdapter; +import com.nomagic.magicdraw.core.Project; +import com.nomagic.magicdraw.tests.common.TestEnvironment; + +public class SnapshotCreator implements ISnapshotManager { + + private void createAndSaveSnapshot(ViatraQueryEngine engine, IQueryGroup group, String snapshotName) throws IOException { + SnapshotHelper helper = new TestSnapshotHelperFactory().createSnapshotHelper(); + QuerySnapshot snap = SnapshotFactory.eINSTANCE.createQuerySnapshot(); + + group.getSpecifications().forEach( spec -> helper.saveMatchesToSnapshot((ViatraQueryMatcher)engine.getMatcher(spec), snap)); + + ResourceSet resourceSet = new ResourceSetImpl(); + Resource resource = resourceSet.createResource(URI.createFileURI(new File(TestEnvironment.getResourceDir(), snapshotLibrary + snapshotName +".snapshot").getAbsolutePath())); + resource.getContents().add(snap); + + resource.save(null); + } + + @Override + public void assertQueryResult(Project project, IQueryGroup queryGroup, String snapshotFileName) { + try { + ViatraQueryEngine engine = ViatraQueryAdapter.getOrCreateAdapter(project).getEngine(); + createAndSaveSnapshot(engine, queryGroup, snapshotFileName); + } catch (IOException e) { + Assert.fail(e.getMessage()); + } + } + +} diff --git a/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/snapshot/TestSnapshotHelperFactory.java b/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/snapshot/TestSnapshotHelperFactory.java new file mode 100644 index 0000000..5389aeb --- /dev/null +++ b/com.incquerylabs.v4md/src/test/com/incquerylabs/v4md/test/snapshot/TestSnapshotHelperFactory.java @@ -0,0 +1,71 @@ +package com.incquerylabs.v4md.test.snapshot; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.viatra.query.testing.core.SnapshotHelper; +import org.eclipse.viatra.query.testing.core.api.JavaObjectAccess; + +import com.google.common.collect.Maps; +import com.nomagic.uml2.ext.jmi.helpers.ModelHelper; +import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement; +import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Property; +import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Type; +import com.nomagic.uml2.ext.magicdraw.compositestructures.mdinternalstructures.ConnectableElement; +import com.nomagic.uml2.ext.magicdraw.compositestructures.mdinternalstructures.Connector; +import com.nomagic.uml2.ext.magicdraw.compositestructures.mdports.Port; +import com.nomagic.uml2.ext.magicdraw.metadata.UMLPackage.Literals; + +public class TestSnapshotHelperFactory { + private Map> snapshotStringFunctionMap; + + public Map> getSnapshotStringFunctionMap() { + return snapshotStringFunctionMap; + } + + public TestSnapshotHelperFactory() { + this.snapshotStringFunctionMap = new HashMap>(); + this.snapshotStringFunctionMap.put(Literals.CONNECTOR, element -> { + Connector connector = (Connector) element; + ConnectableElement firstRole = ModelHelper.getFirstEnd(connector).getRole(); + ConnectableElement secondRole = ModelHelper.getSecondEnd(connector).getRole(); + String fqn1 = firstRole.getQualifiedName(); + String fqn2 = secondRole.getQualifiedName(); + return (fqn1.compareTo(fqn2) <= 0) ? String.format("%s <-> %s", fqn1, fqn2) : String.format("%s <-> %s", fqn2, fqn1); + }); + this.snapshotStringFunctionMap.put(Literals.PORT, element -> { + Port port = (Port) element; + return port.getQualifiedName(); + }); + this.snapshotStringFunctionMap.put(Literals.PROPERTY, element -> { + Property property = (Property) element; + String qualifiedName = property.getQualifiedName(); + if (property.getName() == null || property.getName().isEmpty()) { + return String.format("%s -> : %s", qualifiedName.substring(0, qualifiedName.length() - 2), property.getType().getName()); + } else { + Type type = property.getType(); + String typeName = "Untyped"; + if(type != null) { + typeName = type.getName(); + } + + return String.format("%s : %s", qualifiedName, typeName); + } + }); + this.snapshotStringFunctionMap.put(Literals.NAMED_ELEMENT, element -> { + NamedElement namedElement = (NamedElement) element; + return namedElement.getQualifiedName(); + }); + } + + public SnapshotHelper createSnapshotHelper(Map> snapshotStringFunctionMap) { + return new SnapshotHelper(Maps.newHashMap(), snapshotStringFunctionMap); + } + + public SnapshotHelper createSnapshotHelper() { + return createSnapshotHelper(snapshotStringFunctionMap); + } +} diff --git a/com.incquerylabs.v4md/src/test/data/snapshots/Aggregator_Functions.snapshot b/com.incquerylabs.v4md/src/test/data/snapshots/Aggregator_Functions.snapshot index 59174d2..72dc7d8 100644 --- a/com.incquerylabs.v4md/src/test/data/snapshots/Aggregator_Functions.snapshot +++ b/com.incquerylabs.v4md/src/test/data/snapshots/Aggregator_Functions.snapshot @@ -1,18628 +1,18628 @@ - + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + - - - - - + + + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - - - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + - - + + + + + + - - + + + + + + - - - + + + + + + + + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - + + + + + - - - - - - + + + + + + - - - - - - - - - - - + + + + + - - - - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - - - + + + + + - diff --git a/com.incquerylabs.v4md/src/test/data/snapshots/Block_With_More_than_1_Parent.snapshot b/com.incquerylabs.v4md/src/test/data/snapshots/Block_With_More_than_1_Parent.snapshot index bd5027a..d6f16c1 100644 --- a/com.incquerylabs.v4md/src/test/data/snapshots/Block_With_More_than_1_Parent.snapshot +++ b/com.incquerylabs.v4md/src/test/data/snapshots/Block_With_More_than_1_Parent.snapshot @@ -1,13821 +1,13821 @@ + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - diff --git a/com.incquerylabs.v4md/src/test/data/snapshots/Check_Expression.snapshot b/com.incquerylabs.v4md/src/test/data/snapshots/Check_Expression.snapshot index b6686af..c1157f6 100644 --- a/com.incquerylabs.v4md/src/test/data/snapshots/Check_Expression.snapshot +++ b/com.incquerylabs.v4md/src/test/data/snapshots/Check_Expression.snapshot @@ -2,58 +2,58 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/com.incquerylabs.v4md/src/test/data/snapshots/Circular_Dependency.snapshot b/com.incquerylabs.v4md/src/test/data/snapshots/Circular_Dependency.snapshot index d48a7ef..63f3c9f 100644 --- a/com.incquerylabs.v4md/src/test/data/snapshots/Circular_Dependency.snapshot +++ b/com.incquerylabs.v4md/src/test/data/snapshots/Circular_Dependency.snapshot @@ -2,188 +2,188 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/com.incquerylabs.v4md/src/test/data/snapshots/Non_Unique_Names.snapshot b/com.incquerylabs.v4md/src/test/data/snapshots/Non_Unique_Names.snapshot index 36b349f..32e855c 100644 --- a/com.incquerylabs.v4md/src/test/data/snapshots/Non_Unique_Names.snapshot +++ b/com.incquerylabs.v4md/src/test/data/snapshots/Non_Unique_Names.snapshot @@ -1,83 +1,83 @@ - + - - + + + + + - - + + - - + + - - + + + + + - - + + + + + - - + + - - + + + + + - - + + - + - - - - - + + - - + + - - + + - - - - - + + - - - - - + + - - + + - - - - - + + - - + + diff --git a/com.incquerylabs.v4md/src/test/data/snapshots/Pattern_Constraints.snapshot b/com.incquerylabs.v4md/src/test/data/snapshots/Pattern_Constraints.snapshot index fd85b44..0177109 100644 --- a/com.incquerylabs.v4md/src/test/data/snapshots/Pattern_Constraints.snapshot +++ b/com.incquerylabs.v4md/src/test/data/snapshots/Pattern_Constraints.snapshot @@ -2,54940 +2,54940 @@ - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - - - - - - - - - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + + + + + + + + + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + + + + + + + + + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - - - - - - - - - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - - - - - - - + + - - - - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - - - - - - - - - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + + + + + + + + + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + + + + + + + + + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + + + + + + + + + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + + + + + + + + + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - - - - - - - - - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + + + + + + + + + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - - - - - - - - - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + - - + + - - + + - + diff --git a/com.incquerylabs.v4md/src/test/data/snapshots/Port_Connections.snapshot b/com.incquerylabs.v4md/src/test/data/snapshots/Port_Connections.snapshot index 79fa579..8c6074e 100644 --- a/com.incquerylabs.v4md/src/test/data/snapshots/Port_Connections.snapshot +++ b/com.incquerylabs.v4md/src/test/data/snapshots/Port_Connections.snapshot @@ -2,1301 +2,1301 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/com.incquerylabs.v4md/src/test/data/snapshots/Requirement_Realization.snapshot b/com.incquerylabs.v4md/src/test/data/snapshots/Requirement_Realization.snapshot index ba0b89e..cf4cf46 100644 --- a/com.incquerylabs.v4md/src/test/data/snapshots/Requirement_Realization.snapshot +++ b/com.incquerylabs.v4md/src/test/data/snapshots/Requirement_Realization.snapshot @@ -2,107 +2,107 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/com.incquerylabs.v4md/src/test/data/snapshots/Subpattern_Calls.snapshot b/com.incquerylabs.v4md/src/test/data/snapshots/Subpattern_Calls.snapshot index bd5ef43..4d1549c 100644 --- a/com.incquerylabs.v4md/src/test/data/snapshots/Subpattern_Calls.snapshot +++ b/com.incquerylabs.v4md/src/test/data/snapshots/Subpattern_Calls.snapshot @@ -1,885 +1,885 @@ - + - - + + - - + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - + + - - + + - - + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - + + - - + + diff --git a/com.incquerylabs.v4md/src/test/data/snapshots/Transitive_Closure.snapshot b/com.incquerylabs.v4md/src/test/data/snapshots/Transitive_Closure.snapshot index a4e0ae0..1b30806 100644 --- a/com.incquerylabs.v4md/src/test/data/snapshots/Transitive_Closure.snapshot +++ b/com.incquerylabs.v4md/src/test/data/snapshots/Transitive_Closure.snapshot @@ -2,29230 +2,29230 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/com.incquerylabs.v4md/src/test/data/snapshots/Unreachable_States.snapshot b/com.incquerylabs.v4md/src/test/data/snapshots/Unreachable_States.snapshot index b8012c7..22be47a 100644 --- a/com.incquerylabs.v4md/src/test/data/snapshots/Unreachable_States.snapshot +++ b/com.incquerylabs.v4md/src/test/data/snapshots/Unreachable_States.snapshot @@ -2,300 +2,300 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - -