Import 'conreactor' project and its history as a subproject.

This commit is contained in:
Fedor Isakov 2018-07-18 16:49:34 +02:00
commit c92b8a616c
144 changed files with 10738 additions and 0 deletions

5
reactor/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
.idea/workspace.xml
out/**
API/target/**
Core/target/**
Test/target/**

1
reactor/.idea/.name Normal file
View File

@ -0,0 +1 @@
Reactor

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="kotlin">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>

View File

@ -0,0 +1,12 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="kotlin">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
<entry name="!*.mps" />
<entry name="!*.mpsr" />
<entry name="!*.model" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="API" />
<module name="Core" />
<module name="Test" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="API" target="1.8" />
<module name="Core" target="1.8" />
<module name="main" target="1.5" />
<module name="Reactor" target="1.8" />
<module name="Test" target="1.8" />
<module name="tests" target="1.8" />
<module name="unification-lib" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

View File

@ -0,0 +1,6 @@
<component name="CopyrightManager">
<copyright>
<option name="myName" value="Apache 2.0" />
<option name="notice" value="Copyright 2014-&amp;#36;today.year JetBrains s.r.o.&#10;&#10;Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);&#10;you may not use this file except in compliance with the License.&#10;You may obtain a copy of the License at&#10;&#10;http://www.apache.org/licenses/LICENSE-2.0&#10;&#10;Unless required by applicable law or agreed to in writing, software&#10;distributed under the License is distributed on an &quot;AS IS&quot; BASIS,&#10;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#10;See the License for the specific language governing permissions and&#10;limitations under the License." />
</copyright>
</component>

View File

@ -0,0 +1,7 @@
<component name="CopyrightManager">
<settings default="Apache 2.0">
<module2copyright>
<element module="source" copyright="Apache 2.0" />
</module2copyright>
</settings>
</component>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/API" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/Core" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/Test" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/unification/code" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/unification/tests" charset="UTF-8" />
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Kotlin2JsCompilerArguments">
<option name="sourceMapEmbedSources" />
<option name="sourceMapPrefix" />
</component>
</project>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.github.andrewoma.dexx:collection:0.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/github/andrewoma/dexx/collection/0.7/collection-0.7.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/github/andrewoma/dexx/collection/0.7/collection-0.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/github/andrewoma/dexx/collection/0.7/collection-0.7-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.google.code.findbugs:jsr305:2.0.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.intellij:annotations:12.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/intellij/annotations/12.0/annotations-12.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/intellij/annotations/12.0/annotations-12.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/intellij/annotations/12.0/annotations-12.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: commons-io:commons-io:2.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.4/commons-io-2.4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.4/commons-io-2.4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.4/commons-io-2.4-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: junit:junit:4.12">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: net.sf.trove4j:trove4j:3.0.3">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.maven:maven-aether-provider:3.0.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-aether-provider/3.0.5/maven-aether-provider-3.0.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-aether-provider/3.0.5/maven-aether-provider-3.0.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-aether-provider/3.0.5/maven-aether-provider-3.0.5-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.maven:maven-artifact:3.0.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-artifact/3.0.5/maven-artifact-3.0.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-artifact/3.0.5/maven-artifact-3.0.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-artifact/3.0.5/maven-artifact-3.0.5-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.maven:maven-core:3.0.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-core/3.0.5/maven-core-3.0.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-core/3.0.5/maven-core-3.0.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-core/3.0.5/maven-core-3.0.5-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.maven:maven-model:3.0.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-model/3.0.5/maven-model-3.0.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-model/3.0.5/maven-model-3.0.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-model/3.0.5/maven-model-3.0.5-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.maven:maven-model-builder:3.0.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-model-builder/3.0.5/maven-model-builder-3.0.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-model-builder/3.0.5/maven-model-builder-3.0.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-model-builder/3.0.5/maven-model-builder-3.0.5-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.maven:maven-plugin-api:3.0.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-plugin-api/3.0.5/maven-plugin-api-3.0.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-plugin-api/3.0.5/maven-plugin-api-3.0.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-plugin-api/3.0.5/maven-plugin-api-3.0.5-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.maven:maven-repository-metadata:3.0.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-repository-metadata/3.0.5/maven-repository-metadata-3.0.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-repository-metadata/3.0.5/maven-repository-metadata-3.0.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-repository-metadata/3.0.5/maven-repository-metadata-3.0.5-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.maven:maven-settings:3.0.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-settings/3.0.5/maven-settings-3.0.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-settings/3.0.5/maven-settings-3.0.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-settings/3.0.5/maven-settings-3.0.5-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.maven:maven-settings-builder:3.0.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-settings-builder/3.0.5/maven-settings-builder-3.0.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-settings-builder/3.0.5/maven-settings-builder-3.0.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-settings-builder/3.0.5/maven-settings-builder-3.0.5-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.maven:maven-toolchain:2.2.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-toolchain/2.2.1/maven-toolchain-2.2.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-toolchain/2.2.1/maven-toolchain-2.2.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/maven-toolchain/2.2.1/maven-toolchain-2.2.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.maven.plugin-tools:maven-plugin-annotations:3.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/plugin-tools/maven-plugin-annotations/3.4/maven-plugin-annotations-3.4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/plugin-tools/maven-plugin-annotations/3.4/maven-plugin-annotations-3.4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/plugin-tools/maven-plugin-annotations/3.4/maven-plugin-annotations-3.4-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.maven.plugins:maven-compiler-plugin:3.5.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/plugins/maven-compiler-plugin/3.5.1/maven-compiler-plugin-3.5.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/plugins/maven-compiler-plugin/3.5.1/maven-compiler-plugin-3.5.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/plugins/maven-compiler-plugin/3.5.1/maven-compiler-plugin-3.5.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.maven.shared:maven-shared-incremental:1.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/shared/maven-shared-incremental/1.1/maven-shared-incremental-1.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/shared/maven-shared-incremental/1.1/maven-shared-incremental-1.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/shared/maven-shared-incremental/1.1/maven-shared-incremental-1.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.apache.maven.shared:maven-shared-utils:3.0.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/shared/maven-shared-utils/3.0.0/maven-shared-utils-3.0.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/shared/maven-shared-utils/3.0.0/maven-shared-utils-3.0.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/apache/maven/shared/maven-shared-utils/3.0.0/maven-shared-utils-3.0.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.codehaus.plexus:plexus-classworlds:2.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-classworlds/2.4/plexus-classworlds-2.4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-classworlds/2.4/plexus-classworlds-2.4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-classworlds/2.4/plexus-classworlds-2.4-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.codehaus.plexus:plexus-compiler-api:2.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-compiler-api/2.7/plexus-compiler-api-2.7.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-compiler-api/2.7/plexus-compiler-api-2.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-compiler-api/2.7/plexus-compiler-api-2.7-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.codehaus.plexus:plexus-compiler-javac:2.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-compiler-javac/2.7/plexus-compiler-javac-2.7.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-compiler-javac/2.7/plexus-compiler-javac-2.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-compiler-javac/2.7/plexus-compiler-javac-2.7-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.codehaus.plexus:plexus-compiler-manager:2.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-compiler-manager/2.7/plexus-compiler-manager-2.7.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-compiler-manager/2.7/plexus-compiler-manager-2.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-compiler-manager/2.7/plexus-compiler-manager-2.7-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.codehaus.plexus:plexus-component-annotations:1.5.5">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.codehaus.plexus:plexus-interpolation:1.14">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.codehaus.plexus:plexus-utils:2.0.6">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.hamcrest:hamcrest-core:1.3">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.jetbrains:annotations:13.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.jetbrains.kotlin:kotlin-compiler:1.2.30">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-compiler/1.2.30/kotlin-compiler-1.2.30.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-compiler/1.2.30/kotlin-compiler-1.2.30-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-compiler/1.2.30/kotlin-compiler-1.2.30-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.jetbrains.kotlin:kotlin-maven-plugin:1.2.30">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-maven-plugin/1.2.30/kotlin-maven-plugin-1.2.30.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-maven-plugin/1.2.30/kotlin-maven-plugin-1.2.30-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-maven-plugin/1.2.30/kotlin-maven-plugin-1.2.30-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.jetbrains.kotlin:kotlin-reflect:1.2.30">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.2.30/kotlin-reflect-1.2.30.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.2.30/kotlin-reflect-1.2.30-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.2.30/kotlin-reflect-1.2.30-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.jetbrains.kotlin:kotlin-runtime:1.2.30">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-runtime/1.2.30/kotlin-runtime-1.2.30.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-runtime/1.2.30/kotlin-runtime-1.2.30-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-runtime/1.2.30/kotlin-runtime-1.2.30-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.jetbrains.kotlin:kotlin-script-runtime:1.2.30">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-script-runtime/1.2.30/kotlin-script-runtime-1.2.30.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-script-runtime/1.2.30/kotlin-script-runtime-1.2.30-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-script-runtime/1.2.30/kotlin-script-runtime-1.2.30-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.2.30">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.2.30/kotlin-stdlib-1.2.30.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.2.30/kotlin-stdlib-1.2.30-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.2.30/kotlin-stdlib-1.2.30-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.sonatype.aether:aether-api:1.13.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/aether/aether-api/1.13.1/aether-api-1.13.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/aether/aether-api/1.13.1/aether-api-1.13.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/aether/aether-api/1.13.1/aether-api-1.13.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.sonatype.aether:aether-impl:1.13.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/aether/aether-impl/1.13.1/aether-impl-1.13.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/aether/aether-impl/1.13.1/aether-impl-1.13.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/aether/aether-impl/1.13.1/aether-impl-1.13.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.sonatype.aether:aether-spi:1.13.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/aether/aether-spi/1.13.1/aether-spi-1.13.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/aether/aether-spi/1.13.1/aether-spi-1.13.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/aether/aether-spi/1.13.1/aether-spi-1.13.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.sonatype.aether:aether-util:1.13.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/aether/aether-util/1.13.1/aether-util-1.13.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/aether/aether-util/1.13.1/aether-util-1.13.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/aether/aether-util/1.13.1/aether-util-1.13.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.sonatype.plexus:plexus-cipher:1.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.sonatype.plexus:plexus-sec-dispatcher:1.3">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.sonatype.sisu:sisu-guava:0.9.9">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/sisu/sisu-guava/0.9.9/sisu-guava-0.9.9.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/sisu/sisu-guava/0.9.9/sisu-guava-0.9.9-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/sisu/sisu-guava/0.9.9/sisu-guava-0.9.9-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.sonatype.sisu:sisu-guice:no_aop:3.1.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.sonatype.sisu:sisu-inject-bean:2.3.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/sisu/sisu-inject-bean/2.3.0/sisu-inject-bean-2.3.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/sisu/sisu-inject-bean/2.3.0/sisu-inject-bean-2.3.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/sisu/sisu-inject-bean/2.3.0/sisu-inject-bean-2.3.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.sonatype.sisu:sisu-inject-plexus:2.3.0">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/sisu/sisu-inject-plexus/2.3.0/sisu-inject-plexus-2.3.0.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/sisu/sisu-inject-plexus/2.3.0/sisu-inject-plexus-2.3.0-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/sonatype/sisu/sisu-inject-plexus/2.3.0/sisu-inject-plexus-2.3.0-sources.jar!/" />
</SOURCES>
</library>
</component>

61
reactor/.idea/misc.xml Normal file
View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ClientPropertiesManager">
<properties class="javax.swing.AbstractButton">
<property name="hideActionText" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JComponent">
<property name="html.disable" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JEditorPane">
<property name="JEditorPane.w3cLengthUnits" class="java.lang.Boolean" />
<property name="JEditorPane.honorDisplayProperties" class="java.lang.Boolean" />
<property name="charset" class="java.lang.String" />
</properties>
<properties class="javax.swing.JList">
<property name="List.isFileList" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JPasswordField">
<property name="JPasswordField.cutCopyAllowed" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JSlider">
<property name="Slider.paintThumbArrowShape" class="java.lang.Boolean" />
<property name="JSlider.isFilled" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JTable">
<property name="Table.isFileList" class="java.lang.Boolean" />
<property name="JTable.autoStartsEdit" class="java.lang.Boolean" />
<property name="terminateEditOnFocusLost" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JToolBar">
<property name="JToolBar.isRollover" class="java.lang.Boolean" />
</properties>
<properties class="javax.swing.JTree">
<property name="JTree.lineStyle" class="java.lang.String" />
</properties>
<properties class="javax.swing.text.JTextComponent">
<property name="caretAspectRatio" class="java.lang.Double" />
<property name="caretWidth" class="java.lang.Integer" />
</properties>
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="SbtLocalSettings">
<option name="modificationStamps">
<map>
<entry key="$PROJECT_DIR$/../../../Hacking/learning/coursera/reactive-2015/calculator" value="1429532720000" />
</map>
</option>
<option name="externalProjectsViewState">
<projects_view />
</option>
</component>
</project>

11
reactor/.idea/modules.xml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/API/API.iml" filepath="$PROJECT_DIR$/API/API.iml" />
<module fileurl="file://$PROJECT_DIR$/Core/Core.iml" filepath="$PROJECT_DIR$/Core/Core.iml" />
<module fileurl="file://$PROJECT_DIR$/Reactor.iml" filepath="$PROJECT_DIR$/Reactor.iml" />
<module fileurl="file://$PROJECT_DIR$/Test/Test.iml" filepath="$PROJECT_DIR$/Test/Test.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,3 @@
<component name="DependencyValidationManager">
<scope name="source" pattern="file[API]:src//*||file[Core]:src//*" />
</component>

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

6
reactor/.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

14
reactor/.travis.yml Normal file
View File

@ -0,0 +1,14 @@
language: java
jdk:
- oraclejdk8
script: mvn -Dmaven.javadoc.skip=true -B package
deploy:
provider: releases
api_key:
secure: lDb8+36TFmBXll5ty4eSx6KIDjOCBcnHN3V/JANvHqsydkXNXoeQSFigEh4CkmOeAdbC9C49JK8StohYT3w8nx4F8N0pwtYlHSEfXVj9HZCOGxJvuO1scc7PJOgxZnNxC/EQZSy6Wqv/G6WwTUZm5tU6PH3yxxYYm4kpXTMHVAPeUeCI7VkrRdASUkGjZ74c2CDD0pQwmY+tisapXWyEdZ59/ozuRCeTEqriEDhCXbvKjp0Th3MoQnBRUy0gFa73JSYLAaPtfQULwZiRu+foP3pqiWQ46ZRs2uqtv97B/1pAeZsSNahjXpQKjuA8rRfBL91crVH73KvCizggN9Ok4pDUvydmKlUh1/Qv1QqZnxx2/lj5SdCAzAuq8NZdGBd98BcWF7TPVRfhvkaAmceobR3IqzhJe1+a1Ui5Hx5elQpClMFlnk39Behi3hK0HSnRRtf/2b8VpO6zpGE5XFa9DwruDvNcatyXnAdnFbRTbhWDuzpGPPld2QwMYT9day5KhupUdkl+otJ4wLFfRIBOqoIyUFkGfvNuGy5f1dy9ePXbiw0u8Oysat0XWQ6Qj+jLpGQqMh8hSOVvcJmpIbowptnB2DEDSDu98gs3jBu1ooFUNYWtLGtm0IpvzVMATrZa5Rug4gdXjs9H8JqZ6sss0URTvMHi/B+I/Bm0XqZ/Uic=
file:
- ./API/target/conreactor-api-0.9.jar
- ./Core/target/conreactor-core-0.9.jar
skip_cleanup: true
on:
tags: true

75
reactor/API/API.iml Normal file
View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="kotlin-language" name="Kotlin">
<configuration version="2" platform="JVM 1.8" useProjectSettings="false">
<compilerSettings />
<compilerArguments>
<option name="jvmTarget" value="1.8" />
<option name="languageVersion" value="1.2" />
<option name="apiVersion" value="1.2" />
<option name="pluginOptions">
<array />
</option>
<option name="pluginClasspaths">
<array />
</option>
<option name="coroutinesWarn" value="true" />
</compilerArguments>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-runtime:1.2.30" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains:annotations:13.0" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.2.30" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-maven-plugin:1.2.30" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-core:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-model:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-settings:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-settings-builder:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-repository-metadata:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-artifact:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-model-builder:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-aether-provider:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.aether:aether-spi:1.13.1" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.aether:aether-impl:1.13.1" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.aether:aether-api:1.13.1" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.aether:aether-util:1.13.1" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.sisu:sisu-inject-plexus:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.sisu:sisu-inject-bean:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.sisu:sisu-guice:no_aop:3.1.0" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.sisu:sisu-guava:0.9.9" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-interpolation:1.14" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-utils:2.0.6" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-classworlds:2.4" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-component-annotations:1.5.5" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.plexus:plexus-sec-dispatcher:1.3" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.plexus:plexus-cipher:1.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-plugin-api:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven.plugin-tools:maven-plugin-annotations:3.4" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-compiler:1.2.30" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-script-runtime:1.2.30" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-reflect:1.2.30" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven.plugins:maven-compiler-plugin:3.5.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-toolchain:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven.shared:maven-shared-utils:3.0.0" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:2.0.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven.shared:maven-shared-incremental:1.1" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-compiler-api:2.7" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-compiler-manager:2.7" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.codehaus.plexus:plexus-compiler-javac:2.7" level="project" />
<orderEntry type="library" name="Maven: com.github.andrewoma.dexx:collection:0.7" level="project" />
<orderEntry type="library" name="Maven: com.intellij:annotations:12.0" level="project" />
<orderEntry type="library" name="Maven: net.sf.trove4j:trove4j:3.0.3" level="project" />
</component>
</module>

21
reactor/API/pom.xml Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>jetbrains.mps.logic.conreactor</groupId>
<artifactId>conreactor-main</artifactId>
<version>0.9</version>
<relativePath>..</relativePath>
</parent>
<artifactId>conreactor-api</artifactId>
<packaging>jar</packaging>
<build>
<sourceDirectory>${basedir}/src/</sourceDirectory>
</build>
</project>

View File

@ -0,0 +1,28 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.evaluation;
/**
* Not very useful now.
* Serves as an abstract superclass for implementations, as a mixin of Instructible and Queryable.
*
* @author Fedor Isakov
*/
public abstract class AbstractSolver implements Instructible, Queryable {
}

