Removes examples for discontinued CPP-based LS implementation

Change-Id: I349033a73f5e21460fad05223379ec3975c746a2
Signed-off-by: Zoltan Ujhelyi <zoltan.ujhelyi@incquerylabs.com>
diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/.classpath b/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/.classpath
deleted file mode 100644
index ccc2c0c..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="emf-gen"/>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="xtend-gen"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
-	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="src" path="src-gen/"/>
-	<classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/.gitignore b/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/.gitignore
deleted file mode 100644
index 64a0ea5..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/bin/

-/cpp-gen/
\ No newline at end of file
diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/.project b/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/.project
deleted file mode 100644
index 6846111..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/.project
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

-<projectDescription>

-	<name>org.eclipse.viatra.query.localsearch.cpp.example</name>

-	<comment></comment>

-	<projects>

-	</projects>

-	<buildSpec>

-		<buildCommand>

-			<name>org.eclipse.viatra.query.tooling.core.projectbuilder</name>

-			<arguments>

-			</arguments>

-		</buildCommand>

-		<buildCommand>

-			<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>

-			<arguments>

-			</arguments>

-		</buildCommand>

-		<buildCommand>

-			<name>org.eclipse.jdt.core.javabuilder</name>

-			<arguments>

-			</arguments>

-		</buildCommand>

-		<buildCommand>

-			<name>org.eclipse.pde.ManifestBuilder</name>

-			<arguments>

-			</arguments>

-		</buildCommand>

-		<buildCommand>

-			<name>org.eclipse.pde.SchemaBuilder</name>

-			<arguments>

-			</arguments>

-		</buildCommand>

-	</buildSpec>

-	<natures>

-		<nature>org.eclipse.jdt.core.javanature</nature>

-		<nature>org.eclipse.pde.PluginNature</nature>

-		<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>

-		<nature>org.eclipse.viatra.query.projectnature</nature>

-	</natures>

-</projectDescription>

diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/.settings/org.eclipse.jdt.core.prefs b/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 7341ab1..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,11 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.7
diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/META-INF/MANIFEST.MF b/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/META-INF/MANIFEST.MF
deleted file mode 100644
index 2b37b51..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,23 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: VIATRA Localsearch C++ Usage Example (Incubation)
-Bundle-SymbolicName: org.eclipse.viatra.query.localsearch.cpp.example;singleton:=true
-Bundle-Version: 1.0.0.qualifier
-Bundle-ClassPath: .
-Bundle-Vendor: Eclipse VIATRA Project
-Export-Package: org.eclipse.viatra.query.localsearch.cpp.example.query,
- org.eclipse.viatra.query.localsearch.cpp.example.query.util
-Require-Bundle: org.eclipse.core.runtime,
- com.google.guava,
- org.eclipse.xtext.xbase.lib,
- org.eclipse.xtend.lib,
- org.eclipse.xtend.lib.macro,
- org.eclipse.emf.ecore;visibility:=reexport,
- org.eclipse.emf.ecore.xmi;bundle-version="2.11.1",
- org.eclipse.viatra.query.runtime;bundle-version="1.3.0",
- org.eclipse.viatra.query.runtime.localsearch;bundle-version="1.3.0",
- org.eclipse.viatra.examples.cps.model;bundle-version="0.1.0",
- org.eclipse.viatra.query.runtime.base.itc;bundle-version="1.3.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Bundle-ActivationPolicy: lazy
-Import-Package: org.apache.log4j
diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/build.properties b/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/build.properties
deleted file mode 100644
index a9ab8b5..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/build.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-bin.includes = .,\

-               model/,\

-               META-INF/,\

-               plugin.xml,\

-               plugin.properties

-jars.compile.order = .

-source.. = src/,\

-           src-gen/

-output.. = bin/

diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/emf-gen/.gitignore b/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/emf-gen/.gitignore
deleted file mode 100644
index ce4a58f..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/emf-gen/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-#This file is needed to prevent git from omitting this folder that would cause build issues/compile errors.

-# Ignore everything in this directory

-*

-# Except this file