View File

@ -0,0 +1,38 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.evaluation;
import jetbrains.mps.logic.reactor.logical.LogicalContext;
import jetbrains.mps.logic.reactor.program.Constraint;
import java.util.List;
/**
* Represents a run-time object corresponding to an actual constraint.
*
* @author Fedor Isakov
*/
public interface ConstraintOccurrence {
Constraint constraint();
List<?> arguments();
LogicalContext logicalContext();
}

View File

@ -0,0 +1,35 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.evaluation;
/**
* Thrown in case evaluation fails.
*
* @author Fedor Isakov
*/
public class EvaluationFailureException extends RuntimeException {
public EvaluationFailureException(String message) {
super(message);
}
public EvaluationFailureException(Throwable cause) {
super(cause);
}
}

View File

@ -0,0 +1,97 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.evaluation;
import jetbrains.mps.logic.reactor.logical.LogicalContext;
import jetbrains.mps.logic.reactor.program.Constraint;
import jetbrains.mps.logic.reactor.program.Predicate;
import jetbrains.mps.logic.reactor.program.PredicateSymbol;
import jetbrains.mps.logic.reactor.program.Program;
/**
* The starting point to evaluate a program.
* <p>
* The session is started with {@code newSession}, provided the backend has been initialized.
* <p>
* The backend is supposed to be provided at startup.
*
* @author Fedor Isakov
*/
public abstract class EvaluationSession {
private static EvaluationSession.Backend ourBackend;
public static EvaluationSession current() {
if (ourBackend == null) {
throw new IllegalStateException("no backend");
}
return ourBackend.current();
}
public static EvaluationSession.Config newSession(Program program) {
if (ourBackend == null) {
throw new IllegalStateException("no backend");
}
return ourBackend.createConfig(program);
}
protected static void setBackend(EvaluationSession.Backend backend) {
if (ourBackend != null) {
throw new IllegalStateException("backend already assigned");
}
ourBackend = backend;
}
protected static void clearBackend(EvaluationSession.Backend backend) {
if (ourBackend != backend) {
throw new IllegalStateException("illegal access");
}
ourBackend = null;
}
public abstract SessionSolver sessionSolver();
public abstract StoreView storeView();
public abstract PredicateInvocation invocation(Predicate predicate, LogicalContext logicalContext);
public abstract ConstraintOccurrence occurrence(Constraint constraint, LogicalContext logicalContext);
protected interface Backend {
EvaluationSession current();
EvaluationSession.Config createConfig(Program program);
}
public static abstract class Config {
public abstract EvaluationSession.Config withPredicates(PredicateSymbol... predicateSymbols);
public abstract EvaluationSession.Config withTrace(EvaluationTrace computingTracer);
public abstract EvaluationSession.Config withStoreView(StoreView storeView);
public abstract EvaluationSession.Config withParam(String key, Object param);
public abstract EvaluationSession start(SessionSolver sessionSolver);
}
}

View File

@ -0,0 +1,96 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.evaluation;
/**
* An interface to be implemented by clients wishing to be notified of the events during evaluation.
*
* @author Fedor Isakov
*/
public interface EvaluationTrace {
EvaluationTrace NULL = new EvaluationTrace() {
public void activate(ConstraintOccurrence occurrence) {
}
public void reactivate(ConstraintOccurrence occurrence) {
}
public void suspend(ConstraintOccurrence occurrence) {
}
public void discard(ConstraintOccurrence occurrence) {
}
public void trying(MatchRule matchRule) {
}
public void reject(MatchRule matchRule) {
}
public void trigger(MatchRule matchRule) {
}
public void retry(MatchRule matchRule) {
}
public void finish(MatchRule matchRule) {
}
public void tell(PredicateInvocation invocation) {
}
public void ask(boolean result, PredicateInvocation invocation) {
}
public void failure(EvaluationFailureException fail) {
}
public void reportFailure(String message) {
}
};
void activate(ConstraintOccurrence occurrence);
void reactivate(ConstraintOccurrence occurrence);
void suspend(ConstraintOccurrence occurrence);
void discard(ConstraintOccurrence occurrence);
void trying(MatchRule matchRule);
void reject(MatchRule matchRule);
void trigger(MatchRule matchRule);
void retry(MatchRule matchRule);
void finish(MatchRule matchRule);
void tell(PredicateInvocation invocation);
void ask(boolean result, PredicateInvocation invocation);
void failure(EvaluationFailureException fail);
@Deprecated
void reportFailure(String message);
}

View File

@ -0,0 +1,29 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.evaluation;
/**
* Abstract interface to a predicate.
*
* @author Fedor Isakov
*/
public interface Instructible {
void tell(PredicateInvocation invocation);
}

View File

@ -0,0 +1,35 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.evaluation;
import jetbrains.mps.logic.reactor.program.Rule;
/**
* A binding of a rule and the constraints that matched its head.
*
* @author Fedor Isakov
*/
public interface MatchRule {
Rule rule();
Iterable<ConstraintOccurrence> matchHeadKept();
Iterable<ConstraintOccurrence> matchHeadReplaced();
}

View File

@ -0,0 +1,38 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.evaluation;
import jetbrains.mps.logic.reactor.logical.LogicalContext;
import jetbrains.mps.logic.reactor.program.Predicate;
import java.util.List;
/**
* A run-time object representing invocation of a predicate.
*
* @author Fedor Isakov
*/
public interface PredicateInvocation {
Predicate predicate();
List<?> arguments();
LogicalContext logicalContext();
}

View File