-!.gitignore
\ No newline at end of file
diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/plugin.xml b/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/plugin.xml
deleted file mode 100644
index 7dfdb17..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/plugin.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?><?eclipse version="3.0"?><!--
---><plugin>
-  <extension id="org.eclipse.viatra.query.localsearch.cpp.example.query.Cps" point="org.eclipse.viatra.query.runtime.queryspecification">
-    <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:org.eclipse.viatra.query.localsearch.cpp.example.query.Cps" id="org.eclipse.viatra.query.localsearch.cpp.example.query.Cps">
-      <query-specification fqn="org.eclipse.viatra.query.localsearch.cpp.example.query.applicationInstances"/>
-      <query-specification fqn="org.eclipse.viatra.query.localsearch.cpp.example.query.hostInstances"/>
-      <query-specification fqn="org.eclipse.viatra.query.localsearch.cpp.example.query.appInstanceType"/>
-      <query-specification fqn="org.eclipse.viatra.query.localsearch.cpp.example.query.applicationName"/>
-      <query-specification fqn="org.eclipse.viatra.query.localsearch.cpp.example.query.applicationRequirements"/>
-      <query-specification fqn="org.eclipse.viatra.query.localsearch.cpp.example.query.communicatingTypes"/>
-      <query-specification fqn="org.eclipse.viatra.query.localsearch.cpp.example.query.usefulApplicationTypes"/>
-      <query-specification fqn="org.eclipse.viatra.query.localsearch.cpp.example.query.uselessApplicationTypes"/>
-    </group>
-  </extension>
-</plugin>
diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src-gen/.gitignore b/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src-gen/.gitignore
deleted file mode 100644
index ce4a58f..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src-gen/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-#This file is needed to prevent git from omitting this folder that would cause build issues/compile errors.

-# Ignore everything in this directory

-*

-# Except this file