@ -0,0 +1,29 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.evaluation;
/**
* Abstract interface to a predicate.
*
* @author Fedor Isakov
*/
public interface Queryable extends Instructible {
boolean ask(PredicateInvocation invocation);
}

View File

@ -0,0 +1,95 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.evaluation;
import jetbrains.mps.logic.reactor.logical.LogicalContext;
import jetbrains.mps.logic.reactor.program.AndItem;
import jetbrains.mps.logic.reactor.program.Predicate;
import jetbrains.mps.logic.reactor.program.PredicateSymbol;
import java.util.HashMap;
import java.util.Map;
/**
* Is used to provide an interface for handlers and solvers working together in a single session.
*
* @author Fedor Isakov
*/
public abstract class SessionSolver implements Queryable, Instructible {
private Map<PredicateSymbol, AbstractSolver> solvers = new HashMap<PredicateSymbol, AbstractSolver>();
private EvaluationTrace tracer = EvaluationTrace.NULL;
public void init(PredicateSymbol... predicateSymbols) {
registerSymbols(predicateSymbols);
}
public void init(EvaluationTrace evaluationTrace, PredicateSymbol... predicateSymbols) {
tracer = evaluationTrace;
init(predicateSymbols);
}
@Override
public boolean ask(PredicateInvocation invocation) {
AbstractSolver solver = solver(invocation.predicate().symbol());
boolean result = solver.ask(invocation);
tracer.ask(result, invocation);
return result;
}
@Override
public void tell(PredicateInvocation invocation) {
AbstractSolver handler = solver(invocation.predicate().symbol());
tracer.tell(invocation);
handler.tell(invocation);
}
public boolean ask(Predicate predicate, LogicalContext logicalContext) {
return ask(EvaluationSession.current().invocation(predicate, logicalContext));
}
public void tell(AndItem item, LogicalContext logicalContext) {
if (item instanceof Predicate) {
tell(EvaluationSession.current().invocation((Predicate) item, logicalContext));
} else {
// FIXME: implement me
throw new UnsupportedOperationException("not implemented");
}
}
protected abstract void registerSymbol(PredicateSymbol predicateSymbol, EvaluationTrace computingTracer);
protected void registerSolver(PredicateSymbol constraint, AbstractSolver solver) {
solvers.put(constraint, solver);
}
private AbstractSolver solver(PredicateSymbol predicateSymbol) {
if (!(solvers.containsKey(predicateSymbol))) {
throw new IllegalStateException("no handler: " + predicateSymbol);
}
return solvers.get(predicateSymbol);
}
private void registerSymbols(PredicateSymbol... predicateSymbols) {
for (PredicateSymbol symbol : predicateSymbols) {
registerSymbol(symbol, tracer);
}
}
}

View File

@ -0,0 +1,34 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.evaluation;
import jetbrains.mps.logic.reactor.program.ConstraintSymbol;
/**
* A read-only view on the constraints store.
*
* @author Fedor Isakov
*/
public interface StoreView {
Iterable<ConstraintSymbol> constraintSymbols();
Iterable<ConstraintOccurrence> allOccurrences();
Iterable<ConstraintOccurrence> occurrences(ConstraintSymbol symbol);
}

View File

@ -0,0 +1,58 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.logical;
/**
* A logical variable that can be joined with another variable to produce a union.
*
* @param <T> the value type
*
* @author Fedor Isakov
*/
public interface JoinableLogical<T> extends Logical<T> {
/**
* Covariant override.
*/
JoinableLogical<T> findRoot();
/**
* Unions two equivalence classes of logicals.
* Both the receiver and the {@code other} parameter are expected to be representatives.
* The one with the highest rank becomes the representative for the new class.
*/
void union(JoinableLogical<T> other, JoinableLogical.ValueReconciler<T> reconciler);
/**
* Calls {@link JoinableLogical#union(JoinableLogical <T>, JoinableLogical.ValueReconciler<T>) } with the default value reconciler.
* The default reconciler throws {@link java.lang.IllegalArgumentException } if the two values are not equal.
*/
void union(JoinableLogical<T> other);
/**
* Should only be called on a representative.
*/
void setValue(T newValue);
interface ValueReconciler<T> {
void reconcile(T valueA, T valueB);
}
}

View File

@ -0,0 +1,56 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.logical;
/**
* A run-time representation of a logical variable.
*
* @param <T> the value type
*
* @author Fedor Isakov
*/
public interface Logical<T> {
String name();
/**
* Returns the representative logical instance.
* <p>
* TODO: rename to 'find()'
*/
Logical<T> findRoot();
/**
* Returns the value associated with this logical instance.
* Can be null.
* Only the logical instance that is a representative can have value that is not null.
* <p>
* FIXME: must return the representative's value
*/
T value();
/**
* True iff the representative has a non-null value.
*/
boolean isBound();
boolean isWildcard();
MetaLogical<T> metaLogical();
}

View File

@ -0,0 +1,30 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.logical;
/**
* Substitution of logicals for meta-logicals.
*
* @author Fedor Isakov
*/
public interface LogicalContext {
<V> Logical<V> variable(MetaLogical<V> metaLogical);
}

View File

@ -0,0 +1,29 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.logical;
/**
* An abstract wrapper for a {@link Logical}.
*
* @author Fedor Isakov
*/
public interface LogicalOwner {
Logical<?> logical();
}

View File

@ -0,0 +1,62 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.logical;
/**
* A declaration of a logical variable.
*
* @param <T> the value type
*
* @author Fedor Isakov
*/
public class MetaLogical<T> {
private static final String WILDCARD = "_";
private String name;
private Class<T> type;
private boolean wildcard = false;
public MetaLogical(String name, Class<T> type) {
this.name = name;
this.type = type;
}
public MetaLogical(Class<T> type) {
this.name = MetaLogical.WILDCARD + System.identityHashCode(this);
this.type = type;
this.wildcard = true;
}
public String name() {
return name;
}
public boolean isWildcard() {
return wildcard;
}
public Class<T> type() {
return type;
}
@Override
public String toString() {
return name;
}
}

View File

@ -0,0 +1,59 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.logical;
import java.util.ArrayList;
import java.util.List;
/**
* A declaration of a logical variable with index.
*
* @param <T> the value type
*
* @author Fedor Isakov
*/
public class MultiMetaLogical<T> extends MetaLogical<T> {
private int cardinality;
private List<MetaLogical<T>> metaLogicals = new ArrayList<MetaLogical<T>>();
public MultiMetaLogical(String name, Class<T> type, int cardinality) {
super(name, type);
this.cardinality = cardinality;
init();
}
public int cardinality() {
return cardinality;
}
public MetaLogical<T> logicalAt(int idx) {
return metaLogicals.get(idx);
}
public MetaLogical[] toArray() {
MetaLogical[] array = new MetaLogical[cardinality];
return metaLogicals.toArray(array);
}
private void init() {
for (int i = 0; i < cardinality; i++) {
metaLogicals.add(new MetaLogical<T>(name() + "_" + (i + 1), type()));
}
}
}

View File

@ -0,0 +1,33 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.program;
import java.util.List;
/**
* An abstract conjunct.
*
* @author Fedor Isakov
*/
public interface AndItem {
Symbol symbol();
List<?> arguments();
}

View File

@ -0,0 +1,41 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.program;
import java.util.Collection;
import java.util.List;
/**
* A constraint provided by a handler.
*
* @author Fedor Isakov
*/
public interface Constraint extends AndItem {
ConstraintSymbol symbol();
List<Class<?>> argumentTypes();
/**
* Returns the collection of predicates that need to be applied after a successful match of this collection by a
* rule's head.
* This method only returns meaningful results for constraints that serve as patterns in a rule's head.
*/
Collection<? extends Predicate> patternPredicates(Collection<?> occurrenceArgs);
}

View File

@ -0,0 +1,40 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.program;
/**
* A constraint symbol.
*
* @author Fedor Isakov
*/
public class ConstraintSymbol extends Symbol {
public ConstraintSymbol(String id, int arity) {
super(id, arity);
}
public static ConstraintSymbol symbol(String id, int arity) {
return new ConstraintSymbol(id, arity);
}
@Override
public String toString() {
return id() + "/" + arity();
}
}