-!.gitignore
\ No newline at end of file
diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src/main.cpp b/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src/main.cpp
deleted file mode 100644
index 7e7597d..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src/main.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014-2016 Robert Doczi, IncQuery Labs Ltd.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Robert Doczi - initial API and implementation
- *******************************************************************************/
-
-
-#include "cyberPhysicalSystem_def.h"
-
-#include "Viatra\Query\QueryEngine.h"
-#include "Viatra\Query\Matcher\ModelIndex.h"
-#include "Viatra\Query\CPS\CommunicatingTypesMatcher.h"
-
-#include <cmath>
-#include <chrono>
-#include <iostream>
-#include <functional>
-#include <string>
-#include <vector>
-
-using namespace ::cyberPhysicalSystem;
-
-namespace Viatra {
-	namespace Query {
-		template<>
-		struct ModelIndex<::cyberPhysicalSystem::ApplicationType, ::cyberPhysicalSystem::CyberPhysicalSystem> {
-			static const std::list<::cyberPhysicalSystem::ApplicationType*>& instances(const ::cyberPhysicalSystem::CyberPhysicalSystem* modelroot) {
-				return ::cyberPhysicalSystem::ApplicationType::_instances;
-			}
-		};
-
-		template<>
-		struct ModelIndex<::cyberPhysicalSystem::HostType, ::cyberPhysicalSystem::CyberPhysicalSystem> {
-			static const std::list<::cyberPhysicalSystem::HostType*>& instances(const ::cyberPhysicalSystem::CyberPhysicalSystem* modelroot) {
-				return ::cyberPhysicalSystem::HostType::_instances;
-			}
-		};
-
-	}
-}
-
-std::vector<CyberPhysicalSystem*> cpss;
-
-const int HOST_TYPES = 5;
-const int HOST_INSTANCES = 20;
-const int APP_TYPES = 10;
-const int APP_INSTANCES = 500;
-
-const int REQUIREMENTS_PER_APP_TYPE = 10;
-const int APP_INSTANCES_PER_HOST_INSTANCES = 5;
-
-std::string get_random_string(const std::string& characters, int length) {
-	std::string ret;
-	for (int i = 0; i < length; ++i) {
-		ret += characters[rand() % characters.size()];
-	}
-
-	return ret;
-}
-
-std::string get_alpha_string(int length) {
-	return get_random_string("abcdefghijklmnopqrstvwxyz", length);
-}
-
-std::string get_alphanumeric_string(int length) {
-	return get_random_string("ABCDEFGHIJKLMNOPQRSTVWXYZ1234567890", length);
-}
-
-template <typename I>
-I random_element(I begin, I end)
-{
-	const unsigned long n = std::distance(begin, end);
-	const unsigned long divisor = (RAND_MAX + 1) / n;
-
-	unsigned long k;
-	do { k = std::rand() / divisor; } while (k >= n);
-
-	std::advance(begin, k);
-	return begin;
-}
-
-long get_unique_id() {
-	static long id = 0;
-	long new_id = id++;
-	return new_id;
-}
-
-void init_model(int scale) {
-	std::cout << "Initializing model (scale : " << scale << ")" << std::endl;
-
-	for (int i = 0; i < scale; ++i) {
-		auto cps = new CyberPhysicalSystem();
-		cpss.push_back(cps);
-
-		for (int j = 0; j < APP_TYPES; ++j) {
-			auto appType = new ApplicationType();
-			appType->cps = cps;
-			cps->identifier = get_alpha_string(12);
-
-			cps->appTypes.push_back(appType);
-
-			for (int j = 0; j < APP_INSTANCES; ++j) {
-				auto appInstance = new ApplicationInstance();
-				appInstance->identifier = get_alpha_string(12);
-				appInstance->type = appType;
-
-				appType->instances.push_back(appInstance);
-			}
-
-			for (int j = 0; j < REQUIREMENTS_PER_APP_TYPE; ++j) {
-				auto requirement = new ResourceRequirement();
-				requirement->identifier = get_alphanumeric_string(6);
-
-				appType->requirements.push_back(requirement);
-			}
-		}
-
-		for (int j = 0; j < HOST_TYPES; ++j) {
-			auto hostType = new HostType();
-			hostType->identifier = get_alpha_string(12);
-
-			cps->hostTypes.push_back(hostType);
-
-			for (int j = 0; j < HOST_INSTANCES; ++j) {
-				auto hostInstance = new HostInstance();
-				hostInstance->identifier = get_alpha_string(12);
-
-				hostType->instances.push_back(hostInstance);
-			}
-		}
-
-	}
-}
-
-void query(int runs) {
-	int size;
-
-	auto start = std::chrono::high_resolution_clock::now();
-
-	auto engine = ::Viatra::Query::QueryEngine<CyberPhysicalSystem>::empty();
-	auto matcher = engine.matcher<::Viatra::Query::Cps::CommunicatingTypesQuerySpecification>();
-
-	for (int i = 0; i < runs; ++i) {
-
-		auto sos = matcher.matches();
-		size = sos.size();
-	}
-
-	auto end = std::chrono::high_resolution_clock::now();
-	auto elapsed = std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
-
-	std::cout << size << std::endl;
-	std::cout << "Elapsed time: " << elapsed / runs << " us" << std::endl;
-}
-
-void cleanup_model() {
-	for (auto&& cps : cpss) {
-		for (auto&& appType : cps->appTypes) {
-			for (auto&& appInstance : appType->instances) {
-				delete appInstance;
-			}
-			for (auto&& requirement : appType->requirements) {
-				delete requirement;
-			}
-			delete appType;
-		}
-
-		for (auto&& hostType : cps->hostTypes) {
-			for (auto&& hostInstance : hostType->instances) {
-				delete hostInstance;
-			}
-			delete hostType;
-		}
-	}
-
-	cpss.clear();
-}
-
-void run(int levels, int runs) {
-	for (int i = 0; i < levels; ++i) {
-		init_model(pow(2, i));
-		query(runs);
-		cleanup_model();
-	}
-}
-
-int main(int argc, char **argv) {
-	std::cout << "start" << std::endl;
-	run(6, 1);
-}
diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src/main2.cpp b/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src/main2.cpp
deleted file mode 100644
index 603c08e..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src/main2.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014-2016 Robert Doczi, IncQuery Labs Ltd.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     Robert Doczi - initial API and implementation
- *******************************************************************************/
-#include "Viatra\Query\Matcher\ModelIndex.h"
-
-#include <unordered_set>
-#include <functional>
-#include <iostream>
-
-#include "cyberPhysicalSystem_def.h"
-#include "Viatra\Query\CPS\HostInstancesMatcher.h"
-#include "Viatra\Query\CPS\ApplicationNameMatcher.h"
-#include "Viatra\Query\CPS\UsefulApplicationMatcher.h"
-#include "Viatra\Query\CPS\UselessApplicationMatcher.h"
-
-using namespace ::cyberPhysicalSystem;
-
-namespace Viatra {
-namespace Query {
-
-template<>
-struct ModelIndex<::cyberPhysicalSystem::ApplicationType, ::cyberPhysicalSystem::CyberPhysicalSystem> {
-	static const std::list<::cyberPhysicalSystem::ApplicationType*>& instances(const ::cyberPhysicalSystem::CyberPhysicalSystem* modelroot) {
-		return ::cyberPhysicalSystem::ApplicationType::_instances;
-	}
-};
-
-template<>
-struct ModelIndex<::cyberPhysicalSystem::AppInstance, ::cyberPhysicalSystem::CyberPhysicalSystem> {
-	static const std::list<::cyberPhysicalSystem::AppInstance*>& instances(const ::cyberPhysicalSystem::CyberPhysicalSystem* modelroot) {
-		return ::cyberPhysicalSystem::AppInstance::_instances;
-	}
-};
-
-template<>
-struct ModelIndex<::cyberPhysicalSystem::HostType, ::cyberPhysicalSystem::CyberPhysicalSystem> {
-	static const std::list<::cyberPhysicalSystem::HostType*>& instances(const ::cyberPhysicalSystem::CyberPhysicalSystem* modelroot) {
-		return ::cyberPhysicalSystem::HostType::_instances;
-	}
-};
-
-template<>
-struct ModelIndex<::cyberPhysicalSystem::HostInstance, ::cyberPhysicalSystem::CyberPhysicalSystem> {
-	static const std::list<::cyberPhysicalSystem::HostInstance*>& instances(const ::cyberPhysicalSystem::CyberPhysicalSystem* modelroot) {
-		return ::cyberPhysicalSystem::HostInstance::_instances;
-	}
-};
-
-}
-}
-
-
-int main() {
-	auto at = new ApplicationType();
-	at->identifier = "at1";
-	auto ai = new ApplicationInstance();
-	ai->identifier = "ai1";
-	ai->type = at;
-	at->instances.push_back(ai);
-	ai = new ApplicationInstance();
-	ai->identifier = "ai2";
-	ai->type = at;
-	at->instances.push_back(ai);
-	at = new ApplicationType();
-	at->identifier = "at2";
-	at = new ApplicationType();
-	at->identifier = "at3";
-	ai = new ApplicationInstance();
-	ai->identifier = "ai3";
-	ai->type = at;
-	at->instances.push_back(ai);
-	auto ht = new HostType();
-	ht->identifier = "ht1";
-	auto hi = new HostInstance();
-	hi->identifier = "hi1";
-	ht->instances.push_back(hi);
-	ai->allocatedTo = hi;
-	hi->applications.push_back(ai);
-
-	auto engine = ::Viatra::Query::QueryEngine<School>::of((School*)0x12345678); 
-
-	//{
-	//	auto matcher = engine.matcher<::Viatra::Query::School::SchoolsQuerySpecification>();
-	//	auto matches = matcher.matches();
-
-	//	int i = 0;
-	//	for (auto&& sch : matches) {
-	//		std::cout << "School{" << sch.school->name << "}" << std::endl;
-	//		if (i++ > 10) {
-	//			break;
-	//		}
-	//	}
-	//}
-
-	{
-		auto matcher = engine.matcher<::Viatra::Query::CPS::HostInstancesQuerySpecification>();
-		auto matches = matcher.matches(s);
-
-		int i = 0;
-		for (auto&& m : matches) {
-			std::cout << "HostInstance{" << m.hostInstance->identifier<< "}" << std::endl;
-			if (i++ > 10) {
-				break;
-			}
-		}
-	}
-
-	{
-		auto matcher = engine.matcher<::Viatra::Query::CPS::ApplicationNameQuerySpecification>();
-		auto matches = matcher.matches();
-
-		int i = 0;
-		for (auto&& m : matches) {
-			std::cout << "name {" << m.name << "}" << " ApplicationInstance{" << m.appInstance->name << "}" << std::endl;
-			if (i++ > 10) {
-				break;
-			}
-		}
-	}
-
-	{
-		std::cout << "Teachers with work: " << std::endl;
-		auto matcher = engine.matcher<::Viatra::Query::CPS::UsefulApplicationTypesQuerySpecification>();
-		auto matches = matcher.matches();
-
-		int i = 0;
-		for (auto&& m : matches) {
-			std::cout << " ApplicationType{" << m.appType->identifier<< "}" << std::endl;
-			if (i++ > 10) {
-				break;
-			}
-		}
-	}
-
-	{
-		std::cout << "Teachers without work: " << std::endl;
-		auto matcher = engine.matcher<::Viatra::Query::CPS::UselessApplicationTypesQuerySpecification>();
-		auto matches = matcher.matches();
-
-		int i = 0;
-		for (auto&& m : matches) {
-			std::cout << " ApplicationType{" << m.teacher->name << "}" << std::endl;
-			if (i++ > 10) {
-				break;
-			}
-		}
-	}
-
-	return 0;
-}
diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src/org/eclipse/viatra/query/localsearch/cpp/example/Main.xtend b/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src/org/eclipse/viatra/query/localsearch/cpp/example/Main.xtend
deleted file mode 100644
index 413dbe2..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src/org/eclipse/viatra/query/localsearch/cpp/example/Main.xtend
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************

- * Copyright (c) 2014-2016 Robert Doczi, IncQuery Labs Ltd.

- * All rights reserved. This program and the accompanying materials

- * are made available under the terms of the Eclipse Public License v1.0

- * which accompanies this distribution, and is available at

- * http://www.eclipse.org/legal/epl-v10.html

- * 

- * Contributors:

- *     Robert Doczi - initial API and implementation

- *******************************************************************************/

-package org.eclipse.viatra.query.localsearch.cpp.example

-

-import com.google.common.base.Stopwatch

-import com.google.common.collect.Lists

-import com.google.common.collect.Sets

-import java.util.List

-import java.util.Random

-import java.util.concurrent.TimeUnit

-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.emf.ecore.xmi.impl.EcoreResourceFactoryImpl

-import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl

-import org.eclipse.viatra.examples.cps.cyberPhysicalSystem.CyberPhysicalSystemFactory

-import org.eclipse.viatra.query.localsearch.cpp.example.query.util.CommunicatingTypesQuerySpecification

-import org.eclipse.viatra.query.runtime.api.AdvancedViatraQueryEngine

-import org.eclipse.viatra.query.runtime.api.IPatternMatch

-import org.eclipse.viatra.query.runtime.api.IQuerySpecification

-import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher

-import org.eclipse.viatra.query.runtime.emf.EMFScope