View File

@ -0,0 +1,35 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.program;
/**
* A handler is a container of rules.
* <p>
* If the {@code primarySymbols} is a non-empty collection, only constraints with these symbols are processed
* by this handler.
*
* @author Fedor Isakov
*/
public abstract class Handler {
public abstract String name();
public abstract Iterable<ConstraintSymbol> primarySymbols();
public abstract Iterable<Rule> rules();
}

View File

@ -0,0 +1,31 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.program;
public class InvalidConstraintException extends Exception {
public InvalidConstraintException(String message) {
super(message);
}
public InvalidConstraintException(String message, Throwable ex) {
super(message, ex);
}
}

View File

@ -0,0 +1,30 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.program;
public class InvalidRuleException extends Exception {
public InvalidRuleException(String message) {
super(message);
}
public InvalidRuleException(String message, Throwable throwable) {
super(message, throwable);
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.program;
/**
* A predicate symbol for an anonymous expression.
*
* @author Fedor Isakov
*/
public class JavaPredicateSymbol extends PredicateSymbol {
public static final JavaPredicateSymbol EXPRESSION0 = new JavaPredicateSymbol(1);
public static final JavaPredicateSymbol EXPRESSION1 = new JavaPredicateSymbol(2);
public static final JavaPredicateSymbol EXPRESSION2 = new JavaPredicateSymbol(3);
public static final JavaPredicateSymbol EXPRESSION3 = new JavaPredicateSymbol(4);
private static final String EXPRESSION = "expression";
private static JavaPredicateSymbol[] KNOWN_SYMBOLS = {EXPRESSION0, EXPRESSION1, EXPRESSION2, EXPRESSION3};
private JavaPredicateSymbol(int arity) {
super(EXPRESSION, arity);
}
public static JavaPredicateSymbol withArity(int arity) {
return KNOWN_SYMBOLS[arity];
}
}

View File

@ -0,0 +1,29 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.program;
/**
* A predicate that is provided by a solver. Can be either told or asked.
*
* @author Fedor Isakov
*/
public interface Predicate extends AndItem {
PredicateSymbol symbol();
}

View File

@ -0,0 +1,36 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.program;
/**
* A predicate symbol.
*
* @author Fedor Isakov
*/
public class PredicateSymbol extends Symbol {
public PredicateSymbol(String id, int arity) {
super(id, arity);
}
@Override
public String toString() {
return id() + "()/" + arity();
}
}

View File

@ -0,0 +1,43 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.program;
import jetbrains.mps.logic.reactor.logical.LogicalContext;
import java.util.List;
/**
* A collection of handlers that constitute a constraint rules program.
*
* @author Fedor Isakov
*/
public abstract class Program {
public abstract String name();
public abstract Iterable<ConstraintSymbol> constraintSymbols();
public abstract List<Class<?>> constraintArgumentTypes(ConstraintSymbol constraintSymbol);
public abstract Iterable<PredicateSymbol> predicateSymbols();
public abstract Iterable<Handler> handlers();
public abstract List<?> instantiateArguments(List<?> arguments, LogicalContext logicalContext);
}

View File

@ -0,0 +1,50 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.program;
/**
* A constraint rule description.
*
* @author Fedor Isakov
*/
public abstract class Rule {
public abstract Rule.Kind kind();
public abstract String tag();
public abstract Iterable<Constraint> headKept();
public abstract Iterable<Constraint> headReplaced();
public abstract Iterable<Predicate> guard();
@Deprecated
public abstract Iterable<AndItem> body();
public abstract Iterable<? extends Iterable<AndItem>> bodyAlternation();
public abstract Iterable<AndItem> all();
public enum Kind {
SIMPLIFICATION(),
PROPAGATION(),
SIMPAGATION()
}
}

View File

@ -0,0 +1,70 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.program;
/**
* A symbol used by both constraints and predicates. Is uniquely identified by id and arity.
*
* @author Fedor Isakov
*/
public abstract class Symbol {
private String id;
private int arity;
protected Symbol(String id, int arity) {
this.id = id;
this.arity = arity;
}
public String id() {
return id;
}
public int arity() {
return arity;
}
@Override
public int hashCode() {
int result = 17;
result = 43 * result + ((id != null ? String.valueOf(id).hashCode() : 0));
result = 31 * result + 37 * arity;
return result;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || this.getClass() != o.getClass()) {
return false;
}
Symbol that = (Symbol) o;
if ((id != null ? !(id.equals(that.id())) : that.id != null)) {
return false;
}
if (arity != that.arity) {
return false;
}
return true;
}
}

85
reactor/Core/Core.iml Normal file
View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="AutoImportedSourceRoots">
<option name="directories">
<list>
<option value="$MODULE_DIR$/src" />
</list>
</option>
</component>
<component name="FacetManager">
<facet type="kotlin-language" name="Kotlin">
<configuration version="2" platform="JVM 1.8" useProjectSettings="false">
<compilerSettings />
<compilerArguments>
<option name="jvmTarget" value="1.8" />
<option name="languageVersion" value="1.2" />
<option name="apiVersion" value="1.2" />
<option name="pluginOptions">
<array />
</option>
<option name="pluginClasspaths">
<array />
</option>
<option name="coroutinesWarn" value="true" />
</compilerArguments>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/classes" />
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/test-classes" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="API" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-runtime:1.2.30" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains:annotations:13.0" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.2.30" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-maven-plugin:1.2.30" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-core:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-model:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-settings:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-settings-builder:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-repository-metadata:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-artifact:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-model-builder:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-aether-provider:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.aether:aether-spi:1.13.1" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.aether:aether-impl:1.13.1" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.aether:aether-api:1.13.1" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.aether:aether-util:1.13.1" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.sisu:sisu-inject-plexus:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.sisu:sisu-inject-bean:2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.sisu:sisu-guice:no_aop:3.1.0" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.sisu:sisu-guava:0.9.9" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-interpolation:1.14" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-utils:2.0.6" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-classworlds:2.4" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-component-annotations:1.5.5" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.plexus:plexus-sec-dispatcher:1.3" level="project" />
<orderEntry type="library" name="Maven: org.sonatype.plexus:plexus-cipher:1.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-plugin-api:3.0.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven.plugin-tools:maven-plugin-annotations:3.4" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-compiler:1.2.30" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-script-runtime:1.2.30" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-reflect:1.2.30" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven.plugins:maven-compiler-plugin:3.5.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven:maven-toolchain:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven.shared:maven-shared-utils:3.0.0" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:2.0.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.maven.shared:maven-shared-incremental:1.1" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-compiler-api:2.7" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-compiler-manager:2.7" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.codehaus.plexus:plexus-compiler-javac:2.7" level="project" />
<orderEntry type="library" name="Maven: com.github.andrewoma.dexx:collection:0.7" level="project" />
<orderEntry type="library" name="Maven: com.intellij:annotations:12.0" level="project" />
<orderEntry type="library" name="Maven: net.sf.trove4j:trove4j:3.0.3" level="project" />
</component>
</module>

50
reactor/Core/pom.xml Normal file
View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>jetbrains.mps.logic.conreactor</groupId>
<artifactId>conreactor-main</artifactId>
<version>0.9</version>
<relativePath>..</relativePath>
</parent>
<artifactId>conreactor-core</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>jetbrains.mps.logic.conreactor</groupId>
<artifactId>conreactor-api</artifactId>
<version>${project.parent.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${basedir}/src/</sourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<source>${basedir}/src</source>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,197 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.core
import jetbrains.mps.logic.reactor.evaluation.*
import jetbrains.mps.logic.reactor.logical.Logical
import jetbrains.mps.logic.reactor.logical.LogicalContext
import jetbrains.mps.logic.reactor.logical.MetaLogical
import jetbrains.mps.logic.reactor.program.Constraint
import jetbrains.mps.logic.reactor.program.Predicate
import jetbrains.mps.logic.reactor.program.Program
import jetbrains.mps.logic.reactor.program.Rule
import jetbrains.mps.logic.reactor.util.Profiler
import jetbrains.mps.logic.reactor.util.profile
import com.github.andrewoma.dexx.collection.Map as PersMap
class Controller(
val program: Program,
val trace: EvaluationTrace = EvaluationTrace.NULL,
val profiler: Profiler? = null,
val storeView: StoreView? = null)
{
private val session: EvaluationSession = EvaluationSession.current()
private val ruleIndex: RuleIndex = RuleIndex(program.handlers())
private val frameStack = FrameStack(storeView)
private val matcher = Matcher(ruleIndex, profiler)
// persistent (functional) object. reassigned on update
private var propHistory = PropagationHistory()
internal fun currentFrame(): Frame = frameStack.current
fun storeView(): StoreView = frameStack.current.store.view()
fun activate(constraint: Constraint) {
try {
process(session.occurrence(constraint, noLogicalContext)) // FIXME noLogicalContext
}
catch (t: Throwable) {
throw t
}
}
fun reactivate(occurrence: ConstraintOccurrence) {
try {
process(occurrence)
}
catch (t: Throwable) {
throw t
}
}
/** For tests only */
fun evaluate(occurrence: ConstraintOccurrence): StoreView {
process(occurrence)
return storeView()
}
private fun process(active: ConstraintOccurrence) {
assert(active.isAlive())
profiler.profile("process_${active.constraint().symbol()}") {
if (!active.isStored()) {
frameStack.current.store.store(active)
trace.activate(active)
} else {
trace.reactivate(active)
}
for (match in matcher.matches(active, frameStack.current.store)) {
// TODO: paranoid check. should be isAlive() instead
if (!active.isStored()) break
if (!match.successful) continue
// FIXME: move this check elsewhere
if ((match.keptOccurrences + match.discardedOccurrences).any { co -> !co.isStored() }) continue
if (propHistory.isRecorded(match)) continue
trace.trying(match)
for (prd in match.patternPredicates) {
tellPredicate(prd, match.logicalContext, trace)
}
if (!match.rule.checkGuard(match.logicalContext, trace)) {
trace.reject(match)
continue
}
trace.trigger(match)
for (occ in match.discardedOccurrences) {
frameStack.current.store.discard(occ)
trace.discard(occ)
}
var failure: EvaluationFailureException? = null
for (body in match.rule.bodyAlternation()) {
if (failure != null) {
trace.failure(failure)
trace.retry(match)
failure = null
}
// propHistory is now functional (persistent)
// we must reassign the field on every rule triggering
// and store on the stack the last value before rule activation in order to undo in case of failure
val savedPropHistory = propHistory
this.propHistory = propHistory.record(match)
val savedFrame = frameStack.current
frameStack.push()
try {
for (item in body) {
when (item) {
is Constraint -> process(session.occurrence(item, match.logicalContext))
is Predicate -> tellPredicate(item, match.logicalContext, trace)
else -> throw IllegalArgumentException("unknown item ${item}")
}
}
}
catch (ex: EvaluationFailureException) {
failure = ex
// abrupt termination: restore the state
this.propHistory = savedPropHistory
frameStack.reset(savedFrame)
}
if (failure == null) {
// normal termination: skip the other alternatives
break
}
}
if (failure != null) {
throw failure
}
trace.finish(match)
}
// TODO: should be isAlive()
if (active.isStored()) {
trace.suspend(active)
}
}
}
private fun Rule.checkGuard(logicalContext: LogicalContext, trace: EvaluationTrace): Boolean =
profiler.profile<Boolean>("checkGuard") {
return guard().all { prd -> askPredicate(prd, logicalContext, trace) }
}
private fun askPredicate(predicate: Predicate, logicalContext: LogicalContext, trace: EvaluationTrace): Boolean =
profiler.profile<Boolean>("ask_${predicate.symbol()}", {
session.sessionSolver().ask(session.invocation(predicate, logicalContext))
})
private fun tellPredicate(predicate: Predicate, logicalContext: LogicalContext, trace: EvaluationTrace) =
profiler.profile("tell_${predicate.symbol()}") {
session.sessionSolver().tell(session.invocation(predicate, logicalContext))
}
}
private val noLogicalContext: LogicalContext = object: LogicalContext {
override fun <V : Any> variable(metaLogical: MetaLogical<V>): Logical<V> = TODO()
}

View File

@ -0,0 +1,146 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.core
import jetbrains.mps.logic.reactor.evaluation.*
import jetbrains.mps.logic.reactor.logical.LogicalContext
import jetbrains.mps.logic.reactor.program.Constraint
import jetbrains.mps.logic.reactor.program.Predicate
import jetbrains.mps.logic.reactor.program.PredicateSymbol
import jetbrains.mps.logic.reactor.program.Program
import jetbrains.mps.logic.reactor.util.Profiler
import java.util.*
import com.github.andrewoma.dexx.collection.LinkedList as PLinkedList
import com.github.andrewoma.dexx.collection.List as PList
/**
* @author Fedor Isakov
*/
interface SessionObjects {
fun handler(): Controller
}
class EvaluationSessionImpl private constructor (
val program: Program,
val sessionSolver: SessionSolver,
val trace: EvaluationTrace) : EvaluationSession(), SessionObjects
{
lateinit var controller: Controller
private fun launch(main: Constraint, profiler: Profiler?, storeView: StoreView?) {
this.controller = Controller(program, trace, profiler, storeView)
controller.activate(main)
}
private class Config(val program: Program) : EvaluationSession.Config() {
val predicateSymbols = ArrayList<PredicateSymbol>()
val parameters = HashMap<String, Any?>()
var evaluationTrace: EvaluationTrace = EvaluationTrace.NULL
var storeView: StoreView? = null
override fun withPredicates(vararg predicateSymbols: PredicateSymbol): EvaluationSession.Config {
this.predicateSymbols.addAll(Arrays.asList(* predicateSymbols))
return this
}
override fun withTrace(computingTracer: EvaluationTrace): EvaluationSession.Config {
this.evaluationTrace = computingTracer
return this
}
override fun withStoreView(storeView: StoreView): EvaluationSession.Config {
this.storeView = storeView
return this
}
override fun withParam(key: String, param: Any): EvaluationSession.Config {
this.parameters.put(key, param)
return this
}
override fun start(sessionSolver: SessionSolver): EvaluationSession {
var session = ourBackend.ourSession.get()
if (session != null) throw IllegalStateException("session already active")
sessionSolver.init(evaluationTrace, * predicateSymbols.toArray<PredicateSymbol>(arrayOfNulls(predicateSymbols.size)))
@Suppress("UNCHECKED_CAST")
val durations =
parameters.get("profiling.data") as MutableMap<String, String>?
val profiler = durations?.let { Profiler() }
session = EvaluationSessionImpl(program, sessionSolver, evaluationTrace)
ourBackend.ourSession.set(session)
try {
session.launch(parameters["main"] as Constraint, profiler, storeView)
}
finally {
try {
profiler?.run {
formattedData().entries.forEach { e -> durations?.put(e.key, e.value) }
clear()
}
}
catch (t: Throwable) {
// avoid nested failure
}
ourBackend.ourSession.set(null)
}
return session
}
}
override fun handler() = controller
override fun sessionSolver(): SessionSolver = sessionSolver
override fun storeView(): StoreView =
controller.storeView()
override fun invocation(predicate: Predicate, logicalContext: LogicalContext): PredicateInvocation =
predicate.invocation(program.instantiateArguments(predicate.arguments(), logicalContext), logicalContext)
override fun occurrence(constraint: Constraint, logicalContext: LogicalContext): ConstraintOccurrence =
constraint.occurrence(controller, program.instantiateArguments(constraint.arguments(), logicalContext), logicalContext)
private class Backend : EvaluationSession.Backend {
val ourSession = ThreadLocal<EvaluationSessionImpl>()
override fun current(): EvaluationSession = ourSession.get() ?: throw IllegalStateException("no session")
override fun createConfig(program: Program): EvaluationSession.Config = Config(program)
}
companion object {
private val ourBackend = Backend()
fun init() {
setBackend(ourBackend)
}
fun deinit() {
clearBackend(ourBackend)
}
}
}

View File

@ -0,0 +1,135 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.core
import com.github.andrewoma.dexx.collection.ConsList
import com.github.andrewoma.dexx.collection.Map
import com.github.andrewoma.dexx.collection.Maps
import jetbrains.mps.logic.reactor.evaluation.StoreView
import jetbrains.mps.logic.reactor.logical.Logical
import jetbrains.mps.logic.reactor.util.IdWrapper
import jetbrains.mps.logic.reactor.util.cons
import jetbrains.mps.logic.reactor.util.remove
import java.util.*
internal class Frame: LogicalObserver, StoreKeeper {
val stack: FrameStack
val store: Store
private var observers: Map<IdWrapper<Logical<*>>, ConsList<(StoreKeeper) -> LogicalObserver>>
constructor(stack: FrameStack) {
this.stack = stack
this.store = Store() { stack.current }
this.observers = Maps.of()
}
constructor(stack: FrameStack, prev: Frame) {
this.stack = stack
this.store = Store(prev.store) { stack.current }
this.observers = prev.observers
}
constructor(stack: FrameStack, storeView: StoreView) {
this.stack = stack
this.store = Store(storeView) { stack.current }
this.observers = Maps.of()
}
override fun store() = store
override fun addObserver(logical: Logical<*>, obs: (StoreKeeper) -> LogicalObserver) {
val logicalId = IdWrapper(logical)
if (!observers.containsKey(logicalId)) {
stack.addObserver(logical)
}
this.observers = observers.put(logicalId,
observers[logicalId]?.prepend(obs) ?: cons(obs))
}
override fun removeObserver(logical: Logical<*>, obs: (StoreKeeper) -> LogicalObserver) {
val logicalId = IdWrapper(logical)
observers[logicalId].remove(obs)?.let { newList ->
this.observers = observers.put(logicalId, newList)
if (newList.isEmpty) {
stack.removeObserver(logical)
}
}
}
override fun valueUpdated(logical: Logical<*>) {
observers[IdWrapper(logical)]?.let { list ->
for (obs in list) {
obs(this).valueUpdated(logical)
}
}
}
override fun parentUpdated(logical: Logical<*>) {
observers[IdWrapper(logical)]?.let { list ->
for (obs in list) {
obs(this).parentUpdated(logical)
}
}
}
}
internal class FrameStack(storeView: StoreView?) : LogicalObserver {
var current: Frame
val observing = HashSet<IdWrapper<Logical<*>>>()
init {
this.current = if (storeView != null) Frame(this, storeView) else Frame(this)
}
fun push(): Frame {
val frame = Frame(this, current)
this.current = frame
return frame
}
fun reset(frame: Frame): Unit {
this.current = frame
}
fun addObserver(logical: Logical<*>) {
val token = IdWrapper(logical)
if (!observing.contains(token)) {
logical.addObserver(this)
observing.add(token)
}
}
fun removeObserver(logical: Logical<*>) {
// NOP
// yes, keep listening, the updates are still filtered down the stream
}
override fun valueUpdated(logical: Logical<*>) {
current.valueUpdated(logical)
}
override fun parentUpdated(logical: Logical<*>) {
current.parentUpdated(logical)
}
}

View File

@ -0,0 +1,39 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.core
import jetbrains.mps.logic.reactor.evaluation.PredicateInvocation
import jetbrains.mps.logic.reactor.logical.LogicalContext
import jetbrains.mps.logic.reactor.program.Predicate
/**
* @author Fedor Isakov
*/
fun Predicate.invocation(arguments: List<*>, logicalContext: LogicalContext): PredicateInvocation =
Invocation(this, arguments, logicalContext)
private data class Invocation(val predicate: Predicate,
val invocationArguments: List<*>,
val logicalContext: LogicalContext) : PredicateInvocation {
override fun predicate(): Predicate = predicate
override fun arguments(): List<*> = invocationArguments
override fun logicalContext(): LogicalContext = logicalContext
}

View File

@ -0,0 +1,210 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.core
import jetbrains.mps.logic.reactor.logical.Logical
import jetbrains.mps.logic.reactor.logical.MetaLogical
import jetbrains.mps.logic.reactor.logical.JoinableLogical
import java.util.*
/**
* @author Fedor Isakov
*/
interface LogicalObserver {
fun valueUpdated(logical: Logical<*>)
fun parentUpdated(logical: Logical<*>)
}
fun Logical<*>.addObserver(observer: LogicalObserver) {
(this as LogicalImpl<*>).valueObservers.add(this.to(observer))
(this as LogicalImpl<*>).parentObservers.add(this.to(observer))
}
fun Logical<*>.removeObserver(observer: LogicalObserver) {
(this as LogicalImpl<*>).valueObservers.removeAll { p -> p.second == observer }
(this as LogicalImpl<*>).parentObservers.removeAll { p -> p.second == observer }
}
fun <V> MetaLogical<V>.logical(): Logical<V> = LogicalImpl<V>(this)
fun <V> MetaLogical<V>.logical(value: V): Logical<V> = LogicalImpl<V>(name(), value)
class LogicalImpl<T> : JoinableLogical<T> {
companion object {
var lastIdx = 0
}
val name: String
val metaLogical: MetaLogical<T>
var _parent: LogicalImpl<T>? = null
var _value: T? = null
var rank = 0
internal val valueObservers = ArrayList<Pair<LogicalImpl<*>, LogicalObserver>>()
internal val parentObservers = ArrayList<Pair<LogicalImpl<*>, LogicalObserver>>()
constructor(value: T) {
this.name = "$${++lastIdx}"
this.metaLogical = DefaultMetaLogical<T>(name)
this._value = value
}
constructor(name: String) {
this.name = "${name}_${++lastIdx}"
this.metaLogical = DefaultMetaLogical<T>(name)
}
constructor(name: String, value: T) {
this.name = "${name}_${++lastIdx}"
this.metaLogical = DefaultMetaLogical<T>(name)
this._value = value
}
constructor(metaLogical: MetaLogical<T>) {
this.metaLogical = metaLogical
this.name = "${metaLogical.name()}_${++lastIdx}"
}
override fun name(): String = name
override fun value(): T? = _value
override fun isBound(): Boolean = find()._value != null
override fun isWildcard(): Boolean = metaLogical.isWildcard
override fun metaLogical(): MetaLogical<T> = metaLogical
override fun findRoot(): JoinableLogical<T> = find()
override fun setValue(newValue: T) {
if (_value !== newValue) {
this._value = newValue
notifyValueUpdated()
}
}
override fun union(other: JoinableLogical<T>, reconciler: JoinableLogical.ValueReconciler<T>) {
val thisRepr = this.find()
val otherRepr = (other as LogicalImpl<T>).find()
// invariant: thisRepr.rank > otherRepr.rank
if (thisRepr.rank() < otherRepr.rank()) {
otherRepr.union(thisRepr, reconciler);
return;
} else if (thisRepr.rank() == otherRepr.rank()) {
thisRepr.incRank();
}
val thisVal = thisRepr.value();
val otherVal = otherRepr.value();
// first copy the value
if (thisVal == null && otherVal != null) {
// var ground
thisRepr.setValue(otherVal);
// TODO: clear the value in the "other" logical after union
} else if (thisVal != null && otherVal == null) {
// ground var
// TODO: no need to copy the value
otherRepr.setValue(thisVal);
}
// then set parent
otherRepr.setParent(thisRepr)
thisRepr.mergeParentObservers(otherRepr)
// last, reconcile the values/merge observers
if (thisVal == null && otherVal == null) {
// var var
thisRepr.mergeValueObservers(otherRepr);
} else if (thisVal != null && otherVal != null) {
// ground ground
reconciler.reconcile(thisVal, otherVal);
}
}
override fun union(other: JoinableLogical<T>) {
union(other, { a, b -> if (a != b) throw IllegalStateException("$a does not equal to $b")})
}
private fun find(): LogicalImpl<T> {
val tmp = _parent
if (tmp == null) return this
else {
val root = tmp.find()
this._parent = root
return root
}
}
private fun rank(): Int = rank
private fun incRank() { rank++ }
private fun setParent(parent: LogicalImpl<T>) {
this._parent = parent
notifyParentUpdated()
}
private fun mergeValueObservers(mergeFrom: JoinableLogical<T>) {
val other = mergeFrom as LogicalImpl<T>
valueObservers.addAll(other.valueObservers)
other.valueObservers.clear()
}
private fun mergeParentObservers(mergeFrom: JoinableLogical<T>) {
val other = mergeFrom as LogicalImpl<T>
parentObservers.addAll(other.parentObservers)
other.parentObservers.clear()
}
private fun notifyValueUpdated() {
val obs = ArrayList(valueObservers)
this.valueObservers.clear()
for (p in obs) {
p.second.valueUpdated(p.first)
}
}
private fun notifyParentUpdated() {
val obs = ArrayList(parentObservers)
for (p in obs) {
p.second.parentUpdated(p.first)
}
}
override fun toString(): String =
if (_parent != null) "${name}(^${_parent.toString()})"
else name
}
class DefaultMetaLogical<V> (val name: String) : MetaLogical<V>(name, Object::class.java as Class<V>) {}

View File

@ -0,0 +1,194 @@
/*
* Copyright 2014-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.mps.logic.reactor.core
import jetbrains.mps.logic.reactor.evaluation.ConstraintOccurrence
import jetbrains.mps.logic.reactor.evaluation.MatchRule
import jetbrains.mps.logic.reactor.logical.Logical
import jetbrains.mps.logic.reactor.logical.LogicalContext
import jetbrains.mps.logic.reactor.logical.LogicalOwner
import jetbrains.mps.logic.reactor.logical.MetaLogical
import jetbrains.mps.logic.reactor.program.Constraint
import jetbrains.mps.logic.reactor.program.Predicate
import jetbrains.mps.logic.reactor.program.Rule
import jetbrains.mps.logic.reactor.util.LazyIterable
import jetbrains.mps.logic.reactor.util.Profiler
import jetbrains.mps.unification.Substitution
import jetbrains.mps.unification.Term
import jetbrains.mps.unification.TermWrapper
import com.github.andrewoma.dexx.collection.List as PersList
/**
* @author Fedor Isakov
*/
class Matcher(val ruleIndex: RuleIndex,
val profiler: Profiler? = null)
{
private val rule2matchTrieSet = HashMap<Rule, MatchTrieSet>()
fun matches(activeOcc: ConstraintOccurrence, aux: OccurrenceIndex) : Iterable<Match> = object : Iterable<Match> {
override fun iterator(): Iterator<Match> {
val relevantRules = ruleIndex.forOccurrence(activeOcc).toList()
val tries = LazyIterable<Rule, MatchTrieSet>(relevantRules) { rule ->
rule2matchTrieSet[rule] ?: MatchTrieSet(rule, profiler).apply {
rule2matchTrieSet[rule] = this
}
}.asSequence()
return tries.flatMap { matchTrieSet ->
matchTrieSet.matches(activeOcc, aux)
}.map { partialMatch ->
partialMatch.complete(profiler)
}.filter { match ->
match.successful
}.iterator()
}
}
}
class Match(val rule: Rule,
val substitution: Substitution,
val keptOccurrences: List<ConstraintOccurrence>,
val discardedOccurrences: List<ConstraintOccurrence>) : MatchRule
{
val logicalContext: LogicalContext by lazy(LazyThreadSafetyMode.NONE) {
object : LogicalContext {
// invariant: the variables in substitution bindings can only be instances of MetaLogical
val meta2subs = substitution.bindings().map { b ->
(b.`var`().symbol() as MetaLogical<Any>).to(b.term().toValue())
}.toMap(HashMap<MetaLogical<*>, Any?>())
val meta2logical = HashMap<MetaLogical<*>, Logical<*>>()
override fun <V : Any> variable(meta: MetaLogical<V>): Logical<V> =
(meta2logical[meta] ?: meta2subs[meta]?.let { value ->
when (value) {
is Logical<*> -> value
is LogicalOwner -> value.logical()
else -> LogicalImpl(value)
}
} ?: meta.logical().also {
logical -> meta2logical[meta] = logical }) as Logical<V>
}
}
val patternPredicates: List<Predicate> by lazy(LazyThreadSafetyMode.NONE) {
(rule.headKept() + rule.headReplaced()).zip(keptOccurrences + discardedOccurrences).flatMap { p ->
p.first.patternPredicates(p.second.arguments()) }.toList()
}
val successful: Boolean
get() = substitution.isSuccessful
val isPropagation: Boolean
get() = !keptOccurrences.isEmpty() && discardedOccurrences.isEmpty()
override fun rule(): Rule = rule
override fun matchHeadKept(): Iterable<ConstraintOccurrence> = keptOccurrences
override fun matchHeadReplaced(): Iterable<ConstraintOccurrence> = discardedOccurrences
}
/** Function term with arguments == constraints converted to terms. May contain variables. */
class RuleTerm(rule: Rule) :
Function(
rule.tag(),
(rule.headKept() + rule.headReplaced()).map { c -> ConstraintPatternTerm(c) }) {}
/** Function term with arguments == constraint arguments converted to terms.
* MetaLogical arguments are term variables.
* Everything else is either a term or a constant wrapping the value. */
class ConstraintPatternTerm(constraint: Constraint) :
Function(
constraint.symbol(),
constraint.arguments().mapIndexed { idx: Int, arg: Any? -> arg.asTerm() }) {}
/** Function term with arguments == terms corresponding to constraint occurrences. Never contains variables. */
class MatchTerm(rule: Rule, kept: List<ConstraintOccurrence>, discarded: List<ConstraintOccurrence>) :
Function(rule.tag(), (kept + discarded).map { co -> ConstraintOccurrenceTerm(co) }) {}
/** Function term with arguments == constraint occurrence arguments converted to terms.
* Logical arguments are constants wrapping the logical itself.
* Everything else is either a term or a constant wrapping the value.
* Never contains variable terms. */
class ConstraintOccurrenceTerm(occurrence: ConstraintOccurrence) :
Function(
occurrence.constraint().symbol(),
occurrence.arguments().mapIndexed { idx: Int, arg: Any? -> arg.asTerm() }) {}
/** Wraps the terms for the internal representation of the unification algorithm.
* When unifying constraint and occurrence terms we are interested in bindings of the meta logicals,
* so these are represented as variables.
* In addition, the logicals are either represented as constants (unbound ones) or their values.
* When unwrapping, the reverse transformation takes place, so that the unification result binds meta logicals
* to logicals, and not to their values. */
class MatchTermWrapper() : TermWrapper {
override fun wrap(orig: Term): Term =
if (orig.`is`(Term.Kind.VAR)) {
val symbol = orig.symbol()
when (symbol) {
is MetaLogical<*> -> orig
is Logical<*> -> symbol.let { logical ->
if (logical.isBound && logical.findRoot().value() is Term) {
WrapGroundLogical(logical as Logical<Term>)
} else {
WrapFreeLogical(logical)
}
}
else -> WrapConstant(orig)
}
} else {
orig
}
override fun unwrap(wrapper: Term): Term = when (wrapper) {
is WrapConstant -> wrapper.orig
is WrapFreeLogical -> Constant(wrapper.logical)
is WrapGroundLogical -> Constant(wrapper.logical)
else -> wrapper
}
}
fun Any?.asTerm(): Term = when (this) {
is MetaLogical<*> -> Variable(this)
is Logical<*> -> Variable(this)
// is Logical<*> -> if (this.isBound) this.findRoot().value().asTerm() else Constant(this.findRoot())
is Term -> this // wrapped before unification
is Any -> Constant(this)
else -> throw NullPointerException()
}
// FIXME: "unpacking" the logicals
fun Term.toValue(): Any? = if (this is Constant) this.symbol() else this

Some files were not shown because too many files have changed in this diff Show More