-import org.eclipse.viatra.query.runtime.localsearch.matcher.integration.LocalSearchBackendFactory

-import org.eclipse.viatra.query.runtime.localsearch.matcher.integration.LocalSearchHintKeys

-import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint

-

-/**

- * @author Robert Doczi

- */

-class Main {

-

-	static val SEED = 0;

-	static val random = new Random(SEED)

-

-	static val HOST_TYPES = 5

-	static val HOST_INSTANCES = 20

-	static val APP_TYPES = 10

-	static val APP_INSTANCES = 500

-

-	static val REQUIREMENTS_PER_APP_TYPE = 10

-	static val APP_INSTANCES_PER_HOST_INSTANCES = 5

-

-	long currentId = 0;

-	ResourceSet cpsResourceSet = new ResourceSetImpl;

-

-	def getAlphabeticString(int length) {

-		val chars = "abcdefghijklmnopqrstvwxyz"

-		getRandomString(random, chars, length)

-	}

-

-	def getAlphaNumericString(int length) {

-		val chars = "ABCDEFGHIJKLMNOPQRSTVWXYZ1234567890"

-		getRandomString(random, chars, length)

-	}

-

-	def getRandomString(Random rnd, String characters, int length) {

-		val StringBuilder sb = new StringBuilder;

-		for (i : 0 ..< length) {

-			sb.append(characters.charAt(rnd.nextInt(characters.length)))

-		}

-		return sb.toString

-	}

-

-	def <E> getRandom(Iterable<E> iterable) {

-		val n = iterable.size

-		if (n == 0)

-			return null

-

-		val rnd = random.nextDouble

-		val idx = Math.round(rnd * n - 1) as int;

-

-		return iterable.get(idx)

-	}

-

-	def <E> getRandom(Iterable<E> iterable, int count) {

-		if (count <= 0)

-			return #{}

-

-		val n = iterable.size

-		if (n == 0)

-			return #{}

-

-		if (count > n)

-			return Sets::newHashSet(iterable)

-

-		val data = Lists::newLinkedList(iterable)

-		val resultData = newHashSet

-		

-		for(i : 0 ..< count) {

-			val rnd = random.nextDouble

-			val idx = Math.max(0, Math.round((rnd * data.size) - 1)) as int;

-			

-			resultData += data.get(idx)

-			data.remove(idx)

-		}

-

-		return resultData

-	}

-

-	def getUniqueId() {

-		val id = currentId;

-		currentId++;

-		return id;

-	}

-

-	def init() {

-		cpsResourceSet.createResource(URI::createPlatformResourceURI("example.cyberphysicalsystem", true))

-	}

-

-	def initModel(int size) {

-		println('''Initializing model (scale : «size»)''')

-		extension val factory = CyberPhysicalSystemFactory.eINSTANCE

-

-		cpsResourceSet.resources.clear

-

-		val cpsResource = cpsResourceSet.createResource(URI::createPlatformResourceURI("example.cyberphysicalsystem", true))

-		for (i : 0 ..< size) {

-			val cps = createCyberPhysicalSystem

-

-			cpsResource.contents.add(cps)

-

-			for (j : 0 ..< APP_TYPES) {

-				val appType = createApplicationType => [

-					it.identifier = getAlphabeticString(12)

-				]

-				cps.appTypes += appType

-

-				for (k : 0 ..< APP_INSTANCES) {

-					appType.instances += createApplicationInstance => [

-						it.identifier = getAlphabeticString(12)

-

-					]

-				}

-				

-				for (k : 0 ..< REQUIREMENTS_PER_APP_TYPE) {

-					appType.requirements += createResourceRequirement => [

-						it.identifier = getAlphaNumericString(6)

-					]

-				} 

-			}

-

-			for (j : 0 ..< HOST_TYPES) {

-				val hostType = createHostType => [

-					it.identifier = getAlphabeticString(12)

-				]

-				cps.hostTypes += hostType

-

-				for (k : 0 ..< HOST_INSTANCES) {

-					hostType.instances += createHostInstance => [

-						it.identifier = getAlphabeticString(12)

-						it.applications += cps.appTypes.map[instances].flatten.getRandom(APP_INSTANCES_PER_HOST_INSTANCES)

-					]

-				}

-			}

-		}

-

-	}

-

-	def void query(int runs,

-		List<IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> patterns) {

-

-		for (patternSpecification : patterns) {

-			println('''Preparing query: «patternSpecification.fullyQualifiedName»''')

-

-			val hint = new QueryEvaluationHint(LocalSearchBackendFactory.INSTANCE, #{

-				LocalSearchHintKeys::USE_BASE_INDEX -> false

-			})

-

-			val sw = Stopwatch::createUnstarted

-			var deltaMem = 0.0;

-			for (i : 1 .. runs) {

-				for (j : 0 ..< 10)

-					System.gc

-				val memStart = Runtime.runtime.totalMemory - Runtime.runtime.freeMemory

-				sw.start

-				val engine = AdvancedViatraQueryEngine::createUnmanagedEngine(new EMFScope(cpsResourceSet))

-

-				val matcher = engine.getMatcher(patternSpecification ,hint)

-				val count = matcher.countMatches

-				

-				println(count)

-

-				sw.stop

-				val memEnd = Runtime.runtime.totalMemory - Runtime.runtime.freeMemory

-				deltaMem = memEnd - memStart;

-				engine.dispose

-			}

-

-			println('''Elapsed time: «sw.elapsed(TimeUnit::MICROSECONDS) / runs» us''')

-			println('''Memory usage: «(deltaMem / runs) / 1024» kb''')

-			// println(matches.size)

-			for (i : 0 ..< 10)

-				System.gc

-		}

-

-	}

-

-	def void run(int levels, int runs,

-		List<IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> patterns) {

-		for (i : 0 ..< levels) {

-			initModel(Math.pow(2, i) as int)

-			query(runs, #[CommunicatingTypesQuerySpecification::instance])

-		}

-	}

-

-	def static void main(String[] args) {

-		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl);

-		Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("cyberphysicalsystem", new XMIResourceFactoryImpl);

-

-		val main = new Main

-		main.init

-		main.run(6, 10, #[])

-	}

-}

diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src/org/eclipse/viatra/query/localsearch/cpp/example/query/cps.vql b/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src/org/eclipse/viatra/query/localsearch/cpp/example/query/cps.vql
deleted file mode 100644
index 7b2bb38..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/src/org/eclipse/viatra/query/localsearch/cpp/example/query/cps.vql
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************

- * Copyright (c) 2014-2016 Robert Doczi, IncQuery Labs Ltd.

- * All rights reserved. This program and the accompanying materials

- * are made available under the terms of the Eclipse Public License v1.0

- * which accompanies this distribution, and is available at

- * http://www.eclipse.org/legal/epl-v10.html

- *

- * Contributors:

- *     Robert Doczi - initial API and implementation

- *******************************************************************************/

-package org.eclipse.viatra.query.localsearch.cpp.example.query

-

-import "http://org.eclipse.viatra/model/cps"

-

-pattern applicationInstances(appInstance) {
-	ApplicationInstance(appInstance);
-}

-

-pattern hostInstances(hostInstance) {

-	HostInstance(hostInstance);

-}

-

-@Bind(parameters={appType})

-pattern appInstanceType(appInstance, appType) {
-	ApplicationType.instances(appType, appInstance);
-}

-

-@Bind(parameters={appInstance})

-@Bind(parameters={name})

-pattern applicationName(appInstance, name) {

-	ApplicationInstance.identifier(appInstance, name);

-}

-

-@Bind(parameters={appInstance, requirement})

-pattern applicationRequirements(appInstance, requirement) {

-	find appInstanceType(appInstance, appType);

-	ApplicationType.requirements(appType, requirement);

-}

-

-@Bind(parameters={appType})

-@Bind(parameters={hostType})

-@Bind(parameters={appType, hostType})

-pattern communicatingTypes(appType, hostType) {

-	ApplicationType.instances.allocatedTo(appType, hostInstance);

-	HostType.instances(hostType, hostInstance);

-}

-

-// has either an instance or a requirement

-pattern usefulApplicationTypes(appType) {

-	ApplicationType.instances(appType, _);

-} or {

-	ApplicationType.requirements(appType, _);

-}

-

-pattern uselessApplicationTypes(appType) {

-	ApplicationType(appType);

-	neg find usefulApplicationTypes(appType);

-}
\ No newline at end of file
diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/xtend-gen/.gitignore b/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/xtend-gen/.gitignore
deleted file mode 100644
index ce4a58f..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.localsearch.cpp.example/xtend-gen/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-#This file is needed to prevent git from omitting this folder that would cause build issues/compile errors.

-# Ignore everything in this directory

-*

-# Except this file

-!.gitignore
\ No newline at end of file
diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.tooling.cpp.localsearch.ui/.project b/query/localsearch-cpp/org.eclipse.viatra.query.tooling.cpp.localsearch.ui/.project
deleted file mode 100644
index c4d037e..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.tooling.cpp.localsearch.ui/.project
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>org.eclipse.viatra.query.tooling.cpp.localsearch.ui</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.pde.ManifestBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.pde.SchemaBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.pde.PluginNature</nature>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-		<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
-		<nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
-	</natures>
-</projectDescription>
diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.tooling.cpp.localsearch.util/.project b/query/localsearch-cpp/org.eclipse.viatra.query.tooling.cpp.localsearch.util/.project
deleted file mode 100644
index b83f459..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.tooling.cpp.localsearch.util/.project
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>org.eclipse.viatra.query.tooling.cpp.localsearch.util</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.pde.ManifestBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.pde.SchemaBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.m2e.core.maven2Nature</nature>
-		<nature>org.eclipse.pde.PluginNature</nature>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-		<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
-		<nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
-	</natures>
-</projectDescription>
diff --git a/query/localsearch-cpp/org.eclipse.viatra.query.tooling.cpp.localsearch/.project b/query/localsearch-cpp/org.eclipse.viatra.query.tooling.cpp.localsearch/.project
deleted file mode 100644
index b6f6d0b..0000000
--- a/query/localsearch-cpp/org.eclipse.viatra.query.tooling.cpp.localsearch/.project
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>org.eclipse.viatra.query.tooling.cpp.localsearch</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.incquery.tooling.core.projectbuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.pde.ManifestBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.pde.SchemaBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.pde.PluginNature</nature>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-		<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
-		<nature>org.eclipse.incquery.projectnature</nature>
-		<nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
-	</natures>
-</projectDescription>