diff options
Diffstat (limited to 'subprojects')
-rw-r--r-- | subprojects/interpreter-localsearch/NOTICE.md (renamed from subprojects/store-query-viatra/NOTICE.md) | 13 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/about.html (renamed from subprojects/viatra-runtime-localsearch/about.html) | 0 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/build.gradle.kts | 14 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/ExecutionLoggerAdapter.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/ExecutionLoggerAdapter.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/MatchingFrame.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/MatchingFrame.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/exceptions/LocalSearchException.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/exceptions/LocalSearchException.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/CallWithAdornment.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/CallWithAdornment.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/ILocalSearchAdaptable.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/ILocalSearchAdaptable.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/ILocalSearchAdapter.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/ILocalSearchAdapter.java) | 42 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/ISearchContext.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/ISearchContext.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/LocalSearchMatcher.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/LocalSearchMatcher.java) | 76 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/MatcherReference.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/MatcherReference.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/AbstractLocalSearchResultProvider.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/AbstractLocalSearchResultProvider.java) | 196 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/AllValidAdornments.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/AllValidAdornments.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/DontFlattenDisjunctive.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/DontFlattenDisjunctive.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/DontFlattenIncrementalPredicate.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/DontFlattenIncrementalPredicate.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/GenericLocalSearchResultProvider.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/GenericLocalSearchResultProvider.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/IAdornmentProvider.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/IAdornmentProvider.java) | 36 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LazyPlanningAdornments.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LazyPlanningAdornments.java) | 30 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchBackend.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchBackend.java) | 116 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchGenericBackendFactory.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchGenericBackendFactory.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchGenericBackendFactoryProvider.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchGenericBackendFactoryProvider.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchHintOptions.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchHintOptions.java) | 50 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchHints.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchHints.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/CheckOperationExecutor.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/CheckOperationExecutor.java) | 13 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/ExtendOperationExecutor.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/ExtendOperationExecutor.java) | 9 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/IIteratingSearchOperation.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/IIteratingSearchOperation.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/IPatternMatcherOperation.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/IPatternMatcherOperation.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/ISearchOperation.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/ISearchOperation.java) | 44 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/MatchingFrameValueProvider.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/MatchingFrameValueProvider.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/AggregatorCheck.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/AggregatorCheck.java) | 44 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/BinaryTransitiveClosureCheck.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/BinaryTransitiveClosureCheck.java) | 44 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/CheckConstant.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/CheckConstant.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/CheckPositivePatternCall.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/CheckPositivePatternCall.java) | 38 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/CountCheck.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/CountCheck.java) | 40 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/ExpressionCheck.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/ExpressionCheck.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/ExpressionEvalCheck.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/ExpressionEvalCheck.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/InequalityCheck.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/InequalityCheck.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/NACOperation.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/NACOperation.java) | 38 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/AggregatorExtend.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/AggregatorExtend.java) | 48 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/CountOperation.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/CountOperation.java) | 36 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/ExpressionEval.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/ExpressionEval.java) | 34 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/ExtendBinaryTransitiveClosure.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/ExtendBinaryTransitiveClosure.java) | 40 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/ExtendConstant.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/ExtendConstant.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/ExtendPositivePatternCall.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/ExtendPositivePatternCall.java) | 54 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/SingleValueExtendOperationExecutor.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/SingleValueExtendOperationExecutor.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/generic/GenericTypeCheck.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/generic/GenericTypeCheck.java) | 32 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/generic/GenericTypeExtend.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/generic/GenericTypeExtend.java) | 38 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/generic/GenericTypeExtendSingleValue.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/generic/GenericTypeExtendSingleValue.java) | 34 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/util/CallInformation.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/util/CallInformation.java) | 78 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/IPlanDescriptor.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/IPlanDescriptor.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/IPlanProvider.java | 33 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/PlanDescriptor.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/PlanDescriptor.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/SearchPlan.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/SearchPlan.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/SearchPlanExecutor.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/SearchPlanExecutor.java) | 49 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/SearchPlanForBody.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/SearchPlanForBody.java) | 34 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/SimplePlanProvider.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/SimplePlanProvider.java) | 34 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/ILocalSearchPlanner.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/ILocalSearchPlanner.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/ISearchPlanCodeGenerator.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/ISearchPlanCodeGenerator.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/LocalSearchPlanner.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/LocalSearchPlanner.java) | 54 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/LocalSearchRuntimeBasedStrategy.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/LocalSearchRuntimeBasedStrategy.java) | 80 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/PConstraintCategory.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/PConstraintCategory.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/PConstraintInfo.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/PConstraintInfo.java) | 40 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/PConstraintInfoInferrer.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/PConstraintInfoInferrer.java) | 34 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/PlanState.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/PlanState.java) | 114 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/compiler/AbstractOperationCompiler.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/compiler/AbstractOperationCompiler.java) | 188 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/compiler/GenericOperationCompiler.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/compiler/GenericOperationCompiler.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/compiler/IOperationCompiler.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/compiler/IOperationCompiler.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/IConstraintEvaluationContext.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/IConstraintEvaluationContext.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/ICostFunction.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/ICostFunction.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/impl/HybridMatcherConstraintCostFunction.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/impl/HybridMatcherConstraintCostFunction.java) | 41 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/impl/IndexerBasedConstraintCostFunction.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/impl/IndexerBasedConstraintCostFunction.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/impl/StatisticsBasedConstraintCostFunction.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/impl/StatisticsBasedConstraintCostFunction.java) | 150 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/impl/VariableBindingBasedCostFunction.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/impl/VariableBindingBasedCostFunction.java) | 36 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/util/CompilerHelper.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/util/CompilerHelper.java) | 40 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/util/OperationCostComparator.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/util/OperationCostComparator.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/profiler/LocalSearchProfilerAdapter.java (renamed from subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/profiler/LocalSearchProfilerAdapter.java) | 32 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/META-INF/MANIFEST.MF (renamed from subprojects/viatra-runtime-rete-recipes/META-INF/MANIFEST.MF) | 0 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/META-INF/MANIFEST.MF.license (renamed from subprojects/viatra-runtime-rete-recipes/META-INF/MANIFEST.MF.license) | 0 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/NOTICE.md | 94 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/about.html (renamed from subprojects/viatra-runtime-rete-recipes/about.html) | 0 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/build.gradle.kts (renamed from subprojects/viatra-runtime-rete-recipes/build.gradle.kts) | 12 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/build.properties (renamed from subprojects/viatra-runtime-rete-recipes/build.properties) | 0 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/plugin.properties (renamed from subprojects/viatra-runtime-rete-recipes/plugin.properties) | 0 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/plugin.xml (renamed from subprojects/viatra-runtime-rete-recipes/plugin.xml) | 6 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/GenerateReteRecipes.mwe2 (renamed from subprojects/viatra-runtime-rete-recipes/src/main/java/tools/refinery/viatra/runtime/rete/recipes/GenerateReteRecipes.mwe2) | 6 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/helper/RecipeRecognizer.java (renamed from subprojects/viatra-runtime-rete-recipes/src/main/java/tools/refinery/viatra/runtime/rete/recipes/helper/RecipeRecognizer.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/helper/RecipesHelper.java (renamed from subprojects/viatra-runtime-rete-recipes/src/main/java/tools/refinery/viatra/runtime/rete/recipes/helper/RecipesHelper.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore (renamed from subprojects/viatra-runtime-rete-recipes/src/main/resources/model/recipes.ecore) | 32 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore.license (renamed from subprojects/viatra-runtime-rete-recipes/src/main/resources/model/recipes.ecore.license) | 0 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel (renamed from subprojects/viatra-runtime-rete-recipes/src/main/resources/model/rete-recipes.genmodel) | 30 | ||||
-rw-r--r-- | subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel.license (renamed from subprojects/viatra-runtime-rete-recipes/src/main/resources/model/rete-recipes.genmodel.license) | 0 | ||||
-rw-r--r-- | subprojects/interpreter-rete/NOTICE.md | 94 | ||||
-rw-r--r-- | subprojects/interpreter-rete/about.html (renamed from subprojects/viatra-runtime-rete/about.html) | 0 | ||||
-rw-r--r-- | subprojects/interpreter-rete/build.gradle.kts | 15 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/AbstractColumnAggregatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/AbstractColumnAggregatorNode.java) | 48 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/ColumnAggregatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/ColumnAggregatorNode.java) | 44 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/CountNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/CountNode.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/GroupedMap.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/GroupedMap.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/GroupedSet.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/GroupedSet.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/IAggregatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/IAggregatorNode.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/IndexerBasedAggregatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/IndexerBasedAggregatorNode.java) | 54 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FaithfulParallelTimelyColumnAggregatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FaithfulParallelTimelyColumnAggregatorNode.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FaithfulSequentialTimelyColumnAggregatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FaithfulSequentialTimelyColumnAggregatorNode.java) | 30 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FaithfulTimelyColumnAggregatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FaithfulTimelyColumnAggregatorNode.java) | 46 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FirstOnlyParallelTimelyColumnAggregatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FirstOnlyParallelTimelyColumnAggregatorNode.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FirstOnlySequentialTimelyColumnAggregatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FirstOnlySequentialTimelyColumnAggregatorNode.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FirstOnlyTimelyColumnAggregatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FirstOnlyTimelyColumnAggregatorNode.java) | 38 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/Disconnectable.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/Disconnectable.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/ExternalInputEnumeratorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/ExternalInputEnumeratorNode.java) | 60 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/ExternalInputStatelessFilterNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/ExternalInputStatelessFilterNode.java) | 44 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/InputConnector.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/InputConnector.java) | 60 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/ReteBoundary.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/ReteBoundary.java) | 46 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/RetePatternBuildException.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/RetePatternBuildException.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/basiclinear/BasicLinearLayout.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/basiclinear/BasicLinearLayout.java) | 74 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/basiclinear/OrderingHeuristics.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/basiclinear/OrderingHeuristics.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/plancompiler/CompilerHelper.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/plancompiler/CompilerHelper.java) | 94 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/plancompiler/RecursionCutoffPoint.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/plancompiler/RecursionCutoffPoint.java) | 48 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/plancompiler/ReteRecipeCompiler.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/plancompiler/ReteRecipeCompiler.java) | 84 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/JoinCandidate.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/quasitree/JoinCandidate.java) | 50 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/JoinOrderingHeuristics.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/quasitree/JoinOrderingHeuristics.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/QuasiTreeLayout.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/quasitree/QuasiTreeLayout.java) | 68 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/TieBreaker.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/quasitree/TieBreaker.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/AbstractEvaluatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/AbstractEvaluatorNode.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/EvaluatorCore.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/EvaluatorCore.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/IEvaluatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/IEvaluatorNode.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/MemorylessEvaluatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/MemorylessEvaluatorNode.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/OutputCachingEvaluatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/OutputCachingEvaluatorNode.java) | 38 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/RelationEvaluatorNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/RelationEvaluatorNode.java) | 38 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/DefaultIndexerListener.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/DefaultIndexerListener.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/DualInputNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/DualInputNode.java) | 41 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/ExistenceNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/ExistenceNode.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/GenericProjectionIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/GenericProjectionIndexer.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/IdentityIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/IdentityIndexer.java) | 34 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/Indexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/Indexer.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/IndexerListener.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/IndexerListener.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/IndexerWithMemory.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/IndexerWithMemory.java) | 52 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/IterableIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/IterableIndexer.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/JoinNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/JoinNode.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/MemoryIdentityIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/MemoryIdentityIndexer.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/MemoryNullIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/MemoryNullIndexer.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/NullIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/NullIndexer.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/OnetimeIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/OnetimeIndexer.java) | 15 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/ProjectionIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/ProjectionIndexer.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/SpecializedProjectionIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/SpecializedProjectionIndexer.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/StandardIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/StandardIndexer.java) | 36 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/TransitiveClosureNodeIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/TransitiveClosureNodeIndexer.java) | 44 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/timely/TimelyMemoryIdentityIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/timely/TimelyMemoryIdentityIndexer.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/timely/TimelyMemoryNullIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/timely/TimelyMemoryNullIndexer.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/counting/CountingAlg.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/counting/CountingAlg.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/counting/CountingTcRelation.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/counting/CountingTcRelation.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/incscc/CountingListener.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/incscc/CountingListener.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/incscc/IncSCCAlg.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/incscc/IncSCCAlg.java) | 34 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/DFSPathFinder.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/DFSPathFinder.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/Edge.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/Edge.java) | 2 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/GraphHelper.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/GraphHelper.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/IGraphPathFinder.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/IGraphPathFinder.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/ITcRelation.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/ITcRelation.java) | 2 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/Tuple.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/Tuple.java) | 2 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/bfs/BFS.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/bfs/BFS.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/scc/PKAlg.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/scc/PKAlg.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/scc/SCC.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/scc/SCC.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/scc/SCCProperty.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/scc/SCCProperty.java) | 2 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/scc/SCCResult.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/scc/SCCResult.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/topsort/TopologicalSorting.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/topsort/TopologicalSorting.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/representative/RepresentativeElectionAlgorithm.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/representative/RepresentativeElectionAlgorithm.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/representative/RepresentativeObserver.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/representative/RepresentativeObserver.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/representative/StronglyConnectedComponentAlgorithm.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/representative/StronglyConnectedComponentAlgorithm.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/representative/WeaklyConnectedComponentAlgorithm.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/representative/WeaklyConnectedComponentAlgorithm.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/util/CollectionHelper.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/util/CollectionHelper.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/graphimpl/DotGenerator.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/graphimpl/DotGenerator.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/graphimpl/Graph.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/graphimpl/Graph.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/IBiDirectionalGraphDataSource.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/IBiDirectionalGraphDataSource.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/IBiDirectionalWrapper.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/IBiDirectionalWrapper.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/IGraphDataSource.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/IGraphDataSource.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/IGraphObserver.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/IGraphObserver.java) | 2 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/ITcDataSource.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/ITcDataSource.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/ITcObserver.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/ITcObserver.java) | 2 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/DRedReteBackendFactory.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/DRedReteBackendFactory.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/HintConfigurator.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/HintConfigurator.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/IncrementalMatcherCapability.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/IncrementalMatcherCapability.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/ReteBackendFactory.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/ReteBackendFactory.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/ReteBackendFactoryProvider.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/ReteBackendFactoryProvider.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/ReteEngine.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/ReteEngine.java) | 88 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/RetePatternMatcher.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/RetePatternMatcher.java) | 42 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/TimelyConfiguration.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/TimelyConfiguration.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/TimelyReteBackendFactory.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/TimelyReteBackendFactory.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/Bag.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/Bag.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/ConstantNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/ConstantNode.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/DefaultDeltaMonitor.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/DefaultDeltaMonitor.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/DeltaMonitor.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/DeltaMonitor.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/SimpleReceiver.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/SimpleReceiver.java) | 36 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/BaseNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/BaseNode.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/ConnectionFactory.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/ConnectionFactory.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/IGroupable.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/IGroupable.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Network.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Network.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/NetworkStructureChangeSensitiveNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/NetworkStructureChangeSensitiveNode.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Node.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Node.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/NodeFactory.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/NodeFactory.java) | 68 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/NodeProvisioner.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/NodeProvisioner.java) | 46 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/PosetAwareReceiver.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/PosetAwareReceiver.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/ProductionNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/ProductionNode.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Receiver.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Receiver.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/RederivableNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/RederivableNode.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/ReinitializedNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/ReinitializedNode.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/ReteContainer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/ReteContainer.java) | 44 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/StandardNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/StandardNode.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Supplier.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Supplier.java) | 40 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Tunnel.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Tunnel.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/UpdateMessage.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/UpdateMessage.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/CommunicationGroup.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/CommunicationGroup.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/CommunicationTracker.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/CommunicationTracker.java) | 36 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/MessageSelector.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/MessageSelector.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/NodeComparator.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/NodeComparator.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/PhasedSelector.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/PhasedSelector.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/Timestamp.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/Timestamp.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/RecursiveCommunicationGroup.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timeless/RecursiveCommunicationGroup.java) | 32 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/SingletonCommunicationGroup.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timeless/SingletonCommunicationGroup.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/TimelessCommunicationTracker.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timeless/TimelessCommunicationTracker.java) | 34 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/ResumableNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/ResumableNode.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimelyCommunicationGroup.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimelyCommunicationGroup.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimelyCommunicationTracker.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimelyCommunicationTracker.java) | 40 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimelyIndexerListenerProxy.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimelyIndexerListenerProxy.java) | 30 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimelyMailboxProxy.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimelyMailboxProxy.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimestampTransformation.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimestampTransformation.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/delayed/DelayedCommand.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/delayed/DelayedCommand.java) | 30 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/delayed/DelayedConnectCommand.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/delayed/DelayedConnectCommand.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/delayed/DelayedDisconnectCommand.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/delayed/DelayedDisconnectCommand.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/indexer/DefaultMessageIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/indexer/DefaultMessageIndexer.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/indexer/GroupBasedMessageIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/indexer/GroupBasedMessageIndexer.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/indexer/MessageIndexer.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/indexer/MessageIndexer.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/AdaptableMailbox.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/AdaptableMailbox.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/FallThroughCapableMailbox.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/FallThroughCapableMailbox.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/Mailbox.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/Mailbox.java) | 34 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/MessageIndexerFactory.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/MessageIndexerFactory.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/AbstractUpdateSplittingMailbox.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/AbstractUpdateSplittingMailbox.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/BehaviorChangingMailbox.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/BehaviorChangingMailbox.java) | 42 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/DefaultMailbox.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/DefaultMailbox.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/PosetAwareMailbox.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/PosetAwareMailbox.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/UpdateSplittingMailbox.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/UpdateSplittingMailbox.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timely/TimelyMailbox.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timely/TimelyMailbox.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/remote/Address.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/remote/Address.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/remote/RemoteReceiver.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/remote/RemoteReceiver.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/remote/RemoteSupplier.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/remote/RemoteSupplier.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/AbstractUniquenessEnforcerNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/AbstractUniquenessEnforcerNode.java) | 38 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/CallbackNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/CallbackNode.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/DefaultProductionNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DefaultProductionNode.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/DiscriminatorBucketNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DiscriminatorBucketNode.java) | 38 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/DiscriminatorDispatcherNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DiscriminatorDispatcherNode.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/EqualityFilterNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/EqualityFilterNode.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/FilterNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/FilterNode.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/InequalityFilterNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/InequalityFilterNode.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/RepresentativeElectionNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/RepresentativeElectionNode.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/SingleInputNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/SingleInputNode.java) | 46 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TimelyProductionNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TimelyProductionNode.java) | 15 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TimelyUniquenessEnforcerNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TimelyUniquenessEnforcerNode.java) | 42 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TransformerNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TransformerNode.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TransitiveClosureNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TransitiveClosureNode.java) | 46 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TransparentNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TransparentNode.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TrimmerNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TrimmerNode.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/UniquenessEnforcerNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/UniquenessEnforcerNode.java) | 54 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/ValueBinderFilterNode.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/ValueBinderFilterNode.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/ActiveNodeConflictTrace.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/ActiveNodeConflictTrace.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/CompiledQuery.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/CompiledQuery.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/CompiledSubPlan.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/CompiledSubPlan.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/ParameterProjectionTrace.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/ParameterProjectionTrace.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/PatternTraceInfo.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/PatternTraceInfo.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/PlanningTrace.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/PlanningTrace.java) | 32 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/RecipeTraceInfo.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/RecipeTraceInfo.java) | 32 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/TraceInfo.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/TraceInfo.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/UserRequestTrace.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/UserRequestTrace.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/util/LexicographicComparator.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/util/LexicographicComparator.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/util/Options.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/util/Options.java) | 34 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/util/OrderingCompareAgent.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/util/OrderingCompareAgent.java) | 2 | ||||
-rw-r--r-- | subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/util/ReteHintOptions.java (renamed from subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/util/ReteHintOptions.java) | 40 | ||||
-rw-r--r-- | subprojects/interpreter/NOTICE.md | 94 | ||||
-rw-r--r-- | subprojects/interpreter/about.html (renamed from subprojects/viatra-runtime/about.html) | 0 | ||||
-rw-r--r-- | subprojects/interpreter/build.gradle.kts | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/CancellationToken.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/CancellationToken.java) | 2 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/AdvancedInterpreterEngine.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/AdvancedViatraQueryEngine.java) | 131 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/GenericPatternMatch.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/GenericPatternMatch.java) | 32 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/GenericPatternMatcher.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/GenericPatternMatcher.java) | 33 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/GenericQueryGroup.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/GenericQueryGroup.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/GenericQuerySpecification.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/GenericQuerySpecification.java) | 33 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/IMatchUpdateListener.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/IMatchUpdateListener.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/IPatternMatch.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/IPatternMatch.java) | 50 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/IQueryGroup.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/IQueryGroup.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/IQuerySpecification.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/IQuerySpecification.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterEngine.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngine.java) | 86 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterEngineInitializationListener.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngineInitializationListener.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterEngineLifecycleListener.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngineLifecycleListener.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterEngineOptions.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngineOptions.java) | 80 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterMatcher.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryMatcher.java) | 76 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterModelUpdateListener.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryModelUpdateListener.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/MatchUpdateAdapter.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/MatchUpdateAdapter.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BaseGeneratedPatternGroup.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BaseGeneratedPatternGroup.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BaseMatcher.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BaseMatcher.java) | 42 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BasePatternMatch.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BasePatternMatch.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BaseQueryGroup.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BaseQueryGroup.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BaseQuerySpecification.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BaseQuerySpecification.java) | 59 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/IBaseIndex.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/IBaseIndex.java) | 40 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/IEngineContext.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/IEngineContext.java) | 38 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/IIndexingErrorListener.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/IIndexingErrorListener.java) | 2 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/IInstanceObserver.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/IInstanceObserver.java) | 42 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/InterpreterBaseIndexChangeListener.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/ViatraBaseIndexChangeListener.java) | 23 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/QueryScope.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/QueryScope.java) | 19 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/exception/InterpreterException.java | 67 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/apiimpl/EngineContextFactory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/apiimpl/EngineContextFactory.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/apiimpl/InterpreterEngineImpl.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/apiimpl/ViatraQueryEngineImpl.java) | 209 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/apiimpl/QueryResultWrapper.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/apiimpl/QueryResultWrapper.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/engine/LifecycleProvider.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/engine/LifecycleProvider.java) | 58 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/engine/ListenerContainer.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/engine/ListenerContainer.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/engine/ModelUpdateProvider.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/engine/ModelUpdateProvider.java) | 114 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/InterpreterRuntimeException.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/ViatraQueryRuntimeException.java) | 27 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/AverageAccumulator.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/AverageAccumulator.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/DoubleAverageOperator.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/DoubleAverageOperator.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/DoubleSumOperator.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/DoubleSumOperator.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/ExtremumOperator.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/ExtremumOperator.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/IntegerAverageOperator.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/IntegerAverageOperator.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/IntegerSumOperator.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/IntegerSumOperator.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/LongAverageOperator.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/LongAverageOperator.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/LongSumOperator.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/LongSumOperator.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/avg.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/avg.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/count.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/count.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/max.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/max.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/min.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/min.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/sum.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/sum.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/algorithms/OrderedIterableMerge.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/algorithms/OrderedIterableMerge.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/algorithms/UnionFind.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/algorithms/UnionFind.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/algorithms/UnionFindNodeProperty.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/algorithms/UnionFindNodeProperty.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/CommonQueryHintOptions.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/CommonQueryHintOptions.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/ICallDelegationStrategy.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/ICallDelegationStrategy.java) | 62 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IMatcherCapability.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IMatcherCapability.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryBackend.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryBackend.java) | 37 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryBackendFactory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryBackendFactory.java) | 35 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryBackendFactoryProvider.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryBackendFactoryProvider.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryBackendHintProvider.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryBackendHintProvider.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryResultProvider.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryResultProvider.java) | 90 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IUpdateable.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IUpdateable.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/QueryEvaluationHint.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/QueryEvaluationHint.java) | 85 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/QueryHintOption.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/QueryHintOption.java) | 38 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/ResultProviderRequestor.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/ResultProviderRequestor.java) | 32 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/AbstractQueryMetaContext.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/AbstractQueryMetaContext.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/AbstractQueryRuntimeContext.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/AbstractQueryRuntimeContext.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IInputKey.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IInputKey.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IPosetComparator.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IPosetComparator.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryBackendContext.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryBackendContext.java) | 30 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryCacheContext.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryCacheContext.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryMetaContext.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryMetaContext.java) | 40 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryResultProviderAccess.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryResultProviderAccess.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryRuntimeContext.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryRuntimeContext.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryRuntimeContextListener.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryRuntimeContextListener.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IndexingService.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IndexingService.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/InputKeyImplication.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/InputKeyImplication.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/common/BaseInputKeyWrapper.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/common/BaseInputKeyWrapper.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/common/JavaTransitiveInstancesKey.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/common/JavaTransitiveInstancesKey.java) | 2 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/surrogate/SurrogateQueryRegistry.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/surrogate/SurrogateQueryRegistry.java) | 50 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/AbstractTrivialMaskedMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/AbstractTrivialMaskedMemory.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/DefaultMaskedTupleMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/DefaultMaskedTupleMemory.java) | 30 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/IdentityMaskedTupleMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/IdentityMaskedTupleMemory.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/MaskedTupleMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/MaskedTupleMemory.java) | 98 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/NullaryMaskedTupleMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/NullaryMaskedTupleMemory.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/UnaryMaskedTupleMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/UnaryMaskedTupleMemory.java) | 36 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/AbstractTimelyMaskedMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/AbstractTimelyMaskedMemory.java) | 60 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/AbstractTimelyTrivialMaskedMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/AbstractTimelyTrivialMaskedMemory.java) | 36 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/TimelyDefaultMaskedTupleMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/TimelyDefaultMaskedTupleMemory.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/TimelyIdentityMaskedTupleMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/TimelyIdentityMaskedTupleMemory.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/TimelyNullaryMaskedTupleMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/TimelyNullaryMaskedTupleMemory.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/TimelyUnaryMaskedTupleMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/TimelyUnaryMaskedTupleMemory.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/IOperationCompiler.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/IOperationCompiler.java) | 32 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/IQueryPlannerStrategy.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/IQueryPlannerStrategy.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/QueryProcessingException.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/QueryProcessingException.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/SubPlan.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/SubPlan.java) | 110 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/SubPlanFactory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/SubPlanFactory.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/helpers/BuildHelper.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/helpers/BuildHelper.java) | 66 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/helpers/FunctionalDependencyHelper.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/helpers/FunctionalDependencyHelper.java) | 40 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/helpers/StatisticsHelper.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/helpers/StatisticsHelper.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/helpers/TypeHelper.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/helpers/TypeHelper.java) | 38 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PApply.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PApply.java) | 30 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PEnumerate.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PEnumerate.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PJoin.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PJoin.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/POperation.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/POperation.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PProject.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PProject.java) | 34 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PStart.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PStart.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/BasePConstraint.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/BasePConstraint.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/DeferredPConstraint.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/DeferredPConstraint.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/EnumerablePConstraint.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/EnumerablePConstraint.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IExpressionEvaluator.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IExpressionEvaluator.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IMultiQueryReference.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IMultiQueryReference.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IQueryReference.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IQueryReference.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IRelationEvaluator.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IRelationEvaluator.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/ITypeConstraint.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/ITypeConstraint.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/ITypeInfoProviderConstraint.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/ITypeInfoProviderConstraint.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IValueProvider.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IValueProvider.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/InitializablePQuery.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/InitializablePQuery.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/KeyedEnumerablePConstraint.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/KeyedEnumerablePConstraint.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/PBody.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PBody.java) | 65 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/PConstraint.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PConstraint.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/PTraceable.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PTraceable.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/PVariable.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PVariable.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/TypeJudgement.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/TypeJudgement.java) | 44 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/VariableDeferredPConstraint.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/VariableDeferredPConstraint.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/AbstractMemorylessAggregationOperator.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/AbstractMemorylessAggregationOperator.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/AggregatorType.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/AggregatorType.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/BoundAggregator.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/BoundAggregator.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/IAggregatorFactory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/IAggregatorFactory.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/IMultisetAggregationOperator.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/IMultisetAggregationOperator.java) | 52 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/analysis/QueryAnalyzer.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/analysis/QueryAnalyzer.java) | 90 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/annotations/PAnnotation.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/annotations/PAnnotation.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/annotations/ParameterReference.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/annotations/ParameterReference.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/AggregatorConstraint.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/AggregatorConstraint.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/BaseTypeSafeConstraint.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/BaseTypeSafeConstraint.java) | 40 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/Equality.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/Equality.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/ExportedParameter.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/ExportedParameter.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/ExpressionEvaluation.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/ExpressionEvaluation.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/Inequality.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/Inequality.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/NegativePatternCall.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/NegativePatternCall.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/PatternCallBasedDeferred.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/PatternCallBasedDeferred.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/PatternMatchCounter.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/PatternMatchCounter.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/RelationEvaluation.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/RelationEvaluation.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/TypeFilterConstraint.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/TypeFilterConstraint.java) | 48 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/AbstractTransitiveClosure.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/AbstractTransitiveClosure.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/BinaryReflexiveTransitiveClosure.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/BinaryReflexiveTransitiveClosure.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/BinaryTransitiveClosure.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/BinaryTransitiveClosure.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/Connectivity.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/Connectivity.java) | 2 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/ConstantValue.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/ConstantValue.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/PositivePatternCall.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/PositivePatternCall.java) | 32 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/RepresentativeElectionConstraint.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/RepresentativeElectionConstraint.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/TypeConstraint.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/TypeConstraint.java) | 42 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/BasePQuery.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/BasePQuery.java) | 46 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PDisjunction.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PDisjunction.java) | 24 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PParameter.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PParameter.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PParameterDirection.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PParameterDirection.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PProblem.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PProblem.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PQueries.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PQueries.java) | 29 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PQuery.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PQuery.java) | 72 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PQueryHeader.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PQueryHeader.java) | 36 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PVisibility.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PVisibility.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/QueryInitializationException.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/QueryInitializationException.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/AbstractRewriterTraceSource.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/AbstractRewriterTraceSource.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/ConstraintRemovalReason.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/ConstraintRemovalReason.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/DefaultFlattenCallPredicate.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/DefaultFlattenCallPredicate.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/FlattenerCopier.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/FlattenerCopier.java) | 36 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IConstraintFilter.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IConstraintFilter.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IDerivativeModificationReason.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IDerivativeModificationReason.java) | 4 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IFlattenCallPredicate.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IFlattenCallPredicate.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IPTraceableTraceProvider.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IPTraceableTraceProvider.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IRewriterTraceCollector.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IRewriterTraceCollector.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IVariableRenamer.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IVariableRenamer.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/MappingTraceCollector.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/MappingTraceCollector.java) | 30 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/NeverFlattenCallPredicate.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/NeverFlattenCallPredicate.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/NopTraceCollector.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/NopTraceCollector.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PBodyCopier.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PBodyCopier.java) | 30 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PBodyNormalizer.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PBodyNormalizer.java) | 86 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PDisjunctionRewriter.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PDisjunctionRewriter.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PDisjunctionRewriterCacher.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PDisjunctionRewriterCacher.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PQueryFlattener.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PQueryFlattener.java) | 46 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/RewriterException.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/RewriterException.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/SurrogateQueryRewriter.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/SurrogateQueryRewriter.java) | 32 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/VariableMappingExpressionEvaluatorWrapper.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/VariableMappingExpressionEvaluatorWrapper.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/AbstractTuple.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/AbstractTuple.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/BaseFlatTuple.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/BaseFlatTuple.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/BaseLeftInheritanceTuple.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/BaseLeftInheritanceTuple.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple0.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple0.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple1.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple1.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple2.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple2.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple3.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple3.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple4.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple4.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/IModifiableTuple.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/IModifiableTuple.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/ITuple.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/ITuple.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple1.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple1.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple2.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple2.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple3.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple3.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple4.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple4.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/MaskedTuple.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/MaskedTuple.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/Tuple.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/Tuple.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/TupleMask.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleMask.java) | 90 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/TupleMask0.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleMask0.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/TupleMaskIdentity.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleMaskIdentity.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/TupleValueProvider.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleValueProvider.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/Tuples.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/Tuples.java) | 76 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/VolatileMaskedTuple.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/VolatileMaskedTuple.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/VolatileModifiableMaskedTuple.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/VolatileModifiableMaskedTuple.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/VolatileTuple.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/VolatileTuple.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Accuracy.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Accuracy.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Clearable.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Clearable.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/CollectionsFactory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/CollectionsFactory.java) | 42 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Direction.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Direction.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsBagMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsBagMemory.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsDeltaBag.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsDeltaBag.java) | 18 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsFactory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsFactory.java) | 34 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsLongMultiset.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsLongMultiset.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsLongSetMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsLongSetMemory.java) | 2 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsMultiLookup.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsMultiLookup.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsMultiset.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsMultiset.java) | 26 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsSetMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsSetMemory.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EmptyMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EmptyMemory.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/ICache.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/ICache.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IDeltaBag.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IDeltaBag.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMemory.java) | 36 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMemoryView.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMemoryView.java) | 64 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMultiLookup.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMultiLookup.java) | 86 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMultiLookupAbstract.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMultiLookupAbstract.java) | 174 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMultiset.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMultiset.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IProvider.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IProvider.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/ISetMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/ISetMemory.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/MapBackedMemoryView.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/MapBackedMemoryView.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/MarkedMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/MarkedMemory.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/MemoryViewBackedMapView.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/MemoryViewBackedMapView.java) | 14 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Preconditions.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Preconditions.java) | 28 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/PurgableCache.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/PurgableCache.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Sets.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Sets.java) | 32 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Signed.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Signed.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/SingletonInstanceProvider.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/SingletonInstanceProvider.java) | 12 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/SingletonMemoryView.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/SingletonMemoryView.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/TimelyMemory.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/TimelyMemory.java) | 22 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/resumable/MaskedResumable.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/resumable/MaskedResumable.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/resumable/Resumable.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/resumable/Resumable.java) | 6 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/resumable/UnmaskedResumable.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/resumable/UnmaskedResumable.java) | 16 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/CompactTimeline.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/CompactTimeline.java) | 20 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/Diff.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/Diff.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/SingletonTimeline.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/SingletonTimeline.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/Timeline.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/Timeline.java) | 10 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/Timelines.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/Timelines.java) | 8 | ||||
-rw-r--r-- | subprojects/interpreter/src/main/java/tools/refinery/interpreter/util/InterpreterLoggingUtil.java (renamed from subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/util/ViatraQueryLoggingUtil.java) | 32 | ||||
-rw-r--r-- | subprojects/language-semantics/build.gradle.kts | 2 | ||||
-rw-r--r-- | subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/model/CountPropagationTest.java | 4 | ||||
-rw-r--r-- | subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/model/ModelGenerationTest.java | 8 | ||||
-rw-r--r-- | subprojects/language-web/build.gradle.kts | 2 | ||||
-rw-r--r-- | subprojects/language-web/src/main/java/tools/refinery/language/web/generator/ModelGenerationWorker.java | 4 | ||||
-rw-r--r-- | subprojects/language-web/src/main/java/tools/refinery/language/web/semantics/SemanticsWorker.java | 4 | ||||
-rw-r--r-- | subprojects/store-dse/build.gradle.kts | 2 | ||||
-rw-r--r-- | subprojects/store-dse/src/test/java/tools/refinery/store/dse/CRAExamplesTest.java | 4 | ||||
-rw-r--r-- | subprojects/store-dse/src/test/java/tools/refinery/store/dse/DebugTest.java | 4 | ||||
-rw-r--r-- | subprojects/store-dse/src/test/java/tools/refinery/store/dse/transition/TransitionTests.java | 4 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/NOTICE.md | 94 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/build.gradle.kts | 26 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/QueryInterpreterAdapter.java | 18 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/QueryInterpreterBuilder.java | 54 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/QueryInterpreterStoreAdapter.java | 17 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/QueryInterpreterAdapterImpl.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryAdapterImpl.java) | 34 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/QueryInterpreterBuilderImpl.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryBuilderImpl.java) | 60 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/QueryInterpreterStoreAdapterImpl.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryStoreAdapterImpl.java) | 26 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/RelationalScope.java | 27 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/context/DummyBaseIndexer.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/DummyBaseIndexer.java) | 14 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/context/RelationalEngineContext.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalEngineContext.java) | 12 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/context/RelationalQueryMetaContext.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalQueryMetaContext.java) | 12 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/context/RelationalRuntimeContext.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalRuntimeContext.java) | 26 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/localsearch/FlatCostFunction.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/FlatCostFunction.java) | 14 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/AbstractInterpretedMatcher.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/AbstractViatraMatcher.java) | 14 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/FunctionalCursor.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/FunctionalCursor.java) | 6 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/InterpretedFunctionalMatcher.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/FunctionalViatraMatcher.java) | 29 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/InterpretedRelationalMatcher.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RelationalViatraMatcher.java) | 29 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/MatcherUtils.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/MatcherUtils.java) | 8 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/RawPatternMatcher.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RawPatternMatcher.java) | 8 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/RelationalCursor.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RelationalCursor.java) | 4 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/UnsafeFunctionalCursor.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/UnsafeFunctionalCursor.java) | 4 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/CheckEvaluator.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/CheckEvaluator.java) | 4 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/Dnf2PQuery.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/Dnf2PQuery.java) | 34 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/QueryWrapperFactory.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/QueryWrapperFactory.java) | 28 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/RawPQuery.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/RawPQuery.java) | 24 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/StatefulMultisetAggregator.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/StatefulMultisetAggregator.java) | 4 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/StatelessMultisetAggregator.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/StatelessMultisetAggregator.java) | 4 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/SymbolViewWrapper.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/SymbolViewWrapper.java) | 4 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/TermEvaluator.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/TermEvaluator.java) | 6 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/ValueProviderBasedValuation.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/ValueProviderBasedValuation.java) | 4 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/ModelUpdateListener.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/ModelUpdateListener.java) | 14 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/RelationViewFilter.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/RelationViewFilter.java) | 10 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/SymbolViewUpdateListener.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/SymbolViewUpdateListener.java) | 22 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/TupleChangingViewUpdateListener.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingViewUpdateListener.java) | 10 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/TuplePreservingViewUpdateListener.java (renamed from subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TuplePreservingViewUpdateListener.java) | 10 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/DiagonalQueryTest.java (renamed from subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java) | 26 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/FunctionalQueryTest.java (renamed from subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java) | 34 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/OrderedResultSetTest.java (renamed from subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/OrderedResultSetTest.java) | 6 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/QueryTest.java (renamed from subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java) | 46 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/QueryTransactionTest.java (renamed from subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java) | 22 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/StronglyConnectedComponentsTest.java (renamed from subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/StronglyConnectedComponentsTest.java) | 16 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/WeaklyConnectedComponentsTest.java (renamed from subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/WeaklyConnectedComponentsTest.java) | 12 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/internal/matcher/MatcherUtilsTest.java (renamed from subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/matcher/MatcherUtilsTest.java) | 4 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/tests/QueryAssertions.java (renamed from subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryAssertions.java) | 2 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/tests/QueryBackendHint.java (renamed from subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryBackendHint.java) | 4 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/tests/QueryEngineTest.java (renamed from subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryEngineTest.java) | 2 | ||||
-rw-r--r-- | subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/tests/QueryEvaluationHintSource.java (renamed from subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryEvaluationHintSource.java) | 4 | ||||
-rw-r--r-- | subprojects/store-query-viatra/build.gradle.kts | 19 | ||||
-rw-r--r-- | subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryAdapter.java | 18 | ||||
-rw-r--r-- | subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryBuilder.java | 54 | ||||
-rw-r--r-- | subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryStoreAdapter.java | 17 | ||||
-rw-r--r-- | subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/RelationalScope.java | 27 | ||||
-rw-r--r-- | subprojects/store-reasoning-scope/build.gradle.kts | 2 | ||||
-rw-r--r-- | subprojects/store-reasoning-scope/src/test/java/tools/refinery/store/reasoning/scope/MultiObjectTest.java | 4 | ||||
-rw-r--r-- | subprojects/store-reasoning/build.gradle.kts | 2 | ||||
-rw-r--r-- | subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/PartialModelTest.java | 4 | ||||
-rw-r--r-- | subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/containment/ContainmentHierarchyTranslatorTest.java | 4 | ||||
-rw-r--r-- | subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/metamodel/MetamodelTest.java | 4 | ||||
-rw-r--r-- | subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/multiobject/PartialCountTest.java | 4 | ||||
-rw-r--r-- | subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/ConcreteSupertypeTest.java | 4 | ||||
-rw-r--r-- | subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyPartialModelTest.java | 4 | ||||
-rw-r--r-- | subprojects/viatra-runtime-localsearch/build.gradle.kts | 18 | ||||
-rw-r--r-- | subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/IPlanProvider.java | 33 | ||||
-rw-r--r-- | subprojects/viatra-runtime-rete/build.gradle.kts | 19 | ||||
-rw-r--r-- | subprojects/viatra-runtime/build.gradle.kts | 19 | ||||
-rw-r--r-- | subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngineManager.java | 191 | ||||
-rw-r--r-- | subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/exception/ViatraQueryException.java | 71 |
605 files changed, 7690 insertions, 7630 deletions
diff --git a/subprojects/store-query-viatra/NOTICE.md b/subprojects/interpreter-localsearch/NOTICE.md index 7c21726a..94c1d803 100644 --- a/subprojects/store-query-viatra/NOTICE.md +++ b/subprojects/interpreter-localsearch/NOTICE.md | |||
@@ -5,11 +5,18 @@ | |||
5 | SPDX-License-Identifier: EPL-2.0 | 5 | SPDX-License-Identifier: EPL-2.0 |
6 | --> | 6 | --> |
7 | 7 | ||
8 | This module contains source code from the [Eclipse VIATRA project](https://projects.eclipse.org/projects/modeling.viatra), which is available under the terms of the [Eclipse Public License v 2.0](http://www.eclipse.org/legal/epl-v20.html). | 8 | This module contains source code from the [Eclipse VIATRA™ project](https://projects.eclipse.org/projects/modeling.viatra), which is available under the terms of the [Eclipse Public License v 2.0](http://www.eclipse.org/legal/epl-v20.html). |
9 | 9 | ||
10 | We reproduce the [accompanying notices](https://github.com/viatra/org.eclipse.viatra/blob/d422bcc626a99c4640c0d13931f393ccea0d2326/NOTICE.md) in full below: | 10 | Eclipse®, VIATRA™ and ‘Eclipse VIATRA™’ are trademarks of Eclipse Foundation, Inc. |
11 | 11 | ||
12 | # Notices for Eclipse VIATRA | 12 | To comply with the [Eclipse Foundation Trademark Usage Policy](https://www.eclipse.org/legal/logo_guidelines.php), we replaced the Eclipse VIATRA™ branding in this repository with the name _Refinery Interpreter_, since the [Eclipse Public License - v 2.0](https://www.eclipse.org/legal/epl-2.0/) does not grant trademark usage rights to derived projects. |
13 | _Refinery Interpreter_ is not endorsed or sponsored by Eclipse Foundation, Inc. or any other organizations using the Eclipse VIATRA™ trademark. | ||
14 | |||
15 | We publish our modifications to Eclipse VIATRA™ for use within the Refinery framework under the name _Refinery Interpreter_. When not using _Refinery Interpreter_ directly in the Refinery framework, users are strongly encouraged to rely on [Eclipse VIATRA™](https://eclipse.dev/viatra/) instead. In particular, _Refinery Interpreter_ does not provide any API stability guarantees that are provided by Eclipse VIATRA™. | ||
16 | |||
17 | We reproduce the [accompanying notices of Eclipse VIATRA™](https://github.com/viatra/org.eclipse.viatra/blob/d422bcc626a99c4640c0d13931f393ccea0d2326/NOTICE.md) in full below: | ||
18 | |||
19 | # Notices for Eclipse VIATRA™ | ||
13 | 20 | ||
14 | This content is produced and maintained by the Eclipse VIATRA project. | 21 | This content is produced and maintained by the Eclipse VIATRA project. |
15 | 22 | ||
diff --git a/subprojects/viatra-runtime-localsearch/about.html b/subprojects/interpreter-localsearch/about.html index d1d5593a..d1d5593a 100644 --- a/subprojects/viatra-runtime-localsearch/about.html +++ b/subprojects/interpreter-localsearch/about.html | |||
diff --git a/subprojects/interpreter-localsearch/build.gradle.kts b/subprojects/interpreter-localsearch/build.gradle.kts new file mode 100644 index 00000000..dae92c6c --- /dev/null +++ b/subprojects/interpreter-localsearch/build.gradle.kts | |||
@@ -0,0 +1,14 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | plugins { | ||
8 | id("tools.refinery.gradle.interpreter-library") | ||
9 | } | ||
10 | |||
11 | dependencies { | ||
12 | implementation(project(":refinery-interpreter")) | ||
13 | implementation(libs.slf4j.log4j) | ||
14 | } | ||
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/ExecutionLoggerAdapter.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/ExecutionLoggerAdapter.java index bfb76d9a..bbfa2f4e 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/ExecutionLoggerAdapter.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/ExecutionLoggerAdapter.java | |||
@@ -6,13 +6,13 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch; | 9 | package tools.refinery.interpreter.localsearch; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.localsearch.matcher.ILocalSearchAdapter; | 11 | import tools.refinery.interpreter.localsearch.matcher.ILocalSearchAdapter; |
12 | import tools.refinery.viatra.runtime.localsearch.matcher.LocalSearchMatcher; | 12 | import tools.refinery.interpreter.localsearch.matcher.LocalSearchMatcher; |
13 | import tools.refinery.viatra.runtime.localsearch.operations.IPatternMatcherOperation; | 13 | import tools.refinery.interpreter.localsearch.operations.IPatternMatcherOperation; |
14 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 14 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
15 | import tools.refinery.viatra.runtime.localsearch.plan.SearchPlan; | 15 | import tools.refinery.interpreter.localsearch.plan.SearchPlan; |
16 | 16 | ||
17 | import java.util.Optional; | 17 | import java.util.Optional; |
18 | import java.util.function.Consumer; | 18 | import java.util.function.Consumer; |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/MatchingFrame.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/MatchingFrame.java index bdbc663c..6a597c19 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/MatchingFrame.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/MatchingFrame.java | |||
@@ -7,11 +7,11 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.localsearch; | 10 | package tools.refinery.interpreter.localsearch; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.tuple.IModifiableTuple; | 12 | import tools.refinery.interpreter.matchers.tuple.IModifiableTuple; |
13 | import tools.refinery.viatra.runtime.matchers.tuple.VolatileTuple; | 13 | import tools.refinery.interpreter.matchers.tuple.VolatileTuple; |
14 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 14 | import tools.refinery.interpreter.matchers.util.Preconditions; |
15 | 15 | ||
16 | import java.util.Arrays; | 16 | import java.util.Arrays; |
17 | import java.util.stream.Collectors; | 17 | import java.util.stream.Collectors; |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/exceptions/LocalSearchException.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/exceptions/LocalSearchException.java index c239e766..46bffb1f 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/exceptions/LocalSearchException.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/exceptions/LocalSearchException.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.exceptions; | 9 | package tools.refinery.interpreter.localsearch.exceptions; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 11 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * @author Zoltan Ujhelyi, Akos Horvath | 14 | * @author Zoltan Ujhelyi, Akos Horvath |
15 | * | 15 | * |
16 | */ | 16 | */ |
17 | public class LocalSearchException extends ViatraQueryRuntimeException { | 17 | public class LocalSearchException extends InterpreterRuntimeException { |
18 | 18 | ||
19 | private static final long serialVersionUID = -2585896573351435974L; | 19 | private static final long serialVersionUID = -2585896573351435974L; |
20 | 20 | ||
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/CallWithAdornment.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/CallWithAdornment.java index 0cabeb97..e3906ccd 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/CallWithAdornment.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/CallWithAdornment.java | |||
@@ -3,27 +3,27 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher; | 9 | package tools.refinery.interpreter.localsearch.matcher; |
10 | 10 | ||
11 | import java.util.HashSet; | 11 | import java.util.HashSet; |
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.psystem.IQueryReference; | 14 | import tools.refinery.interpreter.matchers.psystem.IQueryReference; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 15 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 16 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 17 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Immutable data that represents the role of a pattern call within an LS query plan. | 20 | * Immutable data that represents the role of a pattern call within an LS query plan. |
21 | * | 21 | * |
22 | * <p> The call is expressed as the {@link PConstraint} {@link #call} (implementing {@link IQueryReference}), | 22 | * <p> The call is expressed as the {@link PConstraint} {@link #call} (implementing {@link IQueryReference}), |
23 | * while the stored {@link #adornment} records the way it will be used within a search plan (specifically, | 23 | * while the stored {@link #adornment} records the way it will be used within a search plan (specifically, |
24 | * pattern parameters within the adornment will have their values known at the point of evaluating the constraint). | 24 | * pattern parameters within the adornment will have their values known at the point of evaluating the constraint). |
25 | * | 25 | * |
26 | * | 26 | * |
27 | * @author Gabor Bergmann | 27 | * @author Gabor Bergmann |
28 | * @since 2.1 | 28 | * @since 2.1 |
29 | */ | 29 | */ |
@@ -43,12 +43,12 @@ public class CallWithAdornment { | |||
43 | public Set<PParameter> getAdornment() { | 43 | public Set<PParameter> getAdornment() { |
44 | return adornment; | 44 | return adornment; |
45 | } | 45 | } |
46 | 46 | ||
47 | 47 | ||
48 | public PQuery getReferredQuery() { | 48 | public PQuery getReferredQuery() { |
49 | return call.getReferredQuery(); | 49 | return call.getReferredQuery(); |
50 | } | 50 | } |
51 | 51 | ||
52 | public MatcherReference getMatcherReference() { | 52 | public MatcherReference getMatcherReference() { |
53 | return new MatcherReference(getReferredQuery(), adornment); | 53 | return new MatcherReference(getReferredQuery(), adornment); |
54 | } | 54 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/ILocalSearchAdaptable.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/ILocalSearchAdaptable.java index f4b28ed0..9cec930f 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/ILocalSearchAdaptable.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/ILocalSearchAdaptable.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher; | 9 | package tools.refinery.interpreter.localsearch.matcher; |
10 | 10 | ||
11 | import java.util.List; | 11 | import java.util.List; |
12 | 12 | ||
@@ -26,4 +26,4 @@ public interface ILocalSearchAdaptable { | |||
26 | 26 | ||
27 | void addAdapters(List<ILocalSearchAdapter> adapter); | 27 | void addAdapters(List<ILocalSearchAdapter> adapter); |
28 | 28 | ||
29 | } \ No newline at end of file | 29 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/ILocalSearchAdapter.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/ILocalSearchAdapter.java index df64b5f1..088bbcba 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/ILocalSearchAdapter.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/ILocalSearchAdapter.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher; | 9 | package tools.refinery.interpreter.localsearch.matcher; |
10 | 10 | ||
11 | import java.util.Optional; | 11 | import java.util.Optional; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.localsearch.ExecutionLoggerAdapter; | 13 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
14 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 14 | import tools.refinery.interpreter.localsearch.profiler.LocalSearchProfilerAdapter; |
15 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 15 | import tools.refinery.interpreter.localsearch.ExecutionLoggerAdapter; |
16 | import tools.refinery.viatra.runtime.localsearch.plan.SearchPlan; | 16 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
17 | import tools.refinery.viatra.runtime.localsearch.profiler.LocalSearchProfilerAdapter; | 17 | import tools.refinery.interpreter.localsearch.plan.SearchPlan; |
18 | 18 | ||
19 | 19 | ||
20 | /** | 20 | /** |
@@ -26,7 +26,7 @@ import tools.refinery.viatra.runtime.localsearch.profiler.LocalSearchProfilerAda | |||
26 | * it is not recommended to provide implementations outside of VIATRA. If necessary, have a look at the built-in | 26 | * it is not recommended to provide implementations outside of VIATRA. If necessary, have a look at the built-in |
27 | * adapters that should fulfill most cases in the meantime. See bugs https://bugs.eclipse.org/bugs/show_bug.cgi?id=535101 | 27 | * adapters that should fulfill most cases in the meantime. See bugs https://bugs.eclipse.org/bugs/show_bug.cgi?id=535101 |
28 | * and https://bugs.eclipse.org/bugs/show_bug.cgi?id=535102 for details. | 28 | * and https://bugs.eclipse.org/bugs/show_bug.cgi?id=535102 for details. |
29 | * | 29 | * |
30 | * @author Marton Bur | 30 | * @author Marton Bur |
31 | * @see ExecutionLoggerAdapter | 31 | * @see ExecutionLoggerAdapter |
32 | * @see LocalSearchProfilerAdapter | 32 | * @see LocalSearchProfilerAdapter |
@@ -35,16 +35,16 @@ import tools.refinery.viatra.runtime.localsearch.profiler.LocalSearchProfilerAda | |||
35 | public interface ILocalSearchAdapter { | 35 | public interface ILocalSearchAdapter { |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * | 38 | * |
39 | * @since 1.2 | 39 | * @since 1.2 |
40 | */ | 40 | */ |
41 | default void adapterRegistered(ILocalSearchAdaptable adaptable) {}; | 41 | default void adapterRegistered(ILocalSearchAdaptable adaptable) {}; |
42 | /** | 42 | /** |
43 | * | 43 | * |
44 | * @since 1.2 | 44 | * @since 1.2 |
45 | */ | 45 | */ |
46 | default void adapterUnregistered(ILocalSearchAdaptable adaptable) {}; | 46 | default void adapterUnregistered(ILocalSearchAdaptable adaptable) {}; |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Callback method to indicate the start of a matching process | 49 | * Callback method to indicate the start of a matching process |
50 | * | 50 | * |
@@ -57,7 +57,7 @@ public interface ILocalSearchAdapter { | |||
57 | * </p> | 57 | * </p> |
58 | * <strong>WARNING</strong>: It is not guaranteed that this method will be called; | 58 | * <strong>WARNING</strong>: It is not guaranteed that this method will be called; |
59 | * it is possible that a match process will end after a match is found and no other matches are accessed. | 59 | * it is possible that a match process will end after a match is found and no other matches are accessed. |
60 | * | 60 | * |
61 | * @param lsMatcher the local search matcher that finished | 61 | * @param lsMatcher the local search matcher that finished |
62 | * @since 2.0 | 62 | * @since 2.0 |
63 | */ | 63 | */ |
@@ -65,16 +65,16 @@ public interface ILocalSearchAdapter { | |||
65 | 65 | ||
66 | /** | 66 | /** |
67 | * Callback method to indicate switching to a new plan during the execution of a pattern matching | 67 | * Callback method to indicate switching to a new plan during the execution of a pattern matching |
68 | * | 68 | * |
69 | * @param oldPlan the plan that is finished. Value is null when the first plan is starting. | 69 | * @param oldPlan the plan that is finished. Value is null when the first plan is starting. |
70 | * @param newPlan the plan that will begin execution | 70 | * @param newPlan the plan that will begin execution |
71 | * @since 2.0 | 71 | * @since 2.0 |
72 | */ | 72 | */ |
73 | default void planChanged(Optional<SearchPlan> oldPlan, Optional<SearchPlan> newPlan) {}; | 73 | default void planChanged(Optional<SearchPlan> oldPlan, Optional<SearchPlan> newPlan) {}; |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Callback method to indicate the selection of an operation to execute | 76 | * Callback method to indicate the selection of an operation to execute |
77 | * | 77 | * |
78 | * @param plan the current plan executor | 78 | * @param plan the current plan executor |
79 | * @param frame the current matching frame | 79 | * @param frame the current matching frame |
80 | * @param isBacktrack if true, the selected operation was reached via backtracking | 80 | * @param isBacktrack if true, the selected operation was reached via backtracking |
@@ -84,7 +84,7 @@ public interface ILocalSearchAdapter { | |||
84 | 84 | ||
85 | /** | 85 | /** |
86 | * Callback method to indicate that an operation is executed | 86 | * Callback method to indicate that an operation is executed |
87 | * | 87 | * |
88 | * @param plan the current plan | 88 | * @param plan the current plan |
89 | * @param frame the current matching frame | 89 | * @param frame the current matching frame |
90 | * @param isSuccessful if true, the operation executed successfully, or false if the execution failed and backtracking will happen | 90 | * @param isSuccessful if true, the operation executed successfully, or false if the execution failed and backtracking will happen |
@@ -94,24 +94,24 @@ public interface ILocalSearchAdapter { | |||
94 | 94 | ||
95 | /** | 95 | /** |
96 | * Callback that is used to indicate that a match has been found | 96 | * Callback that is used to indicate that a match has been found |
97 | * | 97 | * |
98 | * @param plan the search plan executor that found the match | 98 | * @param plan the search plan executor that found the match |
99 | * @param frame the frame that holds the substitutions of the variables that match | 99 | * @param frame the frame that holds the substitutions of the variables that match |
100 | * @since 2.0 | 100 | * @since 2.0 |
101 | */ | 101 | */ |
102 | default void matchFound(SearchPlan plan, MatchingFrame frame) {}; | 102 | default void matchFound(SearchPlan plan, MatchingFrame frame) {}; |
103 | /** | 103 | /** |
104 | * Callback that is used to indicate that the previously reported match has been found as a duplicate, thus will be ignored from the match results. | 104 | * Callback that is used to indicate that the previously reported match has been found as a duplicate, thus will be ignored from the match results. |
105 | * | 105 | * |
106 | * @param plan the search plan executor that found the match | 106 | * @param plan the search plan executor that found the match |
107 | * @param frame the frame that holds the substitutions of the variables that match | 107 | * @param frame the frame that holds the substitutions of the variables that match |
108 | * @since 2.0 | 108 | * @since 2.0 |
109 | */ | 109 | */ |
110 | default void duplicateMatchFound(MatchingFrame frame) {}; | 110 | default void duplicateMatchFound(MatchingFrame frame) {}; |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * Callback method to indicate that a search plan is initialized in an executor with the given frame and starting operation | 113 | * Callback method to indicate that a search plan is initialized in an executor with the given frame and starting operation |
114 | * | 114 | * |
115 | * @param searchPlan | 115 | * @param searchPlan |
116 | * @param frame | 116 | * @param frame |
117 | * @since 2.0 | 117 | * @since 2.0 |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/ISearchContext.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/ISearchContext.java index 71aa4aac..1ac2fa53 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/ISearchContext.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/ISearchContext.java | |||
@@ -6,17 +6,17 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher; | 9 | package tools.refinery.interpreter.localsearch.matcher; |
10 | 10 | ||
11 | import org.apache.log4j.Logger; | 11 | import org.apache.log4j.Logger; |
12 | import tools.refinery.viatra.runtime.localsearch.matcher.integration.IAdornmentProvider; | 12 | import tools.refinery.interpreter.localsearch.matcher.integration.IAdornmentProvider; |
13 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 13 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
14 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 14 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
15 | import tools.refinery.viatra.runtime.matchers.backend.ResultProviderRequestor; | 15 | import tools.refinery.interpreter.matchers.backend.ResultProviderRequestor; |
16 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 16 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
17 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 17 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
18 | import tools.refinery.viatra.runtime.matchers.util.ICache; | 18 | import tools.refinery.interpreter.matchers.util.ICache; |
19 | import tools.refinery.viatra.runtime.matchers.util.IProvider; | 19 | import tools.refinery.interpreter.matchers.util.IProvider; |
20 | 20 | ||
21 | import java.util.Collections; | 21 | import java.util.Collections; |
22 | 22 | ||
@@ -40,7 +40,7 @@ public interface ISearchContext { | |||
40 | /** | 40 | /** |
41 | * Returns a matcher for a selected query specification. | 41 | * Returns a matcher for a selected query specification. |
42 | * | 42 | * |
43 | * @throws ViatraQueryRuntimeException | 43 | * @throws InterpreterRuntimeException |
44 | * @since 1.5 | 44 | * @since 1.5 |
45 | */ | 45 | */ |
46 | IQueryResultProvider getMatcher(CallWithAdornment dependency); | 46 | IQueryResultProvider getMatcher(CallWithAdornment dependency); |
@@ -86,7 +86,7 @@ public interface ISearchContext { | |||
86 | } | 86 | } |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * @throws ViatraQueryRuntimeException | 89 | * @throws InterpreterRuntimeException |
90 | * @since 2.1 | 90 | * @since 2.1 |
91 | */ | 91 | */ |
92 | @Override | 92 | @Override |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/LocalSearchMatcher.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/LocalSearchMatcher.java index e31d7b5c..e26d08c7 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/LocalSearchMatcher.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/LocalSearchMatcher.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher; | 9 | package tools.refinery.interpreter.localsearch.matcher; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.HashSet; | 12 | import java.util.HashSet; |
@@ -23,16 +23,16 @@ import java.util.stream.Collectors; | |||
23 | import java.util.stream.Stream; | 23 | import java.util.stream.Stream; |
24 | import java.util.stream.StreamSupport; | 24 | import java.util.stream.StreamSupport; |
25 | 25 | ||
26 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 26 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
27 | import tools.refinery.viatra.runtime.localsearch.plan.IPlanDescriptor; | 27 | import tools.refinery.interpreter.localsearch.plan.IPlanDescriptor; |
28 | import tools.refinery.viatra.runtime.localsearch.plan.SearchPlan; | 28 | import tools.refinery.interpreter.localsearch.plan.SearchPlan; |
29 | import tools.refinery.viatra.runtime.localsearch.plan.SearchPlanExecutor; | 29 | import tools.refinery.interpreter.localsearch.plan.SearchPlanExecutor; |
30 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 30 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
31 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 31 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
32 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 32 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
33 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 33 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
34 | import tools.refinery.viatra.runtime.matchers.tuple.VolatileModifiableMaskedTuple; | 34 | import tools.refinery.interpreter.matchers.tuple.VolatileModifiableMaskedTuple; |
35 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 35 | import tools.refinery.interpreter.matchers.util.Preconditions; |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * @author Zoltan Ujhelyi | 38 | * @author Zoltan Ujhelyi |
@@ -50,22 +50,22 @@ public final class LocalSearchMatcher implements ILocalSearchAdaptable { | |||
50 | public List<SearchPlanExecutor> getPlan() { | 50 | public List<SearchPlanExecutor> getPlan() { |
51 | return plan; | 51 | return plan; |
52 | } | 52 | } |
53 | 53 | ||
54 | @Override | 54 | @Override |
55 | public List<ILocalSearchAdapter> getAdapters() { | 55 | public List<ILocalSearchAdapter> getAdapters() { |
56 | return new ArrayList<>(adapters); | 56 | return new ArrayList<>(adapters); |
57 | } | 57 | } |
58 | 58 | ||
59 | private abstract class PlanExecutionIterator implements Iterator<Tuple> { | 59 | private abstract class PlanExecutionIterator implements Iterator<Tuple> { |
60 | 60 | ||
61 | protected final Iterator<SearchPlanExecutor> planIterator; | 61 | protected final Iterator<SearchPlanExecutor> planIterator; |
62 | 62 | ||
63 | protected SearchPlanExecutor currentPlan; | 63 | protected SearchPlanExecutor currentPlan; |
64 | protected MatchingFrame frame; | 64 | protected MatchingFrame frame; |
65 | protected final Set<ITuple> matchSet; | 65 | protected final Set<ITuple> matchSet; |
66 | protected VolatileModifiableMaskedTuple parametersOfFrameView; | 66 | protected VolatileModifiableMaskedTuple parametersOfFrameView; |
67 | private boolean isNextMatchCalculated; | 67 | private boolean isNextMatchCalculated; |
68 | 68 | ||
69 | public PlanExecutionIterator(final Iterator<SearchPlanExecutor> planIterator) { | 69 | public PlanExecutionIterator(final Iterator<SearchPlanExecutor> planIterator) { |
70 | this.planIterator = planIterator; | 70 | this.planIterator = planIterator; |
71 | isNextMatchCalculated = false; | 71 | isNextMatchCalculated = false; |
@@ -77,17 +77,17 @@ public final class LocalSearchMatcher implements ILocalSearchAdaptable { | |||
77 | currentPlan.removeAdapters(adapters); | 77 | currentPlan.removeAdapters(adapters); |
78 | } | 78 | } |
79 | boolean validPlanSelected = false; | 79 | boolean validPlanSelected = false; |
80 | 80 | ||
81 | SearchPlanExecutor nextPlan = null; | 81 | SearchPlanExecutor nextPlan = null; |
82 | 82 | ||
83 | while (!validPlanSelected && planIterator.hasNext()) { | 83 | while (!validPlanSelected && planIterator.hasNext()) { |
84 | nextPlan = planIterator.next(); | 84 | nextPlan = planIterator.next(); |
85 | nextPlan.addAdapters(adapters); | 85 | nextPlan.addAdapters(adapters); |
86 | nextPlan.resetPlan(); | 86 | nextPlan.resetPlan(); |
87 | 87 | ||
88 | validPlanSelected = initializeMatchingFrame(nextPlan); | 88 | validPlanSelected = initializeMatchingFrame(nextPlan); |
89 | } | 89 | } |
90 | 90 | ||
91 | if (validPlanSelected) { | 91 | if (validPlanSelected) { |
92 | for (ILocalSearchAdapter adapter : adapters) { | 92 | for (ILocalSearchAdapter adapter : adapters) { |
93 | adapter.planChanged(Optional.ofNullable(currentPlan).map(SearchPlanExecutor::getSearchPlan), | 93 | adapter.planChanged(Optional.ofNullable(currentPlan).map(SearchPlanExecutor::getSearchPlan), |
@@ -113,7 +113,7 @@ public final class LocalSearchMatcher implements ILocalSearchAdaptable { | |||
113 | } | 113 | } |
114 | return foundMatch; | 114 | return foundMatch; |
115 | } | 115 | } |
116 | 116 | ||
117 | @Override | 117 | @Override |
118 | public boolean hasNext() { | 118 | public boolean hasNext() { |
119 | if (isNextMatchCalculated) { | 119 | if (isNextMatchCalculated) { |
@@ -123,7 +123,7 @@ public final class LocalSearchMatcher implements ILocalSearchAdaptable { | |||
123 | return false; | 123 | return false; |
124 | } | 124 | } |
125 | boolean foundMatch = findNextNewMatchInCurrentPlan(); | 125 | boolean foundMatch = findNextNewMatchInCurrentPlan(); |
126 | 126 | ||
127 | while (!foundMatch && planIterator.hasNext()) { | 127 | while (!foundMatch && planIterator.hasNext()) { |
128 | foundMatch = selectNextPlan() && findNextNewMatchInCurrentPlan(); | 128 | foundMatch = selectNextPlan() && findNextNewMatchInCurrentPlan(); |
129 | } | 129 | } |
@@ -149,15 +149,15 @@ public final class LocalSearchMatcher implements ILocalSearchAdaptable { | |||
149 | } | 149 | } |
150 | 150 | ||
151 | private class PlanExecutionIteratorWithArrayParameters extends PlanExecutionIterator { | 151 | private class PlanExecutionIteratorWithArrayParameters extends PlanExecutionIterator { |
152 | 152 | ||
153 | private final Object[] parameterValues; | 153 | private final Object[] parameterValues; |
154 | 154 | ||
155 | public PlanExecutionIteratorWithArrayParameters(Iterator<SearchPlanExecutor> planIterator, final Object[] parameterValues) { | 155 | public PlanExecutionIteratorWithArrayParameters(Iterator<SearchPlanExecutor> planIterator, final Object[] parameterValues) { |
156 | super(planIterator); | 156 | super(planIterator); |
157 | this.parameterValues = parameterValues; | 157 | this.parameterValues = parameterValues; |
158 | selectNextPlan(); | 158 | selectNextPlan(); |
159 | } | 159 | } |
160 | 160 | ||
161 | protected boolean initializeMatchingFrame(SearchPlanExecutor nextPlan) { | 161 | protected boolean initializeMatchingFrame(SearchPlanExecutor nextPlan) { |
162 | frame = new MatchingFrame(nextPlan.getVariableMapping().size()); | 162 | frame = new MatchingFrame(nextPlan.getVariableMapping().size()); |
163 | parametersOfFrameView = new VolatileModifiableMaskedTuple(frame, nextPlan.getParameterMask()); | 163 | parametersOfFrameView = new VolatileModifiableMaskedTuple(frame, nextPlan.getParameterMask()); |
@@ -175,22 +175,22 @@ public final class LocalSearchMatcher implements ILocalSearchAdaptable { | |||
175 | // If oldValue is not null but equal to newValue, the setting can be ignored | 175 | // If oldValue is not null but equal to newValue, the setting can be ignored |
176 | } | 176 | } |
177 | } | 177 | } |
178 | 178 | ||
179 | return true; | 179 | return true; |
180 | } | 180 | } |
181 | } | 181 | } |
182 | private class PlanExecutionIteratorWithTupleParameters extends PlanExecutionIterator { | 182 | private class PlanExecutionIteratorWithTupleParameters extends PlanExecutionIterator { |
183 | 183 | ||
184 | private final ITuple parameterValues; | 184 | private final ITuple parameterValues; |
185 | private final TupleMask parameterSeedMask; | 185 | private final TupleMask parameterSeedMask; |
186 | 186 | ||
187 | public PlanExecutionIteratorWithTupleParameters(Iterator<SearchPlanExecutor> planIterator, final TupleMask parameterSeedMask, final ITuple parameterValues) { | 187 | public PlanExecutionIteratorWithTupleParameters(Iterator<SearchPlanExecutor> planIterator, final TupleMask parameterSeedMask, final ITuple parameterValues) { |
188 | super(planIterator); | 188 | super(planIterator); |
189 | this.parameterSeedMask = parameterSeedMask; | 189 | this.parameterSeedMask = parameterSeedMask; |
190 | this.parameterValues = parameterValues; | 190 | this.parameterValues = parameterValues; |
191 | selectNextPlan(); | 191 | selectNextPlan(); |
192 | } | 192 | } |
193 | 193 | ||
194 | protected boolean initializeMatchingFrame(SearchPlanExecutor nextPlan) { | 194 | protected boolean initializeMatchingFrame(SearchPlanExecutor nextPlan) { |
195 | frame = new MatchingFrame(nextPlan.getVariableMapping().size()); | 195 | frame = new MatchingFrame(nextPlan.getVariableMapping().size()); |
196 | parametersOfFrameView = new VolatileModifiableMaskedTuple(frame, nextPlan.getParameterMask()); | 196 | parametersOfFrameView = new VolatileModifiableMaskedTuple(frame, nextPlan.getParameterMask()); |
@@ -209,7 +209,7 @@ public final class LocalSearchMatcher implements ILocalSearchAdaptable { | |||
209 | // If oldValue is not null but equal to newValue, the setting can be ignored | 209 | // If oldValue is not null but equal to newValue, the setting can be ignored |
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | return true; | 213 | return true; |
214 | } | 214 | } |
215 | } | 215 | } |
@@ -223,7 +223,7 @@ public final class LocalSearchMatcher implements ILocalSearchAdaptable { | |||
223 | this.plan = plan.stream().map(p -> new SearchPlanExecutor(p, searchContext)).collect(Collectors.toList()); | 223 | this.plan = plan.stream().map(p -> new SearchPlanExecutor(p, searchContext)).collect(Collectors.toList()); |
224 | this.adapters = new LinkedList<>(); | 224 | this.adapters = new LinkedList<>(); |
225 | } | 225 | } |
226 | 226 | ||
227 | @Override | 227 | @Override |
228 | public void addAdapter(ILocalSearchAdapter adapter) { | 228 | public void addAdapter(ILocalSearchAdapter adapter) { |
229 | this.adapters.add(adapter); | 229 | this.adapters.add(adapter); |
@@ -235,7 +235,7 @@ public final class LocalSearchMatcher implements ILocalSearchAdaptable { | |||
235 | this.adapters.remove(adapter); | 235 | this.adapters.remove(adapter); |
236 | adapter.adapterUnregistered(this); | 236 | adapter.adapterUnregistered(this); |
237 | } | 237 | } |
238 | 238 | ||
239 | @Override | 239 | @Override |
240 | public void addAdapters(List<ILocalSearchAdapter> adapters) { | 240 | public void addAdapters(List<ILocalSearchAdapter> adapters) { |
241 | this.adapters.addAll(adapters); | 241 | this.adapters.addAll(adapters); |
@@ -251,7 +251,7 @@ public final class LocalSearchMatcher implements ILocalSearchAdaptable { | |||
251 | adapter.adapterUnregistered(this); | 251 | adapter.adapterUnregistered(this); |
252 | } | 252 | } |
253 | } | 253 | } |
254 | 254 | ||
255 | public int getParameterCount() { | 255 | public int getParameterCount() { |
256 | return planDescriptor.getQuery().getParameters().size(); | 256 | return planDescriptor.getQuery().getParameters().size(); |
257 | } | 257 | } |
@@ -271,7 +271,7 @@ public final class LocalSearchMatcher implements ILocalSearchAdaptable { | |||
271 | return StreamSupport.stream(Spliterators.spliteratorUnknownSize(it, | 271 | return StreamSupport.stream(Spliterators.spliteratorUnknownSize(it, |
272 | Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.DISTINCT), false); | 272 | Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.DISTINCT), false); |
273 | } | 273 | } |
274 | 274 | ||
275 | /** | 275 | /** |
276 | * @since 2.0 | 276 | * @since 2.0 |
277 | */ | 277 | */ |
@@ -282,7 +282,7 @@ public final class LocalSearchMatcher implements ILocalSearchAdaptable { | |||
282 | return StreamSupport.stream(Spliterators.spliteratorUnknownSize(it, | 282 | return StreamSupport.stream(Spliterators.spliteratorUnknownSize(it, |
283 | Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.DISTINCT), false); | 283 | Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.DISTINCT), false); |
284 | } | 284 | } |
285 | 285 | ||
286 | /** | 286 | /** |
287 | * Returns the query specification this matcher used as source for the implementation | 287 | * Returns the query specification this matcher used as source for the implementation |
288 | * @return never null | 288 | * @return never null |
@@ -290,8 +290,8 @@ public final class LocalSearchMatcher implements ILocalSearchAdaptable { | |||
290 | public PQuery getQuerySpecification() { | 290 | public PQuery getQuerySpecification() { |
291 | return planDescriptor.getQuery(); | 291 | return planDescriptor.getQuery(); |
292 | } | 292 | } |
293 | 293 | ||
294 | 294 | ||
295 | /** | 295 | /** |
296 | * @since 1.5 | 296 | * @since 1.5 |
297 | */ | 297 | */ |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/MatcherReference.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/MatcherReference.java index 6bf25192..8e1bec63 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/MatcherReference.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/MatcherReference.java | |||
@@ -3,26 +3,26 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher; | 9 | package tools.refinery.interpreter.localsearch.matcher; |
10 | 10 | ||
11 | import java.util.Set; | 11 | import java.util.Set; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 13 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 14 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 15 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
16 | 16 | ||
17 | public class MatcherReference { | 17 | public class MatcherReference { |
18 | final PQuery query; | 18 | final PQuery query; |
19 | final Set<PParameter> adornment; | 19 | final Set<PParameter> adornment; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Hints that can override the callee's own hints. This field is intentionally left out from hashCode and equals | 22 | * Hints that can override the callee's own hints. This field is intentionally left out from hashCode and equals |
23 | */ | 23 | */ |
24 | final QueryEvaluationHint hints; | 24 | final QueryEvaluationHint hints; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * @since 1.4 | 27 | * @since 1.4 |
28 | */ | 28 | */ |
@@ -32,11 +32,11 @@ public class MatcherReference { | |||
32 | this.adornment = adornment; | 32 | this.adornment = adornment; |
33 | this.hints = hints; | 33 | this.hints = hints; |
34 | } | 34 | } |
35 | 35 | ||
36 | public MatcherReference(PQuery query, Set<PParameter> adornment){ | 36 | public MatcherReference(PQuery query, Set<PParameter> adornment){ |
37 | this(query, adornment, null); | 37 | this(query, adornment, null); |
38 | } | 38 | } |
39 | 39 | ||
40 | public PQuery getQuery() { | 40 | public PQuery getQuery() { |
41 | return query; | 41 | return query; |
42 | } | 42 | } |
@@ -47,7 +47,7 @@ public class MatcherReference { | |||
47 | public int hashCode() { | 47 | public int hashCode() { |
48 | final int prime = 31; | 48 | final int prime = 31; |
49 | int result = 1; | 49 | int result = 1; |
50 | 50 | ||
51 | result = prime * result + ((adornment == null) ? 0 : adornment.hashCode()); | 51 | result = prime * result + ((adornment == null) ? 0 : adornment.hashCode()); |
52 | result = prime * result + ((query == null) ? 0 : query.hashCode()); | 52 | result = prime * result + ((query == null) ? 0 : query.hashCode()); |
53 | return result; | 53 | return result; |
@@ -73,7 +73,7 @@ public class MatcherReference { | |||
73 | return false; | 73 | return false; |
74 | return true; | 74 | return true; |
75 | } | 75 | } |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * @return the hints to override the called reference's own hints with. Can be null. | 78 | * @return the hints to override the called reference's own hints with. Can be null. |
79 | * @since 1.4 | 79 | * @since 1.4 |
@@ -81,7 +81,7 @@ public class MatcherReference { | |||
81 | public QueryEvaluationHint getHints() { | 81 | public QueryEvaluationHint getHints() { |
82 | return hints; | 82 | return hints; |
83 | } | 83 | } |
84 | 84 | ||
85 | @Override | 85 | @Override |
86 | public String toString() { | 86 | public String toString() { |
87 | StringBuilder sb = new StringBuilder(); | 87 | StringBuilder sb = new StringBuilder(); |
@@ -93,5 +93,5 @@ public class MatcherReference { | |||
93 | sb.append(")"); | 93 | sb.append(")"); |
94 | return sb.toString(); | 94 | return sb.toString(); |
95 | } | 95 | } |
96 | 96 | ||
97 | } \ No newline at end of file | 97 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/AbstractLocalSearchResultProvider.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/AbstractLocalSearchResultProvider.java index 1ae24d2d..44214f05 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/AbstractLocalSearchResultProvider.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/AbstractLocalSearchResultProvider.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher.integration; | 9 | package tools.refinery.interpreter.localsearch.matcher.integration; |
10 | 10 | ||
11 | import java.lang.reflect.InvocationTargetException; | 11 | import java.lang.reflect.InvocationTargetException; |
12 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
@@ -27,41 +27,41 @@ import java.util.stream.Collectors; | |||
27 | import java.util.stream.IntStream; | 27 | import java.util.stream.IntStream; |
28 | import java.util.stream.Stream; | 28 | import java.util.stream.Stream; |
29 | 29 | ||
30 | import tools.refinery.viatra.runtime.localsearch.exceptions.LocalSearchException; | 30 | import tools.refinery.interpreter.localsearch.exceptions.LocalSearchException; |
31 | import tools.refinery.viatra.runtime.localsearch.matcher.CallWithAdornment; | 31 | import tools.refinery.interpreter.localsearch.planner.compiler.IOperationCompiler; |
32 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 32 | import tools.refinery.interpreter.localsearch.matcher.CallWithAdornment; |
33 | import tools.refinery.viatra.runtime.localsearch.matcher.LocalSearchMatcher; | 33 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
34 | import tools.refinery.viatra.runtime.localsearch.matcher.MatcherReference; | 34 | import tools.refinery.interpreter.localsearch.matcher.LocalSearchMatcher; |
35 | import tools.refinery.viatra.runtime.localsearch.plan.IPlanDescriptor; | 35 | import tools.refinery.interpreter.localsearch.matcher.MatcherReference; |
36 | import tools.refinery.viatra.runtime.localsearch.plan.IPlanProvider; | 36 | import tools.refinery.interpreter.localsearch.plan.IPlanDescriptor; |
37 | import tools.refinery.viatra.runtime.localsearch.plan.SearchPlan; | 37 | import tools.refinery.interpreter.localsearch.plan.IPlanProvider; |
38 | import tools.refinery.viatra.runtime.localsearch.plan.SearchPlanForBody; | 38 | import tools.refinery.interpreter.localsearch.plan.SearchPlan; |
39 | import tools.refinery.viatra.runtime.localsearch.planner.compiler.IOperationCompiler; | 39 | import tools.refinery.interpreter.localsearch.plan.SearchPlanForBody; |
40 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 40 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
41 | import tools.refinery.viatra.runtime.matchers.backend.IMatcherCapability; | 41 | import tools.refinery.interpreter.matchers.backend.IMatcherCapability; |
42 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackend; | 42 | import tools.refinery.interpreter.matchers.backend.IQueryBackend; |
43 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 43 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
44 | import tools.refinery.viatra.runtime.matchers.backend.IUpdateable; | 44 | import tools.refinery.interpreter.matchers.backend.IUpdateable; |
45 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 45 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
46 | import tools.refinery.viatra.runtime.matchers.backend.QueryHintOption; | 46 | import tools.refinery.interpreter.matchers.backend.QueryHintOption; |
47 | import tools.refinery.viatra.runtime.matchers.backend.ResultProviderRequestor; | 47 | import tools.refinery.interpreter.matchers.backend.ResultProviderRequestor; |
48 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 48 | import tools.refinery.interpreter.matchers.context.IInputKey; |
49 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 49 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
50 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 50 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
51 | import tools.refinery.viatra.runtime.matchers.context.IndexingService; | 51 | import tools.refinery.interpreter.matchers.context.IndexingService; |
52 | import tools.refinery.viatra.runtime.matchers.planning.QueryProcessingException; | 52 | import tools.refinery.interpreter.matchers.planning.QueryProcessingException; |
53 | import tools.refinery.viatra.runtime.matchers.planning.helpers.FunctionalDependencyHelper; | 53 | import tools.refinery.interpreter.matchers.planning.helpers.FunctionalDependencyHelper; |
54 | import tools.refinery.viatra.runtime.matchers.psystem.IQueryReference; | 54 | import tools.refinery.interpreter.matchers.psystem.IQueryReference; |
55 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 55 | import tools.refinery.interpreter.matchers.psystem.PBody; |
56 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 56 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
57 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 57 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
58 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQueries; | 58 | import tools.refinery.interpreter.matchers.psystem.queries.PQueries; |
59 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 59 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
60 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.IFlattenCallPredicate; | 60 | import tools.refinery.interpreter.matchers.psystem.rewriters.IFlattenCallPredicate; |
61 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 61 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
62 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 62 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
63 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 63 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
64 | import tools.refinery.viatra.runtime.matchers.util.Accuracy; | 64 | import tools.refinery.interpreter.matchers.util.Accuracy; |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * @author Zoltan Ujhelyi | 67 | * @author Zoltan Ujhelyi |
@@ -69,7 +69,7 @@ import tools.refinery.viatra.runtime.matchers.util.Accuracy; | |||
69 | * | 69 | * |
70 | */ | 70 | */ |
71 | public abstract class AbstractLocalSearchResultProvider implements IQueryResultProvider { | 71 | public abstract class AbstractLocalSearchResultProvider implements IQueryResultProvider { |
72 | 72 | ||
73 | protected final LocalSearchBackend backend; | 73 | protected final LocalSearchBackend backend; |
74 | protected final IQueryBackendContext backendContext; | 74 | protected final IQueryBackendContext backendContext; |
75 | protected final IQueryRuntimeContext runtimeContext; | 75 | protected final IQueryRuntimeContext runtimeContext; |
@@ -77,7 +77,7 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
77 | protected final QueryEvaluationHint userHints; | 77 | protected final QueryEvaluationHint userHints; |
78 | protected final Map<PQuery, LocalSearchHints> hintCache = new HashMap<>(); | 78 | protected final Map<PQuery, LocalSearchHints> hintCache = new HashMap<>(); |
79 | protected final IPlanProvider planProvider; | 79 | protected final IPlanProvider planProvider; |
80 | private static final String PLAN_CACHE_KEY = AbstractLocalSearchResultProvider.class.getName() + "#planCache"; | 80 | private static final String PLAN_CACHE_KEY = AbstractLocalSearchResultProvider.class.getName() + "#planCache"; |
81 | private final Map<MatcherReference, IPlanDescriptor> planCache; | 81 | private final Map<MatcherReference, IPlanDescriptor> planCache; |
82 | protected final ISearchContext searchContext; | 82 | protected final ISearchContext searchContext; |
83 | /** | 83 | /** |
@@ -102,9 +102,9 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
102 | this.searchContext = new ISearchContext.SearchContext(backendContext, backend.getCache(), resultProviderRequestor); | 102 | this.searchContext = new ISearchContext.SearchContext(backendContext, backend.getCache(), resultProviderRequestor); |
103 | this.planCache = backend.getCache().getValue(PLAN_CACHE_KEY, Map.class, HashMap::new); | 103 | this.planCache = backend.getCache().getValue(PLAN_CACHE_KEY, Map.class, HashMap::new); |
104 | } | 104 | } |
105 | 105 | ||
106 | protected abstract IOperationCompiler getOperationCompiler(IQueryBackendContext backendContext, LocalSearchHints configuration); | 106 | protected abstract IOperationCompiler getOperationCompiler(IQueryBackendContext backendContext, LocalSearchHints configuration); |
107 | 107 | ||
108 | private IQueryRuntimeContext getRuntimeContext() { | 108 | private IQueryRuntimeContext getRuntimeContext() { |
109 | return backend.getRuntimeContext(); | 109 | return backend.getRuntimeContext(); |
110 | } | 110 | } |
@@ -121,26 +121,26 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
121 | if (planCache.containsKey(key)){ | 121 | if (planCache.containsKey(key)){ |
122 | return planCache.get(key); | 122 | return planCache.get(key); |
123 | } else { | 123 | } else { |
124 | IPlanDescriptor plan = planProvider.getPlan(backendContext, compiler, | 124 | IPlanDescriptor plan = planProvider.getPlan(backendContext, compiler, |
125 | resultProviderRequestor, configuration, key); | 125 | resultProviderRequestor, configuration, key); |
126 | planCache.put(key, plan); | 126 | planCache.put(key, plan); |
127 | return plan; | 127 | return plan; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | private IPlanDescriptor getOrCreatePlan(MatcherReference key, IPlanProvider planProvider) { | 131 | private IPlanDescriptor getOrCreatePlan(MatcherReference key, IPlanProvider planProvider) { |
132 | if (planCache.containsKey(key)){ | 132 | if (planCache.containsKey(key)){ |
133 | return planCache.get(key); | 133 | return planCache.get(key); |
134 | } else { | 134 | } else { |
135 | LocalSearchHints configuration = overrideDefaultHints(key.getQuery()); | 135 | LocalSearchHints configuration = overrideDefaultHints(key.getQuery()); |
136 | IOperationCompiler compiler = getOperationCompiler(backendContext, configuration); | 136 | IOperationCompiler compiler = getOperationCompiler(backendContext, configuration); |
137 | IPlanDescriptor plan = planProvider.getPlan(backendContext, compiler, | 137 | IPlanDescriptor plan = planProvider.getPlan(backendContext, compiler, |
138 | resultProviderRequestor, configuration, key); | 138 | resultProviderRequestor, configuration, key); |
139 | planCache.put(key, plan); | 139 | planCache.put(key, plan); |
140 | return plan; | 140 | return plan; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | private LocalSearchHints overrideDefaultHints(PQuery pQuery) { | 144 | private LocalSearchHints overrideDefaultHints(PQuery pQuery) { |
145 | if (hintCache.containsKey(pQuery)) { | 145 | if (hintCache.containsKey(pQuery)) { |
146 | return hintCache.get(pQuery); | 146 | return hintCache.get(pQuery); |
@@ -152,9 +152,9 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | /** | 155 | /** |
156 | * Combine with {@link QueryHintOption#getValueOrDefault(QueryEvaluationHint)} to access | 156 | * Combine with {@link QueryHintOption#getValueOrDefault(QueryEvaluationHint)} to access |
157 | * hint settings not covered by {@link LocalSearchHints} | 157 | * hint settings not covered by {@link LocalSearchHints} |
158 | */ | 158 | */ |
159 | private QueryEvaluationHint computeOverridingHints(PQuery pQuery) { | 159 | private QueryEvaluationHint computeOverridingHints(PQuery pQuery) { |
160 | return backendContext.getHintProvider().getQueryEvaluationHint(pQuery).overrideBy(userHints); | 160 | return backendContext.getHintProvider().getQueryEvaluationHint(pQuery).overrideBy(userHints); |
@@ -219,13 +219,13 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
219 | * This method is called before planning start to allow indexing. It is important to note that this method is called | 219 | * This method is called before planning start to allow indexing. It is important to note that this method is called |
220 | * inside a coalesceTraversals block, meaning (1) it is safe to add multiple registration requests as necessary, but | 220 | * inside a coalesceTraversals block, meaning (1) it is safe to add multiple registration requests as necessary, but |
221 | * (2) no value or statistics is available from the index. | 221 | * (2) no value or statistics is available from the index. |
222 | * | 222 | * |
223 | * @throws ViatraQueryRuntimeException | 223 | * @throws InterpreterRuntimeException |
224 | */ | 224 | */ |
225 | protected void indexInitializationBeforePlanning() { | 225 | protected void indexInitializationBeforePlanning() { |
226 | // By default, no indexing is necessary | 226 | // By default, no indexing is necessary |
227 | } | 227 | } |
228 | 228 | ||
229 | /** | 229 | /** |
230 | * Collects and indexes all types _directly_ referred by the PQuery {@link #query}. Types indirect | 230 | * Collects and indexes all types _directly_ referred by the PQuery {@link #query}. Types indirect |
231 | * @param requiredIndexingServices | 231 | * @param requiredIndexingServices |
@@ -235,21 +235,21 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
235 | inputKey -> runtimeContext.ensureIndexed(inputKey, requiredIndexingServices) | 235 | inputKey -> runtimeContext.ensureIndexed(inputKey, requiredIndexingServices) |
236 | ); | 236 | ); |
237 | } | 237 | } |
238 | 238 | ||
239 | private Set<IQueryReference> getDirectDependencies() { | 239 | private Set<IQueryReference> getDirectDependencies() { |
240 | IFlattenCallPredicate flattenPredicate = overrideDefaultHints(query).getFlattenCallPredicate(); | 240 | IFlattenCallPredicate flattenPredicate = overrideDefaultHints(query).getFlattenCallPredicate(); |
241 | Queue<PQuery> queue = new LinkedList<>(); | 241 | Queue<PQuery> queue = new LinkedList<>(); |
242 | Set<PQuery> visited = new HashSet<>(); | 242 | Set<PQuery> visited = new HashSet<>(); |
243 | Set<IQueryReference> result = new HashSet<>(); | 243 | Set<IQueryReference> result = new HashSet<>(); |
244 | queue.add(query); | 244 | queue.add(query); |
245 | 245 | ||
246 | while(!queue.isEmpty()){ | 246 | while(!queue.isEmpty()){ |
247 | PQuery next = queue.poll(); | 247 | PQuery next = queue.poll(); |
248 | visited.add(next); | 248 | visited.add(next); |
249 | for(PBody body : next.getDisjunctBodies().getBodies()){ | 249 | for(PBody body : next.getDisjunctBodies().getBodies()){ |
250 | for (IQueryReference call : body.getConstraintsOfType(IQueryReference.class)) { | 250 | for (IQueryReference call : body.getConstraintsOfType(IQueryReference.class)) { |
251 | if (call instanceof PositivePatternCall && | 251 | if (call instanceof PositivePatternCall && |
252 | flattenPredicate.shouldFlatten((PositivePatternCall) call)) | 252 | flattenPredicate.shouldFlatten((PositivePatternCall) call)) |
253 | { | 253 | { |
254 | PQuery dep = ((PositivePatternCall) call).getReferredQuery(); | 254 | PQuery dep = ((PositivePatternCall) call).getReferredQuery(); |
255 | if (!visited.contains(dep)){ | 255 | if (!visited.contains(dep)){ |
@@ -267,15 +267,15 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
267 | private LocalSearchMatcher initializeMatcher(Object[] parameters) { | 267 | private LocalSearchMatcher initializeMatcher(Object[] parameters) { |
268 | return newLocalSearchMatcher(parameters); | 268 | return newLocalSearchMatcher(parameters); |
269 | } | 269 | } |
270 | 270 | ||
271 | private LocalSearchMatcher initializeMatcher(TupleMask parameterSeedMask) { | 271 | private LocalSearchMatcher initializeMatcher(TupleMask parameterSeedMask) { |
272 | return newLocalSearchMatcher(parameterSeedMask.transformUnique(query.getParameters())); | 272 | return newLocalSearchMatcher(parameterSeedMask.transformUnique(query.getParameters())); |
273 | 273 | ||
274 | } | 274 | } |
275 | 275 | ||
276 | 276 | ||
277 | /** | 277 | /** |
278 | * @throws ViatraQueryRuntimeException | 278 | * @throws InterpreterRuntimeException |
279 | */ | 279 | */ |
280 | public LocalSearchMatcher newLocalSearchMatcher(ITuple parameters) { | 280 | public LocalSearchMatcher newLocalSearchMatcher(ITuple parameters) { |
281 | final Set<PParameter> adornment = new HashSet<>(); | 281 | final Set<PParameter> adornment = new HashSet<>(); |
@@ -284,12 +284,12 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
284 | adornment.add(query.getParameters().get(i)); | 284 | adornment.add(query.getParameters().get(i)); |
285 | } | 285 | } |
286 | } | 286 | } |
287 | 287 | ||
288 | return newLocalSearchMatcher(adornment); | 288 | return newLocalSearchMatcher(adornment); |
289 | } | 289 | } |
290 | 290 | ||
291 | /** | 291 | /** |
292 | * @throws ViatraQueryRuntimeException | 292 | * @throws InterpreterRuntimeException |
293 | */ | 293 | */ |
294 | public LocalSearchMatcher newLocalSearchMatcher(Object[] parameters) { | 294 | public LocalSearchMatcher newLocalSearchMatcher(Object[] parameters) { |
295 | final Set<PParameter> adornment = new HashSet<>(); | 295 | final Set<PParameter> adornment = new HashSet<>(); |
@@ -298,13 +298,13 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
298 | adornment.add(query.getParameters().get(i)); | 298 | adornment.add(query.getParameters().get(i)); |
299 | } | 299 | } |
300 | } | 300 | } |
301 | 301 | ||
302 | return newLocalSearchMatcher(adornment); | 302 | return newLocalSearchMatcher(adornment); |
303 | } | 303 | } |
304 | 304 | ||
305 | private LocalSearchMatcher newLocalSearchMatcher(final Set<PParameter> adornment) { | 305 | private LocalSearchMatcher newLocalSearchMatcher(final Set<PParameter> adornment) { |
306 | final MatcherReference reference = new MatcherReference(query, adornment, userHints); | 306 | final MatcherReference reference = new MatcherReference(query, adornment, userHints); |
307 | 307 | ||
308 | IPlanDescriptor plan = getOrCreatePlan(reference, planProvider); | 308 | IPlanDescriptor plan = getOrCreatePlan(reference, planProvider); |
309 | if (overrideDefaultHints(reference.getQuery()).isUseBase()){ | 309 | if (overrideDefaultHints(reference.getQuery()).isUseBase()){ |
310 | try { | 310 | try { |
@@ -313,7 +313,7 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
313 | throw new LocalSearchException("Could not index keys", e); | 313 | throw new LocalSearchException("Could not index keys", e); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | 316 | ||
317 | LocalSearchMatcher matcher = createMatcher(plan, searchContext); | 317 | LocalSearchMatcher matcher = createMatcher(plan, searchContext); |
318 | matcher.addAdapters(backend.getAdapters()); | 318 | matcher.addAdapters(backend.getAdapters()); |
319 | return matcher; | 319 | return matcher; |
@@ -322,7 +322,7 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
322 | private void indexKeys(final Iterable<IInputKey> keys) throws InvocationTargetException { | 322 | private void indexKeys(final Iterable<IInputKey> keys) throws InvocationTargetException { |
323 | final IQueryRuntimeContext qrc = getRuntimeContext(); | 323 | final IQueryRuntimeContext qrc = getRuntimeContext(); |
324 | qrc.coalesceTraversals(new Callable<Void>() { | 324 | qrc.coalesceTraversals(new Callable<Void>() { |
325 | 325 | ||
326 | @Override | 326 | @Override |
327 | public Void call() throws Exception { | 327 | public Void call() throws Exception { |
328 | for(IInputKey key : keys){ | 328 | for(IInputKey key : keys){ |
@@ -365,61 +365,61 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
365 | // Count returns long; casting to int - in case of integer overflow casting will throw the exception | 365 | // Count returns long; casting to int - in case of integer overflow casting will throw the exception |
366 | return (int) matcher.streamMatches(parameters).count(); | 366 | return (int) matcher.streamMatches(parameters).count(); |
367 | } | 367 | } |
368 | 368 | ||
369 | @Override | 369 | @Override |
370 | public int countMatches(TupleMask parameterSeedMask, ITuple parameters) { | 370 | public int countMatches(TupleMask parameterSeedMask, ITuple parameters) { |
371 | final LocalSearchMatcher matcher = initializeMatcher(parameterSeedMask); | 371 | final LocalSearchMatcher matcher = initializeMatcher(parameterSeedMask); |
372 | // Count returns long; casting to int - in case of integer overflow casting will throw the exception | 372 | // Count returns long; casting to int - in case of integer overflow casting will throw the exception |
373 | return (int) matcher.streamMatches(parameterSeedMask, parameters).count(); | 373 | return (int) matcher.streamMatches(parameterSeedMask, parameters).count(); |
374 | } | 374 | } |
375 | 375 | ||
376 | private static final double ESTIMATE_CEILING = Long.MAX_VALUE / 16.0; | 376 | private static final double ESTIMATE_CEILING = Long.MAX_VALUE / 16.0; |
377 | 377 | ||
378 | @Override | 378 | @Override |
379 | public Optional<Long> estimateCardinality(TupleMask groupMask, Accuracy requiredAccuracy) { | 379 | public Optional<Long> estimateCardinality(TupleMask groupMask, Accuracy requiredAccuracy) { |
380 | if (Accuracy.BEST_UPPER_BOUND.atLeastAsPreciseAs(requiredAccuracy)) { // approximate using parameter types | 380 | if (Accuracy.BEST_UPPER_BOUND.atLeastAsPreciseAs(requiredAccuracy)) { // approximate using parameter types |
381 | final List<PParameter> parameters = query.getParameters(); | 381 | final List<PParameter> parameters = query.getParameters(); |
382 | final Map<Set<Integer>, Set<Integer>> dependencies = backendContext.getQueryAnalyzer() | 382 | final Map<Set<Integer>, Set<Integer>> dependencies = backendContext.getQueryAnalyzer() |
383 | .getProjectedFunctionalDependencies(query, false); | 383 | .getProjectedFunctionalDependencies(query, false); |
384 | 384 | ||
385 | List<Integer> projectionIndices = groupMask.getIndicesAsList(); | 385 | List<Integer> projectionIndices = groupMask.getIndicesAsList(); |
386 | 386 | ||
387 | return estimateParameterCombinations(requiredAccuracy, parameters, dependencies, | 387 | return estimateParameterCombinations(requiredAccuracy, parameters, dependencies, |
388 | projectionIndices, | 388 | projectionIndices, |
389 | Collections.emptySet() /* No parameters with fixed value */).map(Double::longValue); | 389 | Collections.emptySet() /* No parameters with fixed value */).map(Double::longValue); |
390 | } | 390 | } |
391 | else return Optional.empty(); | 391 | else return Optional.empty(); |
392 | } | 392 | } |
393 | 393 | ||
394 | @Override | 394 | @Override |
395 | public Optional<Double> estimateAverageBucketSize(TupleMask groupMask, Accuracy requiredAccuracy) { | 395 | public Optional<Double> estimateAverageBucketSize(TupleMask groupMask, Accuracy requiredAccuracy) { |
396 | if (Accuracy.BEST_UPPER_BOUND.atLeastAsPreciseAs(requiredAccuracy)) { // approximate using parameter types | 396 | if (Accuracy.BEST_UPPER_BOUND.atLeastAsPreciseAs(requiredAccuracy)) { // approximate using parameter types |
397 | final List<PParameter> parameters = query.getParameters(); | 397 | final List<PParameter> parameters = query.getParameters(); |
398 | final Map<Set<Integer>, Set<Integer>> dependencies = backendContext.getQueryAnalyzer() | 398 | final Map<Set<Integer>, Set<Integer>> dependencies = backendContext.getQueryAnalyzer() |
399 | .getProjectedFunctionalDependencies(query, false); | 399 | .getProjectedFunctionalDependencies(query, false); |
400 | 400 | ||
401 | // all parameters used for the estimation - determinized order | 401 | // all parameters used for the estimation - determinized order |
402 | final List<Integer> allParameterIndices = | 402 | final List<Integer> allParameterIndices = |
403 | IntStream.range(0, parameters.size()).boxed().collect(Collectors.toList()); | 403 | IntStream.range(0, parameters.size()).boxed().collect(Collectors.toList()); |
404 | 404 | ||
405 | // some free parameters are functionally determined by bound parameters | 405 | // some free parameters are functionally determined by bound parameters |
406 | final Set<Integer> boundOrImplied = FunctionalDependencyHelper.closureOf(groupMask.getIndicesAsList(), | 406 | final Set<Integer> boundOrImplied = FunctionalDependencyHelper.closureOf(groupMask.getIndicesAsList(), |
407 | dependencies); | 407 | dependencies); |
408 | 408 | ||
409 | return estimateParameterCombinations(requiredAccuracy, parameters, dependencies, | 409 | return estimateParameterCombinations(requiredAccuracy, parameters, dependencies, |
410 | allParameterIndices, | 410 | allParameterIndices, |
411 | boundOrImplied); | 411 | boundOrImplied); |
412 | } | 412 | } |
413 | else return Optional.empty(); | 413 | else return Optional.empty(); |
414 | } | 414 | } |
415 | 415 | ||
416 | /** | 416 | /** |
417 | * @since 2.1 | 417 | * @since 2.1 |
418 | * @noreference This method is not intended to be referenced by clients. | 418 | * @noreference This method is not intended to be referenced by clients. |
419 | */ | 419 | */ |
420 | public double estimateCost(TupleMask inputBindingMask) { | 420 | public double estimateCost(TupleMask inputBindingMask) { |
421 | // TODO this is currently an abstract cost, not really a branching factor | 421 | // TODO this is currently an abstract cost, not really a branching factor |
422 | 422 | ||
423 | HashSet<PParameter> adornment = new HashSet<>(inputBindingMask.transform(query.getParameters())); | 423 | HashSet<PParameter> adornment = new HashSet<>(inputBindingMask.transform(query.getParameters())); |
424 | final MatcherReference reference = new MatcherReference(query, adornment, userHints); | 424 | final MatcherReference reference = new MatcherReference(query, adornment, userHints); |
425 | IPlanDescriptor plan = getOrCreatePlan(reference, planProvider); | 425 | IPlanDescriptor plan = getOrCreatePlan(reference, planProvider); |
@@ -431,32 +431,32 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
431 | * Approximates using parameter types | 431 | * Approximates using parameter types |
432 | */ | 432 | */ |
433 | private Optional<Double> estimateParameterCombinations( | 433 | private Optional<Double> estimateParameterCombinations( |
434 | Accuracy requiredAccuracy, | 434 | Accuracy requiredAccuracy, |
435 | final List<PParameter> parameters, | 435 | final List<PParameter> parameters, |
436 | final Map<Set<Integer>, Set<Integer>> functionalDependencies, | 436 | final Map<Set<Integer>, Set<Integer>> functionalDependencies, |
437 | final Collection<Integer> parameterIndicesToEstimate, | 437 | final Collection<Integer> parameterIndicesToEstimate, |
438 | final Set<Integer> otherDeterminingIndices) | 438 | final Set<Integer> otherDeterminingIndices) |
439 | { | 439 | { |
440 | // keep order deterministic | 440 | // keep order deterministic |
441 | LinkedHashSet<Integer> freeParameterIndices = new LinkedHashSet<>(parameterIndicesToEstimate); | 441 | LinkedHashSet<Integer> freeParameterIndices = new LinkedHashSet<>(parameterIndicesToEstimate); |
442 | 442 | ||
443 | // determining indices are bound | 443 | // determining indices are bound |
444 | freeParameterIndices.removeAll(otherDeterminingIndices); | 444 | freeParameterIndices.removeAll(otherDeterminingIndices); |
445 | 445 | ||
446 | // some free parameters are functionally determined by other free parameters | 446 | // some free parameters are functionally determined by other free parameters |
447 | for (Integer candidateForRemoval : new ArrayList<>(freeParameterIndices)) { | 447 | for (Integer candidateForRemoval : new ArrayList<>(freeParameterIndices)) { |
448 | List<Integer> others = Stream.concat( | 448 | List<Integer> others = Stream.concat( |
449 | otherDeterminingIndices.stream(), | 449 | otherDeterminingIndices.stream(), |
450 | freeParameterIndices.stream().filter(index -> !Objects.equals(index, candidateForRemoval)) | 450 | freeParameterIndices.stream().filter(index -> !Objects.equals(index, candidateForRemoval)) |
451 | ).collect(Collectors.toList()); | 451 | ).collect(Collectors.toList()); |
452 | Set<Integer> othersClosure = FunctionalDependencyHelper.closureOf(others, functionalDependencies); | 452 | Set<Integer> othersClosure = FunctionalDependencyHelper.closureOf(others, functionalDependencies); |
453 | if (othersClosure.contains(candidateForRemoval)) { | 453 | if (othersClosure.contains(candidateForRemoval)) { |
454 | // other parameters functionally determine this mone, does not count towards estimate | 454 | // other parameters functionally determine this mone, does not count towards estimate |
455 | freeParameterIndices.remove(candidateForRemoval); | 455 | freeParameterIndices.remove(candidateForRemoval); |
456 | } | 456 | } |
457 | } | 457 | } |
458 | 458 | ||
459 | 459 | ||
460 | Optional<Double> result = Optional.of(1.0); | 460 | Optional<Double> result = Optional.of(1.0); |
461 | // TODO this is currently works with declared types only. For better results, information from | 461 | // TODO this is currently works with declared types only. For better results, information from |
462 | // the Type inferrer should be included in the PSystem | 462 | // the Type inferrer should be included in the PSystem |
@@ -466,20 +466,20 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
466 | result = result.flatMap(accumulator -> | 466 | result = result.flatMap(accumulator -> |
467 | runtimeContext.estimateCardinality(type, TupleMask.identity(1), requiredAccuracy).map(multiplier -> | 467 | runtimeContext.estimateCardinality(type, TupleMask.identity(1), requiredAccuracy).map(multiplier -> |
468 | Math.min(accumulator * multiplier, ESTIMATE_CEILING /* avoid overflow */) | 468 | Math.min(accumulator * multiplier, ESTIMATE_CEILING /* avoid overflow */) |
469 | )); | 469 | )); |
470 | } | 470 | } |
471 | } | 471 | } |
472 | // TODO better approximate cardinality based on plan, branching factors, etc. | 472 | // TODO better approximate cardinality based on plan, branching factors, etc. |
473 | return result; | 473 | return result; |
474 | } | 474 | } |
475 | 475 | ||
476 | 476 | ||
477 | @Override | 477 | @Override |
478 | public Stream<Tuple> getAllMatches(Object[] parameters) { | 478 | public Stream<Tuple> getAllMatches(Object[] parameters) { |
479 | final LocalSearchMatcher matcher = initializeMatcher(parameters); | 479 | final LocalSearchMatcher matcher = initializeMatcher(parameters); |
480 | return matcher.streamMatches(parameters); | 480 | return matcher.streamMatches(parameters); |
481 | } | 481 | } |
482 | 482 | ||
483 | @Override | 483 | @Override |
484 | public Stream<Tuple> getAllMatches(TupleMask parameterSeedMask, ITuple parameters) { | 484 | public Stream<Tuple> getAllMatches(TupleMask parameterSeedMask, ITuple parameters) { |
485 | final LocalSearchMatcher matcher = initializeMatcher(parameterSeedMask); | 485 | final LocalSearchMatcher matcher = initializeMatcher(parameterSeedMask); |
@@ -508,20 +508,20 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
508 | LocalSearchHints configuration = overrideDefaultHints(query); | 508 | LocalSearchHints configuration = overrideDefaultHints(query); |
509 | return configuration; | 509 | return configuration; |
510 | } | 510 | } |
511 | 511 | ||
512 | /** | 512 | /** |
513 | * Forgets all stored plans in this result provider. If no plans are stored, nothing happens. | 513 | * Forgets all stored plans in this result provider. If no plans are stored, nothing happens. |
514 | * | 514 | * |
515 | * @since 2.0 | 515 | * @since 2.0 |
516 | * @noreference This method is not intended to be referenced by clients; it should only used by {@link LocalSearchBackend}. | 516 | * @noreference This method is not intended to be referenced by clients; it should only used by {@link LocalSearchBackend}. |
517 | */ | 517 | */ |
518 | public void forgetAllPlans() { | 518 | public void forgetAllPlans() { |
519 | planCache.clear(); | 519 | planCache.clear(); |
520 | } | 520 | } |
521 | 521 | ||
522 | /** | 522 | /** |
523 | * Returns a search plan for a given adornment if exists | 523 | * Returns a search plan for a given adornment if exists |
524 | * | 524 | * |
525 | * @return a search plan for the pattern with the given adornment, or null if none exists | 525 | * @return a search plan for the pattern with the given adornment, or null if none exists |
526 | * @since 2.0 | 526 | * @since 2.0 |
527 | * @noreference This method is not intended to be referenced by clients; it should only used by {@link LocalSearchBackend}. | 527 | * @noreference This method is not intended to be referenced by clients; it should only used by {@link LocalSearchBackend}. |
@@ -529,4 +529,4 @@ public abstract class AbstractLocalSearchResultProvider implements IQueryResultP | |||
529 | public IPlanDescriptor getSearchPlan(Set<PParameter> adornment) { | 529 | public IPlanDescriptor getSearchPlan(Set<PParameter> adornment) { |
530 | return planCache.get(new MatcherReference(query, adornment)); | 530 | return planCache.get(new MatcherReference(query, adornment)); |
531 | } | 531 | } |
532 | } \ No newline at end of file | 532 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/AllValidAdornments.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/AllValidAdornments.java index f801163e..146b53c5 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/AllValidAdornments.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/AllValidAdornments.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher.integration; | 9 | package tools.refinery.interpreter.localsearch.matcher.integration; |
10 | 10 | ||
11 | import java.util.Set; | 11 | import java.util.Set; |
12 | import java.util.stream.Collectors; | 12 | import java.util.stream.Collectors; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 14 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameterDirection; | 15 | import tools.refinery.interpreter.matchers.psystem.queries.PParameterDirection; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQueries; | 16 | import tools.refinery.interpreter.matchers.psystem.queries.PQueries; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 17 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
18 | import tools.refinery.viatra.runtime.matchers.util.Sets; | 18 | import tools.refinery.interpreter.matchers.util.Sets; |
19 | 19 | ||
20 | 20 | ||
21 | /** | 21 | /** |
22 | * This implementation calculates all valid adornments for the given query, respecting the parameter direction constraints. | 22 | * This implementation calculates all valid adornments for the given query, respecting the parameter direction constraints. |
23 | * | 23 | * |
24 | * @author Grill Balázs | 24 | * @author Grill Balázs |
25 | * @since 1.5 | 25 | * @since 1.5 |
26 | */ | 26 | */ |
@@ -28,8 +28,8 @@ public class AllValidAdornments implements IAdornmentProvider { | |||
28 | 28 | ||
29 | @Override | 29 | @Override |
30 | public Iterable<Set<PParameter>> getAdornments(PQuery query) { | 30 | public Iterable<Set<PParameter>> getAdornments(PQuery query) { |
31 | final Set<PParameter> ins = query.getParameters().stream().filter(PQueries.parameterDirectionPredicate(PParameterDirection.IN)).collect(Collectors.toSet()); | 31 | final Set<PParameter> ins = query.getParameters().stream().filter(PQueries.parameterDirectionPredicate(PParameterDirection.IN)).collect(Collectors.toSet()); |
32 | Set<PParameter> inouts = query.getParameters().stream().filter(PQueries.parameterDirectionPredicate(PParameterDirection.INOUT)).collect(Collectors.toSet()); | 32 | Set<PParameter> inouts = query.getParameters().stream().filter(PQueries.parameterDirectionPredicate(PParameterDirection.INOUT)).collect(Collectors.toSet()); |
33 | Set<? extends Set<PParameter>> possibleInouts = Sets.powerSet(inouts); | 33 | Set<? extends Set<PParameter>> possibleInouts = Sets.powerSet(inouts); |
34 | return possibleInouts.stream().map(input -> Sets.union(ins, input)).collect(Collectors.toSet()); | 34 | return possibleInouts.stream().map(input -> Sets.union(ins, input)).collect(Collectors.toSet()); |
35 | } | 35 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/DontFlattenDisjunctive.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/DontFlattenDisjunctive.java index bf1b61b5..55fa53d2 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/DontFlattenDisjunctive.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/DontFlattenDisjunctive.java | |||
@@ -3,17 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher.integration; | 9 | package tools.refinery.interpreter.localsearch.matcher.integration; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 11 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.IFlattenCallPredicate; | 12 | import tools.refinery.interpreter.matchers.psystem.rewriters.IFlattenCallPredicate; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Forbids flattening of patterns that have more than one body. | 15 | * Forbids flattening of patterns that have more than one body. |
16 | * | 16 | * |
17 | * @since 2.1 | 17 | * @since 2.1 |
18 | 18 | ||
19 | * @author Gabor Bergmann | 19 | * @author Gabor Bergmann |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/DontFlattenIncrementalPredicate.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/DontFlattenIncrementalPredicate.java index 1b918528..fd0e9456 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/DontFlattenIncrementalPredicate.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/DontFlattenIncrementalPredicate.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher.integration; | 9 | package tools.refinery.interpreter.localsearch.matcher.integration; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 11 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
12 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint.BackendRequirement; | 12 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint.BackendRequirement; |
13 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 13 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.IFlattenCallPredicate; | 14 | import tools.refinery.interpreter.matchers.psystem.rewriters.IFlattenCallPredicate; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * This implementation forbids flattening of patterns marked to be executed with a caching / incremental backend. | 17 | * This implementation forbids flattening of patterns marked to be executed with a caching / incremental backend. |
18 | * This makes is possible for the user to configure hybrid matching via using | 18 | * This makes is possible for the user to configure hybrid matching via using |
19 | * the 'search' and 'incremental keywords in the pattern definition file. | 19 | * the 'search' and 'incremental keywords in the pattern definition file. |
20 | * | 20 | * |
21 | * @since 1.5 | 21 | * @since 1.5 |
22 | * | 22 | * |
23 | */ | 23 | */ |
@@ -27,7 +27,7 @@ public class DontFlattenIncrementalPredicate implements IFlattenCallPredicate { | |||
27 | public boolean shouldFlatten(PositivePatternCall positivePatternCall) { | 27 | public boolean shouldFlatten(PositivePatternCall positivePatternCall) { |
28 | QueryEvaluationHint evaluationHints = positivePatternCall.getReferredQuery().getEvaluationHints(); | 28 | QueryEvaluationHint evaluationHints = positivePatternCall.getReferredQuery().getEvaluationHints(); |
29 | if (evaluationHints == null) return true; | 29 | if (evaluationHints == null) return true; |
30 | 30 | ||
31 | BackendRequirement backendRequirementType = evaluationHints.getQueryBackendRequirementType(); | 31 | BackendRequirement backendRequirementType = evaluationHints.getQueryBackendRequirementType(); |
32 | switch(backendRequirementType) { | 32 | switch(backendRequirementType) { |
33 | case DEFAULT_CACHING: | 33 | case DEFAULT_CACHING: |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/GenericLocalSearchResultProvider.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/GenericLocalSearchResultProvider.java index ed6c1e5f..c4758053 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/GenericLocalSearchResultProvider.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/GenericLocalSearchResultProvider.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher.integration; | 9 | package tools.refinery.interpreter.localsearch.matcher.integration; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.localsearch.plan.IPlanProvider; | 11 | import tools.refinery.interpreter.localsearch.planner.compiler.GenericOperationCompiler; |
12 | import tools.refinery.viatra.runtime.localsearch.planner.compiler.GenericOperationCompiler; | 12 | import tools.refinery.interpreter.localsearch.planner.compiler.IOperationCompiler; |
13 | import tools.refinery.viatra.runtime.localsearch.planner.compiler.IOperationCompiler; | 13 | import tools.refinery.interpreter.localsearch.plan.IPlanProvider; |
14 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 14 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
15 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 15 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
16 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 16 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
17 | import tools.refinery.viatra.runtime.matchers.context.IndexingService; | 17 | import tools.refinery.interpreter.matchers.context.IndexingService; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 18 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * @author Zoltan Ujhelyi | 21 | * @author Zoltan Ujhelyi |
@@ -25,7 +25,7 @@ import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | |||
25 | public class GenericLocalSearchResultProvider extends AbstractLocalSearchResultProvider { | 25 | public class GenericLocalSearchResultProvider extends AbstractLocalSearchResultProvider { |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * @throws ViatraQueryRuntimeException | 28 | * @throws InterpreterRuntimeException |
29 | */ | 29 | */ |
30 | public GenericLocalSearchResultProvider(LocalSearchBackend backend, IQueryBackendContext context, PQuery query, | 30 | public GenericLocalSearchResultProvider(LocalSearchBackend backend, IQueryBackendContext context, PQuery query, |
31 | IPlanProvider planProvider, QueryEvaluationHint userHints) { | 31 | IPlanProvider planProvider, QueryEvaluationHint userHints) { |
@@ -35,14 +35,14 @@ public class GenericLocalSearchResultProvider extends AbstractLocalSearchResultP | |||
35 | @Override | 35 | @Override |
36 | protected void indexInitializationBeforePlanning() { | 36 | protected void indexInitializationBeforePlanning() { |
37 | super.indexInitializationBeforePlanning(); | 37 | super.indexInitializationBeforePlanning(); |
38 | 38 | ||
39 | indexReferredTypesOfQuery(query, IndexingService.INSTANCES); | 39 | indexReferredTypesOfQuery(query, IndexingService.INSTANCES); |
40 | indexReferredTypesOfQuery(query, IndexingService.STATISTICS); | 40 | indexReferredTypesOfQuery(query, IndexingService.STATISTICS); |
41 | } | 41 | } |
42 | 42 | ||
43 | @Override | 43 | @Override |
44 | protected IOperationCompiler getOperationCompiler(IQueryBackendContext backendContext, | 44 | protected IOperationCompiler getOperationCompiler(IQueryBackendContext backendContext, |
45 | LocalSearchHints configuration) { | 45 | LocalSearchHints configuration) { |
46 | return new GenericOperationCompiler(runtimeContext); | 46 | return new GenericOperationCompiler(runtimeContext); |
47 | } | 47 | } |
48 | 48 | ||
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/IAdornmentProvider.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/IAdornmentProvider.java index 86058be0..ebb65f57 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/IAdornmentProvider.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/IAdornmentProvider.java | |||
@@ -3,33 +3,33 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher.integration; | 9 | package tools.refinery.interpreter.localsearch.matcher.integration; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 14 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
15 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint.BackendRequirement; | 15 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint.BackendRequirement; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 16 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 17 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * An adornment provider is used to define the adornments the pattern matcher should prepare for. | 20 | * An adornment provider is used to define the adornments the pattern matcher should prepare for. |
21 | * | 21 | * |
22 | * <p>A default implementation is available in {@link AllValidAdornments} that describes all | 22 | * <p>A default implementation is available in {@link AllValidAdornments} that describes all |
23 | * adornments fulfilling the parameter direction declarations; | 23 | * adornments fulfilling the parameter direction declarations; |
24 | * another default option (with better performance but restricted applicability) is {@link LazyPlanningAdornments}. | 24 | * another default option (with better performance but restricted applicability) is {@link LazyPlanningAdornments}. |
25 | * | 25 | * |
26 | * <br><br> | 26 | * <br><br> |
27 | * | 27 | * |
28 | * Users may implement this interface to limit the number of prepared plans based on some runtime information: | 28 | * Users may implement this interface to limit the number of prepared plans based on some runtime information: |
29 | * | 29 | * |
30 | * <pre> | 30 | * <pre> |
31 | * class SomeAdornments{ | 31 | * class SomeAdornments{ |
32 | * | 32 | * |
33 | * public Iterable<Set<{@link PParameter}>> getAdornments({@link PQuery} query){ | 33 | * public Iterable<Set<{@link PParameter}>> getAdornments({@link PQuery} query){ |
34 | * if (SomeGeneratedQuerySpecification.instance().getInternalQueryRepresentation().equals(query)){ | 34 | * if (SomeGeneratedQuerySpecification.instance().getInternalQueryRepresentation().equals(query)){ |
35 | * return Collections.singleton(Sets.filter(Sets.newHashSet(query.getParameters()), new Predicate<PParameter>() { | 35 | * return Collections.singleton(Sets.filter(Sets.newHashSet(query.getParameters()), new Predicate<PParameter>() { |
@@ -44,10 +44,10 @@ import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | |||
44 | * // Returning an empty iterable is safe for unknown queries | 44 | * // Returning an empty iterable is safe for unknown queries |
45 | * return Collections.emptySet(); | 45 | * return Collections.emptySet(); |
46 | * } | 46 | * } |
47 | * | 47 | * |
48 | * } | 48 | * } |
49 | * </pre> | 49 | * </pre> |
50 | * | 50 | * |
51 | * @author Grill Balázs | 51 | * @author Grill Balázs |
52 | * @since 1.5 | 52 | * @since 1.5 |
53 | * | 53 | * |
@@ -58,15 +58,15 @@ public interface IAdornmentProvider { | |||
58 | * The bound parameter sets | 58 | * The bound parameter sets |
59 | */ | 59 | */ |
60 | public Iterable<Set<PParameter>> getAdornments(PQuery query); | 60 | public Iterable<Set<PParameter>> getAdornments(PQuery query); |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * @return a simple hint that only overrides the adornment provider | 63 | * @return a simple hint that only overrides the adornment provider |
64 | * @since 2.1 | 64 | * @since 2.1 |
65 | */ | 65 | */ |
66 | public static QueryEvaluationHint toHint(IAdornmentProvider adornmentProvider) { | 66 | public static QueryEvaluationHint toHint(IAdornmentProvider adornmentProvider) { |
67 | return new QueryEvaluationHint( | 67 | return new QueryEvaluationHint( |
68 | Collections.singletonMap(LocalSearchHintOptions.ADORNMENT_PROVIDER, adornmentProvider), | 68 | Collections.singletonMap(LocalSearchHintOptions.ADORNMENT_PROVIDER, adornmentProvider), |
69 | BackendRequirement.UNSPECIFIED); | 69 | BackendRequirement.UNSPECIFIED); |
70 | } | 70 | } |
71 | 71 | ||
72 | } | 72 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LazyPlanningAdornments.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LazyPlanningAdornments.java index 30b3689f..db3bee60 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LazyPlanningAdornments.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LazyPlanningAdornments.java | |||
@@ -3,30 +3,30 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher.integration; | 9 | package tools.refinery.interpreter.localsearch.matcher.integration; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 14 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 15 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * This adornment provider does not trigger the preparation of any plans. | 18 | * This adornment provider does not trigger the preparation of any plans. |
19 | * Actual query plans will be computed on demand, when the first actual match request is made with a given adornment. | 19 | * Actual query plans will be computed on demand, when the first actual match request is made with a given adornment. |
20 | * | 20 | * |
21 | * <p> Caution: this is a safe default adornment provider for {@link GenericLocalSearchResultProvider} only; | 21 | * <p> Caution: this is a safe default adornment provider for {@link GenericLocalSearchResultProvider} only; |
22 | * do not use for the EMF-specific LS backend. | 22 | * do not use for the EMF-specific LS backend. |
23 | * | 23 | * |
24 | * <p> The benefits is in execution time: query planning costs for adornments are postponed until first usage | 24 | * <p> The benefits is in execution time: query planning costs for adornments are postponed until first usage |
25 | * or even entirely avoided (when adornment is never used in practice). | 25 | * or even entirely avoided (when adornment is never used in practice). |
26 | * However, query evaluation time may become less predictable, as the first matcher call (with a given adornment) | 26 | * However, query evaluation time may become less predictable, as the first matcher call (with a given adornment) |
27 | * will include the planning cost. | 27 | * will include the planning cost. |
28 | * For benchmarking or other purposes where this is not desirable, use an adornment provider that demands plan precomputation for all necessary adornments. | 28 | * For benchmarking or other purposes where this is not desirable, use an adornment provider that demands plan precomputation for all necessary adornments. |
29 | * | 29 | * |
30 | * @author Gabor Bergmann | 30 | * @author Gabor Bergmann |
31 | * @since 2.1 | 31 | * @since 2.1 |
32 | * | 32 | * |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchBackend.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchBackend.java index ae51e2b0..de34ae00 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchBackend.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchBackend.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher.integration; | 9 | package tools.refinery.interpreter.localsearch.matcher.integration; |
10 | 10 | ||
11 | import java.lang.reflect.InvocationTargetException; | 11 | import java.lang.reflect.InvocationTargetException; |
12 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
@@ -19,26 +19,26 @@ import java.util.Map; | |||
19 | import java.util.Set; | 19 | import java.util.Set; |
20 | import java.util.stream.Stream; | 20 | import java.util.stream.Stream; |
21 | 21 | ||
22 | import tools.refinery.viatra.runtime.localsearch.exceptions.LocalSearchException; | 22 | import tools.refinery.interpreter.localsearch.exceptions.LocalSearchException; |
23 | import tools.refinery.viatra.runtime.localsearch.matcher.ILocalSearchAdapter; | 23 | import tools.refinery.interpreter.localsearch.matcher.ILocalSearchAdapter; |
24 | import tools.refinery.viatra.runtime.localsearch.plan.IPlanDescriptor; | 24 | import tools.refinery.interpreter.localsearch.plan.IPlanDescriptor; |
25 | import tools.refinery.viatra.runtime.localsearch.plan.IPlanProvider; | 25 | import tools.refinery.interpreter.localsearch.plan.IPlanProvider; |
26 | import tools.refinery.viatra.runtime.localsearch.plan.SimplePlanProvider; | 26 | import tools.refinery.interpreter.localsearch.plan.SimplePlanProvider; |
27 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 27 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
28 | import tools.refinery.viatra.runtime.matchers.backend.IMatcherCapability; | 28 | import tools.refinery.interpreter.matchers.backend.IMatcherCapability; |
29 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackend; | 29 | import tools.refinery.interpreter.matchers.backend.IQueryBackend; |
30 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendHintProvider; | 30 | import tools.refinery.interpreter.matchers.backend.IQueryBackendHintProvider; |
31 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 31 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
32 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 32 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
33 | import tools.refinery.viatra.runtime.matchers.backend.ResultProviderRequestor; | 33 | import tools.refinery.interpreter.matchers.backend.ResultProviderRequestor; |
34 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 34 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
35 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 35 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
36 | import tools.refinery.viatra.runtime.matchers.psystem.analysis.QueryAnalyzer; | 36 | import tools.refinery.interpreter.matchers.psystem.analysis.QueryAnalyzer; |
37 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 37 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
38 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 38 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
39 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 39 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
40 | import tools.refinery.viatra.runtime.matchers.util.ICache; | 40 | import tools.refinery.interpreter.matchers.util.ICache; |
41 | import tools.refinery.viatra.runtime.matchers.util.PurgableCache; | 41 | import tools.refinery.interpreter.matchers.util.PurgableCache; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * @author Marton Bur, Zoltan Ujhelyi | 44 | * @author Marton Bur, Zoltan Ujhelyi |
@@ -49,12 +49,12 @@ public abstract class LocalSearchBackend implements IQueryBackend { | |||
49 | IQueryBackendContext context; | 49 | IQueryBackendContext context; |
50 | IPlanProvider planProvider; | 50 | IPlanProvider planProvider; |
51 | private final Set<ILocalSearchAdapter> adapters = new HashSet<>(); | 51 | private final Set<ILocalSearchAdapter> adapters = new HashSet<>(); |
52 | 52 | ||
53 | private final PurgableCache generalCache; | 53 | private final PurgableCache generalCache; |
54 | 54 | ||
55 | private final Map<PQuery, List<AbstractLocalSearchResultProvider>> resultProviderCache = CollectionsFactory.createMap(); | 55 | private final Map<PQuery, List<AbstractLocalSearchResultProvider>> resultProviderCache = CollectionsFactory.createMap(); |
56 | 56 | ||
57 | 57 | ||
58 | /** | 58 | /** |
59 | * @since 1.5 | 59 | * @since 1.5 |
60 | */ | 60 | */ |
@@ -67,20 +67,20 @@ public abstract class LocalSearchBackend implements IQueryBackend { | |||
67 | 67 | ||
68 | @Override | 68 | @Override |
69 | public void flushUpdates() { | 69 | public void flushUpdates() { |
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | @Override | 73 | @Override |
74 | public IQueryResultProvider getResultProvider(PQuery query) { | 74 | public IQueryResultProvider getResultProvider(PQuery query) { |
75 | return getResultProvider(query, null); | 75 | return getResultProvider(query, null); |
76 | } | 76 | } |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * @since 1.4 | 79 | * @since 1.4 |
80 | */ | 80 | */ |
81 | @Override | 81 | @Override |
82 | public IQueryResultProvider getResultProvider(PQuery query, QueryEvaluationHint hints) { | 82 | public IQueryResultProvider getResultProvider(PQuery query, QueryEvaluationHint hints) { |
83 | 83 | ||
84 | final QueryEvaluationHint callHints = getHintProvider().getQueryEvaluationHint(query).overrideBy(hints); | 84 | final QueryEvaluationHint callHints = getHintProvider().getQueryEvaluationHint(query).overrideBy(hints); |
85 | IMatcherCapability requestedCapability = context.getRequiredMatcherCapability(query, callHints); | 85 | IMatcherCapability requestedCapability = context.getRequiredMatcherCapability(query, callHints); |
86 | for(AbstractLocalSearchResultProvider existingResultProvider : resultProviderCache.getOrDefault(query, Collections.emptyList())){ | 86 | for(AbstractLocalSearchResultProvider existingResultProvider : resultProviderCache.getOrDefault(query, Collections.emptyList())){ |
@@ -88,39 +88,39 @@ public abstract class LocalSearchBackend implements IQueryBackend { | |||
88 | return existingResultProvider; | 88 | return existingResultProvider; |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | AbstractLocalSearchResultProvider resultProvider = initializeResultProvider(query, hints); | 92 | AbstractLocalSearchResultProvider resultProvider = initializeResultProvider(query, hints); |
93 | resultProviderCache.computeIfAbsent(query, k->new ArrayList<>()).add(resultProvider); | 93 | resultProviderCache.computeIfAbsent(query, k->new ArrayList<>()).add(resultProvider); |
94 | resultProvider.prepare(); | 94 | resultProvider.prepare(); |
95 | return resultProvider; | 95 | return resultProvider; |
96 | } | 96 | } |
97 | 97 | ||
98 | /** | 98 | /** |
99 | * Returns a requestor that this backend uses while processing pattern calls <i>from</i> this query. | 99 | * Returns a requestor that this backend uses while processing pattern calls <i>from</i> this query. |
100 | * @noreference This method is not intended to be referenced by clients. | 100 | * @noreference This method is not intended to be referenced by clients. |
101 | * @since 2.1 | 101 | * @since 2.1 |
102 | */ | 102 | */ |
103 | public ResultProviderRequestor getResultProviderRequestor(PQuery query, QueryEvaluationHint userHints) { | 103 | public ResultProviderRequestor getResultProviderRequestor(PQuery query, QueryEvaluationHint userHints) { |
104 | QueryEvaluationHint hintOnQuery = | 104 | QueryEvaluationHint hintOnQuery = |
105 | context.getHintProvider().getQueryEvaluationHint(query).overrideBy(userHints); | 105 | context.getHintProvider().getQueryEvaluationHint(query).overrideBy(userHints); |
106 | LocalSearchHints defaultsApplied = LocalSearchHints.getDefaultOverriddenBy(hintOnQuery); | 106 | LocalSearchHints defaultsApplied = LocalSearchHints.getDefaultOverriddenBy(hintOnQuery); |
107 | 107 | ||
108 | return new ResultProviderRequestor(this, | 108 | return new ResultProviderRequestor(this, |
109 | context.getResultProviderAccess(), | 109 | context.getResultProviderAccess(), |
110 | context.getHintProvider(), | 110 | context.getHintProvider(), |
111 | defaultsApplied.getCallDelegationStrategy(), | 111 | defaultsApplied.getCallDelegationStrategy(), |
112 | userHints, | 112 | userHints, |
113 | /* no global overrides */ null); | 113 | /* no global overrides */ null); |
114 | } | 114 | } |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * @throws ViatraQueryRuntimeException | 117 | * @throws InterpreterRuntimeException |
118 | * @since 1.7 | 118 | * @since 1.7 |
119 | */ | 119 | */ |
120 | protected abstract AbstractLocalSearchResultProvider initializeResultProvider(PQuery query, QueryEvaluationHint hints); | 120 | protected abstract AbstractLocalSearchResultProvider initializeResultProvider(PQuery query, QueryEvaluationHint hints); |
121 | 121 | ||
122 | @Override | 122 | @Override |
123 | public void dispose() { | 123 | public void dispose() { |
124 | resultProviderCache.clear(); | 124 | resultProviderCache.clear(); |
125 | generalCache.purge(); | 125 | generalCache.purge(); |
126 | } | 126 | } |
@@ -144,8 +144,8 @@ public abstract class LocalSearchBackend implements IQueryBackend { | |||
144 | public IQueryRuntimeContext getRuntimeContext() { | 144 | public IQueryRuntimeContext getRuntimeContext() { |
145 | return context.getRuntimeContext(); | 145 | return context.getRuntimeContext(); |
146 | } | 146 | } |
147 | 147 | ||
148 | 148 | ||
149 | /** | 149 | /** |
150 | * @since 1.5 | 150 | * @since 1.5 |
151 | */ | 151 | */ |
@@ -160,21 +160,21 @@ public abstract class LocalSearchBackend implements IQueryBackend { | |||
160 | public IQueryBackendHintProvider getHintProvider() { | 160 | public IQueryBackendHintProvider getHintProvider() { |
161 | return context.getHintProvider(); | 161 | return context.getHintProvider(); |
162 | } | 162 | } |
163 | 163 | ||
164 | /** | 164 | /** |
165 | * @since 1.5 | 165 | * @since 1.5 |
166 | */ | 166 | */ |
167 | public void addAdapter(ILocalSearchAdapter adapter){ | 167 | public void addAdapter(ILocalSearchAdapter adapter){ |
168 | adapters.add(adapter); | 168 | adapters.add(adapter); |
169 | } | 169 | } |
170 | 170 | ||
171 | /** | 171 | /** |
172 | * @since 1.5 | 172 | * @since 1.5 |
173 | */ | 173 | */ |
174 | public void removeAdapter(ILocalSearchAdapter adapter){ | 174 | public void removeAdapter(ILocalSearchAdapter adapter){ |
175 | adapters.remove(adapter); | 175 | adapters.remove(adapter); |
176 | } | 176 | } |
177 | 177 | ||
178 | /** | 178 | /** |
179 | * Return a copy of the current adapters | 179 | * Return a copy of the current adapters |
180 | * @since 1.7 | 180 | * @since 1.7 |
@@ -182,14 +182,14 @@ public abstract class LocalSearchBackend implements IQueryBackend { | |||
182 | public List<ILocalSearchAdapter> getAdapters() { | 182 | public List<ILocalSearchAdapter> getAdapters() { |
183 | return new ArrayList<>(adapters); | 183 | return new ArrayList<>(adapters); |
184 | } | 184 | } |
185 | 185 | ||
186 | /** | 186 | /** |
187 | * @since 1.5 | 187 | * @since 1.5 |
188 | */ | 188 | */ |
189 | public IQueryBackendContext getBackendContext() { | 189 | public IQueryBackendContext getBackendContext() { |
190 | return context; | 190 | return context; |
191 | } | 191 | } |
192 | 192 | ||
193 | /** | 193 | /** |
194 | * Returns the internal cache of the backend | 194 | * Returns the internal cache of the backend |
195 | * @since 1.7 | 195 | * @since 1.7 |
@@ -198,40 +198,40 @@ public abstract class LocalSearchBackend implements IQueryBackend { | |||
198 | public ICache getCache() { | 198 | public ICache getCache() { |
199 | return generalCache; | 199 | return generalCache; |
200 | } | 200 | } |
201 | 201 | ||
202 | /** | 202 | /** |
203 | * Updates the previously stored search plans for one or more given queries, computing a new set of plans if | 203 | * Updates the previously stored search plans for one or more given queries, computing a new set of plans if |
204 | * necessary. The new plans created are the same that would be created by executing prepare on the given query | 204 | * necessary. The new plans created are the same that would be created by executing prepare on the given query |
205 | * definitions. | 205 | * definitions. |
206 | * | 206 | * |
207 | * @since 2.0 | 207 | * @since 2.0 |
208 | */ | 208 | */ |
209 | public void recomputePlans(PQuery... queries) { | 209 | public void recomputePlans(PQuery... queries) { |
210 | recomputePlans(Arrays.stream(queries).flatMap(query -> resultProviderCache.getOrDefault(query, Collections.emptyList()).stream())); | 210 | recomputePlans(Arrays.stream(queries).flatMap(query -> resultProviderCache.getOrDefault(query, Collections.emptyList()).stream())); |
211 | } | 211 | } |
212 | 212 | ||
213 | /** | 213 | /** |
214 | * Updates the previously stored search plans for one or more given queries, computing a new set of plans if | 214 | * Updates the previously stored search plans for one or more given queries, computing a new set of plans if |
215 | * necessary The new plans created are the same that would be created by executing prepare on the given query | 215 | * necessary The new plans created are the same that would be created by executing prepare on the given query |
216 | * definitions. | 216 | * definitions. |
217 | * | 217 | * |
218 | * @since 2.0 | 218 | * @since 2.0 |
219 | */ | 219 | */ |
220 | public void recomputePlans(Collection<PQuery> queries) { | 220 | public void recomputePlans(Collection<PQuery> queries) { |
221 | recomputePlans(queries.stream().flatMap(query -> resultProviderCache.getOrDefault(query, Collections.emptyList()).stream())); | 221 | recomputePlans(queries.stream().flatMap(query -> resultProviderCache.getOrDefault(query, Collections.emptyList()).stream())); |
222 | } | 222 | } |
223 | 223 | ||
224 | /** | 224 | /** |
225 | * Updates the previously stored search plans for one or more given queries, computing a new set of plans if | 225 | * Updates the previously stored search plans for one or more given queries, computing a new set of plans if |
226 | * necessary The new plans created are the same that would be created by executing prepare on the given query | 226 | * necessary The new plans created are the same that would be created by executing prepare on the given query |
227 | * definitions. | 227 | * definitions. |
228 | * | 228 | * |
229 | * @since 2.0 | 229 | * @since 2.0 |
230 | */ | 230 | */ |
231 | public void recomputePlans() { | 231 | public void recomputePlans() { |
232 | recomputePlans(resultProviderCache.values().stream().flatMap(List::stream)); | 232 | recomputePlans(resultProviderCache.values().stream().flatMap(List::stream)); |
233 | } | 233 | } |
234 | 234 | ||
235 | private void recomputePlans(Stream<AbstractLocalSearchResultProvider> resultProviders) { | 235 | private void recomputePlans(Stream<AbstractLocalSearchResultProvider> resultProviders) { |
236 | try { | 236 | try { |
237 | context.getRuntimeContext().coalesceTraversals(() -> { | 237 | context.getRuntimeContext().coalesceTraversals(() -> { |
@@ -245,10 +245,10 @@ public abstract class LocalSearchBackend implements IQueryBackend { | |||
245 | throw new LocalSearchException("Error while rebuilding plans: " + e.getMessage(), e); | 245 | throw new LocalSearchException("Error while rebuilding plans: " + e.getMessage(), e); |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | /** | 249 | /** |
250 | * Returns a search plan for a given query and adornment if such plan is already calculated. | 250 | * Returns a search plan for a given query and adornment if such plan is already calculated. |
251 | * | 251 | * |
252 | * @return a previously calculated search plan for the given query and adornment, or null if no such plan exists | 252 | * @return a previously calculated search plan for the given query and adornment, or null if no such plan exists |
253 | * @since 2.0 | 253 | * @since 2.0 |
254 | */ | 254 | */ |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchGenericBackendFactory.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchGenericBackendFactory.java index 1dd08f98..4bdf0de4 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchGenericBackendFactory.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchGenericBackendFactory.java | |||
@@ -3,17 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher.integration; | 9 | package tools.refinery.interpreter.localsearch.matcher.integration; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.backend.IMatcherCapability; | 11 | import tools.refinery.interpreter.matchers.backend.IMatcherCapability; |
12 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackend; | 12 | import tools.refinery.interpreter.matchers.backend.IQueryBackend; |
13 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendFactory; | 13 | import tools.refinery.interpreter.matchers.backend.IQueryBackendFactory; |
14 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 14 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
15 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 15 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 16 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * @author Marton Bur, Zoltan Ujhelyi | 19 | * @author Marton Bur, Zoltan Ujhelyi |
@@ -21,29 +21,29 @@ import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | |||
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | public enum LocalSearchGenericBackendFactory implements IQueryBackendFactory { | 23 | public enum LocalSearchGenericBackendFactory implements IQueryBackendFactory { |
24 | 24 | ||
25 | INSTANCE; | 25 | INSTANCE; |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * @since 1.5 | 28 | * @since 1.5 |
29 | */ | 29 | */ |
30 | @Override | 30 | @Override |
31 | public IQueryBackend create(IQueryBackendContext context) { | 31 | public IQueryBackend create(IQueryBackendContext context) { |
32 | return new LocalSearchBackend(context) { | 32 | return new LocalSearchBackend(context) { |
33 | 33 | ||
34 | @Override | 34 | @Override |
35 | protected AbstractLocalSearchResultProvider initializeResultProvider(PQuery query, QueryEvaluationHint hints) { | 35 | protected AbstractLocalSearchResultProvider initializeResultProvider(PQuery query, QueryEvaluationHint hints) { |
36 | return new GenericLocalSearchResultProvider(this, context, query, planProvider, hints); | 36 | return new GenericLocalSearchResultProvider(this, context, query, planProvider, hints); |
37 | } | 37 | } |
38 | 38 | ||
39 | @Override | 39 | @Override |
40 | public IQueryBackendFactory getFactory() { | 40 | public IQueryBackendFactory getFactory() { |
41 | return INSTANCE; | 41 | return INSTANCE; |
42 | } | 42 | } |
43 | 43 | ||
44 | }; | 44 | }; |
45 | } | 45 | } |
46 | 46 | ||
47 | @Override | 47 | @Override |
48 | public Class<? extends IQueryBackend> getBackendClass() { | 48 | public Class<? extends IQueryBackend> getBackendClass() { |
49 | return LocalSearchBackend.class; | 49 | return LocalSearchBackend.class; |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchGenericBackendFactoryProvider.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchGenericBackendFactoryProvider.java index ea422d91..cfa310f7 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchGenericBackendFactoryProvider.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchGenericBackendFactoryProvider.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher.integration; | 9 | package tools.refinery.interpreter.localsearch.matcher.integration; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendFactory; | 11 | import tools.refinery.interpreter.matchers.backend.IQueryBackendFactory; |
12 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendFactoryProvider; | 12 | import tools.refinery.interpreter.matchers.backend.IQueryBackendFactoryProvider; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * @since 2.0 | 15 | * @since 2.0 |
16 | */ | 16 | */ |
17 | public class LocalSearchGenericBackendFactoryProvider implements IQueryBackendFactoryProvider { | 17 | public class LocalSearchGenericBackendFactoryProvider implements IQueryBackendFactoryProvider { |
18 | 18 | ||
19 | @Override | 19 | @Override |
20 | public IQueryBackendFactory getFactory() { | 20 | public IQueryBackendFactory getFactory() { |
21 | return LocalSearchGenericBackendFactory.INSTANCE; | 21 | return LocalSearchGenericBackendFactory.INSTANCE; |
22 | } | 22 | } |
23 | 23 | ||
24 | } \ No newline at end of file | 24 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchHintOptions.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchHintOptions.java index 43462204..534d6c04 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchHintOptions.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchHintOptions.java | |||
@@ -3,66 +3,66 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher.integration; | 9 | package tools.refinery.interpreter.localsearch.matcher.integration; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.localsearch.planner.cost.ICostFunction; | 11 | import tools.refinery.interpreter.localsearch.planner.cost.ICostFunction; |
12 | import tools.refinery.viatra.runtime.localsearch.planner.cost.impl.IndexerBasedConstraintCostFunction; | 12 | import tools.refinery.interpreter.localsearch.planner.cost.impl.IndexerBasedConstraintCostFunction; |
13 | import tools.refinery.viatra.runtime.matchers.backend.ICallDelegationStrategy; | 13 | import tools.refinery.interpreter.matchers.backend.ICallDelegationStrategy; |
14 | import tools.refinery.viatra.runtime.matchers.backend.QueryHintOption; | 14 | import tools.refinery.interpreter.matchers.backend.QueryHintOption; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.IFlattenCallPredicate; | 15 | import tools.refinery.interpreter.matchers.psystem.rewriters.IFlattenCallPredicate; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * | 18 | * |
19 | * @author Gabor Bergmann | 19 | * @author Gabor Bergmann |
20 | * @since 1.5 | 20 | * @since 1.5 |
21 | * @noinstantiate This class is not intended to be instantiated by clients. | 21 | * @noinstantiate This class is not intended to be instantiated by clients. |
22 | */ | 22 | */ |
23 | public final class LocalSearchHintOptions { | 23 | public final class LocalSearchHintOptions { |
24 | 24 | ||
25 | private LocalSearchHintOptions() { | 25 | private LocalSearchHintOptions() { |
26 | // Private constructor for utility class | 26 | // Private constructor for utility class |
27 | } | 27 | } |
28 | 28 | ||
29 | public static final QueryHintOption<Boolean> USE_BASE_INDEX = | 29 | public static final QueryHintOption<Boolean> USE_BASE_INDEX = |
30 | hintOption("USE_BASE_INDEX", true); | 30 | hintOption("USE_BASE_INDEX", true); |
31 | 31 | ||
32 | // This key can be used to influence the core planner algorithm | 32 | // This key can be used to influence the core planner algorithm |
33 | public static final QueryHintOption<Integer> PLANNER_TABLE_ROW_COUNT = | 33 | public static final QueryHintOption<Integer> PLANNER_TABLE_ROW_COUNT = |
34 | hintOption("PLANNER_TABLE_ROW_COUNT", 4); | 34 | hintOption("PLANNER_TABLE_ROW_COUNT", 4); |
35 | /** | 35 | /** |
36 | * Cost function to be used by the planner. Must implement {@link ICostFunction} | 36 | * Cost function to be used by the planner. Must implement {@link ICostFunction} |
37 | * @since 1.4 | 37 | * @since 1.4 |
38 | */ | 38 | */ |
39 | public static final QueryHintOption<ICostFunction> PLANNER_COST_FUNCTION = | 39 | public static final QueryHintOption<ICostFunction> PLANNER_COST_FUNCTION = |
40 | hintOption("PLANNER_COST_FUNCTION", new IndexerBasedConstraintCostFunction()); | 40 | hintOption("PLANNER_COST_FUNCTION", new IndexerBasedConstraintCostFunction()); |
41 | /** | 41 | /** |
42 | * Predicate to decide whether to flatten specific positive pattern calls {@link IFlattenCallPredicate} | 42 | * Predicate to decide whether to flatten specific positive pattern calls {@link IFlattenCallPredicate} |
43 | * @since 1.4 | 43 | * @since 1.4 |
44 | */ | 44 | */ |
45 | public static final QueryHintOption<IFlattenCallPredicate> FLATTEN_CALL_PREDICATE = | 45 | public static final QueryHintOption<IFlattenCallPredicate> FLATTEN_CALL_PREDICATE = |
46 | hintOption("FLATTEN_CALL_PREDICATE", new DontFlattenDisjunctive()); | 46 | hintOption("FLATTEN_CALL_PREDICATE", new DontFlattenDisjunctive()); |
47 | /** | 47 | /** |
48 | * Strategy to decide how hints (most importantly, backend selection) propagate across pattern calls. | 48 | * Strategy to decide how hints (most importantly, backend selection) propagate across pattern calls. |
49 | * Must implement {@link ICallDelegationStrategy}. | 49 | * Must implement {@link ICallDelegationStrategy}. |
50 | * @since 2.1 | 50 | * @since 2.1 |
51 | */ | 51 | */ |
52 | public static final QueryHintOption<ICallDelegationStrategy> CALL_DELEGATION_STRATEGY = | 52 | public static final QueryHintOption<ICallDelegationStrategy> CALL_DELEGATION_STRATEGY = |
53 | hintOption("CALL_DELEGATION_STRATEGY", ICallDelegationStrategy.FULL_BACKEND_ADHESION); | 53 | hintOption("CALL_DELEGATION_STRATEGY", ICallDelegationStrategy.FULL_BACKEND_ADHESION); |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * A provider of expected adornments {@link IAdornmentProvider}. | 56 | * A provider of expected adornments {@link IAdornmentProvider}. |
57 | * | 57 | * |
58 | * The safe default is {@link AllValidAdornments}; | 58 | * The safe default is {@link AllValidAdornments}; |
59 | * however, the generic backend variant may safely use {@link LazyPlanningAdornments} instead. | 59 | * however, the generic backend variant may safely use {@link LazyPlanningAdornments} instead. |
60 | * | 60 | * |
61 | * @since 1.5 | 61 | * @since 1.5 |
62 | */ | 62 | */ |
63 | public static final QueryHintOption<IAdornmentProvider> ADORNMENT_PROVIDER = | 63 | public static final QueryHintOption<IAdornmentProvider> ADORNMENT_PROVIDER = |
64 | hintOption("ADORNMENT_PROVIDER", new AllValidAdornments()); | 64 | hintOption("ADORNMENT_PROVIDER", new AllValidAdornments()); |
65 | 65 | ||
66 | // internal helper for conciseness | 66 | // internal helper for conciseness |
67 | private static <T, V extends T> QueryHintOption<T> hintOption(String hintKeyLocalName, V defaultValue) { | 67 | private static <T, V extends T> QueryHintOption<T> hintOption(String hintKeyLocalName, V defaultValue) { |
68 | return new QueryHintOption<>(LocalSearchHintOptions.class, hintKeyLocalName, defaultValue); | 68 | return new QueryHintOption<>(LocalSearchHintOptions.class, hintKeyLocalName, defaultValue); |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchHints.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchHints.java index 5f3895be..5ccae128 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/LocalSearchHints.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/matcher/integration/LocalSearchHints.java | |||
@@ -6,22 +6,22 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.matcher.integration; | 9 | package tools.refinery.interpreter.localsearch.matcher.integration; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.localsearch.planner.cost.ICostFunction; | 11 | import tools.refinery.interpreter.localsearch.planner.cost.ICostFunction; |
12 | import tools.refinery.viatra.runtime.localsearch.planner.cost.impl.IndexerBasedConstraintCostFunction; | 12 | import tools.refinery.interpreter.localsearch.planner.cost.impl.IndexerBasedConstraintCostFunction; |
13 | import tools.refinery.viatra.runtime.localsearch.planner.cost.impl.StatisticsBasedConstraintCostFunction; | 13 | import tools.refinery.interpreter.localsearch.planner.cost.impl.StatisticsBasedConstraintCostFunction; |
14 | import tools.refinery.viatra.runtime.matchers.backend.*; | 14 | import tools.refinery.interpreter.matchers.backend.*; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.IFlattenCallPredicate; | 15 | import tools.refinery.interpreter.matchers.psystem.rewriters.IFlattenCallPredicate; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.IRewriterTraceCollector; | 16 | import tools.refinery.interpreter.matchers.psystem.rewriters.IRewriterTraceCollector; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.NopTraceCollector; | 17 | import tools.refinery.interpreter.matchers.psystem.rewriters.NopTraceCollector; |
18 | 18 | ||
19 | import java.util.HashMap; | 19 | import java.util.HashMap; |
20 | import java.util.Map; | 20 | import java.util.Map; |
21 | import java.util.Objects; | 21 | import java.util.Objects; |
22 | 22 | ||
23 | import static tools.refinery.viatra.runtime.localsearch.matcher.integration.LocalSearchHintOptions.*; | 23 | import static tools.refinery.interpreter.localsearch.matcher.integration.LocalSearchHintOptions.*; |
24 | import static tools.refinery.viatra.runtime.matchers.backend.CommonQueryHintOptions.normalizationTraceCollector; | 24 | import static tools.refinery.interpreter.matchers.backend.CommonQueryHintOptions.normalizationTraceCollector; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Type safe builder and extractor for Local search specific hints | 27 | * Type safe builder and extractor for Local search specific hints |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/CheckOperationExecutor.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/CheckOperationExecutor.java index 295ac110..cd66efbd 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/CheckOperationExecutor.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/CheckOperationExecutor.java | |||
@@ -3,22 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations; | 9 | package tools.refinery.interpreter.localsearch.operations; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 11 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
12 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 12 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
13 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation.ISearchOperationExecutor; | ||
14 | 13 | ||
15 | /** | 14 | /** |
16 | * Abstract base class for search operations that check only the already set variables. | 15 | * Abstract base class for search operations that check only the already set variables. |
17 | * | 16 | * |
18 | * @noextend This class is not intended to be subclassed by clients. | 17 | * @noextend This class is not intended to be subclassed by clients. |
19 | * @since 2.0 | 18 | * @since 2.0 |
20 | */ | 19 | */ |
21 | public abstract class CheckOperationExecutor implements ISearchOperationExecutor { | 20 | public abstract class CheckOperationExecutor implements ISearchOperation.ISearchOperationExecutor { |
22 | 21 | ||
23 | /** | 22 | /** |
24 | * The executed field ensures that the second call of the check always returns false, resulting in a quick | 23 | * The executed field ensures that the second call of the check always returns false, resulting in a quick |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/ExtendOperationExecutor.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/ExtendOperationExecutor.java index a72c30dd..ecf2952c 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/ExtendOperationExecutor.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/ExtendOperationExecutor.java | |||
@@ -7,11 +7,10 @@ | |||
7 | * | 7 | * |
8 | * SPDX-License-Identifier: EPL-2.0 | 8 | * SPDX-License-Identifier: EPL-2.0 |
9 | *******************************************************************************/ | 9 | *******************************************************************************/ |
10 | package tools.refinery.viatra.runtime.localsearch.operations; | 10 | package tools.refinery.interpreter.localsearch.operations; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 12 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
13 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 13 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
14 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation.ISearchOperationExecutor; | ||
15 | 14 | ||
16 | import java.util.Iterator; | 15 | import java.util.Iterator; |
17 | 16 | ||
@@ -21,7 +20,7 @@ import java.util.Iterator; | |||
21 | * @noextend This class is not intended to be subclassed by clients. | 20 | * @noextend This class is not intended to be subclassed by clients. |
22 | * @since 2.0 | 21 | * @since 2.0 |
23 | */ | 22 | */ |
24 | public abstract class ExtendOperationExecutor<T> implements ISearchOperationExecutor { | 23 | public abstract class ExtendOperationExecutor<T> implements ISearchOperation.ISearchOperationExecutor { |
25 | 24 | ||
26 | private Iterator<? extends T> it; | 25 | private Iterator<? extends T> it; |
27 | 26 | ||
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/IIteratingSearchOperation.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/IIteratingSearchOperation.java index 6fee0097..85f0b6ac 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/IIteratingSearchOperation.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/IIteratingSearchOperation.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations; | 9 | package tools.refinery.interpreter.localsearch.operations; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 11 | import tools.refinery.interpreter.matchers.context.IInputKey; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Denotes a {@link ISearchOperation} which involves iterating over an instances of an {@link IInputKey} | 14 | * Denotes a {@link ISearchOperation} which involves iterating over an instances of an {@link IInputKey} |
15 | * | 15 | * |
16 | * @author Grill Balázs | 16 | * @author Grill Balázs |
17 | * @since 1.4 | 17 | * @since 1.4 |
18 | * | 18 | * |
@@ -23,5 +23,5 @@ public interface IIteratingSearchOperation extends ISearchOperation{ | |||
23 | * Get the {@link IInputKey} which instances this operation iterates upon. | 23 | * Get the {@link IInputKey} which instances this operation iterates upon. |
24 | */ | 24 | */ |
25 | public IInputKey getIteratedInputKey(); | 25 | public IInputKey getIteratedInputKey(); |
26 | 26 | ||
27 | } | 27 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/IPatternMatcherOperation.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/IPatternMatcherOperation.java index d8106329..f4a0f468 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/IPatternMatcherOperation.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/IPatternMatcherOperation.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations; | 9 | package tools.refinery.interpreter.localsearch.operations; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.localsearch.operations.util.CallInformation; | 11 | import tools.refinery.interpreter.localsearch.operations.util.CallInformation; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Marker interface for pattern matcher call operations, such as positive and negative pattern calls or match aggregators. | 14 | * Marker interface for pattern matcher call operations, such as positive and negative pattern calls or match aggregators. |
15 | * | 15 | * |
16 | * @author Zoltan Ujhelyi | 16 | * @author Zoltan Ujhelyi |
17 | * @since 1.7 | 17 | * @since 1.7 |
18 | */ | 18 | */ |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/ISearchOperation.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/ISearchOperation.java index eb6243ed..61519723 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/ISearchOperation.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/ISearchOperation.java | |||
@@ -3,75 +3,75 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations; | 9 | package tools.refinery.interpreter.localsearch.operations; |
10 | 10 | ||
11 | import java.util.List; | 11 | import java.util.List; |
12 | import java.util.function.Function; | 12 | import java.util.function.Function; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 14 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
15 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 15 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
16 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 16 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Represents a search operation executable by the LS engine. It is expected that an operation can be shared among | 19 | * Represents a search operation executable by the LS engine. It is expected that an operation can be shared among |
20 | * multiple LS matchers, but the created executors are not. | 20 | * multiple LS matchers, but the created executors are not. |
21 | * | 21 | * |
22 | * @author Zoltan Ujhelyi | 22 | * @author Zoltan Ujhelyi |
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | public interface ISearchOperation { | 25 | public interface ISearchOperation { |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * Initializes a new operation executor for the given operation. Repeated calls must return different executor | 28 | * Initializes a new operation executor for the given operation. Repeated calls must return different executor |
29 | * instances. | 29 | * instances. |
30 | * | 30 | * |
31 | * @since 2.0 | 31 | * @since 2.0 |
32 | */ | 32 | */ |
33 | public ISearchOperationExecutor createExecutor(); | 33 | public ISearchOperationExecutor createExecutor(); |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * | 36 | * |
37 | * @since 2.0 | 37 | * @since 2.0 |
38 | * | 38 | * |
39 | */ | 39 | */ |
40 | public interface ISearchOperationExecutor { | 40 | public interface ISearchOperationExecutor { |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Returns the stateless operation this executor was initialized from | 43 | * Returns the stateless operation this executor was initialized from |
44 | */ | 44 | */ |
45 | ISearchOperation getOperation(); | 45 | ISearchOperation getOperation(); |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * During the execution of the corresponding plan, the onInitialize callback is evaluated before the execution of | 48 | * During the execution of the corresponding plan, the onInitialize callback is evaluated before the execution of |
49 | * the operation may begin. Operations may use this method to initialize its internal data structures. | 49 | * the operation may begin. Operations may use this method to initialize its internal data structures. |
50 | * | 50 | * |
51 | * @throws ViatraQueryRuntimeException | 51 | * @throws InterpreterRuntimeException |
52 | */ | 52 | */ |
53 | void onInitialize(MatchingFrame frame, ISearchContext context); | 53 | void onInitialize(MatchingFrame frame, ISearchContext context); |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * After the execution of the operation failed and {@link #execute(MatchingFrame, ISearchContext)} returns false, the onBacktrack | 56 | * After the execution of the operation failed and {@link #execute(MatchingFrame, ISearchContext)} returns false, the onBacktrack |
57 | * callback is evaluated. Operations may use this method to clean up any temporary structures, and make the | 57 | * callback is evaluated. Operations may use this method to clean up any temporary structures, and make the |
58 | * operation ready for a new execution. | 58 | * operation ready for a new execution. |
59 | * | 59 | * |
60 | * @throws ViatraQueryRuntimeException | 60 | * @throws InterpreterRuntimeException |
61 | */ | 61 | */ |
62 | void onBacktrack(MatchingFrame frame, ISearchContext context); | 62 | void onBacktrack(MatchingFrame frame, ISearchContext context); |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * | 65 | * |
66 | * @param frame | 66 | * @param frame |
67 | * @param context | 67 | * @param context |
68 | * @return true if successful, or false if backtracking needed | 68 | * @return true if successful, or false if backtracking needed |
69 | * @throws ViatraQueryRuntimeException | 69 | * @throws InterpreterRuntimeException |
70 | */ | 70 | */ |
71 | boolean execute(MatchingFrame frame, ISearchContext context); | 71 | boolean execute(MatchingFrame frame, ISearchContext context); |
72 | } | 72 | } |
73 | /** | 73 | /** |
74 | * | 74 | * |
75 | * @return the ordered list of the variable numbers that are affected by the search operation | 75 | * @return the ordered list of the variable numbers that are affected by the search operation |
76 | */ | 76 | */ |
77 | List<Integer> getVariablePositions(); | 77 | List<Integer> getVariablePositions(); |
@@ -81,7 +81,7 @@ public interface ISearchOperation { | |||
81 | * parameter function. It is expected that the provided function does return a non-null value for each variable | 81 | * parameter function. It is expected that the provided function does return a non-null value for each variable |
82 | * index that is returned by {@link #getVariablePositions()}; otherwise a {@link NullPointerException} will be | 82 | * index that is returned by {@link #getVariablePositions()}; otherwise a {@link NullPointerException} will be |
83 | * thrown during the calculation of the string. | 83 | * thrown during the calculation of the string. |
84 | * | 84 | * |
85 | * @since 2.0 | 85 | * @since 2.0 |
86 | */ | 86 | */ |
87 | String toString(Function<Integer, String> variableMapping); | 87 | String toString(Function<Integer, String> variableMapping); |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/MatchingFrameValueProvider.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/MatchingFrameValueProvider.java index 38f62129..b7a0dba0 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/MatchingFrameValueProvider.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/MatchingFrameValueProvider.java | |||
@@ -3,28 +3,28 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations; | 9 | package tools.refinery.interpreter.localsearch.operations; |
10 | 10 | ||
11 | import java.util.Map; | 11 | import java.util.Map; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 13 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.IValueProvider; | 14 | import tools.refinery.interpreter.matchers.psystem.IValueProvider; |
15 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 15 | import tools.refinery.interpreter.matchers.util.Preconditions; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * | 18 | * |
19 | * | 19 | * |
20 | * @author Zoltan Ujhelyi | 20 | * @author Zoltan Ujhelyi |
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | public class MatchingFrameValueProvider implements IValueProvider { | 23 | public class MatchingFrameValueProvider implements IValueProvider { |
24 | 24 | ||
25 | final Map<String, Integer> nameMap; | 25 | final Map<String, Integer> nameMap; |
26 | final MatchingFrame frame; | 26 | final MatchingFrame frame; |
27 | 27 | ||
28 | public MatchingFrameValueProvider(MatchingFrame frame, Map<String, Integer> nameMap) { | 28 | public MatchingFrameValueProvider(MatchingFrame frame, Map<String, Integer> nameMap) { |
29 | super(); | 29 | super(); |
30 | this.frame = frame; | 30 | this.frame = frame; |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/AggregatorCheck.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/AggregatorCheck.java index 4d631635..440028ce 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/AggregatorCheck.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/AggregatorCheck.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.check; | 9 | package tools.refinery.interpreter.localsearch.operations.check; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.List; | 12 | import java.util.List; |
@@ -14,20 +14,20 @@ import java.util.Objects; | |||
14 | import java.util.function.Function; | 14 | import java.util.function.Function; |
15 | import java.util.stream.Stream; | 15 | import java.util.stream.Stream; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 17 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
18 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 18 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
19 | import tools.refinery.viatra.runtime.localsearch.operations.CheckOperationExecutor; | 19 | import tools.refinery.interpreter.localsearch.operations.CheckOperationExecutor; |
20 | import tools.refinery.viatra.runtime.localsearch.operations.IPatternMatcherOperation; | 20 | import tools.refinery.interpreter.localsearch.operations.IPatternMatcherOperation; |
21 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 21 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
22 | import tools.refinery.viatra.runtime.localsearch.operations.util.CallInformation; | 22 | import tools.refinery.interpreter.localsearch.operations.util.CallInformation; |
23 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 23 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 24 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | 25 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.AggregatorConstraint; |
26 | import tools.refinery.viatra.runtime.matchers.tuple.VolatileModifiableMaskedTuple; | 26 | import tools.refinery.interpreter.matchers.tuple.VolatileModifiableMaskedTuple; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Calculates the aggregated value of a column based on the given {@link AggregatorConstraint} | 29 | * Calculates the aggregated value of a column based on the given {@link AggregatorConstraint} |
30 | * | 30 | * |
31 | * @author Balázs Grill | 31 | * @author Balázs Grill |
32 | * @since 1.4 | 32 | * @since 1.4 |
33 | * @noextend This class is not intended to be subclassed by clients. | 33 | * @noextend This class is not intended to be subclassed by clients. |
@@ -35,15 +35,15 @@ import tools.refinery.viatra.runtime.matchers.tuple.VolatileModifiableMaskedTupl | |||
35 | public class AggregatorCheck implements ISearchOperation, IPatternMatcherOperation { | 35 | public class AggregatorCheck implements ISearchOperation, IPatternMatcherOperation { |
36 | 36 | ||
37 | private class Executor extends CheckOperationExecutor { | 37 | private class Executor extends CheckOperationExecutor { |
38 | 38 | ||
39 | private final VolatileModifiableMaskedTuple maskedTuple; | 39 | private final VolatileModifiableMaskedTuple maskedTuple; |
40 | private IQueryResultProvider matcher; | 40 | private IQueryResultProvider matcher; |
41 | 41 | ||
42 | public Executor() { | 42 | public Executor() { |
43 | super(); | 43 | super(); |
44 | this.maskedTuple = new VolatileModifiableMaskedTuple(information.getThinFrameMask()); | 44 | this.maskedTuple = new VolatileModifiableMaskedTuple(information.getThinFrameMask()); |
45 | } | 45 | } |
46 | 46 | ||
47 | @Override | 47 | @Override |
48 | public void onInitialize(MatchingFrame frame, ISearchContext context) { | 48 | public void onInitialize(MatchingFrame frame, ISearchContext context) { |
49 | super.onInitialize(frame, context); | 49 | super.onInitialize(frame, context); |
@@ -67,17 +67,17 @@ public class AggregatorCheck implements ISearchOperation, IPatternMatcherOperati | |||
67 | .map(match -> (Domain) match.get(aggregatedColumn)); | 67 | .map(match -> (Domain) match.get(aggregatedColumn)); |
68 | return operator.aggregateStream(valueStream); | 68 | return operator.aggregateStream(valueStream); |
69 | } | 69 | } |
70 | 70 | ||
71 | @Override | 71 | @Override |
72 | public ISearchOperation getOperation() { | 72 | public ISearchOperation getOperation() { |
73 | return AggregatorCheck.this; | 73 | return AggregatorCheck.this; |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | private final int position; | 77 | private final int position; |
78 | private final AggregatorConstraint aggregator; | 78 | private final AggregatorConstraint aggregator; |
79 | private final CallInformation information; | 79 | private final CallInformation information; |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * @since 1.7 | 82 | * @since 1.7 |
83 | */ | 83 | */ |
@@ -97,12 +97,12 @@ public class AggregatorCheck implements ISearchOperation, IPatternMatcherOperati | |||
97 | public List<Integer> getVariablePositions() { | 97 | public List<Integer> getVariablePositions() { |
98 | return Collections.singletonList(position); | 98 | return Collections.singletonList(position); |
99 | } | 99 | } |
100 | 100 | ||
101 | @Override | 101 | @Override |
102 | public String toString() { | 102 | public String toString() { |
103 | return toString(Object::toString); | 103 | return toString(Object::toString); |
104 | } | 104 | } |
105 | 105 | ||
106 | @Override | 106 | @Override |
107 | public String toString(Function<Integer, String> variableMapping) { | 107 | public String toString(Function<Integer, String> variableMapping) { |
108 | return "check "+variableMapping.apply(position)+" = " + aggregator.getAggregator().getOperator().getName() + " find " + information.toString(variableMapping); | 108 | return "check "+variableMapping.apply(position)+" = " + aggregator.getAggregator().getOperator().getName() + " find " + information.toString(variableMapping); |
@@ -112,5 +112,5 @@ public class AggregatorCheck implements ISearchOperation, IPatternMatcherOperati | |||
112 | public CallInformation getCallInformation() { | 112 | public CallInformation getCallInformation() { |
113 | return information; | 113 | return information; |
114 | } | 114 | } |
115 | 115 | ||
116 | } | 116 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/BinaryTransitiveClosureCheck.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/BinaryTransitiveClosureCheck.java index 8f818542..078d0722 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/BinaryTransitiveClosureCheck.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/BinaryTransitiveClosureCheck.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.check; | 9 | package tools.refinery.interpreter.localsearch.operations.check; |
10 | 10 | ||
11 | import java.util.Arrays; | 11 | import java.util.Arrays; |
12 | import java.util.HashSet; | 12 | import java.util.HashSet; |
@@ -17,28 +17,28 @@ import java.util.Queue; | |||
17 | import java.util.Set; | 17 | import java.util.Set; |
18 | import java.util.function.Function; | 18 | import java.util.function.Function; |
19 | 19 | ||
20 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 20 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
21 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 21 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
22 | import tools.refinery.viatra.runtime.localsearch.operations.CheckOperationExecutor; | 22 | import tools.refinery.interpreter.localsearch.operations.CheckOperationExecutor; |
23 | import tools.refinery.viatra.runtime.localsearch.operations.IPatternMatcherOperation; | 23 | import tools.refinery.interpreter.localsearch.operations.IPatternMatcherOperation; |
24 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 24 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
25 | import tools.refinery.viatra.runtime.localsearch.operations.util.CallInformation; | 25 | import tools.refinery.interpreter.localsearch.operations.util.CallInformation; |
26 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 26 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
27 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 27 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * Checking for a transitive closure expressed as a local search pattern matcher. The matched pattern must have two | 30 | * Checking for a transitive closure expressed as a local search pattern matcher. The matched pattern must have two |
31 | * parameters of the same model type. | 31 | * parameters of the same model type. |
32 | * | 32 | * |
33 | * @author Zoltan Ujhelyi | 33 | * @author Zoltan Ujhelyi |
34 | * @noextend This class is not intended to be subclassed by clients. | 34 | * @noextend This class is not intended to be subclassed by clients. |
35 | * @noinstantiate This class is not intended to be instantiated by clients. | 35 | * @noinstantiate This class is not intended to be instantiated by clients. |
36 | * | 36 | * |
37 | */ | 37 | */ |
38 | public class BinaryTransitiveClosureCheck implements ISearchOperation, IPatternMatcherOperation { | 38 | public class BinaryTransitiveClosureCheck implements ISearchOperation, IPatternMatcherOperation { |
39 | 39 | ||
40 | private class Executor extends CheckOperationExecutor { | 40 | private class Executor extends CheckOperationExecutor { |
41 | 41 | ||
42 | @Override | 42 | @Override |
43 | public void onInitialize(MatchingFrame frame, ISearchContext context) { | 43 | public void onInitialize(MatchingFrame frame, ISearchContext context) { |
44 | super.onInitialize(frame, context); | 44 | super.onInitialize(frame, context); |
@@ -51,7 +51,7 @@ public class BinaryTransitiveClosureCheck implements ISearchOperation, IPatternM | |||
51 | if (checkReflexive(frame)) { | 51 | if (checkReflexive(frame)) { |
52 | return true; | 52 | return true; |
53 | } | 53 | } |
54 | 54 | ||
55 | Object targetValue = frame.get(targetPosition); | 55 | Object targetValue = frame.get(targetPosition); |
56 | Queue<Object> sourcesToEvaluate = new LinkedList<>(); | 56 | Queue<Object> sourcesToEvaluate = new LinkedList<>(); |
57 | sourcesToEvaluate.add(frame.get(sourcePosition)); | 57 | sourcesToEvaluate.add(frame.get(sourcePosition)); |
@@ -72,29 +72,29 @@ public class BinaryTransitiveClosureCheck implements ISearchOperation, IPatternM | |||
72 | } | 72 | } |
73 | return false; | 73 | return false; |
74 | } | 74 | } |
75 | 75 | ||
76 | protected boolean checkReflexive(MatchingFrame frame) { | 76 | protected boolean checkReflexive(MatchingFrame frame) { |
77 | return reflexive && Objects.equals(frame.get(sourcePosition), frame.get(targetPosition)); | 77 | return reflexive && Objects.equals(frame.get(sourcePosition), frame.get(targetPosition)); |
78 | } | 78 | } |
79 | 79 | ||
80 | @Override | 80 | @Override |
81 | public ISearchOperation getOperation() { | 81 | public ISearchOperation getOperation() { |
82 | return BinaryTransitiveClosureCheck.this; | 82 | return BinaryTransitiveClosureCheck.this; |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | private final CallInformation information; | 86 | private final CallInformation information; |
87 | private IQueryResultProvider matcher; | 87 | private IQueryResultProvider matcher; |
88 | private final int sourcePosition; | 88 | private final int sourcePosition; |
89 | private final int targetPosition; | 89 | private final int targetPosition; |
90 | private final boolean reflexive; | 90 | private final boolean reflexive; |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * The source position will be matched in the called pattern to the first parameter; while target to the second. | 93 | * The source position will be matched in the called pattern to the first parameter; while target to the second. |
94 | * </p> | 94 | * </p> |
95 | * <strong>NOTE</strong>: the reflexive check call does not include the parameter type checks; appropriate type checks should be | 95 | * <strong>NOTE</strong>: the reflexive check call does not include the parameter type checks; appropriate type checks should be |
96 | * added as necessary by the operation compiler. | 96 | * added as necessary by the operation compiler. |
97 | * | 97 | * |
98 | * @since 2.0 | 98 | * @since 2.0 |
99 | */ | 99 | */ |
100 | public BinaryTransitiveClosureCheck(CallInformation information, int sourcePosition, int targetPosition, boolean reflexive) { | 100 | public BinaryTransitiveClosureCheck(CallInformation information, int sourcePosition, int targetPosition, boolean reflexive) { |
@@ -104,7 +104,7 @@ public class BinaryTransitiveClosureCheck implements ISearchOperation, IPatternM | |||
104 | this.information = information; | 104 | this.information = information; |
105 | this.reflexive = reflexive; | 105 | this.reflexive = reflexive; |
106 | } | 106 | } |
107 | 107 | ||
108 | @Override | 108 | @Override |
109 | public ISearchOperationExecutor createExecutor() { | 109 | public ISearchOperationExecutor createExecutor() { |
110 | return new Executor(); | 110 | return new Executor(); |
@@ -114,7 +114,7 @@ public class BinaryTransitiveClosureCheck implements ISearchOperation, IPatternM | |||
114 | public String toString() { | 114 | public String toString() { |
115 | return toString(Object::toString); | 115 | return toString(Object::toString); |
116 | } | 116 | } |
117 | 117 | ||
118 | @Override | 118 | @Override |
119 | public String toString(Function<Integer, String> variableMapping) { | 119 | public String toString(Function<Integer, String> variableMapping) { |
120 | String c = information.toString(variableMapping); | 120 | String c = information.toString(variableMapping); |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/CheckConstant.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/CheckConstant.java index 4ce48af0..4c39db6a 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/CheckConstant.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/CheckConstant.java | |||
@@ -3,42 +3,42 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.check; | 9 | package tools.refinery.interpreter.localsearch.operations.check; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.List; | 12 | import java.util.List; |
13 | import java.util.function.Function; | 13 | import java.util.function.Function; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 15 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
16 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 16 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
17 | import tools.refinery.viatra.runtime.localsearch.operations.CheckOperationExecutor; | 17 | import tools.refinery.interpreter.localsearch.operations.CheckOperationExecutor; |
18 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 18 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * This operation handles constants in search plans by checking if a variable is bound to a certain constant value. Such | 21 | * This operation handles constants in search plans by checking if a variable is bound to a certain constant value. Such |
22 | * operations should be executed as early as possible during plan execution. | 22 | * operations should be executed as early as possible during plan execution. |
23 | * | 23 | * |
24 | * @author Marton Bur | 24 | * @author Marton Bur |
25 | * @noextend This class is not intended to be subclassed by clients. | 25 | * @noextend This class is not intended to be subclassed by clients. |
26 | */ | 26 | */ |
27 | public class CheckConstant implements ISearchOperation { | 27 | public class CheckConstant implements ISearchOperation { |
28 | 28 | ||
29 | private class Executor extends CheckOperationExecutor { | 29 | private class Executor extends CheckOperationExecutor { |
30 | 30 | ||
31 | @Override | 31 | @Override |
32 | protected boolean check(MatchingFrame frame, ISearchContext context) { | 32 | protected boolean check(MatchingFrame frame, ISearchContext context) { |
33 | return frame.get(position).equals(value); | 33 | return frame.get(position).equals(value); |
34 | } | 34 | } |
35 | 35 | ||
36 | @Override | 36 | @Override |
37 | public ISearchOperation getOperation() { | 37 | public ISearchOperation getOperation() { |
38 | return CheckConstant.this; | 38 | return CheckConstant.this; |
39 | } | 39 | } |
40 | } | 40 | } |
41 | 41 | ||
42 | private int position; | 42 | private int position; |
43 | private Object value; | 43 | private Object value; |
44 | 44 | ||
@@ -56,15 +56,15 @@ public class CheckConstant implements ISearchOperation { | |||
56 | public List<Integer> getVariablePositions() { | 56 | public List<Integer> getVariablePositions() { |
57 | return Collections.singletonList(position); | 57 | return Collections.singletonList(position); |
58 | } | 58 | } |
59 | 59 | ||
60 | @Override | 60 | @Override |
61 | public String toString() { | 61 | public String toString() { |
62 | return toString(Object::toString); | 62 | return toString(Object::toString); |
63 | } | 63 | } |
64 | 64 | ||
65 | @Override | 65 | @Override |
66 | public String toString(Function<Integer, String> variableMapping) { | 66 | public String toString(Function<Integer, String> variableMapping) { |
67 | return "check constant "+variableMapping.apply(position)+"='"+value+"'"; | 67 | return "check constant "+variableMapping.apply(position)+"='"+value+"'"; |
68 | } | 68 | } |
69 | 69 | ||
70 | } | 70 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/CheckPositivePatternCall.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/CheckPositivePatternCall.java index 5f9b688a..8d9ae0e2 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/CheckPositivePatternCall.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/CheckPositivePatternCall.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.check; | 9 | package tools.refinery.interpreter.localsearch.operations.check; |
10 | 10 | ||
11 | import java.util.List; | 11 | import java.util.List; |
12 | import java.util.function.Function; | 12 | import java.util.function.Function; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 14 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
15 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 15 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
16 | import tools.refinery.viatra.runtime.localsearch.operations.CheckOperationExecutor; | 16 | import tools.refinery.interpreter.localsearch.operations.CheckOperationExecutor; |
17 | import tools.refinery.viatra.runtime.localsearch.operations.IPatternMatcherOperation; | 17 | import tools.refinery.interpreter.localsearch.operations.IPatternMatcherOperation; |
18 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 18 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
19 | import tools.refinery.viatra.runtime.localsearch.operations.util.CallInformation; | 19 | import tools.refinery.interpreter.localsearch.operations.util.CallInformation; |
20 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 20 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
21 | import tools.refinery.viatra.runtime.matchers.tuple.VolatileModifiableMaskedTuple; | 21 | import tools.refinery.interpreter.matchers.tuple.VolatileModifiableMaskedTuple; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * @author Grill Balázs | 24 | * @author Grill Balázs |
@@ -28,10 +28,10 @@ import tools.refinery.viatra.runtime.matchers.tuple.VolatileModifiableMaskedTupl | |||
28 | public class CheckPositivePatternCall implements ISearchOperation, IPatternMatcherOperation { | 28 | public class CheckPositivePatternCall implements ISearchOperation, IPatternMatcherOperation { |
29 | 29 | ||
30 | private class Executor extends CheckOperationExecutor { | 30 | private class Executor extends CheckOperationExecutor { |
31 | 31 | ||
32 | private final VolatileModifiableMaskedTuple maskedTuple; | 32 | private final VolatileModifiableMaskedTuple maskedTuple; |
33 | private IQueryResultProvider matcher; | 33 | private IQueryResultProvider matcher; |
34 | 34 | ||
35 | public Executor() { | 35 | public Executor() { |
36 | super(); | 36 | super(); |
37 | this.maskedTuple = new VolatileModifiableMaskedTuple(information.getThinFrameMask()); | 37 | this.maskedTuple = new VolatileModifiableMaskedTuple(information.getThinFrameMask()); |
@@ -43,21 +43,21 @@ public class CheckPositivePatternCall implements ISearchOperation, IPatternMatch | |||
43 | maskedTuple.updateTuple(frame); | 43 | maskedTuple.updateTuple(frame); |
44 | matcher = context.getMatcher(information.getCallWithAdornment()); | 44 | matcher = context.getMatcher(information.getCallWithAdornment()); |
45 | } | 45 | } |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * @since 1.5 | 48 | * @since 1.5 |
49 | */ | 49 | */ |
50 | protected boolean check(MatchingFrame frame, ISearchContext context) { | 50 | protected boolean check(MatchingFrame frame, ISearchContext context) { |
51 | return matcher.hasMatch(information.getParameterMask(), maskedTuple); | 51 | return matcher.hasMatch(information.getParameterMask(), maskedTuple); |
52 | } | 52 | } |
53 | 53 | ||
54 | @Override | 54 | @Override |
55 | public ISearchOperation getOperation() { | 55 | public ISearchOperation getOperation() { |
56 | return CheckPositivePatternCall.this; | 56 | return CheckPositivePatternCall.this; |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | private final CallInformation information; | 60 | private final CallInformation information; |
61 | 61 | ||
62 | 62 | ||
63 | /** | 63 | /** |
@@ -66,7 +66,7 @@ public class CheckPositivePatternCall implements ISearchOperation, IPatternMatch | |||
66 | public CheckPositivePatternCall(CallInformation information) { | 66 | public CheckPositivePatternCall(CallInformation information) { |
67 | super(); | 67 | super(); |
68 | this.information = information; | 68 | this.information = information; |
69 | 69 | ||
70 | } | 70 | } |
71 | 71 | ||
72 | @Override | 72 | @Override |
@@ -78,12 +78,12 @@ public class CheckPositivePatternCall implements ISearchOperation, IPatternMatch | |||
78 | public List<Integer> getVariablePositions() { | 78 | public List<Integer> getVariablePositions() { |
79 | return information.getVariablePositions(); | 79 | return information.getVariablePositions(); |
80 | } | 80 | } |
81 | 81 | ||
82 | @Override | 82 | @Override |
83 | public String toString() { | 83 | public String toString() { |
84 | return toString(Object::toString); | 84 | return toString(Object::toString); |
85 | } | 85 | } |
86 | 86 | ||
87 | @Override | 87 | @Override |
88 | public String toString(Function<Integer, String> variableMapping) { | 88 | public String toString(Function<Integer, String> variableMapping) { |
89 | return "check find "+information.toString(variableMapping); | 89 | return "check find "+information.toString(variableMapping); |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/CountCheck.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/CountCheck.java index d74c1c6f..c8e77a70 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/CountCheck.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/CountCheck.java | |||
@@ -3,63 +3,63 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.check; | 9 | package tools.refinery.interpreter.localsearch.operations.check; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.List; | 12 | import java.util.List; |
13 | import java.util.function.Function; | 13 | import java.util.function.Function; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 15 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
16 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 16 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
17 | import tools.refinery.viatra.runtime.localsearch.operations.CheckOperationExecutor; | 17 | import tools.refinery.interpreter.localsearch.operations.CheckOperationExecutor; |
18 | import tools.refinery.viatra.runtime.localsearch.operations.IPatternMatcherOperation; | 18 | import tools.refinery.interpreter.localsearch.operations.IPatternMatcherOperation; |
19 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 19 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
20 | import tools.refinery.viatra.runtime.localsearch.operations.util.CallInformation; | 20 | import tools.refinery.interpreter.localsearch.operations.util.CallInformation; |
21 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 21 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
22 | import tools.refinery.viatra.runtime.matchers.tuple.VolatileModifiableMaskedTuple; | 22 | import tools.refinery.interpreter.matchers.tuple.VolatileModifiableMaskedTuple; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Calculates the count of matches for a called matcher | 25 | * Calculates the count of matches for a called matcher |
26 | * | 26 | * |
27 | * @author Zoltan Ujhelyi | 27 | * @author Zoltan Ujhelyi |
28 | * @noextend This class is not intended to be subclassed by clients. | 28 | * @noextend This class is not intended to be subclassed by clients. |
29 | */ | 29 | */ |
30 | public class CountCheck implements ISearchOperation, IPatternMatcherOperation { | 30 | public class CountCheck implements ISearchOperation, IPatternMatcherOperation { |
31 | 31 | ||
32 | private class Executor extends CheckOperationExecutor { | 32 | private class Executor extends CheckOperationExecutor { |
33 | 33 | ||
34 | private final VolatileModifiableMaskedTuple maskedTuple; | 34 | private final VolatileModifiableMaskedTuple maskedTuple; |
35 | private IQueryResultProvider matcher; | 35 | private IQueryResultProvider matcher; |
36 | 36 | ||
37 | public Executor() { | 37 | public Executor() { |
38 | maskedTuple = new VolatileModifiableMaskedTuple(information.getThinFrameMask()); | 38 | maskedTuple = new VolatileModifiableMaskedTuple(information.getThinFrameMask()); |
39 | } | 39 | } |
40 | 40 | ||
41 | @Override | 41 | @Override |
42 | public void onInitialize(MatchingFrame frame, ISearchContext context) { | 42 | public void onInitialize(MatchingFrame frame, ISearchContext context) { |
43 | super.onInitialize(frame, context); | 43 | super.onInitialize(frame, context); |
44 | maskedTuple.updateTuple(frame); | 44 | maskedTuple.updateTuple(frame); |
45 | matcher = context.getMatcher(information.getCallWithAdornment()); | 45 | matcher = context.getMatcher(information.getCallWithAdornment()); |
46 | } | 46 | } |
47 | 47 | ||
48 | @Override | 48 | @Override |
49 | protected boolean check(MatchingFrame frame, ISearchContext context) { | 49 | protected boolean check(MatchingFrame frame, ISearchContext context) { |
50 | int count = matcher.countMatches(information.getParameterMask(), maskedTuple); | 50 | int count = matcher.countMatches(information.getParameterMask(), maskedTuple); |
51 | return ((Integer)frame.getValue(position)) == count; | 51 | return ((Integer)frame.getValue(position)) == count; |
52 | } | 52 | } |
53 | 53 | ||
54 | @Override | 54 | @Override |
55 | public ISearchOperation getOperation() { | 55 | public ISearchOperation getOperation() { |
56 | return CountCheck.this; | 56 | return CountCheck.this; |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | private final int position; | 60 | private final int position; |
61 | private final CallInformation information; | 61 | private final CallInformation information; |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * @since 1.7 | 64 | * @since 1.7 |
65 | */ | 65 | */ |
@@ -79,12 +79,12 @@ public class CountCheck implements ISearchOperation, IPatternMatcherOperation { | |||
79 | public List<Integer> getVariablePositions() { | 79 | public List<Integer> getVariablePositions() { |
80 | return Collections.singletonList(position); | 80 | return Collections.singletonList(position); |
81 | } | 81 | } |
82 | 82 | ||
83 | @Override | 83 | @Override |
84 | public String toString(Function<Integer, String> variableMapping) { | 84 | public String toString(Function<Integer, String> variableMapping) { |
85 | return "check "+variableMapping.apply(position)+" = count find "+ information.toString(variableMapping); | 85 | return "check "+variableMapping.apply(position)+" = count find "+ information.toString(variableMapping); |
86 | } | 86 | } |
87 | 87 | ||
88 | @Override | 88 | @Override |
89 | public CallInformation getCallInformation() { | 89 | public CallInformation getCallInformation() { |
90 | return information; | 90 | return information; |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/ExpressionCheck.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/ExpressionCheck.java index fc9efdca..5e34a7a7 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/ExpressionCheck.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/ExpressionCheck.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.check; | 9 | package tools.refinery.interpreter.localsearch.operations.check; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.List; | 12 | import java.util.List; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.function.Function; | 14 | import java.util.function.Function; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 16 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
17 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 17 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
18 | import tools.refinery.viatra.runtime.localsearch.operations.CheckOperationExecutor; | 18 | import tools.refinery.interpreter.localsearch.operations.CheckOperationExecutor; |
19 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 19 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
20 | import tools.refinery.viatra.runtime.localsearch.operations.MatchingFrameValueProvider; | 20 | import tools.refinery.interpreter.localsearch.operations.MatchingFrameValueProvider; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.IExpressionEvaluator; | 21 | import tools.refinery.interpreter.matchers.psystem.IExpressionEvaluator; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * @author Zoltan Ujhelyi | 24 | * @author Zoltan Ujhelyi |
@@ -27,7 +27,7 @@ import tools.refinery.viatra.runtime.matchers.psystem.IExpressionEvaluator; | |||
27 | public class ExpressionCheck implements ISearchOperation { | 27 | public class ExpressionCheck implements ISearchOperation { |
28 | 28 | ||
29 | private class Executor extends CheckOperationExecutor { | 29 | private class Executor extends CheckOperationExecutor { |
30 | 30 | ||
31 | @Override | 31 | @Override |
32 | protected boolean check(MatchingFrame frame, ISearchContext context) { | 32 | protected boolean check(MatchingFrame frame, ISearchContext context) { |
33 | try { | 33 | try { |
@@ -38,13 +38,13 @@ public class ExpressionCheck implements ISearchOperation { | |||
38 | return false; | 38 | return false; |
39 | } | 39 | } |
40 | } | 40 | } |
41 | 41 | ||
42 | @Override | 42 | @Override |
43 | public ISearchOperation getOperation() { | 43 | public ISearchOperation getOperation() { |
44 | return ExpressionCheck.this; | 44 | return ExpressionCheck.this; |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | IExpressionEvaluator evaluator; | 48 | IExpressionEvaluator evaluator; |
49 | Map<String, Integer> nameMap; | 49 | Map<String, Integer> nameMap; |
50 | 50 | ||
@@ -64,15 +64,15 @@ public class ExpressionCheck implements ISearchOperation { | |||
64 | // XXX not sure if this is the correct implementation to get the affected variable indicies | 64 | // XXX not sure if this is the correct implementation to get the affected variable indicies |
65 | return new ArrayList<>(nameMap.values()); | 65 | return new ArrayList<>(nameMap.values()); |
66 | } | 66 | } |
67 | 67 | ||
68 | @Override | 68 | @Override |
69 | public String toString() { | 69 | public String toString() { |
70 | return toString(Object::toString); | 70 | return toString(Object::toString); |
71 | } | 71 | } |
72 | 72 | ||
73 | @Override | 73 | @Override |
74 | public String toString(Function<Integer, String> variableMapping) { | 74 | public String toString(Function<Integer, String> variableMapping) { |
75 | return "check expression "+evaluator.getShortDescription(); | 75 | return "check expression "+evaluator.getShortDescription(); |
76 | } | 76 | } |
77 | 77 | ||
78 | } | 78 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/ExpressionEvalCheck.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/ExpressionEvalCheck.java index 5b1bca10..f4b6f903 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/ExpressionEvalCheck.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/ExpressionEvalCheck.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.check; | 9 | package tools.refinery.interpreter.localsearch.operations.check; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.List; | 12 | import java.util.List; |
@@ -14,12 +14,12 @@ import java.util.Map; | |||
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | import java.util.function.Function; | 15 | import java.util.function.Function; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 17 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
18 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 18 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
19 | import tools.refinery.viatra.runtime.localsearch.operations.CheckOperationExecutor; | 19 | import tools.refinery.interpreter.localsearch.operations.CheckOperationExecutor; |
20 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 20 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
21 | import tools.refinery.viatra.runtime.localsearch.operations.MatchingFrameValueProvider; | 21 | import tools.refinery.interpreter.localsearch.operations.MatchingFrameValueProvider; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.IExpressionEvaluator; | 22 | import tools.refinery.interpreter.matchers.psystem.IExpressionEvaluator; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * @author Grill Balázs | 25 | * @author Grill Balázs |
@@ -29,7 +29,7 @@ import tools.refinery.viatra.runtime.matchers.psystem.IExpressionEvaluator; | |||
29 | public class ExpressionEvalCheck implements ISearchOperation { | 29 | public class ExpressionEvalCheck implements ISearchOperation { |
30 | 30 | ||
31 | private class Executor extends CheckOperationExecutor { | 31 | private class Executor extends CheckOperationExecutor { |
32 | 32 | ||
33 | @Override | 33 | @Override |
34 | protected boolean check(MatchingFrame frame, ISearchContext context) { | 34 | protected boolean check(MatchingFrame frame, ISearchContext context) { |
35 | try { | 35 | try { |
@@ -46,22 +46,22 @@ public class ExpressionEvalCheck implements ISearchOperation { | |||
46 | } | 46 | } |
47 | return false; | 47 | return false; |
48 | } | 48 | } |
49 | 49 | ||
50 | @Override | 50 | @Override |
51 | public ISearchOperation getOperation() { | 51 | public ISearchOperation getOperation() { |
52 | return ExpressionEvalCheck.this; | 52 | return ExpressionEvalCheck.this; |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | private final int outputPosition; | 56 | private final int outputPosition; |
57 | private final IExpressionEvaluator evaluator; | 57 | private final IExpressionEvaluator evaluator; |
58 | private final Map<String, Integer> nameMap; | 58 | private final Map<String, Integer> nameMap; |
59 | private final boolean unwind; | 59 | private final boolean unwind; |
60 | 60 | ||
61 | public ExpressionEvalCheck(IExpressionEvaluator evaluator, Map<String, Integer> nameMap, int position) { | 61 | public ExpressionEvalCheck(IExpressionEvaluator evaluator, Map<String, Integer> nameMap, int position) { |
62 | this(evaluator, nameMap, false, position); | 62 | this(evaluator, nameMap, false, position); |
63 | } | 63 | } |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * @since 2.7 | 66 | * @since 2.7 |
67 | */ | 67 | */ |
@@ -87,7 +87,7 @@ public class ExpressionEvalCheck implements ISearchOperation { | |||
87 | public String toString() { | 87 | public String toString() { |
88 | return toString(Object::toString); | 88 | return toString(Object::toString); |
89 | } | 89 | } |
90 | 90 | ||
91 | @Override | 91 | @Override |
92 | public String toString(Function<Integer, String> variableMapping) { | 92 | public String toString(Function<Integer, String> variableMapping) { |
93 | return "check "+variableMapping.apply(outputPosition)+" = expression "+evaluator.getShortDescription(); | 93 | return "check "+variableMapping.apply(outputPosition)+" = expression "+evaluator.getShortDescription(); |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/InequalityCheck.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/InequalityCheck.java index 3f30c3c4..4383d5a7 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/InequalityCheck.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/InequalityCheck.java | |||
@@ -3,20 +3,20 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.check; | 9 | package tools.refinery.interpreter.localsearch.operations.check; |
10 | 10 | ||
11 | import java.util.Arrays; | 11 | import java.util.Arrays; |
12 | import java.util.List; | 12 | import java.util.List; |
13 | import java.util.function.Function; | 13 | import java.util.function.Function; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 15 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
16 | import tools.refinery.viatra.runtime.localsearch.exceptions.LocalSearchException; | 16 | import tools.refinery.interpreter.localsearch.exceptions.LocalSearchException; |
17 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 17 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
18 | import tools.refinery.viatra.runtime.localsearch.operations.CheckOperationExecutor; | 18 | import tools.refinery.interpreter.localsearch.operations.CheckOperationExecutor; |
19 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 19 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @author Zoltan Ujhelyi | 22 | * @author Zoltan Ujhelyi |
@@ -25,7 +25,7 @@ import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | |||
25 | public class InequalityCheck implements ISearchOperation { | 25 | public class InequalityCheck implements ISearchOperation { |
26 | 26 | ||
27 | private class Executor extends CheckOperationExecutor { | 27 | private class Executor extends CheckOperationExecutor { |
28 | 28 | ||
29 | @Override | 29 | @Override |
30 | protected boolean check(MatchingFrame frame, ISearchContext context) { | 30 | protected boolean check(MatchingFrame frame, ISearchContext context) { |
31 | Object source = frame.getValue(sourceLocation); | 31 | Object source = frame.getValue(sourceLocation); |
@@ -38,13 +38,13 @@ public class InequalityCheck implements ISearchOperation { | |||
38 | } | 38 | } |
39 | return !source.equals(target); | 39 | return !source.equals(target); |
40 | } | 40 | } |
41 | 41 | ||
42 | @Override | 42 | @Override |
43 | public ISearchOperation getOperation() { | 43 | public ISearchOperation getOperation() { |
44 | return InequalityCheck.this; | 44 | return InequalityCheck.this; |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | int sourceLocation; | 48 | int sourceLocation; |
49 | int targetLocation; | 49 | int targetLocation; |
50 | 50 | ||
@@ -53,17 +53,17 @@ public class InequalityCheck implements ISearchOperation { | |||
53 | this.sourceLocation = sourceLocation; | 53 | this.sourceLocation = sourceLocation; |
54 | this.targetLocation = targetLocation; | 54 | this.targetLocation = targetLocation; |
55 | } | 55 | } |
56 | 56 | ||
57 | @Override | 57 | @Override |
58 | public ISearchOperationExecutor createExecutor() { | 58 | public ISearchOperationExecutor createExecutor() { |
59 | return new Executor(); | 59 | return new Executor(); |
60 | } | 60 | } |
61 | 61 | ||
62 | @Override | 62 | @Override |
63 | public String toString() { | 63 | public String toString() { |
64 | return toString(Object::toString); | 64 | return toString(Object::toString); |
65 | } | 65 | } |
66 | 66 | ||
67 | @Override | 67 | @Override |
68 | public String toString(Function<Integer, String> variableMapping) { | 68 | public String toString(Function<Integer, String> variableMapping) { |
69 | return "check "+variableMapping.apply(sourceLocation)+" != "+variableMapping.apply(targetLocation); | 69 | return "check "+variableMapping.apply(sourceLocation)+" != "+variableMapping.apply(targetLocation); |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/NACOperation.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/NACOperation.java index 3759e1d1..0921678e 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/check/NACOperation.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/check/NACOperation.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.check; | 9 | package tools.refinery.interpreter.localsearch.operations.check; |
10 | 10 | ||
11 | import java.util.List; | 11 | import java.util.List; |
12 | import java.util.function.Function; | 12 | import java.util.function.Function; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 14 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
15 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 15 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
16 | import tools.refinery.viatra.runtime.localsearch.operations.CheckOperationExecutor; | 16 | import tools.refinery.interpreter.localsearch.operations.CheckOperationExecutor; |
17 | import tools.refinery.viatra.runtime.localsearch.operations.IPatternMatcherOperation; | 17 | import tools.refinery.interpreter.localsearch.operations.IPatternMatcherOperation; |
18 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 18 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
19 | import tools.refinery.viatra.runtime.localsearch.operations.util.CallInformation; | 19 | import tools.refinery.interpreter.localsearch.operations.util.CallInformation; |
20 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 20 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
21 | import tools.refinery.viatra.runtime.matchers.tuple.VolatileModifiableMaskedTuple; | 21 | import tools.refinery.interpreter.matchers.tuple.VolatileModifiableMaskedTuple; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * @author Zoltan Ujhelyi | 24 | * @author Zoltan Ujhelyi |
@@ -29,29 +29,29 @@ public class NACOperation implements ISearchOperation, IPatternMatcherOperation | |||
29 | private class Executor extends CheckOperationExecutor { | 29 | private class Executor extends CheckOperationExecutor { |
30 | private final VolatileModifiableMaskedTuple maskedTuple; | 30 | private final VolatileModifiableMaskedTuple maskedTuple; |
31 | private IQueryResultProvider matcher; | 31 | private IQueryResultProvider matcher; |
32 | 32 | ||
33 | private Executor() { | 33 | private Executor() { |
34 | this.maskedTuple = new VolatileModifiableMaskedTuple(information.getThinFrameMask()); | 34 | this.maskedTuple = new VolatileModifiableMaskedTuple(information.getThinFrameMask()); |
35 | } | 35 | } |
36 | 36 | ||
37 | @Override | 37 | @Override |
38 | public void onInitialize(MatchingFrame frame, ISearchContext context) { | 38 | public void onInitialize(MatchingFrame frame, ISearchContext context) { |
39 | super.onInitialize(frame, context); | 39 | super.onInitialize(frame, context); |
40 | maskedTuple.updateTuple(frame); | 40 | maskedTuple.updateTuple(frame); |
41 | matcher = context.getMatcher(information.getCallWithAdornment()); | 41 | matcher = context.getMatcher(information.getCallWithAdornment()); |
42 | } | 42 | } |
43 | 43 | ||
44 | @Override | 44 | @Override |
45 | protected boolean check(MatchingFrame frame, ISearchContext context) { | 45 | protected boolean check(MatchingFrame frame, ISearchContext context) { |
46 | return !matcher.hasMatch(information.getParameterMask(), maskedTuple); | 46 | return !matcher.hasMatch(information.getParameterMask(), maskedTuple); |
47 | } | 47 | } |
48 | 48 | ||
49 | @Override | 49 | @Override |
50 | public ISearchOperation getOperation() { | 50 | public ISearchOperation getOperation() { |
51 | return NACOperation.this; | 51 | return NACOperation.this; |
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
55 | private final CallInformation information; | 55 | private final CallInformation information; |
56 | 56 | ||
57 | /** | 57 | /** |
@@ -61,22 +61,22 @@ public class NACOperation implements ISearchOperation, IPatternMatcherOperation | |||
61 | super(); | 61 | super(); |
62 | this.information = information; | 62 | this.information = information; |
63 | } | 63 | } |
64 | 64 | ||
65 | @Override | 65 | @Override |
66 | public ISearchOperationExecutor createExecutor() { | 66 | public ISearchOperationExecutor createExecutor() { |
67 | return new Executor(); | 67 | return new Executor(); |
68 | } | 68 | } |
69 | 69 | ||
70 | @Override | 70 | @Override |
71 | public String toString() { | 71 | public String toString() { |
72 | return toString(Object::toString); | 72 | return toString(Object::toString); |
73 | } | 73 | } |
74 | 74 | ||
75 | @Override | 75 | @Override |
76 | public String toString(Function<Integer, String> variableMapping) { | 76 | public String toString(Function<Integer, String> variableMapping) { |
77 | return "check neg find "+information.toString(variableMapping); | 77 | return "check neg find "+information.toString(variableMapping); |
78 | } | 78 | } |
79 | 79 | ||
80 | @Override | 80 | @Override |
81 | public List<Integer> getVariablePositions() { | 81 | public List<Integer> getVariablePositions() { |
82 | return information.getVariablePositions(); | 82 | return information.getVariablePositions(); |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/AggregatorExtend.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/AggregatorExtend.java index c2e75b7a..19d0a41d 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/AggregatorExtend.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/AggregatorExtend.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.extend; | 9 | package tools.refinery.interpreter.localsearch.operations.extend; |
10 | 10 | ||
11 | import java.util.Arrays; | 11 | import java.util.Arrays; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -15,19 +15,19 @@ import java.util.List; | |||
15 | import java.util.function.Function; | 15 | import java.util.function.Function; |
16 | import java.util.stream.Stream; | 16 | import java.util.stream.Stream; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 18 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
19 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 19 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
20 | import tools.refinery.viatra.runtime.localsearch.operations.IPatternMatcherOperation; | 20 | import tools.refinery.interpreter.localsearch.operations.IPatternMatcherOperation; |
21 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 21 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
22 | import tools.refinery.viatra.runtime.localsearch.operations.util.CallInformation; | 22 | import tools.refinery.interpreter.localsearch.operations.util.CallInformation; |
23 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 23 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 24 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | 25 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.AggregatorConstraint; |
26 | import tools.refinery.viatra.runtime.matchers.tuple.VolatileModifiableMaskedTuple; | 26 | import tools.refinery.interpreter.matchers.tuple.VolatileModifiableMaskedTuple; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Calculates the aggregated value of a column based on the given {@link AggregatorConstraint} | 29 | * Calculates the aggregated value of a column based on the given {@link AggregatorConstraint} |
30 | * | 30 | * |
31 | * @author Balázs Grill | 31 | * @author Balázs Grill |
32 | * @since 1.4 | 32 | * @since 1.4 |
33 | */ | 33 | */ |
@@ -37,21 +37,21 @@ public class AggregatorExtend implements ISearchOperation, IPatternMatcherOpera | |||
37 | 37 | ||
38 | private final VolatileModifiableMaskedTuple maskedTuple; | 38 | private final VolatileModifiableMaskedTuple maskedTuple; |
39 | private IQueryResultProvider matcher; | 39 | private IQueryResultProvider matcher; |
40 | 40 | ||
41 | public Executor(int position) { | 41 | public Executor(int position) { |
42 | super(position); | 42 | super(position); |
43 | this.maskedTuple = new VolatileModifiableMaskedTuple(information.getThinFrameMask()); | 43 | this.maskedTuple = new VolatileModifiableMaskedTuple(information.getThinFrameMask()); |
44 | } | 44 | } |
45 | 45 | ||
46 | @Override | 46 | @Override |
47 | public Iterator<?> getIterator(MatchingFrame frame, ISearchContext context) { | 47 | public Iterator<?> getIterator(MatchingFrame frame, ISearchContext context) { |
48 | maskedTuple.updateTuple(frame); | 48 | maskedTuple.updateTuple(frame); |
49 | matcher = context.getMatcher(information.getCallWithAdornment()); | 49 | matcher = context.getMatcher(information.getCallWithAdornment()); |
50 | Object aggregate = aggregate(aggregator.getAggregator().getOperator(), aggregator.getAggregatedColumn()); | 50 | Object aggregate = aggregate(aggregator.getAggregator().getOperator(), aggregator.getAggregatedColumn()); |
51 | return aggregate == null ? Collections.emptyIterator() : Collections.singletonList(aggregate).iterator(); | 51 | return aggregate == null ? Collections.emptyIterator() : Collections.singletonList(aggregate).iterator(); |
52 | 52 | ||
53 | } | 53 | } |
54 | 54 | ||
55 | @SuppressWarnings("unchecked") | 55 | @SuppressWarnings("unchecked") |
56 | private <Domain, Accumulator, AggregateResult> AggregateResult aggregate( | 56 | private <Domain, Accumulator, AggregateResult> AggregateResult aggregate( |
57 | IMultisetAggregationOperator<Domain, Accumulator, AggregateResult> operator, int aggregatedColumn) { | 57 | IMultisetAggregationOperator<Domain, Accumulator, AggregateResult> operator, int aggregatedColumn) { |
@@ -59,17 +59,17 @@ public class AggregatorExtend implements ISearchOperation, IPatternMatcherOpera | |||
59 | .map(match -> (Domain) match.get(aggregatedColumn)); | 59 | .map(match -> (Domain) match.get(aggregatedColumn)); |
60 | return operator.aggregateStream(valueStream); | 60 | return operator.aggregateStream(valueStream); |
61 | } | 61 | } |
62 | 62 | ||
63 | @Override | 63 | @Override |
64 | public ISearchOperation getOperation() { | 64 | public ISearchOperation getOperation() { |
65 | return AggregatorExtend.this; | 65 | return AggregatorExtend.this; |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | private final AggregatorConstraint aggregator; | 69 | private final AggregatorConstraint aggregator; |
70 | private final CallInformation information; | 70 | private final CallInformation information; |
71 | private final int position; | 71 | private final int position; |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * @since 1.7 | 74 | * @since 1.7 |
75 | */ | 75 | */ |
@@ -78,7 +78,7 @@ public class AggregatorExtend implements ISearchOperation, IPatternMatcherOpera | |||
78 | this.information = information; | 78 | this.information = information; |
79 | this.position = position; | 79 | this.position = position; |
80 | } | 80 | } |
81 | 81 | ||
82 | @Override | 82 | @Override |
83 | public ISearchOperationExecutor createExecutor() { | 83 | public ISearchOperationExecutor createExecutor() { |
84 | return new Executor(position); | 84 | return new Executor(position); |
@@ -88,17 +88,17 @@ public class AggregatorExtend implements ISearchOperation, IPatternMatcherOpera | |||
88 | public List<Integer> getVariablePositions() { | 88 | public List<Integer> getVariablePositions() { |
89 | return Arrays.asList(position); | 89 | return Arrays.asList(position); |
90 | } | 90 | } |
91 | 91 | ||
92 | @Override | 92 | @Override |
93 | public String toString() { | 93 | public String toString() { |
94 | return toString(Object::toString); | 94 | return toString(Object::toString); |
95 | } | 95 | } |
96 | 96 | ||
97 | @Override | 97 | @Override |
98 | public String toString(Function<Integer, String> variableMapping) { | 98 | public String toString(Function<Integer, String> variableMapping) { |
99 | return "extend -"+variableMapping.apply(position)+" = " + aggregator.getAggregator().getOperator().getName()+" find " + information.toString(variableMapping); | 99 | return "extend -"+variableMapping.apply(position)+" = " + aggregator.getAggregator().getOperator().getName()+" find " + information.toString(variableMapping); |
100 | } | 100 | } |
101 | 101 | ||
102 | @Override | 102 | @Override |
103 | public CallInformation getCallInformation() { | 103 | public CallInformation getCallInformation() { |
104 | return information; | 104 | return information; |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/CountOperation.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/CountOperation.java index 08ecc8d6..1451f92d 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/CountOperation.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/CountOperation.java | |||
@@ -3,27 +3,27 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.extend; | 9 | package tools.refinery.interpreter.localsearch.operations.extend; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
13 | import java.util.List; | 13 | import java.util.List; |
14 | import java.util.function.Function; | 14 | import java.util.function.Function; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 16 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
17 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 17 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
18 | import tools.refinery.viatra.runtime.localsearch.operations.IPatternMatcherOperation; | 18 | import tools.refinery.interpreter.localsearch.operations.IPatternMatcherOperation; |
19 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 19 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
20 | import tools.refinery.viatra.runtime.localsearch.operations.util.CallInformation; | 20 | import tools.refinery.interpreter.localsearch.operations.util.CallInformation; |
21 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 21 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
22 | import tools.refinery.viatra.runtime.matchers.tuple.VolatileModifiableMaskedTuple; | 22 | import tools.refinery.interpreter.matchers.tuple.VolatileModifiableMaskedTuple; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Calculates the count of matches for a called matcher | 25 | * Calculates the count of matches for a called matcher |
26 | * | 26 | * |
27 | * @author Zoltan Ujhelyi | 27 | * @author Zoltan Ujhelyi |
28 | */ | 28 | */ |
29 | public class CountOperation implements ISearchOperation, IPatternMatcherOperation{ | 29 | public class CountOperation implements ISearchOperation, IPatternMatcherOperation{ |
@@ -31,28 +31,28 @@ public class CountOperation implements ISearchOperation, IPatternMatcherOperatio | |||
31 | private class Executor extends SingleValueExtendOperationExecutor<Integer> { | 31 | private class Executor extends SingleValueExtendOperationExecutor<Integer> { |
32 | private final VolatileModifiableMaskedTuple maskedTuple; | 32 | private final VolatileModifiableMaskedTuple maskedTuple; |
33 | private IQueryResultProvider matcher; | 33 | private IQueryResultProvider matcher; |
34 | 34 | ||
35 | public Executor(int position) { | 35 | public Executor(int position) { |
36 | super(position); | 36 | super(position); |
37 | maskedTuple = new VolatileModifiableMaskedTuple(information.getThinFrameMask()); | 37 | maskedTuple = new VolatileModifiableMaskedTuple(information.getThinFrameMask()); |
38 | } | 38 | } |
39 | 39 | ||
40 | @Override | 40 | @Override |
41 | public Iterator<Integer> getIterator(MatchingFrame frame, ISearchContext context) { | 41 | public Iterator<Integer> getIterator(MatchingFrame frame, ISearchContext context) { |
42 | matcher = context.getMatcher(information.getCallWithAdornment()); | 42 | matcher = context.getMatcher(information.getCallWithAdornment()); |
43 | maskedTuple.updateTuple(frame); | 43 | maskedTuple.updateTuple(frame); |
44 | return Collections.singletonList(matcher.countMatches(information.getParameterMask(), maskedTuple)).iterator(); | 44 | return Collections.singletonList(matcher.countMatches(information.getParameterMask(), maskedTuple)).iterator(); |
45 | } | 45 | } |
46 | 46 | ||
47 | @Override | 47 | @Override |
48 | public ISearchOperation getOperation() { | 48 | public ISearchOperation getOperation() { |
49 | return CountOperation.this; | 49 | return CountOperation.this; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | private final CallInformation information; | 53 | private final CallInformation information; |
54 | private final int position; | 54 | private final int position; |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * @since 1.7 | 57 | * @since 1.7 |
58 | */ | 58 | */ |
@@ -75,12 +75,12 @@ public class CountOperation implements ISearchOperation, IPatternMatcherOperatio | |||
75 | public String toString() { | 75 | public String toString() { |
76 | return toString(Object::toString); | 76 | return toString(Object::toString); |
77 | } | 77 | } |
78 | 78 | ||
79 | @Override | 79 | @Override |
80 | public String toString(Function<Integer, String> variableMapping) { | 80 | public String toString(Function<Integer, String> variableMapping) { |
81 | return "extend -"+variableMapping.apply(position)+" = count find " + information.toString(variableMapping); | 81 | return "extend -"+variableMapping.apply(position)+" = count find " + information.toString(variableMapping); |
82 | } | 82 | } |
83 | 83 | ||
84 | @Override | 84 | @Override |
85 | public CallInformation getCallInformation() { | 85 | public CallInformation getCallInformation() { |
86 | return information; | 86 | return information; |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/ExpressionEval.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/ExpressionEval.java index 7186f4ac..bdd16265 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/ExpressionEval.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/ExpressionEval.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.extend; | 9 | package tools.refinery.interpreter.localsearch.operations.extend; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -16,17 +16,17 @@ import java.util.Map; | |||
16 | import java.util.Set; | 16 | import java.util.Set; |
17 | import java.util.function.Function; | 17 | import java.util.function.Function; |
18 | 18 | ||
19 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 19 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
20 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 20 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
21 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 21 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
22 | import tools.refinery.viatra.runtime.localsearch.operations.MatchingFrameValueProvider; | 22 | import tools.refinery.interpreter.localsearch.operations.MatchingFrameValueProvider; |
23 | import tools.refinery.viatra.runtime.matchers.psystem.IExpressionEvaluator; | 23 | import tools.refinery.interpreter.matchers.psystem.IExpressionEvaluator; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * Calculates the result of an expression and stores it inside a variable for future reference. | 26 | * Calculates the result of an expression and stores it inside a variable for future reference. |
27 | * | 27 | * |
28 | * @author Zoltan Ujhelyi | 28 | * @author Zoltan Ujhelyi |
29 | * | 29 | * |
30 | */ | 30 | */ |
31 | public class ExpressionEval implements ISearchOperation { | 31 | public class ExpressionEval implements ISearchOperation { |
32 | 32 | ||
@@ -35,7 +35,7 @@ public class ExpressionEval implements ISearchOperation { | |||
35 | public Executor(int position) { | 35 | public Executor(int position) { |
36 | super(position); | 36 | super(position); |
37 | } | 37 | } |
38 | 38 | ||
39 | @Override | 39 | @Override |
40 | public Iterator<?> getIterator(MatchingFrame frame, ISearchContext context) { | 40 | public Iterator<?> getIterator(MatchingFrame frame, ISearchContext context) { |
41 | try { | 41 | try { |
@@ -52,13 +52,13 @@ public class ExpressionEval implements ISearchOperation { | |||
52 | return Collections.emptyIterator(); | 52 | return Collections.emptyIterator(); |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | @Override | 56 | @Override |
57 | public ISearchOperation getOperation() { | 57 | public ISearchOperation getOperation() { |
58 | return ExpressionEval.this; | 58 | return ExpressionEval.this; |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | private final IExpressionEvaluator evaluator; | 62 | private final IExpressionEvaluator evaluator; |
63 | private final boolean unwind; | 63 | private final boolean unwind; |
64 | private final Map<String, Integer> nameMap; | 64 | private final Map<String, Integer> nameMap; |
@@ -67,7 +67,7 @@ public class ExpressionEval implements ISearchOperation { | |||
67 | public ExpressionEval(IExpressionEvaluator evaluator, Map<String, Integer> nameMap, int position) { | 67 | public ExpressionEval(IExpressionEvaluator evaluator, Map<String, Integer> nameMap, int position) { |
68 | this(evaluator, nameMap, false, position); | 68 | this(evaluator, nameMap, false, position); |
69 | } | 69 | } |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * @since 2.7 | 72 | * @since 2.7 |
73 | */ | 73 | */ |
@@ -77,17 +77,17 @@ public class ExpressionEval implements ISearchOperation { | |||
77 | this.unwind = unwind; | 77 | this.unwind = unwind; |
78 | this.position = position; | 78 | this.position = position; |
79 | } | 79 | } |
80 | 80 | ||
81 | @Override | 81 | @Override |
82 | public String toString() { | 82 | public String toString() { |
83 | return toString(Object::toString); | 83 | return toString(Object::toString); |
84 | } | 84 | } |
85 | 85 | ||
86 | @Override | 86 | @Override |
87 | public String toString(Function<Integer, String> variableMapping) { | 87 | public String toString(Function<Integer, String> variableMapping) { |
88 | return "extend -"+variableMapping.apply(position)+" = expression "+evaluator.getShortDescription(); | 88 | return "extend -"+variableMapping.apply(position)+" = expression "+evaluator.getShortDescription(); |
89 | } | 89 | } |
90 | 90 | ||
91 | @Override | 91 | @Override |
92 | public ISearchOperationExecutor createExecutor() { | 92 | public ISearchOperationExecutor createExecutor() { |
93 | return new Executor(position); | 93 | return new Executor(position); |
@@ -100,5 +100,5 @@ public class ExpressionEval implements ISearchOperation { | |||
100 | variables.addAll(nameMap.values()); | 100 | variables.addAll(nameMap.values()); |
101 | return variables; | 101 | return variables; |
102 | } | 102 | } |
103 | 103 | ||
104 | } | 104 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/ExtendBinaryTransitiveClosure.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/ExtendBinaryTransitiveClosure.java index 1250e84e..ae6bc30c 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/ExtendBinaryTransitiveClosure.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/ExtendBinaryTransitiveClosure.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.extend; | 9 | package tools.refinery.interpreter.localsearch.operations.extend; |
10 | 10 | ||
11 | import java.util.Arrays; | 11 | import java.util.Arrays; |
12 | import java.util.HashSet; | 12 | import java.util.HashSet; |
@@ -17,21 +17,21 @@ import java.util.Queue; | |||
17 | import java.util.Set; | 17 | import java.util.Set; |
18 | import java.util.function.Function; | 18 | import java.util.function.Function; |
19 | 19 | ||
20 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 20 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
21 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 21 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
22 | import tools.refinery.viatra.runtime.localsearch.operations.IPatternMatcherOperation; | 22 | import tools.refinery.interpreter.localsearch.operations.IPatternMatcherOperation; |
23 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 23 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
24 | import tools.refinery.viatra.runtime.localsearch.operations.util.CallInformation; | 24 | import tools.refinery.interpreter.localsearch.operations.util.CallInformation; |
25 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 25 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
26 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 26 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Checking for a transitive closure expressed as a local search pattern matcher. The matched pattern must have two | 29 | * Checking for a transitive closure expressed as a local search pattern matcher. The matched pattern must have two |
30 | * parameters of the same model type. | 30 | * parameters of the same model type. |
31 | * | 31 | * |
32 | * @author Zoltan Ujhelyi | 32 | * @author Zoltan Ujhelyi |
33 | * @since 1.7 | 33 | * @since 1.7 |
34 | * | 34 | * |
35 | */ | 35 | */ |
36 | public abstract class ExtendBinaryTransitiveClosure implements ISearchOperation, IPatternMatcherOperation { | 36 | public abstract class ExtendBinaryTransitiveClosure implements ISearchOperation, IPatternMatcherOperation { |
37 | 37 | ||
@@ -40,7 +40,7 @@ public abstract class ExtendBinaryTransitiveClosure implements ISearchOperation, | |||
40 | public Executor(int position) { | 40 | public Executor(int position) { |
41 | super(position); | 41 | super(position); |
42 | } | 42 | } |
43 | 43 | ||
44 | @Override | 44 | @Override |
45 | public Iterator<?> getIterator(MatchingFrame frame, ISearchContext context) { | 45 | public Iterator<?> getIterator(MatchingFrame frame, ISearchContext context) { |
46 | // Note: second parameter is NOT bound during execution, but the first is | 46 | // Note: second parameter is NOT bound during execution, but the first is |
@@ -70,25 +70,25 @@ public abstract class ExtendBinaryTransitiveClosure implements ISearchOperation, | |||
70 | 70 | ||
71 | return targetsFound.iterator(); | 71 | return targetsFound.iterator(); |
72 | } | 72 | } |
73 | 73 | ||
74 | @Override | 74 | @Override |
75 | public ISearchOperation getOperation() { | 75 | public ISearchOperation getOperation() { |
76 | return ExtendBinaryTransitiveClosure.this; | 76 | return ExtendBinaryTransitiveClosure.this; |
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Calculates the transitive closure of a pattern match in a forward direction (first parameter bound, second | 81 | * Calculates the transitive closure of a pattern match in a forward direction (first parameter bound, second |
82 | * unbound). | 82 | * unbound). |
83 | * </p> | 83 | * </p> |
84 | * <strong>Note</strong>: In case the call is reflexive, it is expected that the bound parameter already matches the universe type of the call. | 84 | * <strong>Note</strong>: In case the call is reflexive, it is expected that the bound parameter already matches the universe type of the call. |
85 | * | 85 | * |
86 | * @since 1.7 | 86 | * @since 1.7 |
87 | */ | 87 | */ |
88 | public static class Forward extends ExtendBinaryTransitiveClosure { | 88 | public static class Forward extends ExtendBinaryTransitiveClosure { |
89 | 89 | ||
90 | private Object[] seedFrame = new Object[2]; | 90 | private Object[] seedFrame = new Object[2]; |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * @since 2.0 | 93 | * @since 2.0 |
94 | */ | 94 | */ |
@@ -112,7 +112,7 @@ public abstract class ExtendBinaryTransitiveClosure implements ISearchOperation, | |||
112 | * bound) | 112 | * bound) |
113 | * </p> | 113 | * </p> |
114 | * <strong>Note</strong>: In case the call is reflexive, it is expected that the bound parameter already matches the universe type of the call. | 114 | * <strong>Note</strong>: In case the call is reflexive, it is expected that the bound parameter already matches the universe type of the call. |
115 | * | 115 | * |
116 | * @since 2.0 | 116 | * @since 2.0 |
117 | */ | 117 | */ |
118 | public static class Backward extends ExtendBinaryTransitiveClosure { | 118 | public static class Backward extends ExtendBinaryTransitiveClosure { |
@@ -160,12 +160,12 @@ public abstract class ExtendBinaryTransitiveClosure implements ISearchOperation, | |||
160 | public ISearchOperationExecutor createExecutor() { | 160 | public ISearchOperationExecutor createExecutor() { |
161 | return new Executor(targetPosition); | 161 | return new Executor(targetPosition); |
162 | } | 162 | } |
163 | 163 | ||
164 | @Override | 164 | @Override |
165 | public String toString() { | 165 | public String toString() { |
166 | return toString(Object::toString); | 166 | return toString(Object::toString); |
167 | } | 167 | } |
168 | 168 | ||
169 | @Override | 169 | @Override |
170 | public String toString(Function<Integer, String> variableMapping) { | 170 | public String toString(Function<Integer, String> variableMapping) { |
171 | String c = information.toString(variableMapping); | 171 | String c = information.toString(variableMapping); |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/ExtendConstant.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/ExtendConstant.java index 455236f3..69221662 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/ExtendConstant.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/ExtendConstant.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.extend; | 9 | package tools.refinery.interpreter.localsearch.operations.extend; |
10 | 10 | ||
11 | import java.util.Arrays; | 11 | import java.util.Arrays; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -14,14 +14,14 @@ import java.util.Iterator; | |||
14 | import java.util.List; | 14 | import java.util.List; |
15 | import java.util.function.Function; | 15 | import java.util.function.Function; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 17 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
18 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 18 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
19 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 19 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * This operation handles constants in search plans by binding a variable to a constant value. Such operations should be | 22 | * This operation handles constants in search plans by binding a variable to a constant value. Such operations should be |
23 | * executed as early as possible during plan execution. | 23 | * executed as early as possible during plan execution. |
24 | * | 24 | * |
25 | * @author Marton Bur | 25 | * @author Marton Bur |
26 | * | 26 | * |
27 | */ | 27 | */ |
@@ -37,13 +37,13 @@ public class ExtendConstant implements ISearchOperation { | |||
37 | public Iterator<?> getIterator(MatchingFrame frame, ISearchContext context) { | 37 | public Iterator<?> getIterator(MatchingFrame frame, ISearchContext context) { |
38 | return Collections.singletonList(value).iterator(); | 38 | return Collections.singletonList(value).iterator(); |
39 | } | 39 | } |
40 | 40 | ||
41 | @Override | 41 | @Override |
42 | public ISearchOperation getOperation() { | 42 | public ISearchOperation getOperation() { |
43 | return ExtendConstant.this; | 43 | return ExtendConstant.this; |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | private final Object value; | 47 | private final Object value; |
48 | private final int position; | 48 | private final int position; |
49 | 49 | ||
@@ -61,15 +61,15 @@ public class ExtendConstant implements ISearchOperation { | |||
61 | public List<Integer> getVariablePositions() { | 61 | public List<Integer> getVariablePositions() { |
62 | return Arrays.asList(position); | 62 | return Arrays.asList(position); |
63 | } | 63 | } |
64 | 64 | ||
65 | @Override | 65 | @Override |
66 | public String toString() { | 66 | public String toString() { |
67 | return toString(Object::toString); | 67 | return toString(Object::toString); |
68 | } | 68 | } |
69 | 69 | ||
70 | @Override | 70 | @Override |
71 | public String toString(Function<Integer, String> variableMapping) { | 71 | public String toString(Function<Integer, String> variableMapping) { |
72 | return "extend constant -"+variableMapping.apply(position)+"='"+value+"'"; | 72 | return "extend constant -"+variableMapping.apply(position)+"='"+value+"'"; |
73 | } | 73 | } |
74 | 74 | ||
75 | } | 75 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/ExtendPositivePatternCall.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/ExtendPositivePatternCall.java index 690a3241..b0bd2dcf 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/ExtendPositivePatternCall.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/ExtendPositivePatternCall.java | |||
@@ -3,25 +3,25 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.extend; | 9 | package tools.refinery.interpreter.localsearch.operations.extend; |
10 | 10 | ||
11 | import java.util.Iterator; | 11 | import java.util.Iterator; |
12 | import java.util.List; | 12 | import java.util.List; |
13 | import java.util.function.Function; | 13 | import java.util.function.Function; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 15 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
16 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 16 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
17 | import tools.refinery.viatra.runtime.localsearch.operations.ExtendOperationExecutor; | 17 | import tools.refinery.interpreter.localsearch.operations.ExtendOperationExecutor; |
18 | import tools.refinery.viatra.runtime.localsearch.operations.IPatternMatcherOperation; | 18 | import tools.refinery.interpreter.localsearch.operations.IPatternMatcherOperation; |
19 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 19 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
20 | import tools.refinery.viatra.runtime.localsearch.operations.util.CallInformation; | 20 | import tools.refinery.interpreter.localsearch.operations.util.CallInformation; |
21 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 21 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
22 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 22 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
23 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 23 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
24 | import tools.refinery.viatra.runtime.matchers.tuple.VolatileModifiableMaskedTuple; | 24 | import tools.refinery.interpreter.matchers.tuple.VolatileModifiableMaskedTuple; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * @author Grill Balázs | 27 | * @author Grill Balázs |
@@ -32,25 +32,25 @@ public class ExtendPositivePatternCall implements ISearchOperation, IPatternMatc | |||
32 | 32 | ||
33 | private class Executor extends ExtendOperationExecutor<Tuple> { | 33 | private class Executor extends ExtendOperationExecutor<Tuple> { |
34 | private final VolatileModifiableMaskedTuple maskedTuple; | 34 | private final VolatileModifiableMaskedTuple maskedTuple; |
35 | 35 | ||
36 | public Executor() { | 36 | public Executor() { |
37 | maskedTuple = new VolatileModifiableMaskedTuple(information.getThinFrameMask()); | 37 | maskedTuple = new VolatileModifiableMaskedTuple(information.getThinFrameMask()); |
38 | } | 38 | } |
39 | 39 | ||
40 | @Override | 40 | @Override |
41 | protected Iterator<? extends Tuple> getIterator(MatchingFrame frame, ISearchContext context) { | 41 | protected Iterator<? extends Tuple> getIterator(MatchingFrame frame, ISearchContext context) { |
42 | maskedTuple.updateTuple(frame); | 42 | maskedTuple.updateTuple(frame); |
43 | IQueryResultProvider matcher = context.getMatcher(information.getCallWithAdornment()); | 43 | IQueryResultProvider matcher = context.getMatcher(information.getCallWithAdornment()); |
44 | return matcher.getAllMatches(information.getParameterMask(), maskedTuple).iterator(); | 44 | return matcher.getAllMatches(information.getParameterMask(), maskedTuple).iterator(); |
45 | } | 45 | } |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * @since 2.0 | 48 | * @since 2.0 |
49 | */ | 49 | */ |
50 | @Override | 50 | @Override |
51 | protected boolean fillInValue(Tuple result, MatchingFrame frame, ISearchContext context) { | 51 | protected boolean fillInValue(Tuple result, MatchingFrame frame, ISearchContext context) { |
52 | TupleMask mask = information.getFullFrameMask(); | 52 | TupleMask mask = information.getFullFrameMask(); |
53 | // The first loop clears out the elements from a possible previous iteration | 53 | // The first loop clears out the elements from a possible previous iteration |
54 | for(int i : information.getFreeParameterIndices()) { | 54 | for(int i : information.getFreeParameterIndices()) { |
55 | mask.set(frame, i, null); | 55 | mask.set(frame, i, null); |
56 | } | 56 | } |
@@ -58,7 +58,7 @@ public class ExtendPositivePatternCall implements ISearchOperation, IPatternMatc | |||
58 | Object oldValue = mask.getValue(frame, i); | 58 | Object oldValue = mask.getValue(frame, i); |
59 | Object valueToFill = result.get(i); | 59 | Object valueToFill = result.get(i); |
60 | if (oldValue != null && !oldValue.equals(valueToFill)){ | 60 | if (oldValue != null && !oldValue.equals(valueToFill)){ |
61 | // If the inverse map contains more than one values for the same key, it means that these arguments are unified by the caller. | 61 | // If the inverse map contains more than one values for the same key, it means that these arguments are unified by the caller. |
62 | // In this case if the callee assigns different values the frame shall be dropped | 62 | // In this case if the callee assigns different values the frame shall be dropped |
63 | return false; | 63 | return false; |
64 | } | 64 | } |
@@ -66,31 +66,31 @@ public class ExtendPositivePatternCall implements ISearchOperation, IPatternMatc | |||
66 | } | 66 | } |
67 | return true; | 67 | return true; |
68 | } | 68 | } |
69 | 69 | ||
70 | @Override | 70 | @Override |
71 | protected void cleanup(MatchingFrame frame, ISearchContext context) { | 71 | protected void cleanup(MatchingFrame frame, ISearchContext context) { |
72 | TupleMask mask = information.getFullFrameMask(); | 72 | TupleMask mask = information.getFullFrameMask(); |
73 | for(int i : information.getFreeParameterIndices()){ | 73 | for(int i : information.getFreeParameterIndices()){ |
74 | mask.set(frame, i, null); | 74 | mask.set(frame, i, null); |
75 | } | 75 | } |
76 | 76 | ||
77 | } | 77 | } |
78 | 78 | ||
79 | @Override | 79 | @Override |
80 | public ISearchOperation getOperation() { | 80 | public ISearchOperation getOperation() { |
81 | return ExtendPositivePatternCall.this; | 81 | return ExtendPositivePatternCall.this; |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
85 | private final CallInformation information; | 85 | private final CallInformation information; |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * @since 1.7 | 88 | * @since 1.7 |
89 | */ | 89 | */ |
90 | public ExtendPositivePatternCall(CallInformation information) { | 90 | public ExtendPositivePatternCall(CallInformation information) { |
91 | this.information = information; | 91 | this.information = information; |
92 | } | 92 | } |
93 | 93 | ||
94 | @Override | 94 | @Override |
95 | public ISearchOperationExecutor createExecutor() { | 95 | public ISearchOperationExecutor createExecutor() { |
96 | return new Executor(); | 96 | return new Executor(); |
@@ -100,17 +100,17 @@ public class ExtendPositivePatternCall implements ISearchOperation, IPatternMatc | |||
100 | public List<Integer> getVariablePositions() { | 100 | public List<Integer> getVariablePositions() { |
101 | return information.getVariablePositions(); | 101 | return information.getVariablePositions(); |
102 | } | 102 | } |
103 | 103 | ||
104 | @Override | 104 | @Override |
105 | public String toString() { | 105 | public String toString() { |
106 | return toString(Object::toString); | 106 | return toString(Object::toString); |
107 | } | 107 | } |
108 | 108 | ||
109 | @Override | 109 | @Override |
110 | public String toString(Function<Integer, String> variableMapping) { | 110 | public String toString(Function<Integer, String> variableMapping) { |
111 | return "extend find " + information.toString(variableMapping); | 111 | return "extend find " + information.toString(variableMapping); |
112 | } | 112 | } |
113 | 113 | ||
114 | @Override | 114 | @Override |
115 | public CallInformation getCallInformation() { | 115 | public CallInformation getCallInformation() { |
116 | return information; | 116 | return information; |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/SingleValueExtendOperationExecutor.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/SingleValueExtendOperationExecutor.java index a04ffcca..31b4c294 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/extend/SingleValueExtendOperationExecutor.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/extend/SingleValueExtendOperationExecutor.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.extend; | 9 | package tools.refinery.interpreter.localsearch.operations.extend; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 11 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
12 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 12 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
13 | import tools.refinery.viatra.runtime.localsearch.operations.ExtendOperationExecutor; | 13 | import tools.refinery.interpreter.localsearch.operations.ExtendOperationExecutor; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * @since 2.0 | 16 | * @since 2.0 |
@@ -18,7 +18,7 @@ import tools.refinery.viatra.runtime.localsearch.operations.ExtendOperationExecu | |||
18 | */ | 18 | */ |
19 | public abstract class SingleValueExtendOperationExecutor<T> extends ExtendOperationExecutor<T> { | 19 | public abstract class SingleValueExtendOperationExecutor<T> extends ExtendOperationExecutor<T> { |
20 | protected int position; | 20 | protected int position; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * @param position the frame position all values are to be added | 23 | * @param position the frame position all values are to be added |
24 | */ | 24 | */ |
@@ -37,4 +37,4 @@ public abstract class SingleValueExtendOperationExecutor<T> extends ExtendOperat | |||
37 | protected final void cleanup(MatchingFrame frame, ISearchContext context) { | 37 | protected final void cleanup(MatchingFrame frame, ISearchContext context) { |
38 | frame.setValue(position, null); | 38 | frame.setValue(position, null); |
39 | } | 39 | } |
40 | } \ No newline at end of file | 40 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/generic/GenericTypeCheck.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/generic/GenericTypeCheck.java index 2b189c57..b9a10524 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/generic/GenericTypeCheck.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/generic/GenericTypeCheck.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.generic; | 9 | package tools.refinery.interpreter.localsearch.operations.generic; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -14,15 +14,15 @@ import java.util.List; | |||
14 | import java.util.function.Function; | 14 | import java.util.function.Function; |
15 | import java.util.stream.Collectors; | 15 | import java.util.stream.Collectors; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 17 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
18 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 18 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
19 | import tools.refinery.viatra.runtime.localsearch.operations.CheckOperationExecutor; | 19 | import tools.refinery.interpreter.localsearch.operations.CheckOperationExecutor; |
20 | import tools.refinery.viatra.runtime.localsearch.operations.IIteratingSearchOperation; | 20 | import tools.refinery.interpreter.localsearch.operations.IIteratingSearchOperation; |
21 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 21 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
22 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 22 | import tools.refinery.interpreter.matchers.context.IInputKey; |
23 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 23 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
24 | import tools.refinery.viatra.runtime.matchers.tuple.VolatileMaskedTuple; | 24 | import tools.refinery.interpreter.matchers.tuple.VolatileMaskedTuple; |
25 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 25 | import tools.refinery.interpreter.matchers.util.Preconditions; |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * @author Zoltan Ujhelyi | 28 | * @author Zoltan Ujhelyi |
@@ -30,20 +30,20 @@ import tools.refinery.viatra.runtime.matchers.util.Preconditions; | |||
30 | * @noextend This class is not intended to be subclassed by clients. | 30 | * @noextend This class is not intended to be subclassed by clients. |
31 | */ | 31 | */ |
32 | public class GenericTypeCheck implements ISearchOperation, IIteratingSearchOperation { | 32 | public class GenericTypeCheck implements ISearchOperation, IIteratingSearchOperation { |
33 | 33 | ||
34 | private class Executor extends CheckOperationExecutor { | 34 | private class Executor extends CheckOperationExecutor { |
35 | private VolatileMaskedTuple maskedTuple; | 35 | private VolatileMaskedTuple maskedTuple; |
36 | 36 | ||
37 | private Executor() { | 37 | private Executor() { |
38 | this.maskedTuple = new VolatileMaskedTuple(callMask); | 38 | this.maskedTuple = new VolatileMaskedTuple(callMask); |
39 | } | 39 | } |
40 | 40 | ||
41 | @Override | 41 | @Override |
42 | protected boolean check(MatchingFrame frame, ISearchContext context) { | 42 | protected boolean check(MatchingFrame frame, ISearchContext context) { |
43 | maskedTuple.updateTuple(frame); | 43 | maskedTuple.updateTuple(frame); |
44 | return context.getRuntimeContext().containsTuple(type, maskedTuple); | 44 | return context.getRuntimeContext().containsTuple(type, maskedTuple); |
45 | } | 45 | } |
46 | 46 | ||
47 | @Override | 47 | @Override |
48 | public ISearchOperation getOperation() { | 48 | public ISearchOperation getOperation() { |
49 | return GenericTypeCheck.this; | 49 | return GenericTypeCheck.this; |
@@ -81,7 +81,7 @@ public class GenericTypeCheck implements ISearchOperation, IIteratingSearchOpera | |||
81 | public String toString() { | 81 | public String toString() { |
82 | return toString(Object::toString); | 82 | return toString(Object::toString); |
83 | } | 83 | } |
84 | 84 | ||
85 | @Override | 85 | @Override |
86 | public String toString(Function<Integer, String> variableMapping) { | 86 | public String toString(Function<Integer, String> variableMapping) { |
87 | return "check " + type.getPrettyPrintableName() + "(" | 87 | return "check " + type.getPrettyPrintableName() + "(" |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/generic/GenericTypeExtend.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/generic/GenericTypeExtend.java index dfc3e9ad..79db98aa 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/generic/GenericTypeExtend.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/generic/GenericTypeExtend.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.generic; | 9 | package tools.refinery.interpreter.localsearch.operations.generic; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -17,16 +17,16 @@ import java.util.Set; | |||
17 | import java.util.function.Function; | 17 | import java.util.function.Function; |
18 | import java.util.stream.Collectors; | 18 | import java.util.stream.Collectors; |
19 | 19 | ||
20 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 20 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
21 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 21 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
22 | import tools.refinery.viatra.runtime.localsearch.operations.ExtendOperationExecutor; | 22 | import tools.refinery.interpreter.localsearch.operations.ExtendOperationExecutor; |
23 | import tools.refinery.viatra.runtime.localsearch.operations.IIteratingSearchOperation; | 23 | import tools.refinery.interpreter.localsearch.operations.IIteratingSearchOperation; |
24 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 24 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
25 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 25 | import tools.refinery.interpreter.matchers.context.IInputKey; |
26 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 26 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
27 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 27 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
28 | import tools.refinery.viatra.runtime.matchers.tuple.VolatileMaskedTuple; | 28 | import tools.refinery.interpreter.matchers.tuple.VolatileMaskedTuple; |
29 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 29 | import tools.refinery.interpreter.matchers.util.Preconditions; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * @author Zoltan Ujhelyi | 32 | * @author Zoltan Ujhelyi |
@@ -37,11 +37,11 @@ public class GenericTypeExtend implements IIteratingSearchOperation { | |||
37 | 37 | ||
38 | private class Executor extends ExtendOperationExecutor<Tuple> { | 38 | private class Executor extends ExtendOperationExecutor<Tuple> { |
39 | private final VolatileMaskedTuple maskedTuple; | 39 | private final VolatileMaskedTuple maskedTuple; |
40 | 40 | ||
41 | public Executor() { | 41 | public Executor() { |
42 | this.maskedTuple = new VolatileMaskedTuple(callMask); | 42 | this.maskedTuple = new VolatileMaskedTuple(callMask); |
43 | } | 43 | } |
44 | 44 | ||
45 | @Override | 45 | @Override |
46 | protected Iterator<? extends Tuple> getIterator(MatchingFrame frame, ISearchContext context) { | 46 | protected Iterator<? extends Tuple> getIterator(MatchingFrame frame, ISearchContext context) { |
47 | maskedTuple.updateTuple(frame); | 47 | maskedTuple.updateTuple(frame); |
@@ -73,13 +73,13 @@ public class GenericTypeExtend implements IIteratingSearchOperation { | |||
73 | frame.setValue(position, null); | 73 | frame.setValue(position, null); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | @Override | 77 | @Override |
78 | public ISearchOperation getOperation() { | 78 | public ISearchOperation getOperation() { |
79 | return GenericTypeExtend.this; | 79 | return GenericTypeExtend.this; |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | private final IInputKey type; | 83 | private final IInputKey type; |
84 | private final int[] positions; | 84 | private final int[] positions; |
85 | private final List<Integer> positionList; | 85 | private final List<Integer> positionList; |
@@ -88,7 +88,7 @@ public class GenericTypeExtend implements IIteratingSearchOperation { | |||
88 | private final TupleMask callMask; | 88 | private final TupleMask callMask; |
89 | 89 | ||
90 | /** | 90 | /** |
91 | * | 91 | * |
92 | * @param type | 92 | * @param type |
93 | * the type to execute the extend operation on | 93 | * the type to execute the extend operation on |
94 | * @param positions | 94 | * @param positions |
@@ -127,12 +127,12 @@ public class GenericTypeExtend implements IIteratingSearchOperation { | |||
127 | public List<Integer> getVariablePositions() { | 127 | public List<Integer> getVariablePositions() { |
128 | return positionList; | 128 | return positionList; |
129 | } | 129 | } |
130 | 130 | ||
131 | @Override | 131 | @Override |
132 | public String toString() { | 132 | public String toString() { |
133 | return toString(Object::toString); | 133 | return toString(Object::toString); |
134 | } | 134 | } |
135 | 135 | ||
136 | @Override | 136 | @Override |
137 | public String toString(Function<Integer, String> variableMapping) { | 137 | public String toString(Function<Integer, String> variableMapping) { |
138 | return "extend " + type.getPrettyPrintableName() + "(" | 138 | return "extend " + type.getPrettyPrintableName() + "(" |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/generic/GenericTypeExtendSingleValue.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/generic/GenericTypeExtendSingleValue.java index 45e4fd0e..f381e00d 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/generic/GenericTypeExtendSingleValue.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/generic/GenericTypeExtendSingleValue.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.generic; | 9 | package tools.refinery.interpreter.localsearch.operations.generic; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -16,15 +16,15 @@ import java.util.Objects; | |||
16 | import java.util.function.Function; | 16 | import java.util.function.Function; |
17 | import java.util.stream.Collectors; | 17 | import java.util.stream.Collectors; |
18 | 18 | ||
19 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 19 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
20 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 20 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
21 | import tools.refinery.viatra.runtime.localsearch.operations.IIteratingSearchOperation; | 21 | import tools.refinery.interpreter.localsearch.operations.IIteratingSearchOperation; |
22 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 22 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
23 | import tools.refinery.viatra.runtime.localsearch.operations.extend.SingleValueExtendOperationExecutor; | 23 | import tools.refinery.interpreter.localsearch.operations.extend.SingleValueExtendOperationExecutor; |
24 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 24 | import tools.refinery.interpreter.matchers.context.IInputKey; |
25 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 25 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
26 | import tools.refinery.viatra.runtime.matchers.tuple.VolatileMaskedTuple; | 26 | import tools.refinery.interpreter.matchers.tuple.VolatileMaskedTuple; |
27 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 27 | import tools.refinery.interpreter.matchers.util.Preconditions; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * @author Zoltan Ujhelyi | 30 | * @author Zoltan Ujhelyi |
@@ -34,9 +34,9 @@ import tools.refinery.viatra.runtime.matchers.util.Preconditions; | |||
34 | public class GenericTypeExtendSingleValue implements IIteratingSearchOperation { | 34 | public class GenericTypeExtendSingleValue implements IIteratingSearchOperation { |
35 | 35 | ||
36 | private class Executor extends SingleValueExtendOperationExecutor<Object> { | 36 | private class Executor extends SingleValueExtendOperationExecutor<Object> { |
37 | 37 | ||
38 | private final VolatileMaskedTuple maskedTuple; | 38 | private final VolatileMaskedTuple maskedTuple; |
39 | 39 | ||
40 | public Executor(int position) { | 40 | public Executor(int position) { |
41 | super(position); | 41 | super(position); |
42 | this.maskedTuple = new VolatileMaskedTuple(callMask); | 42 | this.maskedTuple = new VolatileMaskedTuple(callMask); |
@@ -47,13 +47,13 @@ public class GenericTypeExtendSingleValue implements IIteratingSearchOperation { | |||
47 | maskedTuple.updateTuple(frame); | 47 | maskedTuple.updateTuple(frame); |
48 | return context.getRuntimeContext().enumerateValues(type, indexerMask, maskedTuple).iterator(); | 48 | return context.getRuntimeContext().enumerateValues(type, indexerMask, maskedTuple).iterator(); |
49 | } | 49 | } |
50 | 50 | ||
51 | @Override | 51 | @Override |
52 | public ISearchOperation getOperation() { | 52 | public ISearchOperation getOperation() { |
53 | return GenericTypeExtendSingleValue.this; | 53 | return GenericTypeExtendSingleValue.this; |
54 | } | 54 | } |
55 | } | 55 | } |
56 | 56 | ||
57 | private final IInputKey type; | 57 | private final IInputKey type; |
58 | private final List<Integer> positionList; | 58 | private final List<Integer> positionList; |
59 | private final TupleMask indexerMask; | 59 | private final TupleMask indexerMask; |
@@ -61,7 +61,7 @@ public class GenericTypeExtendSingleValue implements IIteratingSearchOperation { | |||
61 | private final int unboundVariableIndex; | 61 | private final int unboundVariableIndex; |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * | 64 | * |
65 | * @param type | 65 | * @param type |
66 | * the type to execute the extend operation on | 66 | * the type to execute the extend operation on |
67 | * @param positions | 67 | * @param positions |
@@ -102,7 +102,7 @@ public class GenericTypeExtendSingleValue implements IIteratingSearchOperation { | |||
102 | public String toString() { | 102 | public String toString() { |
103 | return toString(Object::toString); | 103 | return toString(Object::toString); |
104 | } | 104 | } |
105 | 105 | ||
106 | @Override | 106 | @Override |
107 | public String toString(Function<Integer, String> variableMapping) { | 107 | public String toString(Function<Integer, String> variableMapping) { |
108 | return "extend " + type.getPrettyPrintableName() + "(" | 108 | return "extend " + type.getPrettyPrintableName() + "(" |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/util/CallInformation.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/util/CallInformation.java index b141a7b0..6241b33f 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/operations/util/CallInformation.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/operations/util/CallInformation.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.operations.util; | 9 | package tools.refinery.interpreter.localsearch.operations.util; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.HashMap; | 12 | import java.util.HashMap; |
@@ -17,58 +17,58 @@ import java.util.Set; | |||
17 | import java.util.function.Function; | 17 | import java.util.function.Function; |
18 | import java.util.stream.Collectors; | 18 | import java.util.stream.Collectors; |
19 | 19 | ||
20 | import tools.refinery.viatra.runtime.localsearch.matcher.CallWithAdornment; | 20 | import tools.refinery.interpreter.localsearch.matcher.CallWithAdornment; |
21 | import tools.refinery.viatra.runtime.localsearch.matcher.MatcherReference; | 21 | import tools.refinery.interpreter.localsearch.matcher.MatcherReference; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.IQueryReference; | 22 | import tools.refinery.interpreter.matchers.psystem.IQueryReference; |
23 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 23 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.PatternCallBasedDeferred; | 24 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.PatternCallBasedDeferred; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.BinaryReflexiveTransitiveClosure; | 25 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.BinaryReflexiveTransitiveClosure; |
26 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; | 26 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.BinaryTransitiveClosure; |
27 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 27 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
28 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 28 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
29 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 29 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
30 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 30 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
31 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 31 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * This class stores a precompiled version of call-related metadata and masks for local search operations | 34 | * This class stores a precompiled version of call-related metadata and masks for local search operations |
35 | * | 35 | * |
36 | * @author Zoltan Ujhelyi | 36 | * @author Zoltan Ujhelyi |
37 | * @since 1.7 | 37 | * @since 1.7 |
38 | */ | 38 | */ |
39 | public final class CallInformation { | 39 | public final class CallInformation { |
40 | 40 | ||
41 | private final TupleMask fullFrameMask; | 41 | private final TupleMask fullFrameMask; |
42 | private final TupleMask thinFrameMask; | 42 | private final TupleMask thinFrameMask; |
43 | private final TupleMask parameterMask; | 43 | private final TupleMask parameterMask; |
44 | private final int[] freeParameterIndices; | 44 | private final int[] freeParameterIndices; |
45 | 45 | ||
46 | private final Map<PParameter, Integer> mapping = new HashMap<>(); | 46 | private final Map<PParameter, Integer> mapping = new HashMap<>(); |
47 | private final Set<PParameter> adornment = new HashSet<>(); | 47 | private final Set<PParameter> adornment = new HashSet<>(); |
48 | private final PQuery referredQuery; | 48 | private final PQuery referredQuery; |
49 | private final MatcherReference matcherReference; | 49 | private final MatcherReference matcherReference; |
50 | private final IQueryReference call; | 50 | private final IQueryReference call; |
51 | private CallWithAdornment callWithAdornment; | 51 | private CallWithAdornment callWithAdornment; |
52 | 52 | ||
53 | public static CallInformation create(PatternCallBasedDeferred constraint, Map<PVariable, Integer> variableMapping, Set<Integer> bindings) { | 53 | public static CallInformation create(PatternCallBasedDeferred constraint, Map<PVariable, Integer> variableMapping, Set<Integer> bindings) { |
54 | return new CallInformation(constraint.getActualParametersTuple(), constraint, bindings, variableMapping); | 54 | return new CallInformation(constraint.getActualParametersTuple(), constraint, bindings, variableMapping); |
55 | } | 55 | } |
56 | 56 | ||
57 | public static CallInformation create(PositivePatternCall pCall, Map<PVariable, Integer> variableMapping, Set<Integer> bindings) { | 57 | public static CallInformation create(PositivePatternCall pCall, Map<PVariable, Integer> variableMapping, Set<Integer> bindings) { |
58 | return new CallInformation(pCall.getVariablesTuple(), pCall, bindings, variableMapping); | 58 | return new CallInformation(pCall.getVariablesTuple(), pCall, bindings, variableMapping); |
59 | } | 59 | } |
60 | 60 | ||
61 | public static CallInformation create(BinaryTransitiveClosure constraint, Map<PVariable, Integer> variableMapping, Set<Integer> bindings) { | 61 | public static CallInformation create(BinaryTransitiveClosure constraint, Map<PVariable, Integer> variableMapping, Set<Integer> bindings) { |
62 | return new CallInformation(constraint.getVariablesTuple(), constraint, bindings, variableMapping); | 62 | return new CallInformation(constraint.getVariablesTuple(), constraint, bindings, variableMapping); |
63 | } | 63 | } |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * @since 2.0 | 66 | * @since 2.0 |
67 | */ | 67 | */ |
68 | public static CallInformation create(BinaryReflexiveTransitiveClosure constraint, Map<PVariable, Integer> variableMapping, Set<Integer> bindings) { | 68 | public static CallInformation create(BinaryReflexiveTransitiveClosure constraint, Map<PVariable, Integer> variableMapping, Set<Integer> bindings) { |
69 | return new CallInformation(constraint.getVariablesTuple(), constraint, bindings, variableMapping); | 69 | return new CallInformation(constraint.getVariablesTuple(), constraint, bindings, variableMapping); |
70 | } | 70 | } |
71 | 71 | ||
72 | private CallInformation(Tuple actualParameters, IQueryReference call, final Set<Integer> bindings, | 72 | private CallInformation(Tuple actualParameters, IQueryReference call, final Set<Integer> bindings, |
73 | Map<PVariable, Integer> variableMapping) { | 73 | Map<PVariable, Integer> variableMapping) { |
74 | this.call = call; | 74 | this.call = call; |
@@ -87,10 +87,10 @@ public final class CallInformation { | |||
87 | adornment.add(symbolicParameter); | 87 | adornment.add(symbolicParameter); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | thinFrameMask = TupleMask.fromSelectedIndices(variableMapping.size(), parameterMaskIndices); | 91 | thinFrameMask = TupleMask.fromSelectedIndices(variableMapping.size(), parameterMaskIndices); |
92 | fullFrameMask = TupleMask.fromSelectedIndices(variableMapping.size(), fullParameterMaskIndices); | 92 | fullFrameMask = TupleMask.fromSelectedIndices(variableMapping.size(), fullParameterMaskIndices); |
93 | 93 | ||
94 | // This second iteration is necessary as we don't know beforehand the number of bound parameters | 94 | // This second iteration is necessary as we don't know beforehand the number of bound parameters |
95 | int[] boundParameterIndices = new int[adornment.size()]; | 95 | int[] boundParameterIndices = new int[adornment.size()]; |
96 | int boundIndex = 0; | 96 | int boundIndex = 0; |
@@ -110,38 +110,38 @@ public final class CallInformation { | |||
110 | matcherReference = callWithAdornment.getMatcherReference(); | 110 | matcherReference = callWithAdornment.getMatcherReference(); |
111 | } | 111 | } |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * Returns a mask describing how the bound variables of a Matching Frame are mapped to parameter indexes | 114 | * Returns a mask describing how the bound variables of a Matching Frame are mapped to parameter indexes |
115 | */ | 115 | */ |
116 | public TupleMask getThinFrameMask() { | 116 | public TupleMask getThinFrameMask() { |
117 | return thinFrameMask; | 117 | return thinFrameMask; |
118 | } | 118 | } |
119 | 119 | ||
120 | /** | 120 | /** |
121 | * Returns a mask describing how all variables of a Matching Frame are mapped to parameter indexes | 121 | * Returns a mask describing how all variables of a Matching Frame are mapped to parameter indexes |
122 | */ | 122 | */ |
123 | public TupleMask getFullFrameMask() { | 123 | public TupleMask getFullFrameMask() { |
124 | return fullFrameMask; | 124 | return fullFrameMask; |
125 | } | 125 | } |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * Returns a mask describing the adornment the called pattern uses | 128 | * Returns a mask describing the adornment the called pattern uses |
129 | */ | 129 | */ |
130 | public TupleMask getParameterMask() { | 130 | public TupleMask getParameterMask() { |
131 | return parameterMask; | 131 | return parameterMask; |
132 | } | 132 | } |
133 | 133 | ||
134 | public MatcherReference getReference() { | 134 | public MatcherReference getReference() { |
135 | return matcherReference; | 135 | return matcherReference; |
136 | } | 136 | } |
137 | 137 | ||
138 | /** | 138 | /** |
139 | * @since 2.1 | 139 | * @since 2.1 |
140 | */ | 140 | */ |
141 | public IQueryReference getCall() { | 141 | public IQueryReference getCall() { |
142 | return call; | 142 | return call; |
143 | } | 143 | } |
144 | 144 | ||
145 | /** | 145 | /** |
146 | * @since 2.1 | 146 | * @since 2.1 |
147 | */ | 147 | */ |
@@ -155,7 +155,7 @@ public final class CallInformation { | |||
155 | public int[] getFreeParameterIndices() { | 155 | public int[] getFreeParameterIndices() { |
156 | return freeParameterIndices; | 156 | return freeParameterIndices; |
157 | } | 157 | } |
158 | 158 | ||
159 | public List<Integer> getVariablePositions() { | 159 | public List<Integer> getVariablePositions() { |
160 | List<Integer> variables = new ArrayList<>(mapping.size()); | 160 | List<Integer> variables = new ArrayList<>(mapping.size()); |
161 | for(PParameter p : referredQuery.getParameters()){ | 161 | for(PParameter p : referredQuery.getParameters()){ |
@@ -163,14 +163,14 @@ public final class CallInformation { | |||
163 | } | 163 | } |
164 | return variables; | 164 | return variables; |
165 | } | 165 | } |
166 | 166 | ||
167 | 167 | ||
168 | 168 | ||
169 | @Override | 169 | @Override |
170 | public String toString() { | 170 | public String toString() { |
171 | return toString(Object::toString); | 171 | return toString(Object::toString); |
172 | } | 172 | } |
173 | 173 | ||
174 | /** | 174 | /** |
175 | * @since 2.0 | 175 | * @since 2.0 |
176 | */ | 176 | */ |
@@ -181,6 +181,6 @@ public final class CallInformation { | |||
181 | .collect(Collectors.joining(",")) | 181 | .collect(Collectors.joining(",")) |
182 | + ")"; | 182 | + ")"; |
183 | } | 183 | } |
184 | 184 | ||
185 | 185 | ||
186 | } | 186 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/IPlanDescriptor.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/IPlanDescriptor.java index 987996c9..a855b0b0 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/IPlanDescriptor.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/IPlanDescriptor.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.plan; | 9 | package tools.refinery.interpreter.localsearch.plan; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 14 | import tools.refinery.interpreter.matchers.context.IInputKey; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 15 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 16 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Denotes an executable plan | 19 | * Denotes an executable plan |
20 | * | 20 | * |
21 | * @author Grill Balázs | 21 | * @author Grill Balázs |
22 | * @since 1.4 | 22 | * @since 1.4 |
23 | * | 23 | * |
@@ -28,22 +28,22 @@ public interface IPlanDescriptor { | |||
28 | * The query which this plan implements | 28 | * The query which this plan implements |
29 | */ | 29 | */ |
30 | public PQuery getQuery(); | 30 | public PQuery getQuery(); |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * The executable search plans for each body in the query | 33 | * The executable search plans for each body in the query |
34 | * @since 2.0 | 34 | * @since 2.0 |
35 | */ | 35 | */ |
36 | public Collection<SearchPlanForBody> getPlan(); | 36 | public Collection<SearchPlanForBody> getPlan(); |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * The set of parameters this plan assumes to be bound | 39 | * The set of parameters this plan assumes to be bound |
40 | */ | 40 | */ |
41 | public Set<PParameter> getAdornment(); | 41 | public Set<PParameter> getAdornment(); |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * The collection of {@link IInputKey}s which needs to be iterated during the execution of this plan. For optimal | 44 | * The collection of {@link IInputKey}s which needs to be iterated during the execution of this plan. For optimal |
45 | * performance, instances of these keys might be indexed. | 45 | * performance, instances of these keys might be indexed. |
46 | */ | 46 | */ |
47 | public Set<IInputKey> getIteratedKeys(); | 47 | public Set<IInputKey> getIteratedKeys(); |
48 | 48 | ||
49 | } | 49 | } |
diff --git a/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/IPlanProvider.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/IPlanProvider.java new file mode 100644 index 00000000..d7112bcc --- /dev/null +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/IPlanProvider.java | |||
@@ -0,0 +1,33 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2016, Grill Balázs, IncQuery Labs Ltd. | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | package tools.refinery.interpreter.localsearch.plan; | ||
10 | |||
11 | import tools.refinery.interpreter.localsearch.matcher.MatcherReference; | ||
12 | import tools.refinery.interpreter.localsearch.matcher.integration.LocalSearchHints; | ||
13 | import tools.refinery.interpreter.localsearch.planner.compiler.IOperationCompiler; | ||
14 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; | ||
15 | import tools.refinery.interpreter.matchers.backend.ResultProviderRequestor; | ||
16 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; | ||
17 | |||
18 | /** | ||
19 | * @author Grill Balázs | ||
20 | * @since 1.4 | ||
21 | * @noreference This interface is not intended to be referenced by clients. | ||
22 | */ | ||
23 | public interface IPlanProvider { | ||
24 | |||
25 | /** | ||
26 | * @throws InterpreterRuntimeException | ||
27 | * @since 2.1 | ||
28 | */ | ||
29 | public IPlanDescriptor getPlan(IQueryBackendContext backend, IOperationCompiler compiler, | ||
30 | ResultProviderRequestor resultProviderRequestor, | ||
31 | LocalSearchHints configuration, MatcherReference key); | ||
32 | |||
33 | } | ||
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/PlanDescriptor.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/PlanDescriptor.java index a5565546..f4196032 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/PlanDescriptor.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/PlanDescriptor.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.plan; | 9 | package tools.refinery.interpreter.localsearch.plan; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
@@ -16,11 +16,11 @@ import java.util.List; | |||
16 | import java.util.Set; | 16 | import java.util.Set; |
17 | import java.util.stream.Collectors; | 17 | import java.util.stream.Collectors; |
18 | 18 | ||
19 | import tools.refinery.viatra.runtime.localsearch.operations.IIteratingSearchOperation; | 19 | import tools.refinery.interpreter.localsearch.operations.IIteratingSearchOperation; |
20 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 20 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
21 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 21 | import tools.refinery.interpreter.matchers.context.IInputKey; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 22 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
23 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 23 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * @author Grill Balázs | 26 | * @author Grill Balázs |
@@ -33,7 +33,7 @@ public class PlanDescriptor implements IPlanDescriptor { | |||
33 | private final List<SearchPlanForBody> plan; | 33 | private final List<SearchPlanForBody> plan; |
34 | private final Set<PParameter> adornment; | 34 | private final Set<PParameter> adornment; |
35 | private Set<IInputKey> iteratedKeys = null; | 35 | private Set<IInputKey> iteratedKeys = null; |
36 | 36 | ||
37 | public PlanDescriptor(PQuery pquery, Collection<SearchPlanForBody> plan, Set<PParameter> adornment) { | 37 | public PlanDescriptor(PQuery pquery, Collection<SearchPlanForBody> plan, Set<PParameter> adornment) { |
38 | this.pquery = pquery; | 38 | this.pquery = pquery; |
39 | this.plan = new ArrayList<>(plan); | 39 | this.plan = new ArrayList<>(plan); |
@@ -70,7 +70,7 @@ public class PlanDescriptor implements IPlanDescriptor { | |||
70 | } | 70 | } |
71 | return iteratedKeys; | 71 | return iteratedKeys; |
72 | } | 72 | } |
73 | 73 | ||
74 | @Override | 74 | @Override |
75 | public String toString() { | 75 | public String toString() { |
76 | return new StringBuilder().append("Plan for ").append(pquery.getFullyQualifiedName()).append("(") | 76 | return new StringBuilder().append("Plan for ").append(pquery.getFullyQualifiedName()).append("(") |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/SearchPlan.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/SearchPlan.java index 3159f707..1cbdd92d 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/SearchPlan.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/SearchPlan.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.plan; | 9 | package tools.refinery.interpreter.localsearch.plan; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -15,16 +15,16 @@ import java.util.Map; | |||
15 | import java.util.Map.Entry; | 15 | import java.util.Map.Entry; |
16 | import java.util.stream.Collectors; | 16 | import java.util.stream.Collectors; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 18 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 19 | import tools.refinery.interpreter.matchers.psystem.PBody; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 20 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
21 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 21 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * A SearchPlan stores a collection of SearchPlanOperations for a fixed order of variables. | 24 | * A SearchPlan stores a collection of SearchPlanOperations for a fixed order of variables. |
25 | * | 25 | * |
26 | * @author Zoltan Ujhelyi | 26 | * @author Zoltan Ujhelyi |
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | public class SearchPlan { | 29 | public class SearchPlan { |
30 | 30 | ||
@@ -32,7 +32,7 @@ public class SearchPlan { | |||
32 | private final Map<Integer, PVariable> variableMapping; | 32 | private final Map<Integer, PVariable> variableMapping; |
33 | private final TupleMask parameterMask; | 33 | private final TupleMask parameterMask; |
34 | private final PBody body; | 34 | private final PBody body; |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * @since 2.0 | 37 | * @since 2.0 |
38 | */ | 38 | */ |
@@ -75,18 +75,18 @@ public class SearchPlan { | |||
75 | public TupleMask getParameterMask() { | 75 | public TupleMask getParameterMask() { |
76 | return parameterMask; | 76 | return parameterMask; |
77 | } | 77 | } |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * @since 2.0 | 80 | * @since 2.0 |
81 | */ | 81 | */ |
82 | public PBody getSourceBody() { | 82 | public PBody getSourceBody() { |
83 | return body; | 83 | return body; |
84 | } | 84 | } |
85 | 85 | ||
86 | @Override | 86 | @Override |
87 | public String toString() { | 87 | public String toString() { |
88 | StringBuilder sb = new StringBuilder(); | 88 | StringBuilder sb = new StringBuilder(); |
89 | 89 | ||
90 | sb.append("{\n"); | 90 | sb.append("{\n"); |
91 | for(ISearchOperation operation : this.getOperations()){ | 91 | for(ISearchOperation operation : this.getOperations()){ |
92 | sb.append("\t"); | 92 | sb.append("\t"); |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/SearchPlanExecutor.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/SearchPlanExecutor.java index 4a4e2450..60c2e023 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/SearchPlanExecutor.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/SearchPlanExecutor.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.localsearch.plan; | 10 | package tools.refinery.interpreter.localsearch.plan; |
11 | 11 | ||
12 | 12 | ||
13 | import java.util.Collections; | 13 | import java.util.Collections; |
@@ -17,17 +17,16 @@ import java.util.concurrent.CopyOnWriteArrayList; | |||
17 | import java.util.stream.Collectors; | 17 | import java.util.stream.Collectors; |
18 | 18 | ||
19 | import org.apache.log4j.Logger; | 19 | import org.apache.log4j.Logger; |
20 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 20 | import tools.refinery.interpreter.localsearch.exceptions.LocalSearchException; |
21 | import tools.refinery.viatra.runtime.localsearch.exceptions.LocalSearchException; | 21 | import tools.refinery.interpreter.localsearch.matcher.ILocalSearchAdaptable; |
22 | import tools.refinery.viatra.runtime.localsearch.matcher.ILocalSearchAdaptable; | 22 | import tools.refinery.interpreter.localsearch.matcher.ILocalSearchAdapter; |
23 | import tools.refinery.viatra.runtime.localsearch.matcher.ILocalSearchAdapter; | 23 | import tools.refinery.interpreter.localsearch.matcher.ISearchContext; |
24 | import tools.refinery.viatra.runtime.localsearch.matcher.ISearchContext; | 24 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
25 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 25 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
26 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation.ISearchOperationExecutor; | 26 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
27 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 27 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
28 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 28 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
29 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 29 | import tools.refinery.interpreter.matchers.util.Preconditions; |
30 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | ||
31 | 30 | ||
32 | /** | 31 | /** |
33 | * A search plan executor is used to execute {@link SearchPlan} instances. | 32 | * A search plan executor is used to execute {@link SearchPlan} instances. |
@@ -36,7 +35,7 @@ import tools.refinery.viatra.runtime.matchers.util.Preconditions; | |||
36 | public class SearchPlanExecutor implements ILocalSearchAdaptable { | 35 | public class SearchPlanExecutor implements ILocalSearchAdaptable { |
37 | 36 | ||
38 | private int currentOperation; | 37 | private int currentOperation; |
39 | private final List<ISearchOperationExecutor> operations; | 38 | private final List<ISearchOperation.ISearchOperationExecutor> operations; |
40 | private final SearchPlan plan; | 39 | private final SearchPlan plan; |
41 | private final ISearchContext context; | 40 | private final ISearchContext context; |
42 | private final List<ILocalSearchAdapter> adapters = new CopyOnWriteArrayList<>(); | 41 | private final List<ILocalSearchAdapter> adapters = new CopyOnWriteArrayList<>(); |
@@ -51,11 +50,11 @@ public class SearchPlanExecutor implements ILocalSearchAdaptable { | |||
51 | public int getCurrentOperation() { | 50 | public int getCurrentOperation() { |
52 | return currentOperation; | 51 | return currentOperation; |
53 | } | 52 | } |
54 | 53 | ||
55 | public SearchPlan getSearchPlan() { | 54 | public SearchPlan getSearchPlan() { |
56 | return plan; | 55 | return plan; |
57 | } | 56 | } |
58 | 57 | ||
59 | /** | 58 | /** |
60 | * @since 1.7 | 59 | * @since 1.7 |
61 | */ | 60 | */ |
@@ -92,12 +91,12 @@ public class SearchPlanExecutor implements ILocalSearchAdaptable { | |||
92 | operations = plan.getOperations().stream().map(ISearchOperation::createExecutor).collect(Collectors.toList()); | 91 | operations = plan.getOperations().stream().map(ISearchOperation::createExecutor).collect(Collectors.toList()); |
93 | this.currentOperation = -1; | 92 | this.currentOperation = -1; |
94 | } | 93 | } |
95 | 94 | ||
96 | 95 | ||
97 | private void init(MatchingFrame frame) { | 96 | private void init(MatchingFrame frame) { |
98 | if (currentOperation == -1) { | 97 | if (currentOperation == -1) { |
99 | currentOperation++; | 98 | currentOperation++; |
100 | ISearchOperationExecutor operation = operations.get(currentOperation); | 99 | ISearchOperation.ISearchOperationExecutor operation = operations.get(currentOperation); |
101 | if (!adapters.isEmpty()){ | 100 | if (!adapters.isEmpty()){ |
102 | for (ILocalSearchAdapter adapter : adapters) { | 101 | for (ILocalSearchAdapter adapter : adapters) { |
103 | adapter.executorInitializing(plan, frame); | 102 | adapter.executorInitializing(plan, frame); |
@@ -121,7 +120,7 @@ public class SearchPlanExecutor implements ILocalSearchAdaptable { | |||
121 | } | 120 | } |
122 | 121 | ||
123 | /** | 122 | /** |
124 | * @throws ViatraQueryRuntimeException | 123 | * @throws InterpreterRuntimeException |
125 | */ | 124 | */ |
126 | public boolean execute(MatchingFrame frame) { | 125 | public boolean execute(MatchingFrame frame) { |
127 | int upperBound = operations.size() - 1; | 126 | int upperBound = operations.size() - 1; |
@@ -133,12 +132,12 @@ public class SearchPlanExecutor implements ILocalSearchAdaptable { | |||
133 | currentOperation++; | 132 | currentOperation++; |
134 | operationSelected(frame, currentOperation, false); | 133 | operationSelected(frame, currentOperation, false); |
135 | if (currentOperation <= upperBound) { | 134 | if (currentOperation <= upperBound) { |
136 | ISearchOperationExecutor operation = operations.get(currentOperation); | 135 | ISearchOperation.ISearchOperationExecutor operation = operations.get(currentOperation); |
137 | operation.onInitialize(frame, context); | 136 | operation.onInitialize(frame, context); |
138 | } | 137 | } |
139 | } else { | 138 | } else { |
140 | operationExecuted(frame, currentOperation, false); | 139 | operationExecuted(frame, currentOperation, false); |
141 | ISearchOperationExecutor operation = operations.get(currentOperation); | 140 | ISearchOperation.ISearchOperationExecutor operation = operations.get(currentOperation); |
142 | operation.onBacktrack(frame, context); | 141 | operation.onBacktrack(frame, context); |
143 | currentOperation--; | 142 | currentOperation--; |
144 | operationSelected(frame, currentOperation, true); | 143 | operationSelected(frame, currentOperation, true); |
@@ -152,17 +151,17 @@ public class SearchPlanExecutor implements ILocalSearchAdaptable { | |||
152 | } | 151 | } |
153 | return matchFound; | 152 | return matchFound; |
154 | } | 153 | } |
155 | 154 | ||
156 | public void resetPlan() { | 155 | public void resetPlan() { |
157 | currentOperation = -1; | 156 | currentOperation = -1; |
158 | } | 157 | } |
159 | 158 | ||
160 | public void printDebugInformation() { | 159 | public void printDebugInformation() { |
161 | for (int i = 0; i < operations.size(); i++) { | 160 | for (int i = 0; i < operations.size(); i++) { |
162 | Logger.getRootLogger().debug("[" + i + "]\t" + operations.get(i).toString()); | 161 | Logger.getRootLogger().debug("[" + i + "]\t" + operations.get(i).toString()); |
163 | } | 162 | } |
164 | } | 163 | } |
165 | 164 | ||
166 | private void operationExecuted(MatchingFrame frame, int operationIndex, boolean isSuccessful) { | 165 | private void operationExecuted(MatchingFrame frame, int operationIndex, boolean isSuccessful) { |
167 | if (!adapters.isEmpty()){ | 166 | if (!adapters.isEmpty()){ |
168 | for (ILocalSearchAdapter adapter : adapters) { | 167 | for (ILocalSearchAdapter adapter : adapters) { |
@@ -170,7 +169,7 @@ public class SearchPlanExecutor implements ILocalSearchAdaptable { | |||
170 | } | 169 | } |
171 | } | 170 | } |
172 | } | 171 | } |
173 | 172 | ||
174 | private void operationSelected(MatchingFrame frame, int operationIndex, boolean isBacktrack) { | 173 | private void operationSelected(MatchingFrame frame, int operationIndex, boolean isBacktrack) { |
175 | if (!adapters.isEmpty() && operationIndex >= 0 && operationIndex < operations.size()){ | 174 | if (!adapters.isEmpty() && operationIndex >= 0 && operationIndex < operations.size()){ |
176 | for (ILocalSearchAdapter adapter : adapters) { | 175 | for (ILocalSearchAdapter adapter : adapters) { |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/SearchPlanForBody.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/SearchPlanForBody.java index e0300da4..6910df26 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/SearchPlanForBody.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/SearchPlanForBody.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.plan; | 9 | package tools.refinery.interpreter.localsearch.plan; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Arrays; | 12 | import java.util.Arrays; |
@@ -15,12 +15,12 @@ import java.util.List; | |||
15 | import java.util.Map; | 15 | import java.util.Map; |
16 | import java.util.stream.Collectors; | 16 | import java.util.stream.Collectors; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.localsearch.matcher.CallWithAdornment; | 18 | import tools.refinery.interpreter.localsearch.matcher.CallWithAdornment; |
19 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 19 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
20 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 20 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 21 | import tools.refinery.interpreter.matchers.psystem.PBody; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 22 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
23 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 23 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * This class is responsible for storing the results of the planner and operation compiler for a selected body. | 26 | * This class is responsible for storing the results of the planner and operation compiler for a selected body. |
@@ -37,7 +37,7 @@ public class SearchPlanForBody { | |||
37 | private final Collection<CallWithAdornment> dependencies; | 37 | private final Collection<CallWithAdornment> dependencies; |
38 | private final double cost; | 38 | private final double cost; |
39 | private final Object internalRepresentation; | 39 | private final Object internalRepresentation; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * @since 2.1 | 42 | * @since 2.1 |
43 | */ | 43 | */ |
@@ -57,7 +57,7 @@ public class SearchPlanForBody { | |||
57 | } | 57 | } |
58 | this.compiledOperations = new ArrayList<>(compiledOperations.size()+1); | 58 | this.compiledOperations = new ArrayList<>(compiledOperations.size()+1); |
59 | this.compiledOperations.addAll(compiledOperations); | 59 | this.compiledOperations.addAll(compiledOperations); |
60 | 60 | ||
61 | this.dependencies = new ArrayList<>(dependencies); | 61 | this.dependencies = new ArrayList<>(dependencies); |
62 | } | 62 | } |
63 | 63 | ||
@@ -80,15 +80,15 @@ public class SearchPlanForBody { | |||
80 | public SubPlan getPlan() { | 80 | public SubPlan getPlan() { |
81 | return plan; | 81 | return plan; |
82 | } | 82 | } |
83 | 83 | ||
84 | public Collection<CallWithAdornment> getDependencies() { | 84 | public Collection<CallWithAdornment> getDependencies() { |
85 | return dependencies; | 85 | return dependencies; |
86 | } | 86 | } |
87 | 87 | ||
88 | public TupleMask calculateParameterMask() { | 88 | public TupleMask calculateParameterMask() { |
89 | return TupleMask.fromSelectedIndices(variableKeys.size(), parameterKeys); | 89 | return TupleMask.fromSelectedIndices(variableKeys.size(), parameterKeys); |
90 | } | 90 | } |
91 | 91 | ||
92 | @Override | 92 | @Override |
93 | public String toString() { | 93 | public String toString() { |
94 | return compiledOperations.stream().map(Object::toString).collect(Collectors.joining("\n")); | 94 | return compiledOperations.stream().map(Object::toString).collect(Collectors.joining("\n")); |
@@ -108,8 +108,8 @@ public class SearchPlanForBody { | |||
108 | public Object getInternalRepresentation() { | 108 | public Object getInternalRepresentation() { |
109 | return internalRepresentation; | 109 | return internalRepresentation; |
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | 114 | ||
115 | } | 115 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/SimplePlanProvider.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/SimplePlanProvider.java index ed31bcb0..ae6beae9 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/SimplePlanProvider.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/plan/SimplePlanProvider.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.plan; | 9 | package tools.refinery.interpreter.localsearch.plan; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | 12 | ||
13 | import org.apache.log4j.Logger; | 13 | import org.apache.log4j.Logger; |
14 | import tools.refinery.viatra.runtime.localsearch.matcher.MatcherReference; | 14 | import tools.refinery.interpreter.localsearch.matcher.MatcherReference; |
15 | import tools.refinery.viatra.runtime.localsearch.matcher.integration.LocalSearchHints; | 15 | import tools.refinery.interpreter.localsearch.matcher.integration.LocalSearchHints; |
16 | import tools.refinery.viatra.runtime.localsearch.planner.LocalSearchPlanner; | 16 | import tools.refinery.interpreter.localsearch.planner.LocalSearchPlanner; |
17 | import tools.refinery.viatra.runtime.localsearch.planner.compiler.IOperationCompiler; | 17 | import tools.refinery.interpreter.localsearch.planner.compiler.IOperationCompiler; |
18 | import tools.refinery.viatra.runtime.matchers.backend.ResultProviderRequestor; | 18 | import tools.refinery.interpreter.matchers.backend.ResultProviderRequestor; |
19 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 19 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * A plan provider implementation which caches previously calculated plans to avoid re-planning for the same adornment | 22 | * A plan provider implementation which caches previously calculated plans to avoid re-planning for the same adornment |
23 | * | 23 | * |
24 | * @author Grill Balázs | 24 | * @author Grill Balázs |
25 | * @since 1.7 | 25 | * @since 1.7 |
26 | * | 26 | * |
@@ -28,20 +28,20 @@ import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | |||
28 | public class SimplePlanProvider implements IPlanProvider { | 28 | public class SimplePlanProvider implements IPlanProvider { |
29 | 29 | ||
30 | private final Logger logger; | 30 | private final Logger logger; |
31 | 31 | ||
32 | public SimplePlanProvider(Logger logger) { | 32 | public SimplePlanProvider(Logger logger) { |
33 | this.logger = logger; | 33 | this.logger = logger; |
34 | } | 34 | } |
35 | 35 | ||
36 | @Override | 36 | @Override |
37 | public IPlanDescriptor getPlan(IQueryBackendContext backend, IOperationCompiler compiler, | 37 | public IPlanDescriptor getPlan(IQueryBackendContext backend, IOperationCompiler compiler, |
38 | final ResultProviderRequestor resultRequestor, | 38 | final ResultProviderRequestor resultRequestor, |
39 | final LocalSearchHints configuration, MatcherReference key) { | 39 | final LocalSearchHints configuration, MatcherReference key) { |
40 | 40 | ||
41 | LocalSearchPlanner planner = new LocalSearchPlanner(backend, compiler, logger, configuration, resultRequestor); | 41 | LocalSearchPlanner planner = new LocalSearchPlanner(backend, compiler, logger, configuration, resultRequestor); |
42 | 42 | ||
43 | Collection<SearchPlanForBody> plansForBodies = planner.plan(key.getQuery(), key.getAdornment()); | 43 | Collection<SearchPlanForBody> plansForBodies = planner.plan(key.getQuery(), key.getAdornment()); |
44 | 44 | ||
45 | IPlanDescriptor plan = new PlanDescriptor(key.getQuery(), plansForBodies, key.getAdornment()); | 45 | IPlanDescriptor plan = new PlanDescriptor(key.getQuery(), plansForBodies, key.getAdornment()); |
46 | return plan; | 46 | return plan; |
47 | } | 47 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/ILocalSearchPlanner.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/ILocalSearchPlanner.java index dfd9a3c8..a50eed8c 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/ILocalSearchPlanner.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/ILocalSearchPlanner.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner; | 9 | package tools.refinery.interpreter.localsearch.planner; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.localsearch.plan.SearchPlanForBody; | 14 | import tools.refinery.interpreter.localsearch.plan.SearchPlanForBody; |
15 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 15 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 16 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 17 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * @author Zoltan Ujhelyi | 20 | * @author Zoltan Ujhelyi |
@@ -25,14 +25,14 @@ public interface ILocalSearchPlanner { | |||
25 | /** | 25 | /** |
26 | * Creates executable plans for the provided query. It is required to call one of the | 26 | * Creates executable plans for the provided query. It is required to call one of the |
27 | * <code>initializePlanner()</code> methods before calling this method. | 27 | * <code>initializePlanner()</code> methods before calling this method. |
28 | * | 28 | * |
29 | * @param querySpec | 29 | * @param querySpec |
30 | * @param boundParameters | 30 | * @param boundParameters |
31 | * a set of bound parameters | 31 | * a set of bound parameters |
32 | * @return a mapping between ISearchOperation list and a mapping, that holds a PVariable-Integer mapping for the | 32 | * @return a mapping between ISearchOperation list and a mapping, that holds a PVariable-Integer mapping for the |
33 | * list of ISearchOperations | 33 | * list of ISearchOperations |
34 | * @throws ViatraQueryRuntimeException | 34 | * @throws InterpreterRuntimeException |
35 | */ | 35 | */ |
36 | Collection<SearchPlanForBody> plan(PQuery querySpec, Set<PParameter> boundParameters); | 36 | Collection<SearchPlanForBody> plan(PQuery querySpec, Set<PParameter> boundParameters); |
37 | 37 | ||
38 | } \ No newline at end of file | 38 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/ISearchPlanCodeGenerator.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/ISearchPlanCodeGenerator.java index 72218337..0c2f85c7 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/ISearchPlanCodeGenerator.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/ISearchPlanCodeGenerator.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner; | 9 | package tools.refinery.interpreter.localsearch.planner; |
10 | 10 | ||
11 | import java.util.List; | 11 | import java.util.List; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 13 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * @author Marton Bur | 16 | * @author Marton Bur |
@@ -19,5 +19,5 @@ import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | |||
19 | public interface ISearchPlanCodeGenerator { | 19 | public interface ISearchPlanCodeGenerator { |
20 | 20 | ||
21 | void compile(List<List<ISearchOperation>> plans); | 21 | void compile(List<List<ISearchOperation>> plans); |
22 | 22 | ||
23 | } | 23 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/LocalSearchPlanner.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/LocalSearchPlanner.java index f44be655..38c64d4c 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/LocalSearchPlanner.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/LocalSearchPlanner.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner; | 9 | package tools.refinery.interpreter.localsearch.planner; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
@@ -17,26 +17,26 @@ import java.util.Map; | |||
17 | import java.util.Set; | 17 | import java.util.Set; |
18 | 18 | ||
19 | import org.apache.log4j.Logger; | 19 | import org.apache.log4j.Logger; |
20 | import tools.refinery.viatra.runtime.localsearch.matcher.integration.LocalSearchHints; | 20 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
21 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 21 | import tools.refinery.interpreter.localsearch.planner.compiler.IOperationCompiler; |
22 | import tools.refinery.viatra.runtime.localsearch.plan.SearchPlanForBody; | 22 | import tools.refinery.interpreter.localsearch.matcher.integration.LocalSearchHints; |
23 | import tools.refinery.viatra.runtime.localsearch.planner.compiler.IOperationCompiler; | 23 | import tools.refinery.interpreter.localsearch.plan.SearchPlanForBody; |
24 | import tools.refinery.viatra.runtime.matchers.backend.ResultProviderRequestor; | 24 | import tools.refinery.interpreter.matchers.backend.ResultProviderRequestor; |
25 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 25 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
26 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 26 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
27 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 27 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
28 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 28 | import tools.refinery.interpreter.matchers.psystem.PBody; |
29 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 29 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
30 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 30 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExportedParameter; |
31 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 31 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
32 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 32 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
33 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.PBodyNormalizer; | 33 | import tools.refinery.interpreter.matchers.psystem.rewriters.PBodyNormalizer; |
34 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.PDisjunctionRewriter; | 34 | import tools.refinery.interpreter.matchers.psystem.rewriters.PDisjunctionRewriter; |
35 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.PDisjunctionRewriterCacher; | 35 | import tools.refinery.interpreter.matchers.psystem.rewriters.PDisjunctionRewriterCacher; |
36 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.PQueryFlattener; | 36 | import tools.refinery.interpreter.matchers.psystem.rewriters.PQueryFlattener; |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * | 39 | * |
40 | * @author Marton Bur | 40 | * @author Marton Bur |
41 | * @noreference This class is not intended to be referenced by clients. | 41 | * @noreference This class is not intended to be referenced by clients. |
42 | */ | 42 | */ |
@@ -50,13 +50,13 @@ public class LocalSearchPlanner implements ILocalSearchPlanner { | |||
50 | private final IOperationCompiler operationCompiler; | 50 | private final IOperationCompiler operationCompiler; |
51 | private final IQueryBackendContext context; | 51 | private final IQueryBackendContext context; |
52 | private final ResultProviderRequestor resultRequestor; | 52 | private final ResultProviderRequestor resultRequestor; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * @param resultRequestor | 55 | * @param resultRequestor |
56 | * @since 1.7 | 56 | * @since 1.7 |
57 | */ | 57 | */ |
58 | public LocalSearchPlanner(IQueryBackendContext backendContext, IOperationCompiler compiler, Logger logger, | 58 | public LocalSearchPlanner(IQueryBackendContext backendContext, IOperationCompiler compiler, Logger logger, |
59 | final LocalSearchHints configuration, ResultProviderRequestor resultRequestor) | 59 | final LocalSearchHints configuration, ResultProviderRequestor resultRequestor) |
60 | { | 60 | { |
61 | 61 | ||
62 | this.runtimeContext = backendContext.getRuntimeContext(); | 62 | this.runtimeContext = backendContext.getRuntimeContext(); |
@@ -72,7 +72,7 @@ public class LocalSearchPlanner implements ILocalSearchPlanner { | |||
72 | * negatively. | 72 | * negatively. |
73 | */ | 73 | */ |
74 | PBodyNormalizer normalizer = new PBodyNormalizer(runtimeContext.getMetaContext()) { | 74 | PBodyNormalizer normalizer = new PBodyNormalizer(runtimeContext.getMetaContext()) { |
75 | 75 | ||
76 | @Override | 76 | @Override |
77 | protected boolean shouldCalculateImpliedTypes(PQuery query) { | 77 | protected boolean shouldCalculateImpliedTypes(PQuery query) { |
78 | return false; | 78 | return false; |
@@ -88,7 +88,7 @@ public class LocalSearchPlanner implements ILocalSearchPlanner { | |||
88 | /** | 88 | /** |
89 | * Creates executable plans for the provided query. It is required to call one of the | 89 | * Creates executable plans for the provided query. It is required to call one of the |
90 | * <code>initializePlanner()</code> methods before calling this method. | 90 | * <code>initializePlanner()</code> methods before calling this method. |
91 | * | 91 | * |
92 | * @param querySpec | 92 | * @param querySpec |
93 | * @param boundParameters | 93 | * @param boundParameters |
94 | * a set of bound parameters | 94 | * a set of bound parameters |
@@ -115,7 +115,7 @@ public class LocalSearchPlanner implements ILocalSearchPlanner { | |||
115 | // Store the variable mappings for the plans for debug purposes (traceability information) | 115 | // Store the variable mappings for the plans for debug purposes (traceability information) |
116 | SearchPlanForBody compiledPlan = new SearchPlanForBody(normalizedBody, | 116 | SearchPlanForBody compiledPlan = new SearchPlanForBody(normalizedBody, |
117 | operationCompiler.getVariableMappings(), plan, compiledOperations, | 117 | operationCompiler.getVariableMappings(), plan, compiledOperations, |
118 | operationCompiler.getDependencies(), | 118 | operationCompiler.getDependencies(), |
119 | searchPlanInternal, searchPlanInternal.getCost()); | 119 | searchPlanInternal, searchPlanInternal.getCost()); |
120 | 120 | ||
121 | plansForBodies.add(compiledPlan); | 121 | plansForBodies.add(compiledPlan); |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/LocalSearchRuntimeBasedStrategy.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/LocalSearchRuntimeBasedStrategy.java index 1bebe37e..e66c2d42 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/LocalSearchRuntimeBasedStrategy.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/LocalSearchRuntimeBasedStrategy.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner; | 9 | package tools.refinery.interpreter.localsearch.planner; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
@@ -16,36 +16,36 @@ import java.util.List; | |||
16 | import java.util.Map; | 16 | import java.util.Map; |
17 | import java.util.Set; | 17 | import java.util.Set; |
18 | 18 | ||
19 | import tools.refinery.viatra.runtime.localsearch.matcher.integration.LocalSearchHints; | 19 | import tools.refinery.interpreter.localsearch.planner.cost.ICostFunction; |
20 | import tools.refinery.viatra.runtime.localsearch.planner.cost.ICostFunction; | 20 | import tools.refinery.interpreter.localsearch.planner.util.OperationCostComparator; |
21 | import tools.refinery.viatra.runtime.localsearch.planner.util.OperationCostComparator; | 21 | import tools.refinery.interpreter.localsearch.matcher.integration.LocalSearchHints; |
22 | import tools.refinery.viatra.runtime.matchers.backend.ResultProviderRequestor; | 22 | import tools.refinery.interpreter.matchers.backend.ResultProviderRequestor; |
23 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 23 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
24 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 24 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
25 | import tools.refinery.viatra.runtime.matchers.planning.SubPlanFactory; | 25 | import tools.refinery.interpreter.matchers.planning.SubPlanFactory; |
26 | import tools.refinery.viatra.runtime.matchers.planning.operations.PApply; | 26 | import tools.refinery.interpreter.matchers.planning.operations.PApply; |
27 | import tools.refinery.viatra.runtime.matchers.planning.operations.PProject; | 27 | import tools.refinery.interpreter.matchers.planning.operations.PProject; |
28 | import tools.refinery.viatra.runtime.matchers.planning.operations.PStart; | 28 | import tools.refinery.interpreter.matchers.planning.operations.PStart; |
29 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 29 | import tools.refinery.interpreter.matchers.psystem.PBody; |
30 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 30 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
31 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 31 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
32 | import tools.refinery.viatra.runtime.matchers.util.Sets; | 32 | import tools.refinery.interpreter.matchers.util.Sets; |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * This class contains the logic for local search plan calculation based on costs of the operations. | 35 | * This class contains the logic for local search plan calculation based on costs of the operations. |
36 | * Its name refers to the fact that the strategy tries to use as much information as available about | 36 | * Its name refers to the fact that the strategy tries to use as much information as available about |
37 | * the model on which the matching is initiated. When no runtime info is available, it falls back to | 37 | * the model on which the matching is initiated. When no runtime info is available, it falls back to |
38 | * the information available from the metamodel durint operation cost calculation. | 38 | * the information available from the metamodel durint operation cost calculation. |
39 | * | 39 | * |
40 | * The implementation is based on the paper "Gergely Varró, Frederik Deckwerth, Martin Wieber, and Andy Schürr: | 40 | * The implementation is based on the paper "Gergely Varró, Frederik Deckwerth, Martin Wieber, and Andy Schürr: |
41 | * An algorithm for generating model-sensitive search plans for pattern matching on EMF models" | 41 | * An algorithm for generating model-sensitive search plans for pattern matching on EMF models" |
42 | * (DOI: 10.1007/s10270-013-0372-2) | 42 | * (DOI: 10.1007/s10270-013-0372-2) |
43 | * | 43 | * |
44 | * @author Marton Bur | 44 | * @author Marton Bur |
45 | * @noreference This class is not intended to be referenced by clients. | 45 | * @noreference This class is not intended to be referenced by clients. |
46 | */ | 46 | */ |
47 | public class LocalSearchRuntimeBasedStrategy { | 47 | public class LocalSearchRuntimeBasedStrategy { |
48 | 48 | ||
49 | private final OperationCostComparator infoComparator = new OperationCostComparator(); | 49 | private final OperationCostComparator infoComparator = new OperationCostComparator(); |
50 | 50 | ||
51 | 51 | ||
@@ -55,7 +55,7 @@ public class LocalSearchRuntimeBasedStrategy { | |||
55 | protected SubPlan convertPlan(Set<PVariable> initialBoundVariables, PlanState searchPlan) { | 55 | protected SubPlan convertPlan(Set<PVariable> initialBoundVariables, PlanState searchPlan) { |
56 | PBody pBody; | 56 | PBody pBody; |
57 | pBody = searchPlan.getAssociatedPBody(); | 57 | pBody = searchPlan.getAssociatedPBody(); |
58 | 58 | ||
59 | // Create a starting plan | 59 | // Create a starting plan |
60 | SubPlanFactory subPlanFactory = new SubPlanFactory(pBody); | 60 | SubPlanFactory subPlanFactory = new SubPlanFactory(pBody); |
61 | 61 | ||
@@ -88,12 +88,12 @@ public class LocalSearchRuntimeBasedStrategy { | |||
88 | final ICostFunction costFunction = configuration.getCostFunction(); | 88 | final ICostFunction costFunction = configuration.getCostFunction(); |
89 | PConstraintInfoInferrer pConstraintInfoInferrer = new PConstraintInfoInferrer( | 89 | PConstraintInfoInferrer pConstraintInfoInferrer = new PConstraintInfoInferrer( |
90 | configuration.isUseBase(), context, resultProviderRequestor, costFunction::apply); | 90 | configuration.isUseBase(), context, resultProviderRequestor, costFunction::apply); |
91 | 91 | ||
92 | // Create mask infos | 92 | // Create mask infos |
93 | Set<PConstraint> constraintSet = pBody.getConstraints(); | 93 | Set<PConstraint> constraintSet = pBody.getConstraints(); |
94 | List<PConstraintInfo> constraintInfos = | 94 | List<PConstraintInfo> constraintInfos = |
95 | pConstraintInfoInferrer.createPConstraintInfos(constraintSet); | 95 | pConstraintInfoInferrer.createPConstraintInfos(constraintSet); |
96 | 96 | ||
97 | // Calculate the characteristic function | 97 | // Calculate the characteristic function |
98 | // The characteristic function tells whether a given adornment is backward reachable from the (B)* state, where | 98 | // The characteristic function tells whether a given adornment is backward reachable from the (B)* state, where |
99 | // each variable is bound. | 99 | // each variable is bound. |
@@ -112,7 +112,7 @@ public class LocalSearchRuntimeBasedStrategy { | |||
112 | List<PConstraintInfo> allPotentialCheckInfos = new ArrayList<>(); | 112 | List<PConstraintInfo> allPotentialCheckInfos = new ArrayList<>(); |
113 | Map<PVariable, List<PConstraintInfo>> checkOpsByVariables = new HashMap<>(); | 113 | Map<PVariable, List<PConstraintInfo>> checkOpsByVariables = new HashMap<>(); |
114 | Map<PVariable, Collection<PConstraintInfo>> extendOpsByBoundVariables = new HashMap<>(); | 114 | Map<PVariable, Collection<PConstraintInfo>> extendOpsByBoundVariables = new HashMap<>(); |
115 | 115 | ||
116 | for (PConstraintInfo op : allMaskInfos) { | 116 | for (PConstraintInfo op : allMaskInfos) { |
117 | if (op.getFreeVariables().isEmpty()) { // CHECK | 117 | if (op.getFreeVariables().isEmpty()) { // CHECK |
118 | allPotentialCheckInfos.add(op); | 118 | allPotentialCheckInfos.add(op); |
@@ -124,15 +124,15 @@ public class LocalSearchRuntimeBasedStrategy { | |||
124 | } | 124 | } |
125 | } | 125 | } |
126 | // For CHECKs only, we must start from lists that are ordered by the cost of the constraint application | 126 | // For CHECKs only, we must start from lists that are ordered by the cost of the constraint application |
127 | Collections.sort(allPotentialCheckInfos, infoComparator); // costs are eagerly needed for check ops | 127 | Collections.sort(allPotentialCheckInfos, infoComparator); // costs are eagerly needed for check ops |
128 | for (PConstraintInfo op : allPotentialCheckInfos) { | 128 | for (PConstraintInfo op : allPotentialCheckInfos) { |
129 | for (PVariable variable : op.getBoundVariables()) { | 129 | for (PVariable variable : op.getBoundVariables()) { |
130 | checkOpsByVariables.computeIfAbsent(variable, v -> new ArrayList<>()).add(op); | 130 | checkOpsByVariables.computeIfAbsent(variable, v -> new ArrayList<>()).add(op); |
131 | } | 131 | } |
132 | } | 132 | } |
133 | // costs are not needed for extend ops until they are first applied (TODO make cost computaiton on demand) | 133 | // costs are not needed for extend ops until they are first applied (TODO make cost computaiton on demand) |
134 | 134 | ||
135 | 135 | ||
136 | // rename for better understanding | 136 | // rename for better understanding |
137 | Set<PVariable> boundVariables = initialBoundVariables; | 137 | Set<PVariable> boundVariables = initialBoundVariables; |
138 | Set<PVariable> freeVariables = Sets.difference(pBody.getUniqueVariables(), initialBoundVariables); | 138 | Set<PVariable> freeVariables = Sets.difference(pBody.getUniqueVariables(), initialBoundVariables); |
@@ -144,12 +144,12 @@ public class LocalSearchRuntimeBasedStrategy { | |||
144 | 144 | ||
145 | // Set initial state: begin with an empty operation list | 145 | // Set initial state: begin with an empty operation list |
146 | PlanState initialState = new PlanState(pBody, boundVariables); | 146 | PlanState initialState = new PlanState(pBody, boundVariables); |
147 | 147 | ||
148 | // Initial state creation, categorizes all operations; add present checks to operationsList | 148 | // Initial state creation, categorizes all operations; add present checks to operationsList |
149 | initialState.updateExtends(allPotentialExtendInfos); | 149 | initialState.updateExtends(allPotentialExtendInfos); |
150 | initialState.applyChecks(allPotentialCheckInfos); | 150 | initialState.applyChecks(allPotentialCheckInfos); |
151 | stateTable.get(n).add(0, initialState); | 151 | stateTable.get(n).add(0, initialState); |
152 | 152 | ||
153 | // stateTable.get(0) will contain the states with adornment B* | 153 | // stateTable.get(0) will contain the states with adornment B* |
154 | for (int i = n; i > 0; i--) { | 154 | for (int i = n; i > 0; i--) { |
155 | for (int j = 0; j < k && j < stateTable.get(i).size(); j++) { | 155 | for (int j = 0; j < k && j < stateTable.get(i).size(); j++) { |
@@ -160,19 +160,19 @@ public class LocalSearchRuntimeBasedStrategy { | |||
160 | PlanState newState = calculateNextState(currentState, constraintInfo); | 160 | PlanState newState = calculateNextState(currentState, constraintInfo); |
161 | // also eagerly perform any CHECK operations that become applicable (extends still deferred) | 161 | // also eagerly perform any CHECK operations that become applicable (extends still deferred) |
162 | newState.applyChecksBasedOnDelta(checkOpsByVariables); | 162 | newState.applyChecksBasedOnDelta(checkOpsByVariables); |
163 | 163 | ||
164 | if(currentState.getBoundVariables().size() == newState.getBoundVariables().size()){ | 164 | if(currentState.getBoundVariables().size() == newState.getBoundVariables().size()){ |
165 | // This means no variable binding was done, go on with the next constraint info | 165 | // This means no variable binding was done, go on with the next constraint info |
166 | continue; | 166 | continue; |
167 | } | 167 | } |
168 | int i2 = variableCount - newState.getBoundVariables().size(); | 168 | int i2 = variableCount - newState.getBoundVariables().size(); |
169 | 169 | ||
170 | List<Integer> newIndices = determineIndices(stateTable, i2, newState, k); | 170 | List<Integer> newIndices = determineIndices(stateTable, i2, newState, k); |
171 | int a = newIndices.get(0); | 171 | int a = newIndices.get(0); |
172 | int c = newIndices.get(1); | 172 | int c = newIndices.get(1); |
173 | 173 | ||
174 | if (checkInsertCondition(stateTable.get(i2), newState, reachableBoundVariableSets, a, c, k)) { | 174 | if (checkInsertCondition(stateTable.get(i2), newState, reachableBoundVariableSets, a, c, k)) { |
175 | updateExtends(newState, currentState, extendOpsByBoundVariables); // preprocess next steps | 175 | updateExtends(newState, currentState, extendOpsByBoundVariables); // preprocess next steps |
176 | insert(stateTable,i2, newState, a, c, k); | 176 | insert(stateTable,i2, newState, a, c, k); |
177 | } | 177 | } |
178 | } | 178 | } |
@@ -199,14 +199,14 @@ public class LocalSearchRuntimeBasedStrategy { | |||
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
202 | private void updateExtends(PlanState newState, PlanState currentState, | 202 | private void updateExtends(PlanState newState, PlanState currentState, |
203 | Map<PVariable, ? extends Collection<PConstraintInfo>> extendOpsByBoundVariables) | 203 | Map<PVariable, ? extends Collection<PConstraintInfo>> extendOpsByBoundVariables) |
204 | { | 204 | { |
205 | List<PConstraintInfo> presentExtends = currentState.getPresentExtends(); | 205 | List<PConstraintInfo> presentExtends = currentState.getPresentExtends(); |
206 | 206 | ||
207 | // Recategorize operations | 207 | // Recategorize operations |
208 | newState.updateExtendsBasedOnDelta(presentExtends, extendOpsByBoundVariables); | 208 | newState.updateExtendsBasedOnDelta(presentExtends, extendOpsByBoundVariables); |
209 | 209 | ||
210 | return; | 210 | return; |
211 | } | 211 | } |
212 | 212 | ||
@@ -253,5 +253,5 @@ public class LocalSearchRuntimeBasedStrategy { | |||
253 | return reachableBoundVariableSets; | 253 | return reachableBoundVariableSets; |
254 | } | 254 | } |
255 | 255 | ||
256 | 256 | ||
257 | } | 257 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/PConstraintCategory.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/PConstraintCategory.java index b98dd12e..2f5d8d1f 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/PConstraintCategory.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/PConstraintCategory.java | |||
@@ -3,38 +3,38 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner; | 9 | package tools.refinery.interpreter.localsearch.planner; |
10 | 10 | ||
11 | 11 | ||
12 | /** | 12 | /** |
13 | * Expresses the state of a PConstraint application | 13 | * Expresses the state of a PConstraint application |
14 | * condition with respect to a given adornment. | 14 | * condition with respect to a given adornment. |
15 | * | 15 | * |
16 | * @author Marton Bur | 16 | * @author Marton Bur |
17 | * @noreference This enum is not intended to be referenced by clients. | 17 | * @noreference This enum is not intended to be referenced by clients. |
18 | */ | 18 | */ |
19 | public enum PConstraintCategory { | 19 | public enum PConstraintCategory { |
20 | /* | 20 | /* |
21 | * During plan creation an operation is considered a past | 21 | * During plan creation an operation is considered a past |
22 | * operation, if an already bound variable is free in the | 22 | * operation, if an already bound variable is free in the |
23 | * mask of the operation. | 23 | * mask of the operation. |
24 | * (Mask of the operation: the required binding state of | 24 | * (Mask of the operation: the required binding state of |
25 | * the affected variables) | 25 | * the affected variables) |
26 | */ | 26 | */ |
27 | PAST, | 27 | PAST, |
28 | /* | 28 | /* |
29 | * The binding states of the variables in the operation | 29 | * The binding states of the variables in the operation |
30 | * mask correspond to the current binding states of the | 30 | * mask correspond to the current binding states of the |
31 | * variables in the search plan | 31 | * variables in the search plan |
32 | */ | 32 | */ |
33 | PRESENT, | 33 | PRESENT, |
34 | /* | 34 | /* |
35 | * There is at least one bound variable in the mask of | 35 | * There is at least one bound variable in the mask of |
36 | * a future operation that is still free at the current | 36 | * a future operation that is still free at the current |
37 | * state of the plan. Also, a future operation can't be | 37 | * state of the plan. Also, a future operation can't be |
38 | * PAST. | 38 | * PAST. |
39 | */ | 39 | */ |
40 | FUTURE; | 40 | FUTURE; |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/PConstraintInfo.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/PConstraintInfo.java index c2c76ef2..6c42c180 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/PConstraintInfo.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/PConstraintInfo.java | |||
@@ -1,32 +1,32 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2010-2015, Marton Bur, Zoltan Ujhelyi, Akos Horvath, Istvan Rath and Danil Varro | 2 | * Copyright (c) 2010-2015, Marton Bur, Zoltan Ujhelyi, Akos Horvath, Istvan Rath and Danil Varro |
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | */ | 8 | */ |
9 | package tools.refinery.viatra.runtime.localsearch.planner; | 9 | package tools.refinery.interpreter.localsearch.planner; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.LinkedHashSet; | 12 | import java.util.LinkedHashSet; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | import java.util.function.Function; | 14 | import java.util.function.Function; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.localsearch.planner.cost.IConstraintEvaluationContext; | 16 | import tools.refinery.interpreter.localsearch.planner.cost.IConstraintEvaluationContext; |
17 | import tools.refinery.viatra.runtime.matchers.backend.ResultProviderRequestor; | 17 | import tools.refinery.interpreter.matchers.backend.ResultProviderRequestor; |
18 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 18 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
19 | import tools.refinery.viatra.runtime.matchers.context.IQueryResultProviderAccess; | 19 | import tools.refinery.interpreter.matchers.context.IQueryResultProviderAccess; |
20 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 20 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 21 | import tools.refinery.interpreter.matchers.psystem.PBody; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 22 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
23 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 23 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.analysis.QueryAnalyzer; | 24 | import tools.refinery.interpreter.matchers.psystem.analysis.QueryAnalyzer; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Wraps a PConstraint together with information required for the planner. Currently contains information about the expected binding state of | 27 | * Wraps a PConstraint together with information required for the planner. Currently contains information about the expected binding state of |
28 | * the affected variables also called application condition, and the cost of the enforcement, based on the meta and/or the runtime context. | 28 | * the affected variables also called application condition, and the cost of the enforcement, based on the meta and/or the runtime context. |
29 | * | 29 | * |
30 | * @author Marton Bur | 30 | * @author Marton Bur |
31 | * @noreference This class is not intended to be referenced by clients. | 31 | * @noreference This class is not intended to be referenced by clients. |
32 | */ | 32 | */ |
@@ -43,9 +43,9 @@ public class PConstraintInfo implements IConstraintEvaluationContext { | |||
43 | 43 | ||
44 | private Double cost; | 44 | private Double cost; |
45 | private Function<IConstraintEvaluationContext, Double> costFunction; | 45 | private Function<IConstraintEvaluationContext, Double> costFunction; |
46 | |||
47 | 46 | ||
48 | /** | 47 | |
48 | /** | ||
49 | * Instantiates the wrapper | 49 | * Instantiates the wrapper |
50 | * @param constraintfor which the information is added and stored | 50 | * @param constraintfor which the information is added and stored |
51 | * @param boundMaskVariables the bound variables in the operation mask | 51 | * @param boundMaskVariables the bound variables in the operation mask |
@@ -56,7 +56,7 @@ public class PConstraintInfo implements IConstraintEvaluationContext { | |||
56 | * @param context the query backend context | 56 | * @param context the query backend context |
57 | */ | 57 | */ |
58 | public PConstraintInfo(PConstraint constraint, Set<PVariable> boundMaskVariables, Set<PVariable> freeMaskVariables, | 58 | public PConstraintInfo(PConstraint constraint, Set<PVariable> boundMaskVariables, Set<PVariable> freeMaskVariables, |
59 | Set<PConstraintInfo> sameWithDifferentBindings, | 59 | Set<PConstraintInfo> sameWithDifferentBindings, |
60 | IQueryBackendContext context, | 60 | IQueryBackendContext context, |
61 | ResultProviderRequestor resultRequestor, | 61 | ResultProviderRequestor resultRequestor, |
62 | Function<IConstraintEvaluationContext, Double> costFunction) { | 62 | Function<IConstraintEvaluationContext, Double> costFunction) { |
@@ -72,7 +72,7 @@ public class PConstraintInfo implements IConstraintEvaluationContext { | |||
72 | 72 | ||
73 | this.cost = null; // cost will be computed lazily (esp. important for pattern calls) | 73 | this.cost = null; // cost will be computed lazily (esp. important for pattern calls) |
74 | } | 74 | } |
75 | 75 | ||
76 | @Override | 76 | @Override |
77 | public IQueryRuntimeContext getRuntimeContext() { | 77 | public IQueryRuntimeContext getRuntimeContext() { |
78 | return runtimeContext; | 78 | return runtimeContext; |
@@ -133,7 +133,7 @@ public class PConstraintInfo implements IConstraintEvaluationContext { | |||
133 | public IQueryResultProviderAccess resultProviderAccess() { | 133 | public IQueryResultProviderAccess resultProviderAccess() { |
134 | return resultProviderAccess; | 134 | return resultProviderAccess; |
135 | } | 135 | } |
136 | 136 | ||
137 | @Override | 137 | @Override |
138 | public ResultProviderRequestor resultProviderRequestor() { | 138 | public ResultProviderRequestor resultProviderRequestor() { |
139 | return resultRequestor; | 139 | return resultRequestor; |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/PConstraintInfoInferrer.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/PConstraintInfoInferrer.java index eeac07ce..db9fcd8e 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/PConstraintInfoInferrer.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/PConstraintInfoInferrer.java | |||
@@ -6,23 +6,23 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner; | 9 | package tools.refinery.interpreter.localsearch.planner; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.localsearch.planner.cost.IConstraintEvaluationContext; | 11 | import tools.refinery.interpreter.localsearch.planner.cost.IConstraintEvaluationContext; |
12 | import tools.refinery.viatra.runtime.matchers.backend.ResultProviderRequestor; | 12 | import tools.refinery.interpreter.matchers.backend.ResultProviderRequestor; |
13 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 13 | import tools.refinery.interpreter.matchers.context.IInputKey; |
14 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 14 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 15 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 16 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.*; | 17 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.*; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.AbstractTransitiveClosure; | 18 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.AbstractTransitiveClosure; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.ConstantValue; | 19 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.ConstantValue; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 20 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 21 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.TypeConstraint; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 22 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
23 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameterDirection; | 23 | import tools.refinery.interpreter.matchers.psystem.queries.PParameterDirection; |
24 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 24 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
25 | import tools.refinery.viatra.runtime.matchers.util.Sets; | 25 | import tools.refinery.interpreter.matchers.util.Sets; |
26 | 26 | ||
27 | import java.util.*; | 27 | import java.util.*; |
28 | import java.util.function.Function; | 28 | import java.util.function.Function; |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/PlanState.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/PlanState.java index e93b07bc..b3dd5290 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/PlanState.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/PlanState.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner; | 9 | package tools.refinery.interpreter.localsearch.planner; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
@@ -17,19 +17,19 @@ import java.util.List; | |||
17 | import java.util.Map; | 17 | import java.util.Map; |
18 | import java.util.Set; | 18 | import java.util.Set; |
19 | 19 | ||
20 | import tools.refinery.viatra.runtime.localsearch.planner.util.OperationCostComparator; | 20 | import tools.refinery.interpreter.localsearch.planner.util.OperationCostComparator; |
21 | import tools.refinery.viatra.runtime.matchers.algorithms.OrderedIterableMerge; | 21 | import tools.refinery.interpreter.matchers.algorithms.OrderedIterableMerge; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 22 | import tools.refinery.interpreter.matchers.psystem.PBody; |
23 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 23 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 24 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * This class represents the state of the plan during planning. | 27 | * This class represents the state of the plan during planning. |
28 | * | 28 | * |
29 | * <p> A PlanState represents a sequence of operations (operationsList) and caches the computed cost | 29 | * <p> A PlanState represents a sequence of operations (operationsList) and caches the computed cost |
30 | * for this operation sequence. The list and the cost are initialized in the constructor. | 30 | * for this operation sequence. The list and the cost are initialized in the constructor. |
31 | * However, #categorizeChecks() also updates the operations list (by suffixing checks) | 31 | * However, #categorizeChecks() also updates the operations list (by suffixing checks) |
32 | * | 32 | * |
33 | * @author Marton Bur | 33 | * @author Marton Bur |
34 | * @noreference This class is not intended to be referenced by clients. | 34 | * @noreference This class is not intended to be referenced by clients. |
35 | */ | 35 | */ |
@@ -40,7 +40,7 @@ public class PlanState { | |||
40 | private final Set<PVariable> boundVariables; | 40 | private final Set<PVariable> boundVariables; |
41 | private final Collection<PVariable> deltaVariables; /* bound since ancestor plan */ | 41 | private final Collection<PVariable> deltaVariables; /* bound since ancestor plan */ |
42 | private final Set<PConstraint> enforcedConstraints; | 42 | private final Set<PConstraint> enforcedConstraints; |
43 | 43 | ||
44 | private double cummulativeProduct; | 44 | private double cummulativeProduct; |
45 | private double cost; | 45 | private double cost; |
46 | 46 | ||
@@ -48,7 +48,7 @@ public class PlanState { | |||
48 | 48 | ||
49 | /* | 49 | /* |
50 | * For a short explanation of past, present and future operations, | 50 | * For a short explanation of past, present and future operations, |
51 | * see class | 51 | * see class |
52 | */ | 52 | */ |
53 | private List<PConstraintInfo> presentExtends; | 53 | private List<PConstraintInfo> presentExtends; |
54 | 54 | ||
@@ -57,36 +57,36 @@ public class PlanState { | |||
57 | */ | 57 | */ |
58 | public PlanState(PBody pBody, Set<PVariable> boundVariables) { | 58 | public PlanState(PBody pBody, Set<PVariable> boundVariables) { |
59 | 59 | ||
60 | this(pBody, new ArrayList<>(), boundVariables, boundVariables /* also the delta */, | 60 | this(pBody, new ArrayList<>(), boundVariables, boundVariables /* also the delta */, |
61 | 0.0 /* initial cost */, 1.0 /*initial branch count */); | 61 | 0.0 /* initial cost */, 1.0 /*initial branch count */); |
62 | } | 62 | } |
63 | 63 | ||
64 | public PlanState cloneWithApplied(PConstraintInfo op) { | 64 | public PlanState cloneWithApplied(PConstraintInfo op) { |
65 | // Create operation list based on the current state | 65 | // Create operation list based on the current state |
66 | ArrayList<PConstraintInfo> newOperationsList = | 66 | ArrayList<PConstraintInfo> newOperationsList = |
67 | // pre-reserve excess capacity for later addition of CHECK ops | 67 | // pre-reserve excess capacity for later addition of CHECK ops |
68 | new ArrayList<>(pBody.getConstraints().size()); | 68 | new ArrayList<>(pBody.getConstraints().size()); |
69 | newOperationsList.addAll(this.getOperations()); | 69 | newOperationsList.addAll(this.getOperations()); |
70 | newOperationsList.add(op); | 70 | newOperationsList.add(op); |
71 | 71 | ||
72 | // Bind the variables of the op | 72 | // Bind the variables of the op |
73 | Collection<PVariable> deltaVariables = op.getFreeVariables(); | 73 | Collection<PVariable> deltaVariables = op.getFreeVariables(); |
74 | Set<PVariable> allBoundVariables = | 74 | Set<PVariable> allBoundVariables = |
75 | // pre-reserve exact capacity as variables are known | 75 | // pre-reserve exact capacity as variables are known |
76 | // (will not be affected by adding CHECK ops later) | 76 | // (will not be affected by adding CHECK ops later) |
77 | new HashSet<>(this.getBoundVariables().size() + deltaVariables.size()); | 77 | new HashSet<>(this.getBoundVariables().size() + deltaVariables.size()); |
78 | allBoundVariables.addAll(this.getBoundVariables()); | 78 | allBoundVariables.addAll(this.getBoundVariables()); |
79 | allBoundVariables.addAll(deltaVariables); | 79 | allBoundVariables.addAll(deltaVariables); |
80 | 80 | ||
81 | PlanState newState = new PlanState(getAssociatedPBody(), newOperationsList, allBoundVariables, deltaVariables, | 81 | PlanState newState = new PlanState(getAssociatedPBody(), newOperationsList, allBoundVariables, deltaVariables, |
82 | cost, cummulativeProduct); | 82 | cost, cummulativeProduct); |
83 | newState.accountNewOperation(op); | 83 | newState.accountNewOperation(op); |
84 | return newState; | 84 | return newState; |
85 | } | 85 | } |
86 | 86 | ||
87 | private PlanState(PBody pBody, List<PConstraintInfo> operationsList, | 87 | private PlanState(PBody pBody, List<PConstraintInfo> operationsList, |
88 | Set<PVariable> boundVariables, Collection<PVariable> deltaVariables, | 88 | Set<PVariable> boundVariables, Collection<PVariable> deltaVariables, |
89 | double cost, double cummulativeProduct) | 89 | double cost, double cummulativeProduct) |
90 | { | 90 | { |
91 | this.pBody = pBody; | 91 | this.pBody = pBody; |
92 | this.operationsList = operationsList; | 92 | this.operationsList = operationsList; |
@@ -118,18 +118,18 @@ public class PlanState { | |||
118 | } | 118 | } |
119 | 119 | ||
120 | /** | 120 | /** |
121 | * Re-categorizes given extend operations into already applied or no longer applicable ones (discarded), | 121 | * Re-categorizes given extend operations into already applied or no longer applicable ones (discarded), |
122 | * immediately applicable ones (saved as presently viable extends), | 122 | * immediately applicable ones (saved as presently viable extends), |
123 | * and not yet applicable ones (discarded). | 123 | * and not yet applicable ones (discarded). |
124 | * | 124 | * |
125 | * @param allPotentialExtendInfos all other extends that may be applicable | 125 | * @param allPotentialExtendInfos all other extends that may be applicable |
126 | * to this plan state now or in the future; | 126 | * to this plan state now or in the future; |
127 | * MUST consist of "extend" constraint applications only (at least one free variable) | 127 | * MUST consist of "extend" constraint applications only (at least one free variable) |
128 | */ | 128 | */ |
129 | public void updateExtends(Iterable<PConstraintInfo> allPotentialExtendInfos) { | 129 | public void updateExtends(Iterable<PConstraintInfo> allPotentialExtendInfos) { |
130 | presentExtends = new ArrayList<>(); | 130 | presentExtends = new ArrayList<>(); |
131 | 131 | ||
132 | 132 | ||
133 | // categorize future/present extend constraint infos | 133 | // categorize future/present extend constraint infos |
134 | for (PConstraintInfo op : allPotentialExtendInfos) { | 134 | for (PConstraintInfo op : allPotentialExtendInfos) { |
135 | updateExtendInternal(op); | 135 | updateExtendInternal(op); |
@@ -137,25 +137,25 @@ public class PlanState { | |||
137 | } | 137 | } |
138 | 138 | ||
139 | /** | 139 | /** |
140 | * Re-categorizes given extend operations into already applied or no longer applicable ones (discarded), | 140 | * Re-categorizes given extend operations into already applied or no longer applicable ones (discarded), |
141 | * immediately applicable ones (saved as presently viable extends), | 141 | * immediately applicable ones (saved as presently viable extends), |
142 | * and not yet applicable ones (discarded). | 142 | * and not yet applicable ones (discarded). |
143 | * | 143 | * |
144 | * @param extendOpsByBoundVariables all EXTEND operations indexed by affected <i>bound</i> variables | 144 | * @param extendOpsByBoundVariables all EXTEND operations indexed by affected <i>bound</i> variables |
145 | * MUST consist of "extend" constraint applications only (at least one free variable) | 145 | * MUST consist of "extend" constraint applications only (at least one free variable) |
146 | */ | 146 | */ |
147 | public void updateExtendsBasedOnDelta( | 147 | public void updateExtendsBasedOnDelta( |
148 | Iterable<PConstraintInfo> previousPresentExtends, | 148 | Iterable<PConstraintInfo> previousPresentExtends, |
149 | Map<PVariable, ? extends Collection<PConstraintInfo>> extendOpsByBoundVariables) | 149 | Map<PVariable, ? extends Collection<PConstraintInfo>> extendOpsByBoundVariables) |
150 | { | 150 | { |
151 | presentExtends = new ArrayList<>(); | 151 | presentExtends = new ArrayList<>(); |
152 | if (operationsList.isEmpty()) | 152 | if (operationsList.isEmpty()) |
153 | throw new IllegalStateException("Not applicable as starting step"); | 153 | throw new IllegalStateException("Not applicable as starting step"); |
154 | 154 | ||
155 | for (PConstraintInfo extend: previousPresentExtends) { | 155 | for (PConstraintInfo extend: previousPresentExtends) { |
156 | updateExtendInternal(extend); | 156 | updateExtendInternal(extend); |
157 | } | 157 | } |
158 | 158 | ||
159 | Set<PConstraintInfo> affectedExtends = new HashSet<>(); | 159 | Set<PConstraintInfo> affectedExtends = new HashSet<>(); |
160 | for (PVariable variable : deltaVariables) { | 160 | for (PVariable variable : deltaVariables) { |
161 | // only those check ops may become applicable that have an affected variable in the delta | 161 | // only those check ops may become applicable that have an affected variable in the delta |
@@ -168,43 +168,43 @@ public class PlanState { | |||
168 | updateExtendInternal(extend); | 168 | updateExtendInternal(extend); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | private void updateExtendInternal(PConstraintInfo op) { | 172 | private void updateExtendInternal(PConstraintInfo op) { |
173 | if(!enforcedConstraints.contains(op.getConstraint())) { | 173 | if(!enforcedConstraints.contains(op.getConstraint())) { |
174 | categorizeExtend(op); | 174 | categorizeExtend(op); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | /** | 178 | /** |
179 | * Check operations that newly became applicable (see {@link #getDeltaVariables()}) | 179 | * Check operations that newly became applicable (see {@link #getDeltaVariables()}) |
180 | * are appended to operations lists. | 180 | * are appended to operations lists. |
181 | * | 181 | * |
182 | * <p> Will never discover degenerate checks (of PConstraints with zero variables), | 182 | * <p> Will never discover degenerate checks (of PConstraints with zero variables), |
183 | * so must not use on initial state. | 183 | * so must not use on initial state. |
184 | * | 184 | * |
185 | * @param allPotentialCheckInfos all CHECK operations | 185 | * @param allPotentialCheckInfos all CHECK operations |
186 | * MUST consist of "check" constraint applications only (no free variables) | 186 | * MUST consist of "check" constraint applications only (no free variables) |
187 | * and must be iterable in decreasing order of cost | 187 | * and must be iterable in decreasing order of cost |
188 | * | 188 | * |
189 | * | 189 | * |
190 | */ | 190 | */ |
191 | public void applyChecks(List<PConstraintInfo> allPotentialCheckInfos) { | 191 | public void applyChecks(List<PConstraintInfo> allPotentialCheckInfos) { |
192 | applyChecksInternal(allPotentialCheckInfos); | 192 | applyChecksInternal(allPotentialCheckInfos); |
193 | } | 193 | } |
194 | 194 | ||
195 | /** | 195 | /** |
196 | * Immediately applicable checks are appended to operations lists. | 196 | * Immediately applicable checks are appended to operations lists. |
197 | * | 197 | * |
198 | * @param checkOpsByVariables all CHECK operations indexed by affected variables | 198 | * @param checkOpsByVariables all CHECK operations indexed by affected variables |
199 | * MUST consist of "check" constraint applications only (no free variables) | 199 | * MUST consist of "check" constraint applications only (no free variables) |
200 | * and each bucket must be iterable in decreasing order of cost | 200 | * and each bucket must be iterable in decreasing order of cost |
201 | */ | 201 | */ |
202 | public void applyChecksBasedOnDelta(Map<PVariable, List<PConstraintInfo>> checkOpsByVariables) { | 202 | public void applyChecksBasedOnDelta(Map<PVariable, List<PConstraintInfo>> checkOpsByVariables) { |
203 | if (operationsList.isEmpty()) | 203 | if (operationsList.isEmpty()) |
204 | throw new IllegalStateException("Not applicable as starting step"); | 204 | throw new IllegalStateException("Not applicable as starting step"); |
205 | 205 | ||
206 | Iterable<PConstraintInfo> affectedChecks = Collections.emptyList(); | 206 | Iterable<PConstraintInfo> affectedChecks = Collections.emptyList(); |
207 | 207 | ||
208 | for (PVariable variable : deltaVariables) { | 208 | for (PVariable variable : deltaVariables) { |
209 | // only those check ops may become applicable that have an affected variable in the delta | 209 | // only those check ops may become applicable that have an affected variable in the delta |
210 | List<PConstraintInfo> checksForVariable = checkOpsByVariables.get(variable); | 210 | List<PConstraintInfo> checksForVariable = checkOpsByVariables.get(variable); |
@@ -212,7 +212,7 @@ public class PlanState { | |||
212 | affectedChecks = OrderedIterableMerge.mergeUniques(affectedChecks, checksForVariable, infoComparator); | 212 | affectedChecks = OrderedIterableMerge.mergeUniques(affectedChecks, checksForVariable, infoComparator); |
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||
216 | // checks retain their order, no re-sorting needed | 216 | // checks retain their order, no re-sorting needed |
217 | applyChecksInternal(affectedChecks); | 217 | applyChecksInternal(affectedChecks); |
218 | } | 218 | } |
@@ -220,10 +220,10 @@ public class PlanState { | |||
220 | private void applyChecksInternal(Iterable<PConstraintInfo> checks) { | 220 | private void applyChecksInternal(Iterable<PConstraintInfo> checks) { |
221 | for (PConstraintInfo checkInfo : checks) { | 221 | for (PConstraintInfo checkInfo : checks) { |
222 | if (this.boundVariables.containsAll(checkInfo.getBoundVariables()) && | 222 | if (this.boundVariables.containsAll(checkInfo.getBoundVariables()) && |
223 | !enforcedConstraints.contains(checkInfo.getConstraint())) | 223 | !enforcedConstraints.contains(checkInfo.getConstraint())) |
224 | { | 224 | { |
225 | operationsList.add(checkInfo); | 225 | operationsList.add(checkInfo); |
226 | accountNewOperation(checkInfo); | 226 | accountNewOperation(checkInfo); |
227 | } | 227 | } |
228 | } | 228 | } |
229 | } | 229 | } |
@@ -258,7 +258,7 @@ public class PlanState { | |||
258 | return cost; | 258 | return cost; |
259 | } | 259 | } |
260 | 260 | ||
261 | 261 | ||
262 | /** | 262 | /** |
263 | * @return cumulative branching factor | 263 | * @return cumulative branching factor |
264 | * @since 2.1 | 264 | * @since 2.1 |
@@ -272,12 +272,12 @@ public class PlanState { | |||
272 | } | 272 | } |
273 | 273 | ||
274 | /** | 274 | /** |
275 | * Contains only those variables that are added by the newest extend | 275 | * Contains only those variables that are added by the newest extend |
276 | * (or the initially bound ones if no extend yet) | 276 | * (or the initially bound ones if no extend yet) |
277 | */ | 277 | */ |
278 | public Collection<PVariable> getDeltaVariables() { | 278 | public Collection<PVariable> getDeltaVariables() { |
279 | return deltaVariables; | 279 | return deltaVariables; |
280 | } | 280 | } |
281 | 281 | ||
282 | 282 | ||
283 | } | 283 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/compiler/AbstractOperationCompiler.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/compiler/AbstractOperationCompiler.java index 73312dc9..aaa6414c 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/compiler/AbstractOperationCompiler.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/compiler/AbstractOperationCompiler.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner.compiler; | 9 | package tools.refinery.interpreter.localsearch.planner.compiler; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.HashMap; | 12 | import java.util.HashMap; |
@@ -17,49 +17,49 @@ import java.util.Set; | |||
17 | import java.util.stream.Collectors; | 17 | import java.util.stream.Collectors; |
18 | import java.util.stream.Stream; | 18 | import java.util.stream.Stream; |
19 | 19 | ||
20 | import tools.refinery.viatra.runtime.localsearch.matcher.CallWithAdornment; | 20 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
21 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 21 | import tools.refinery.interpreter.localsearch.operations.util.CallInformation; |
22 | import tools.refinery.viatra.runtime.localsearch.operations.check.AggregatorCheck; | 22 | import tools.refinery.interpreter.localsearch.matcher.CallWithAdornment; |
23 | import tools.refinery.viatra.runtime.localsearch.operations.check.BinaryTransitiveClosureCheck; | 23 | import tools.refinery.interpreter.localsearch.operations.check.AggregatorCheck; |
24 | import tools.refinery.viatra.runtime.localsearch.operations.check.CheckConstant; | 24 | import tools.refinery.interpreter.localsearch.operations.check.BinaryTransitiveClosureCheck; |
25 | import tools.refinery.viatra.runtime.localsearch.operations.check.CheckPositivePatternCall; | 25 | import tools.refinery.interpreter.localsearch.operations.check.CheckConstant; |
26 | import tools.refinery.viatra.runtime.localsearch.operations.check.CountCheck; | 26 | import tools.refinery.interpreter.localsearch.operations.check.CheckPositivePatternCall; |
27 | import tools.refinery.viatra.runtime.localsearch.operations.check.ExpressionCheck; | 27 | import tools.refinery.interpreter.localsearch.operations.check.CountCheck; |
28 | import tools.refinery.viatra.runtime.localsearch.operations.check.ExpressionEvalCheck; | 28 | import tools.refinery.interpreter.localsearch.operations.check.ExpressionCheck; |
29 | import tools.refinery.viatra.runtime.localsearch.operations.check.InequalityCheck; | 29 | import tools.refinery.interpreter.localsearch.operations.check.ExpressionEvalCheck; |
30 | import tools.refinery.viatra.runtime.localsearch.operations.check.NACOperation; | 30 | import tools.refinery.interpreter.localsearch.operations.check.InequalityCheck; |
31 | import tools.refinery.viatra.runtime.localsearch.operations.extend.AggregatorExtend; | 31 | import tools.refinery.interpreter.localsearch.operations.check.NACOperation; |
32 | import tools.refinery.viatra.runtime.localsearch.operations.extend.CountOperation; | 32 | import tools.refinery.interpreter.localsearch.operations.extend.AggregatorExtend; |
33 | import tools.refinery.viatra.runtime.localsearch.operations.extend.ExpressionEval; | 33 | import tools.refinery.interpreter.localsearch.operations.extend.CountOperation; |
34 | import tools.refinery.viatra.runtime.localsearch.operations.extend.ExtendBinaryTransitiveClosure; | 34 | import tools.refinery.interpreter.localsearch.operations.extend.ExpressionEval; |
35 | import tools.refinery.viatra.runtime.localsearch.operations.extend.ExtendConstant; | 35 | import tools.refinery.interpreter.localsearch.operations.extend.ExtendBinaryTransitiveClosure; |
36 | import tools.refinery.viatra.runtime.localsearch.operations.extend.ExtendPositivePatternCall; | 36 | import tools.refinery.interpreter.localsearch.operations.extend.ExtendConstant; |
37 | import tools.refinery.viatra.runtime.localsearch.operations.util.CallInformation; | 37 | import tools.refinery.interpreter.localsearch.operations.extend.ExtendPositivePatternCall; |
38 | import tools.refinery.viatra.runtime.localsearch.planner.util.CompilerHelper; | 38 | import tools.refinery.interpreter.localsearch.planner.util.CompilerHelper; |
39 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 39 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
40 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 40 | import tools.refinery.interpreter.matchers.context.IInputKey; |
41 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 41 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
42 | import tools.refinery.viatra.runtime.matchers.planning.QueryProcessingException; | 42 | import tools.refinery.interpreter.matchers.planning.QueryProcessingException; |
43 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 43 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
44 | import tools.refinery.viatra.runtime.matchers.planning.operations.PApply; | 44 | import tools.refinery.interpreter.matchers.planning.operations.PApply; |
45 | import tools.refinery.viatra.runtime.matchers.planning.operations.POperation; | 45 | import tools.refinery.interpreter.matchers.planning.operations.POperation; |
46 | import tools.refinery.viatra.runtime.matchers.planning.operations.PProject; | 46 | import tools.refinery.interpreter.matchers.planning.operations.PProject; |
47 | import tools.refinery.viatra.runtime.matchers.planning.operations.PStart; | 47 | import tools.refinery.interpreter.matchers.planning.operations.PStart; |
48 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 48 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
49 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 49 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
50 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | 50 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.AggregatorConstraint; |
51 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 51 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExportedParameter; |
52 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | 52 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExpressionEvaluation; |
53 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.Inequality; | 53 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.Inequality; |
54 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | 54 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.NegativePatternCall; |
55 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; | 55 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.PatternMatchCounter; |
56 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | 56 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.TypeFilterConstraint; |
57 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.BinaryReflexiveTransitiveClosure; | 57 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.BinaryReflexiveTransitiveClosure; |
58 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; | 58 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.BinaryTransitiveClosure; |
59 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.ConstantValue; | 59 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.ConstantValue; |
60 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 60 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
61 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 61 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.TypeConstraint; |
62 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 62 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * @author Zoltan Ujhelyi | 65 | * @author Zoltan Ujhelyi |
@@ -67,27 +67,27 @@ import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | |||
67 | * | 67 | * |
68 | */ | 68 | */ |
69 | public abstract class AbstractOperationCompiler implements IOperationCompiler { | 69 | public abstract class AbstractOperationCompiler implements IOperationCompiler { |
70 | 70 | ||
71 | protected static final String UNSUPPORTED_TYPE_MESSAGE = "Unsupported type: "; | 71 | protected static final String UNSUPPORTED_TYPE_MESSAGE = "Unsupported type: "; |
72 | 72 | ||
73 | protected abstract void createExtend(TypeConstraint typeConstraint, Map<PVariable, Integer> variableMapping); | 73 | protected abstract void createExtend(TypeConstraint typeConstraint, Map<PVariable, Integer> variableMapping); |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * @throws ViatraQueryRuntimeException | 76 | * @throws InterpreterRuntimeException |
77 | */ | 77 | */ |
78 | protected abstract void createCheck(TypeConstraint typeConstraint, Map<PVariable, Integer> variableMapping); | 78 | protected abstract void createCheck(TypeConstraint typeConstraint, Map<PVariable, Integer> variableMapping); |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * @throws ViatraQueryRuntimeException | 81 | * @throws InterpreterRuntimeException |
82 | */ | 82 | */ |
83 | protected abstract void createCheck(TypeFilterConstraint typeConstraint, Map<PVariable, Integer> variableMapping); | 83 | protected abstract void createCheck(TypeFilterConstraint typeConstraint, Map<PVariable, Integer> variableMapping); |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * @since 2.0 | 86 | * @since 2.0 |
87 | * @throws ViatraQueryRuntimeException | 87 | * @throws InterpreterRuntimeException |
88 | */ | 88 | */ |
89 | protected abstract void createUnaryTypeCheck(IInputKey type, int position); | 89 | protected abstract void createUnaryTypeCheck(IInputKey type, int position); |
90 | 90 | ||
91 | protected List<ISearchOperation> operations; | 91 | protected List<ISearchOperation> operations; |
92 | protected Set<CallWithAdornment> dependencies = new HashSet<>(); | 92 | protected Set<CallWithAdornment> dependencies = new HashSet<>(); |
93 | protected Map<PConstraint, Set<Integer>> variableBindings; | 93 | protected Map<PConstraint, Set<Integer>> variableBindings; |
@@ -100,34 +100,34 @@ public abstract class AbstractOperationCompiler implements IOperationCompiler { | |||
100 | 100 | ||
101 | /** | 101 | /** |
102 | * Compiles a plan of <code>POperation</code>s to a list of type <code>List<ISearchOperation></code> | 102 | * Compiles a plan of <code>POperation</code>s to a list of type <code>List<ISearchOperation></code> |
103 | * | 103 | * |
104 | * @param plan | 104 | * @param plan |
105 | * @param boundParameters | 105 | * @param boundParameters |
106 | * @return an ordered list of POperations that make up the compiled search plan | 106 | * @return an ordered list of POperations that make up the compiled search plan |
107 | * @throws ViatraQueryRuntimeException | 107 | * @throws InterpreterRuntimeException |
108 | */ | 108 | */ |
109 | @Override | 109 | @Override |
110 | public List<ISearchOperation> compile(SubPlan plan, Set<PParameter> boundParameters) { | 110 | public List<ISearchOperation> compile(SubPlan plan, Set<PParameter> boundParameters) { |
111 | 111 | ||
112 | variableMappings = CompilerHelper.createVariableMapping(plan); | 112 | variableMappings = CompilerHelper.createVariableMapping(plan); |
113 | variableBindings = CompilerHelper.cacheVariableBindings(plan, variableMappings, boundParameters); | 113 | variableBindings = CompilerHelper.cacheVariableBindings(plan, variableMappings, boundParameters); |
114 | 114 | ||
115 | operations = new ArrayList<>(); | 115 | operations = new ArrayList<>(); |
116 | 116 | ||
117 | List<POperation> operationList = CompilerHelper.createOperationsList(plan); | 117 | List<POperation> operationList = CompilerHelper.createOperationsList(plan); |
118 | for (POperation pOperation : operationList) { | 118 | for (POperation pOperation : operationList) { |
119 | compile(pOperation, variableMappings); | 119 | compile(pOperation, variableMappings); |
120 | } | 120 | } |
121 | 121 | ||
122 | return operations; | 122 | return operations; |
123 | } | 123 | } |
124 | 124 | ||
125 | private void compile(POperation pOperation, Map<PVariable, Integer> variableMapping) { | 125 | private void compile(POperation pOperation, Map<PVariable, Integer> variableMapping) { |
126 | 126 | ||
127 | if (pOperation instanceof PApply) { | 127 | if (pOperation instanceof PApply) { |
128 | PApply pApply = (PApply) pOperation; | 128 | PApply pApply = (PApply) pOperation; |
129 | PConstraint pConstraint = pApply.getPConstraint(); | 129 | PConstraint pConstraint = pApply.getPConstraint(); |
130 | 130 | ||
131 | if (isCheck(pConstraint, variableMapping)) { | 131 | if (isCheck(pConstraint, variableMapping)) { |
132 | // check | 132 | // check |
133 | createCheckDispatcher(pConstraint, variableMapping); | 133 | createCheckDispatcher(pConstraint, variableMapping); |
@@ -135,7 +135,7 @@ public abstract class AbstractOperationCompiler implements IOperationCompiler { | |||
135 | // extend | 135 | // extend |
136 | createExtendDispatcher(pConstraint, variableMapping); | 136 | createExtendDispatcher(pConstraint, variableMapping); |
137 | } | 137 | } |
138 | 138 | ||
139 | } else if (pOperation instanceof PStart) { | 139 | } else if (pOperation instanceof PStart) { |
140 | // nop | 140 | // nop |
141 | } else if (pOperation instanceof PProject) { | 141 | } else if (pOperation instanceof PProject) { |
@@ -143,16 +143,16 @@ public abstract class AbstractOperationCompiler implements IOperationCompiler { | |||
143 | } else { | 143 | } else { |
144 | throw new QueryProcessingException("PStart, PApply or PProject was expected, received: " + pOperation.getClass(), null,"Unexpected POperation type", null); | 144 | throw new QueryProcessingException("PStart, PApply or PProject was expected, received: " + pOperation.getClass(), null,"Unexpected POperation type", null); |
145 | } | 145 | } |
146 | 146 | ||
147 | } | 147 | } |
148 | 148 | ||
149 | private void createCheckDispatcher(PConstraint pConstraint, Map<PVariable, Integer> variableMapping) { | 149 | private void createCheckDispatcher(PConstraint pConstraint, Map<PVariable, Integer> variableMapping) { |
150 | 150 | ||
151 | 151 | ||
152 | // DeferredPConstraint subclasses | 152 | // DeferredPConstraint subclasses |
153 | 153 | ||
154 | // Equalities are normalized | 154 | // Equalities are normalized |
155 | 155 | ||
156 | if (pConstraint instanceof Inequality) { | 156 | if (pConstraint instanceof Inequality) { |
157 | createCheck((Inequality) pConstraint, variableMapping); | 157 | createCheck((Inequality) pConstraint, variableMapping); |
158 | } else if (pConstraint instanceof PositivePatternCall){ | 158 | } else if (pConstraint instanceof PositivePatternCall){ |
@@ -170,9 +170,9 @@ public abstract class AbstractOperationCompiler implements IOperationCompiler { | |||
170 | } else if (pConstraint instanceof ExportedParameter) { | 170 | } else if (pConstraint instanceof ExportedParameter) { |
171 | // Nothing to do here | 171 | // Nothing to do here |
172 | } else | 172 | } else |
173 | 173 | ||
174 | // EnumerablePConstraint subclasses | 174 | // EnumerablePConstraint subclasses |
175 | 175 | ||
176 | if (pConstraint instanceof BinaryTransitiveClosure) { | 176 | if (pConstraint instanceof BinaryTransitiveClosure) { |
177 | createCheck((BinaryTransitiveClosure) pConstraint, variableMapping); | 177 | createCheck((BinaryTransitiveClosure) pConstraint, variableMapping); |
178 | } else if (pConstraint instanceof BinaryReflexiveTransitiveClosure) { | 178 | } else if (pConstraint instanceof BinaryReflexiveTransitiveClosure) { |
@@ -185,13 +185,13 @@ public abstract class AbstractOperationCompiler implements IOperationCompiler { | |||
185 | String msg = "Unsupported Check constraint: "+pConstraint.toString(); | 185 | String msg = "Unsupported Check constraint: "+pConstraint.toString(); |
186 | throw new QueryProcessingException(msg, null, msg, null); | 186 | throw new QueryProcessingException(msg, null, msg, null); |
187 | } | 187 | } |
188 | 188 | ||
189 | } | 189 | } |
190 | 190 | ||
191 | protected void createExtendDispatcher(PConstraint pConstraint, Map<PVariable, Integer> variableMapping) { | 191 | protected void createExtendDispatcher(PConstraint pConstraint, Map<PVariable, Integer> variableMapping) { |
192 | 192 | ||
193 | // DeferredPConstraint subclasses | 193 | // DeferredPConstraint subclasses |
194 | 194 | ||
195 | // Equalities are normalized | 195 | // Equalities are normalized |
196 | if (pConstraint instanceof PositivePatternCall) { | 196 | if (pConstraint instanceof PositivePatternCall) { |
197 | createExtend((PositivePatternCall)pConstraint, variableMapping); | 197 | createExtend((PositivePatternCall)pConstraint, variableMapping); |
@@ -204,9 +204,9 @@ public abstract class AbstractOperationCompiler implements IOperationCompiler { | |||
204 | } else if (pConstraint instanceof ExportedParameter) { | 204 | } else if (pConstraint instanceof ExportedParameter) { |
205 | // ExportedParameters are compiled to NOP | 205 | // ExportedParameters are compiled to NOP |
206 | } else | 206 | } else |
207 | 207 | ||
208 | // EnumerablePConstraint subclasses | 208 | // EnumerablePConstraint subclasses |
209 | 209 | ||
210 | if (pConstraint instanceof ConstantValue) { | 210 | if (pConstraint instanceof ConstantValue) { |
211 | createExtend((ConstantValue) pConstraint, variableMapping); | 211 | createExtend((ConstantValue) pConstraint, variableMapping); |
212 | } else if (pConstraint instanceof TypeConstraint) { | 212 | } else if (pConstraint instanceof TypeConstraint) { |
@@ -220,7 +220,7 @@ public abstract class AbstractOperationCompiler implements IOperationCompiler { | |||
220 | throw new QueryProcessingException(msg, null, msg, null); | 220 | throw new QueryProcessingException(msg, null, msg, null); |
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
224 | private boolean isCheck(PConstraint pConstraint, final Map<PVariable, Integer> variableMapping) { | 224 | private boolean isCheck(PConstraint pConstraint, final Map<PVariable, Integer> variableMapping) { |
225 | if (pConstraint instanceof NegativePatternCall){ | 225 | if (pConstraint instanceof NegativePatternCall){ |
226 | return true; | 226 | return true; |
@@ -284,20 +284,20 @@ public abstract class AbstractOperationCompiler implements IOperationCompiler { | |||
284 | protected void createCheck(BinaryTransitiveClosure binaryTransitiveClosure, Map<PVariable, Integer> variableMapping) { | 284 | protected void createCheck(BinaryTransitiveClosure binaryTransitiveClosure, Map<PVariable, Integer> variableMapping) { |
285 | int sourcePosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(0)); | 285 | int sourcePosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(0)); |
286 | int targetPosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(1)); | 286 | int targetPosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(1)); |
287 | 287 | ||
288 | //The second parameter is NOT bound during execution! | 288 | //The second parameter is NOT bound during execution! |
289 | CallInformation information = CallInformation.create(binaryTransitiveClosure, variableMapping, Stream.of(sourcePosition).collect(Collectors.toSet())); | 289 | CallInformation information = CallInformation.create(binaryTransitiveClosure, variableMapping, Stream.of(sourcePosition).collect(Collectors.toSet())); |
290 | operations.add(new BinaryTransitiveClosureCheck(information, sourcePosition, targetPosition, false)); | 290 | operations.add(new BinaryTransitiveClosureCheck(information, sourcePosition, targetPosition, false)); |
291 | dependencies.add(information.getCallWithAdornment()); | 291 | dependencies.add(information.getCallWithAdornment()); |
292 | } | 292 | } |
293 | 293 | ||
294 | /** | 294 | /** |
295 | * @since 2.0 | 295 | * @since 2.0 |
296 | */ | 296 | */ |
297 | protected void createCheck(BinaryReflexiveTransitiveClosure binaryTransitiveClosure, Map<PVariable, Integer> variableMapping) { | 297 | protected void createCheck(BinaryReflexiveTransitiveClosure binaryTransitiveClosure, Map<PVariable, Integer> variableMapping) { |
298 | int sourcePosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(0)); | 298 | int sourcePosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(0)); |
299 | int targetPosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(1)); | 299 | int targetPosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(1)); |
300 | 300 | ||
301 | //The second parameter is NOT bound during execution! | 301 | //The second parameter is NOT bound during execution! |
302 | CallInformation information = CallInformation.create(binaryTransitiveClosure, variableMapping, Stream.of(sourcePosition).collect(Collectors.toSet())); | 302 | CallInformation information = CallInformation.create(binaryTransitiveClosure, variableMapping, Stream.of(sourcePosition).collect(Collectors.toSet())); |
303 | createUnaryTypeCheck(binaryTransitiveClosure.getUniverseType(), sourcePosition); | 303 | createUnaryTypeCheck(binaryTransitiveClosure.getUniverseType(), sourcePosition); |
@@ -309,12 +309,12 @@ public abstract class AbstractOperationCompiler implements IOperationCompiler { | |||
309 | // Fill unbound variables with null; simply copy all variables. Unbound variables will be null anyway | 309 | // Fill unbound variables with null; simply copy all variables. Unbound variables will be null anyway |
310 | Iterable<String> inputParameterNames = expressionEvaluation.getEvaluator().getInputParameterNames(); | 310 | Iterable<String> inputParameterNames = expressionEvaluation.getEvaluator().getInputParameterNames(); |
311 | Map<String, Integer> nameMap = new HashMap<>(); | 311 | Map<String, Integer> nameMap = new HashMap<>(); |
312 | 312 | ||
313 | for (String pVariableName : inputParameterNames) { | 313 | for (String pVariableName : inputParameterNames) { |
314 | PVariable pVariable = expressionEvaluation.getPSystem().getVariableByNameChecked(pVariableName); | 314 | PVariable pVariable = expressionEvaluation.getPSystem().getVariableByNameChecked(pVariableName); |
315 | nameMap.put(pVariableName, variableMapping.get(pVariable)); | 315 | nameMap.put(pVariableName, variableMapping.get(pVariable)); |
316 | } | 316 | } |
317 | 317 | ||
318 | // output variable can be null; if null it is an ExpressionCheck | 318 | // output variable can be null; if null it is an ExpressionCheck |
319 | if(expressionEvaluation.getOutputVariable() == null){ | 319 | if(expressionEvaluation.getOutputVariable() == null){ |
320 | operations.add(new ExpressionCheck(expressionEvaluation.getEvaluator(), nameMap)); | 320 | operations.add(new ExpressionCheck(expressionEvaluation.getEvaluator(), nameMap)); |
@@ -348,44 +348,44 @@ public abstract class AbstractOperationCompiler implements IOperationCompiler { | |||
348 | protected void createExtend(BinaryTransitiveClosure binaryTransitiveClosure, Map<PVariable, Integer> variableMapping) { | 348 | protected void createExtend(BinaryTransitiveClosure binaryTransitiveClosure, Map<PVariable, Integer> variableMapping) { |
349 | int sourcePosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(0)); | 349 | int sourcePosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(0)); |
350 | int targetPosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(1)); | 350 | int targetPosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(1)); |
351 | 351 | ||
352 | boolean sourceBound = variableBindings.get(binaryTransitiveClosure).contains(sourcePosition); | 352 | boolean sourceBound = variableBindings.get(binaryTransitiveClosure).contains(sourcePosition); |
353 | boolean targetBound = variableBindings.get(binaryTransitiveClosure).contains(targetPosition); | 353 | boolean targetBound = variableBindings.get(binaryTransitiveClosure).contains(targetPosition); |
354 | 354 | ||
355 | CallInformation information = CallInformation.create(binaryTransitiveClosure, variableMapping, variableBindings.get(binaryTransitiveClosure)); | 355 | CallInformation information = CallInformation.create(binaryTransitiveClosure, variableMapping, variableBindings.get(binaryTransitiveClosure)); |
356 | 356 | ||
357 | if (sourceBound && !targetBound) { | 357 | if (sourceBound && !targetBound) { |
358 | operations.add(new ExtendBinaryTransitiveClosure.Forward(information, sourcePosition, targetPosition, false)); | 358 | operations.add(new ExtendBinaryTransitiveClosure.Forward(information, sourcePosition, targetPosition, false)); |
359 | dependencies.add(information.getCallWithAdornment()); | 359 | dependencies.add(information.getCallWithAdornment()); |
360 | } else if (!sourceBound && targetBound) { | 360 | } else if (!sourceBound && targetBound) { |
361 | operations.add(new ExtendBinaryTransitiveClosure.Backward(information, sourcePosition, targetPosition, false)); | 361 | operations.add(new ExtendBinaryTransitiveClosure.Backward(information, sourcePosition, targetPosition, false)); |
362 | dependencies.add(information.getCallWithAdornment()); | 362 | dependencies.add(information.getCallWithAdornment()); |
363 | } else { | 363 | } else { |
364 | String msg = "Binary transitive closure not supported with two unbound parameters"; | 364 | String msg = "Binary transitive closure not supported with two unbound parameters"; |
365 | throw new QueryProcessingException(msg, null, msg, binaryTransitiveClosure.getPSystem().getPattern()); | 365 | throw new QueryProcessingException(msg, null, msg, binaryTransitiveClosure.getPSystem().getPattern()); |
366 | } | 366 | } |
367 | } | 367 | } |
368 | 368 | ||
369 | /** | 369 | /** |
370 | * @since 2.0 | 370 | * @since 2.0 |
371 | */ | 371 | */ |
372 | protected void createExtend(BinaryReflexiveTransitiveClosure binaryTransitiveClosure, Map<PVariable, Integer> variableMapping) { | 372 | protected void createExtend(BinaryReflexiveTransitiveClosure binaryTransitiveClosure, Map<PVariable, Integer> variableMapping) { |
373 | int sourcePosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(0)); | 373 | int sourcePosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(0)); |
374 | int targetPosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(1)); | 374 | int targetPosition = variableMapping.get(binaryTransitiveClosure.getVariablesTuple().get(1)); |
375 | 375 | ||
376 | boolean sourceBound = variableBindings.get(binaryTransitiveClosure).contains(sourcePosition); | 376 | boolean sourceBound = variableBindings.get(binaryTransitiveClosure).contains(sourcePosition); |
377 | boolean targetBound = variableBindings.get(binaryTransitiveClosure).contains(targetPosition); | 377 | boolean targetBound = variableBindings.get(binaryTransitiveClosure).contains(targetPosition); |
378 | 378 | ||
379 | CallInformation information = CallInformation.create(binaryTransitiveClosure, variableMapping, variableBindings.get(binaryTransitiveClosure)); | 379 | CallInformation information = CallInformation.create(binaryTransitiveClosure, variableMapping, variableBindings.get(binaryTransitiveClosure)); |
380 | 380 | ||
381 | if (sourceBound && !targetBound) { | 381 | if (sourceBound && !targetBound) { |
382 | createUnaryTypeCheck(binaryTransitiveClosure.getUniverseType(), sourcePosition); | 382 | createUnaryTypeCheck(binaryTransitiveClosure.getUniverseType(), sourcePosition); |
383 | operations.add(new ExtendBinaryTransitiveClosure.Forward(information, sourcePosition, targetPosition, true)); | 383 | operations.add(new ExtendBinaryTransitiveClosure.Forward(information, sourcePosition, targetPosition, true)); |
384 | dependencies.add(information.getCallWithAdornment()); | 384 | dependencies.add(information.getCallWithAdornment()); |
385 | } else if (!sourceBound && targetBound) { | 385 | } else if (!sourceBound && targetBound) { |
386 | createUnaryTypeCheck(binaryTransitiveClosure.getUniverseType(), targetPosition); | 386 | createUnaryTypeCheck(binaryTransitiveClosure.getUniverseType(), targetPosition); |
387 | operations.add(new ExtendBinaryTransitiveClosure.Backward(information, sourcePosition, targetPosition, true)); | 387 | operations.add(new ExtendBinaryTransitiveClosure.Backward(information, sourcePosition, targetPosition, true)); |
388 | dependencies.add(information.getCallWithAdornment()); | 388 | dependencies.add(information.getCallWithAdornment()); |
389 | } else { | 389 | } else { |
390 | String msg = "Binary reflective transitive closure not supported with two unbound parameters"; | 390 | String msg = "Binary reflective transitive closure not supported with two unbound parameters"; |
391 | throw new QueryProcessingException(msg, null, msg, binaryTransitiveClosure.getPSystem().getPattern()); | 391 | throw new QueryProcessingException(msg, null, msg, binaryTransitiveClosure.getPSystem().getPattern()); |
@@ -394,19 +394,19 @@ public abstract class AbstractOperationCompiler implements IOperationCompiler { | |||
394 | 394 | ||
395 | protected void createExtend(ConstantValue constant, Map<PVariable, Integer> variableMapping) { | 395 | protected void createExtend(ConstantValue constant, Map<PVariable, Integer> variableMapping) { |
396 | int position = variableMapping.get(constant.getVariablesTuple().get(0)); | 396 | int position = variableMapping.get(constant.getVariablesTuple().get(0)); |
397 | operations.add(new ExtendConstant(position, constant.getSupplierKey())); | 397 | operations.add(new ExtendConstant(position, constant.getSupplierKey())); |
398 | } | 398 | } |
399 | 399 | ||
400 | protected void createExtend(ExpressionEvaluation expressionEvaluation, Map<PVariable, Integer> variableMapping) { | 400 | protected void createExtend(ExpressionEvaluation expressionEvaluation, Map<PVariable, Integer> variableMapping) { |
401 | // Fill unbound variables with null; simply copy all variables. Unbound variables will be null anyway | 401 | // Fill unbound variables with null; simply copy all variables. Unbound variables will be null anyway |
402 | Iterable<String> inputParameterNames = expressionEvaluation.getEvaluator().getInputParameterNames(); | 402 | Iterable<String> inputParameterNames = expressionEvaluation.getEvaluator().getInputParameterNames(); |
403 | Map<String, Integer> nameMap = new HashMap<>(); | 403 | Map<String, Integer> nameMap = new HashMap<>(); |
404 | 404 | ||
405 | for (String pVariableName : inputParameterNames) { | 405 | for (String pVariableName : inputParameterNames) { |
406 | PVariable pVariable = expressionEvaluation.getPSystem().getVariableByNameChecked(pVariableName); | 406 | PVariable pVariable = expressionEvaluation.getPSystem().getVariableByNameChecked(pVariableName); |
407 | nameMap.put(pVariableName, variableMapping.get(pVariable)); | 407 | nameMap.put(pVariableName, variableMapping.get(pVariable)); |
408 | } | 408 | } |
409 | 409 | ||
410 | // output variable can be null; if null it is an ExpressionCheck | 410 | // output variable can be null; if null it is an ExpressionCheck |
411 | if(expressionEvaluation.getOutputVariable() == null){ | 411 | if(expressionEvaluation.getOutputVariable() == null){ |
412 | operations.add(new ExpressionCheck(expressionEvaluation.getEvaluator(), nameMap)); | 412 | operations.add(new ExpressionCheck(expressionEvaluation.getEvaluator(), nameMap)); |
@@ -426,5 +426,5 @@ public abstract class AbstractOperationCompiler implements IOperationCompiler { | |||
426 | operations.add(new CountOperation(information, variableMapping.get(patternMatchCounter.getResultVariable()))); | 426 | operations.add(new CountOperation(information, variableMapping.get(patternMatchCounter.getResultVariable()))); |
427 | dependencies.add(information.getCallWithAdornment()); | 427 | dependencies.add(information.getCallWithAdornment()); |
428 | } | 428 | } |
429 | 429 | ||
430 | } \ No newline at end of file | 430 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/compiler/GenericOperationCompiler.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/compiler/GenericOperationCompiler.java index d86982e9..82e63ba8 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/compiler/GenericOperationCompiler.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/compiler/GenericOperationCompiler.java | |||
@@ -7,18 +7,18 @@ | |||
7 | * | 7 | * |
8 | * SPDX-License-Identifier: EPL-2.0 | 8 | * SPDX-License-Identifier: EPL-2.0 |
9 | *******************************************************************************/ | 9 | *******************************************************************************/ |
10 | package tools.refinery.viatra.runtime.localsearch.planner.compiler; | 10 | package tools.refinery.interpreter.localsearch.planner.compiler; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.localsearch.operations.generic.GenericTypeCheck; | 12 | import tools.refinery.interpreter.localsearch.operations.generic.GenericTypeCheck; |
13 | import tools.refinery.viatra.runtime.localsearch.operations.generic.GenericTypeExtend; | 13 | import tools.refinery.interpreter.localsearch.operations.generic.GenericTypeExtend; |
14 | import tools.refinery.viatra.runtime.localsearch.operations.generic.GenericTypeExtendSingleValue; | 14 | import tools.refinery.interpreter.localsearch.operations.generic.GenericTypeExtendSingleValue; |
15 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 15 | import tools.refinery.interpreter.matchers.context.IInputKey; |
16 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 16 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 17 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | 18 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.TypeFilterConstraint; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 19 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.TypeConstraint; |
20 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 20 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
21 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 21 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
22 | 22 | ||
23 | import java.util.*; | 23 | import java.util.*; |
24 | 24 | ||
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/compiler/IOperationCompiler.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/compiler/IOperationCompiler.java index 625a7eb2..aee26cc9 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/compiler/IOperationCompiler.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/compiler/IOperationCompiler.java | |||
@@ -3,26 +3,26 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner.compiler; | 9 | package tools.refinery.interpreter.localsearch.planner.compiler; |
10 | 10 | ||
11 | import java.util.List; | 11 | import java.util.List; |
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.localsearch.matcher.CallWithAdornment; | 15 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
16 | import tools.refinery.viatra.runtime.localsearch.matcher.MatcherReference; | 16 | import tools.refinery.interpreter.localsearch.matcher.CallWithAdornment; |
17 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 17 | import tools.refinery.interpreter.localsearch.matcher.MatcherReference; |
18 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 18 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
19 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 19 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 20 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 21 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * An operation compiler is responsible for creating executable search plans from the subplan structure. | 24 | * An operation compiler is responsible for creating executable search plans from the subplan structure. |
25 | * | 25 | * |
26 | * @author Zoltan Ujhelyi | 26 | * @author Zoltan Ujhelyi |
27 | * @since 1.7 | 27 | * @since 1.7 |
28 | * | 28 | * |
@@ -31,11 +31,11 @@ public interface IOperationCompiler { | |||
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Compiles a plan of <code>POperation</code>s to a list of type <code>List<ISearchOperation></code> | 33 | * Compiles a plan of <code>POperation</code>s to a list of type <code>List<ISearchOperation></code> |
34 | * | 34 | * |
35 | * @param plan | 35 | * @param plan |
36 | * @param boundParameters | 36 | * @param boundParameters |
37 | * @return an ordered list of POperations that make up the compiled search plan | 37 | * @return an ordered list of POperations that make up the compiled search plan |
38 | * @throws ViatraQueryRuntimeException | 38 | * @throws InterpreterRuntimeException |
39 | */ | 39 | */ |
40 | List<ISearchOperation> compile(SubPlan plan, Set<PParameter> boundParameters); | 40 | List<ISearchOperation> compile(SubPlan plan, Set<PParameter> boundParameters); |
41 | 41 | ||
@@ -50,4 +50,4 @@ public interface IOperationCompiler { | |||
50 | */ | 50 | */ |
51 | Map<PVariable, Integer> getVariableMappings(); | 51 | Map<PVariable, Integer> getVariableMappings(); |
52 | 52 | ||
53 | } \ No newline at end of file | 53 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/IConstraintEvaluationContext.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/IConstraintEvaluationContext.java index 9b44612b..11195fff 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/IConstraintEvaluationContext.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/IConstraintEvaluationContext.java | |||
@@ -3,23 +3,23 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner.cost; | 9 | package tools.refinery.interpreter.localsearch.planner.cost; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.backend.ResultProviderRequestor; | 11 | import tools.refinery.interpreter.matchers.backend.ResultProviderRequestor; |
12 | import tools.refinery.viatra.runtime.matchers.context.IQueryResultProviderAccess; | 12 | import tools.refinery.interpreter.matchers.context.IQueryResultProviderAccess; |
13 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 13 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 14 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
15 | import java.util.Collection; | 15 | import java.util.Collection; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 16 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.analysis.QueryAnalyzer; | 17 | import tools.refinery.interpreter.matchers.psystem.analysis.QueryAnalyzer; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * This interface denotes the evaluation context of a constraint, intended for cost estimation. Provides access to information | 20 | * This interface denotes the evaluation context of a constraint, intended for cost estimation. Provides access to information |
21 | * on which the cost function can base its calculation. | 21 | * on which the cost function can base its calculation. |
22 | * | 22 | * |
23 | * @author Grill Balázs | 23 | * @author Grill Balázs |
24 | * @since 1.4 | 24 | * @since 1.4 |
25 | * @noimplement | 25 | * @noimplement |
@@ -40,24 +40,24 @@ public interface IConstraintEvaluationContext { | |||
40 | * Bound variables at the time of evaluating the constraint | 40 | * Bound variables at the time of evaluating the constraint |
41 | */ | 41 | */ |
42 | public Collection<PVariable> getBoundVariables(); | 42 | public Collection<PVariable> getBoundVariables(); |
43 | 43 | ||
44 | public IQueryRuntimeContext getRuntimeContext(); | 44 | public IQueryRuntimeContext getRuntimeContext(); |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * @since 1.5 | 47 | * @since 1.5 |
48 | */ | 48 | */ |
49 | public QueryAnalyzer getQueryAnalyzer(); | 49 | public QueryAnalyzer getQueryAnalyzer(); |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * @deprecated use {@link #resultProviderRequestor()} | 52 | * @deprecated use {@link #resultProviderRequestor()} |
53 | * @since 1.5 | 53 | * @since 1.5 |
54 | */ | 54 | */ |
55 | @Deprecated | 55 | @Deprecated |
56 | public IQueryResultProviderAccess resultProviderAccess(); | 56 | public IQueryResultProviderAccess resultProviderAccess(); |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * @since 2.1 | 59 | * @since 2.1 |
60 | */ | 60 | */ |
61 | public ResultProviderRequestor resultProviderRequestor(); | 61 | public ResultProviderRequestor resultProviderRequestor(); |
62 | 62 | ||
63 | } | 63 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/ICostFunction.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/ICostFunction.java index 4d9d0708..717c7787 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/ICostFunction.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/ICostFunction.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner.cost; | 9 | package tools.refinery.interpreter.localsearch.planner.cost; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Common interface for cost function implementation | 12 | * Common interface for cost function implementation |
13 | * | 13 | * |
14 | * @author Grill Balázs | 14 | * @author Grill Balázs |
15 | * @since 1.4 | 15 | * @since 1.4 |
16 | * | 16 | * |
@@ -18,5 +18,5 @@ package tools.refinery.viatra.runtime.localsearch.planner.cost; | |||
18 | public interface ICostFunction{ | 18 | public interface ICostFunction{ |
19 | 19 | ||
20 | public double apply(IConstraintEvaluationContext input); | 20 | public double apply(IConstraintEvaluationContext input); |
21 | 21 | ||
22 | } | 22 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/impl/HybridMatcherConstraintCostFunction.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/impl/HybridMatcherConstraintCostFunction.java index df9292f0..cb859f62 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/impl/HybridMatcherConstraintCostFunction.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/impl/HybridMatcherConstraintCostFunction.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner.cost.impl; | 9 | package tools.refinery.interpreter.localsearch.planner.cost.impl; |
10 | 10 | ||
11 | import java.util.HashMap; | 11 | import java.util.HashMap; |
12 | import java.util.List; | 12 | import java.util.List; |
@@ -14,25 +14,26 @@ import java.util.Map; | |||
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | import java.util.stream.Collectors; | 15 | import java.util.stream.Collectors; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.localsearch.planner.cost.IConstraintEvaluationContext; | 17 | import tools.refinery.interpreter.localsearch.planner.cost.IConstraintEvaluationContext; |
18 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 18 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 19 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 20 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.ConstantValue; | 21 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.ConstantValue; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 22 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
23 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 23 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
24 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 24 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
25 | import tools.refinery.interpreter.matchers.tuple.Tuples; | ||
25 | 26 | ||
26 | /** | 27 | /** |
27 | * This cost function is intended to be used on hybrid configuration, with the strict restriction than any | 28 | * This cost function is intended to be used on hybrid configuration, with the strict restriction than any |
28 | * non-flattened positive pattern call is executed with Rete engine. This implementation provides the exact number | 29 | * non-flattened positive pattern call is executed with Rete engine. This implementation provides the exact number |
29 | * of matches by invoking the result provider for the called pattern. | 30 | * of matches by invoking the result provider for the called pattern. |
30 | * | 31 | * |
31 | * @deprecated {@link StatisticsBasedConstraintCostFunction} should use {@link IQueryResultProvider#estimateCardinality(tools.refinery.viatra.runtime.matchers.tuple.TupleMask, org.eclipse.viatra.query.runtime.matchers.util.Accuracy)} | 32 | * @deprecated {@link StatisticsBasedConstraintCostFunction} should use {@link IQueryResultProvider#estimateCardinality(TupleMask, org.eclipse.viatra.query.runtime.matchers.util.Accuracy)} |
32 | */ | 33 | */ |
33 | @Deprecated | 34 | @Deprecated |
34 | public class HybridMatcherConstraintCostFunction extends IndexerBasedConstraintCostFunction { | 35 | public class HybridMatcherConstraintCostFunction extends IndexerBasedConstraintCostFunction { |
35 | 36 | ||
36 | @Override | 37 | @Override |
37 | protected double _calculateCost(PositivePatternCall patternCall, IConstraintEvaluationContext context) { | 38 | protected double _calculateCost(PositivePatternCall patternCall, IConstraintEvaluationContext context) { |
38 | // Determine local constant constraints which is used to filter results | 39 | // Determine local constant constraints which is used to filter results |
@@ -48,7 +49,7 @@ public class HybridMatcherConstraintCostFunction extends IndexerBasedConstraintC | |||
48 | } | 49 | } |
49 | } | 50 | } |
50 | } | 51 | } |
51 | 52 | ||
52 | // Determine filter | 53 | // Determine filter |
53 | Object[] filter = new Object[variables.getSize()]; | 54 | Object[] filter = new Object[variables.getSize()]; |
54 | for(int i=0; i < variables.getSize(); i++){ | 55 | for(int i=0; i < variables.getSize(); i++){ |
@@ -66,19 +67,19 @@ public class HybridMatcherConstraintCostFunction extends IndexerBasedConstraintC | |||
66 | 67 | ||
67 | IQueryResultProvider resultProvider = context.resultProviderRequestor().requestResultProvider(patternCall, null); | 68 | IQueryResultProvider resultProvider = context.resultProviderRequestor().requestResultProvider(patternCall, null); |
68 | Map<Tuple, Integer> aggregatedCounts = new HashMap<>(); | 69 | Map<Tuple, Integer> aggregatedCounts = new HashMap<>(); |
69 | 70 | ||
70 | // Iterate over all matches and count together matches that has equal values on | 71 | // Iterate over all matches and count together matches that has equal values on |
71 | // aggregateKeys positions. The cost of the pattern call is considered to be the | 72 | // aggregateKeys positions. The cost of the pattern call is considered to be the |
72 | // Maximum of these counted values | 73 | // Maximum of these counted values |
73 | 74 | ||
74 | int result = 0; | 75 | int result = 0; |
75 | // NOTE: a stream is not an iterable (cannot be iterated more than once), so to use it in a for-loop | 76 | // NOTE: a stream is not an iterable (cannot be iterated more than once), so to use it in a for-loop |
76 | // it has to be wrapped; in the following line a lambda is used to implement Iterable#iterator() | 77 | // it has to be wrapped; in the following line a lambda is used to implement Iterable#iterator() |
77 | for (Tuple match : (Iterable<Tuple>) () -> resultProvider.getAllMatches(filter).iterator()) { | 78 | for (Tuple match : (Iterable<Tuple>) () -> resultProvider.getAllMatches(filter).iterator()) { |
78 | Tuple extracted = Tuples.flatTupleOf(aggregateKeys.stream().map(match::get).toArray()); | 79 | Tuple extracted = Tuples.flatTupleOf(aggregateKeys.stream().map(match::get).toArray()); |
79 | int count = (aggregatedCounts.containsKey(extracted)) | 80 | int count = (aggregatedCounts.containsKey(extracted)) |
80 | ? aggregatedCounts.get(extracted) + 1 | 81 | ? aggregatedCounts.get(extracted) + 1 |
81 | : 1; | 82 | : 1; |
82 | aggregatedCounts.put(extracted, count); | 83 | aggregatedCounts.put(extracted, count); |
83 | if (result < count) { | 84 | if (result < count) { |
84 | result = count; | 85 | result = count; |
@@ -87,5 +88,5 @@ public class HybridMatcherConstraintCostFunction extends IndexerBasedConstraintC | |||
87 | 88 | ||
88 | return result; | 89 | return result; |
89 | } | 90 | } |
90 | 91 | ||
91 | } \ No newline at end of file | 92 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/impl/IndexerBasedConstraintCostFunction.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/impl/IndexerBasedConstraintCostFunction.java index 9e2c8680..33d34ed8 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/impl/IndexerBasedConstraintCostFunction.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/impl/IndexerBasedConstraintCostFunction.java | |||
@@ -1,33 +1,33 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2010-2016, Grill Balázs, IncQuery Labs Ltd. | 2 | * Copyright (c) 2010-2016, Grill Balázs, IncQuery Labs Ltd. |
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | */ | 8 | */ |
9 | package tools.refinery.viatra.runtime.localsearch.planner.cost.impl; | 9 | package tools.refinery.interpreter.localsearch.planner.cost.impl; |
10 | 10 | ||
11 | import java.util.Optional; | 11 | import java.util.Optional; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.localsearch.planner.cost.IConstraintEvaluationContext; | 13 | import tools.refinery.interpreter.localsearch.planner.cost.IConstraintEvaluationContext; |
14 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 14 | import tools.refinery.interpreter.matchers.context.IInputKey; |
15 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 15 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
16 | import tools.refinery.viatra.runtime.matchers.util.Accuracy; | 16 | import tools.refinery.interpreter.matchers.util.Accuracy; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Cost function which calculates cost based on the cardinality of items in the runtime model, provided by the base indexer | 19 | * Cost function which calculates cost based on the cardinality of items in the runtime model, provided by the base indexer |
20 | * | 20 | * |
21 | * @author Grill Balázs | 21 | * @author Grill Balázs |
22 | * @since 1.4 | 22 | * @since 1.4 |
23 | */ | 23 | */ |
24 | public class IndexerBasedConstraintCostFunction extends StatisticsBasedConstraintCostFunction { | 24 | public class IndexerBasedConstraintCostFunction extends StatisticsBasedConstraintCostFunction { |
25 | 25 | ||
26 | 26 | ||
27 | 27 | ||
28 | 28 | ||
29 | /** | 29 | /** |
30 | * | 30 | * |
31 | */ | 31 | */ |
32 | public IndexerBasedConstraintCostFunction() { | 32 | public IndexerBasedConstraintCostFunction() { |
33 | super(); | 33 | super(); |
@@ -45,5 +45,5 @@ public class IndexerBasedConstraintCostFunction extends StatisticsBasedConstrain | |||
45 | public Optional<Long> projectionSize(IConstraintEvaluationContext input, IInputKey supplierKey, TupleMask groupMask, Accuracy requiredAccuracy) { | 45 | public Optional<Long> projectionSize(IConstraintEvaluationContext input, IInputKey supplierKey, TupleMask groupMask, Accuracy requiredAccuracy) { |
46 | return input.getRuntimeContext().estimateCardinality(supplierKey, groupMask, requiredAccuracy); | 46 | return input.getRuntimeContext().estimateCardinality(supplierKey, groupMask, requiredAccuracy); |
47 | } | 47 | } |
48 | 48 | ||
49 | } | 49 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/impl/StatisticsBasedConstraintCostFunction.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/impl/StatisticsBasedConstraintCostFunction.java index 873be31d..200b2902 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/impl/StatisticsBasedConstraintCostFunction.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/impl/StatisticsBasedConstraintCostFunction.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | */ | 8 | */ |
9 | package tools.refinery.viatra.runtime.localsearch.planner.cost.impl; | 9 | package tools.refinery.interpreter.localsearch.planner.cost.impl; |
10 | 10 | ||
11 | import static tools.refinery.viatra.runtime.matchers.planning.helpers.StatisticsHelper.min; | 11 | import static tools.refinery.interpreter.matchers.planning.helpers.StatisticsHelper.min; |
12 | 12 | ||
13 | import java.util.ArrayList; | 13 | import java.util.ArrayList; |
14 | import java.util.Arrays; | 14 | import java.util.Arrays; |
@@ -19,41 +19,41 @@ import java.util.Map; | |||
19 | import java.util.Optional; | 19 | import java.util.Optional; |
20 | import java.util.Set; | 20 | import java.util.Set; |
21 | 21 | ||
22 | import tools.refinery.viatra.runtime.localsearch.matcher.integration.AbstractLocalSearchResultProvider; | 22 | import tools.refinery.interpreter.localsearch.matcher.integration.AbstractLocalSearchResultProvider; |
23 | import tools.refinery.viatra.runtime.localsearch.planner.cost.IConstraintEvaluationContext; | 23 | import tools.refinery.interpreter.localsearch.planner.cost.IConstraintEvaluationContext; |
24 | import tools.refinery.viatra.runtime.localsearch.planner.cost.ICostFunction; | 24 | import tools.refinery.interpreter.localsearch.planner.cost.ICostFunction; |
25 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 25 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
26 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 26 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
27 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 27 | import tools.refinery.interpreter.matchers.context.IInputKey; |
28 | import tools.refinery.viatra.runtime.matchers.planning.helpers.FunctionalDependencyHelper; | 28 | import tools.refinery.interpreter.matchers.planning.helpers.FunctionalDependencyHelper; |
29 | import tools.refinery.viatra.runtime.matchers.psystem.IQueryReference; | 29 | import tools.refinery.interpreter.matchers.psystem.IQueryReference; |
30 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 30 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
31 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 31 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
32 | import tools.refinery.viatra.runtime.matchers.psystem.analysis.QueryAnalyzer; | 32 | import tools.refinery.interpreter.matchers.psystem.analysis.QueryAnalyzer; |
33 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | 33 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.AggregatorConstraint; |
34 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 34 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExportedParameter; |
35 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | 35 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExpressionEvaluation; |
36 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.Inequality; | 36 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.Inequality; |
37 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | 37 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.NegativePatternCall; |
38 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.PatternMatchCounter; | 38 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.PatternMatchCounter; |
39 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | 39 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.TypeFilterConstraint; |
40 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.BinaryReflexiveTransitiveClosure; | 40 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.BinaryReflexiveTransitiveClosure; |
41 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; | 41 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.BinaryTransitiveClosure; |
42 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.ConstantValue; | 42 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.ConstantValue; |
43 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 43 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
44 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 44 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.TypeConstraint; |
45 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 45 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
46 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 46 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
47 | import tools.refinery.viatra.runtime.matchers.util.Accuracy; | 47 | import tools.refinery.interpreter.matchers.util.Accuracy; |
48 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 48 | import tools.refinery.interpreter.matchers.util.Preconditions; |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * Cost function which calculates cost based on the cardinality of items in the runtime model | 51 | * Cost function which calculates cost based on the cardinality of items in the runtime model |
52 | * | 52 | * |
53 | * <p> To provide custom statistics, override | 53 | * <p> To provide custom statistics, override |
54 | * {@link #projectionSize(IConstraintEvaluationContext, IInputKey, TupleMask, Accuracy)} | 54 | * {@link #projectionSize(IConstraintEvaluationContext, IInputKey, TupleMask, Accuracy)} |
55 | * and {@link #bucketSize(IQueryReference, IConstraintEvaluationContext, TupleMask)}. | 55 | * and {@link #bucketSize(IQueryReference, IConstraintEvaluationContext, TupleMask)}. |
56 | * | 56 | * |
57 | * @author Grill Balázs | 57 | * @author Grill Balázs |
58 | * @since 1.4 | 58 | * @since 1.4 |
59 | */ | 59 | */ |
@@ -61,7 +61,7 @@ public abstract class StatisticsBasedConstraintCostFunction implements ICostFunc | |||
61 | protected static final double MAX_COST = 250.0; | 61 | protected static final double MAX_COST = 250.0; |
62 | 62 | ||
63 | protected static final double DEFAULT_COST = StatisticsBasedConstraintCostFunction.MAX_COST - 100.0; | 63 | protected static final double DEFAULT_COST = StatisticsBasedConstraintCostFunction.MAX_COST - 100.0; |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * @since 2.1 | 66 | * @since 2.1 |
67 | */ | 67 | */ |
@@ -74,10 +74,10 @@ public abstract class StatisticsBasedConstraintCostFunction implements ICostFunc | |||
74 | * @since 2.7 | 74 | * @since 2.7 |
75 | */ | 75 | */ |
76 | public static final double EVAL_UNWIND_EXTENSION_FACTOR = 3.0; | 76 | public static final double EVAL_UNWIND_EXTENSION_FACTOR = 3.0; |
77 | 77 | ||
78 | private final double inverseNavigationPenalty; | 78 | private final double inverseNavigationPenalty; |
79 | 79 | ||
80 | 80 | ||
81 | /** | 81 | /** |
82 | * @since 2.1 | 82 | * @since 2.1 |
83 | */ | 83 | */ |
@@ -96,7 +96,7 @@ public abstract class StatisticsBasedConstraintCostFunction implements ICostFunc | |||
96 | public long countTuples(final IConstraintEvaluationContext input, final IInputKey supplierKey) { | 96 | public long countTuples(final IConstraintEvaluationContext input, final IInputKey supplierKey) { |
97 | return projectionSize(input, supplierKey, TupleMask.identity(supplierKey.getArity()), Accuracy.EXACT_COUNT).orElse(-1L); | 97 | return projectionSize(input, supplierKey, TupleMask.identity(supplierKey.getArity()), Accuracy.EXACT_COUNT).orElse(-1L); |
98 | } | 98 | } |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * Override this to provide custom statistics on edge/node counts. | 101 | * Override this to provide custom statistics on edge/node counts. |
102 | * New implementors shall implement this instead of {@link #countTuples(IConstraintEvaluationContext, IInputKey)} | 102 | * New implementors shall implement this instead of {@link #countTuples(IConstraintEvaluationContext, IInputKey)} |
@@ -119,12 +119,12 @@ public abstract class StatisticsBasedConstraintCostFunction implements ICostFunc | |||
119 | if (resultProvider instanceof AbstractLocalSearchResultProvider) { | 119 | if (resultProvider instanceof AbstractLocalSearchResultProvider) { |
120 | double estimatedCost = ((AbstractLocalSearchResultProvider) resultProvider).estimateCost(projMask); | 120 | double estimatedCost = ((AbstractLocalSearchResultProvider) resultProvider).estimateCost(projMask); |
121 | return Optional.of(estimatedCost); | 121 | return Optional.of(estimatedCost); |
122 | } else { | 122 | } else { |
123 | return resultProvider.estimateAverageBucketSize(projMask, Accuracy.APPROXIMATION); | 123 | return resultProvider.estimateAverageBucketSize(projMask, Accuracy.APPROXIMATION); |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | 127 | ||
128 | 128 | ||
129 | @Override | 129 | @Override |
130 | public double apply(final IConstraintEvaluationContext input) { | 130 | public double apply(final IConstraintEvaluationContext input) { |
@@ -163,7 +163,7 @@ public abstract class StatisticsBasedConstraintCostFunction implements ICostFunc | |||
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | /** | 167 | /** |
168 | * @deprecated use/implement {@link #calculateBinaryCost(IInputKey, PVariable, PVariable, boolean, IConstraintEvaluationContext)} instead | 168 | * @deprecated use/implement {@link #calculateBinaryCost(IInputKey, PVariable, PVariable, boolean, IConstraintEvaluationContext)} instead |
169 | */ | 169 | */ |
@@ -173,16 +173,16 @@ public abstract class StatisticsBasedConstraintCostFunction implements ICostFunc | |||
173 | final IConstraintEvaluationContext input) { | 173 | final IConstraintEvaluationContext input) { |
174 | throw new UnsupportedOperationException(); | 174 | throw new UnsupportedOperationException(); |
175 | } | 175 | } |
176 | 176 | ||
177 | /** | 177 | /** |
178 | * @since 2.1 | 178 | * @since 2.1 |
179 | */ | 179 | */ |
180 | protected double calculateBinaryCost(final IInputKey supplierKey, final PVariable srcVariable, | 180 | protected double calculateBinaryCost(final IInputKey supplierKey, final PVariable srcVariable, |
181 | final PVariable dstVariable, final boolean isInverse, | 181 | final PVariable dstVariable, final boolean isInverse, |
182 | final IConstraintEvaluationContext input) { | 182 | final IConstraintEvaluationContext input) { |
183 | final Collection<PVariable> freeMaskVariables = input.getFreeVariables(); | 183 | final Collection<PVariable> freeMaskVariables = input.getFreeVariables(); |
184 | final PConstraint constraint = input.getConstraint(); | 184 | final PConstraint constraint = input.getConstraint(); |
185 | 185 | ||
186 | // IQueryMetaContext metaContext = input.getRuntimeContext().getMetaContext(); | 186 | // IQueryMetaContext metaContext = input.getRuntimeContext().getMetaContext(); |
187 | // Collection<InputKeyImplication> implications = metaContext.getImplications(supplierKey); | 187 | // Collection<InputKeyImplication> implications = metaContext.getImplications(supplierKey); |
188 | 188 | ||
@@ -195,55 +195,55 @@ public abstract class StatisticsBasedConstraintCostFunction implements ICostFunc | |||
195 | srcUpper.map(Long::doubleValue).orElse(DEFAULT_COST) | 195 | srcUpper.map(Long::doubleValue).orElse(DEFAULT_COST) |
196 | * | 196 | * |
197 | dstUpper.map(Long::doubleValue).orElse(DEFAULT_COST) | 197 | dstUpper.map(Long::doubleValue).orElse(DEFAULT_COST) |
198 | ); | 198 | ); |
199 | return branchCount; | 199 | return branchCount; |
200 | 200 | ||
201 | } else { | 201 | } else { |
202 | 202 | ||
203 | Optional<Long> srcLower = projectionSize(input, supplierKey, TupleMask.selectSingle(0, 2), Accuracy.APPROXIMATION); | 203 | Optional<Long> srcLower = projectionSize(input, supplierKey, TupleMask.selectSingle(0, 2), Accuracy.APPROXIMATION); |
204 | Optional<Long> dstLower = projectionSize(input, supplierKey, TupleMask.selectSingle(1, 2), Accuracy.APPROXIMATION); | 204 | Optional<Long> dstLower = projectionSize(input, supplierKey, TupleMask.selectSingle(1, 2), Accuracy.APPROXIMATION); |
205 | 205 | ||
206 | List<Optional<Long>> nodeLower = Arrays.asList(srcLower, dstLower); | 206 | List<Optional<Long>> nodeLower = Arrays.asList(srcLower, dstLower); |
207 | List<Optional<Long>> nodeUpper = Arrays.asList(srcUpper, dstUpper); | 207 | List<Optional<Long>> nodeUpper = Arrays.asList(srcUpper, dstUpper); |
208 | 208 | ||
209 | int from = isInverse ? 1 : 0; | 209 | int from = isInverse ? 1 : 0; |
210 | int to = isInverse ? 0 : 1; | 210 | int to = isInverse ? 0 : 1; |
211 | 211 | ||
212 | Optional<Double> costEstimate = Optional.empty(); | 212 | Optional<Double> costEstimate = Optional.empty(); |
213 | 213 | ||
214 | if (!freeMaskVariables.contains(srcVariable) && !freeMaskVariables.contains(dstVariable)) { | 214 | if (!freeMaskVariables.contains(srcVariable) && !freeMaskVariables.contains(dstVariable)) { |
215 | // both variables bound, this is a simple check | 215 | // both variables bound, this is a simple check |
216 | costEstimate = min(costEstimate, 0.9); | 216 | costEstimate = min(costEstimate, 0.9); |
217 | } // TODO use bucket size estimation in the runtime context | 217 | } // TODO use bucket size estimation in the runtime context |
218 | costEstimate = min(costEstimate, | 218 | costEstimate = min(costEstimate, |
219 | edgeUpper.flatMap(edges -> | 219 | edgeUpper.flatMap(edges -> |
220 | nodeLower.get(from).map(fromNodes -> | 220 | nodeLower.get(from).map(fromNodes -> |
221 | // amortize edges over start nodes | 221 | // amortize edges over start nodes |
222 | (fromNodes == 0) ? 0.0 : (((double) edges) / fromNodes) | 222 | (fromNodes == 0) ? 0.0 : (((double) edges) / fromNodes) |
223 | ))); | 223 | ))); |
224 | if (navigatesThroughFunctionalDependencyInverse(input, constraint)) { | 224 | if (navigatesThroughFunctionalDependencyInverse(input, constraint)) { |
225 | costEstimate = min(costEstimate, nodeUpper.get(to).flatMap(toNodes -> | 225 | costEstimate = min(costEstimate, nodeUpper.get(to).flatMap(toNodes -> |
226 | nodeLower.get(from).map(fromNodes -> | 226 | nodeLower.get(from).map(fromNodes -> |
227 | // due to a reverse functional dependency, the destination count is an upper bound for the edge count | 227 | // due to a reverse functional dependency, the destination count is an upper bound for the edge count |
228 | (fromNodes == 0) ? 0.0 : ((double) toNodes) / fromNodes | 228 | (fromNodes == 0) ? 0.0 : ((double) toNodes) / fromNodes |
229 | ))); | 229 | ))); |
230 | } | 230 | } |
231 | if (! edgeUpper.isPresent()) { | 231 | if (! edgeUpper.isPresent()) { |
232 | costEstimate = min(costEstimate, nodeUpper.get(to).flatMap(toNodes -> | 232 | costEstimate = min(costEstimate, nodeUpper.get(to).flatMap(toNodes -> |
233 | nodeLower.get(from).map(fromNodes -> | 233 | nodeLower.get(from).map(fromNodes -> |
234 | // If count is 0, no such element exists in the model, so there will be no branching | 234 | // If count is 0, no such element exists in the model, so there will be no branching |
235 | // TODO rethink, why dstNodeCount / srcNodeCount instead of dstNodeCount? | 235 | // TODO rethink, why dstNodeCount / srcNodeCount instead of dstNodeCount? |
236 | // The universally valid bound would be something like sparseEdgeEstimate = dstNodeCount + 1.0 | 236 | // The universally valid bound would be something like sparseEdgeEstimate = dstNodeCount + 1.0 |
237 | // If we assume sparseness, we can reduce it by a SPARSENESS_FACTOR (e.g. 0.1). | 237 | // If we assume sparseness, we can reduce it by a SPARSENESS_FACTOR (e.g. 0.1). |
238 | // Alternatively, discount dstNodeCount * srcNodeCount on a SPARSENESS_EXPONENT (e.g 0.75) and then amortize over srcNodeCount. | 238 | // Alternatively, discount dstNodeCount * srcNodeCount on a SPARSENESS_EXPONENT (e.g 0.75) and then amortize over srcNodeCount. |
239 | fromNodes != 0 ? Math.max(1.0, ((double) toNodes) / fromNodes) : 1.0 | 239 | fromNodes != 0 ? Math.max(1.0, ((double) toNodes) / fromNodes) : 1.0 |
240 | ))); | 240 | ))); |
241 | } | 241 | } |
242 | if (navigatesThroughFunctionalDependency(input, constraint)) { | 242 | if (navigatesThroughFunctionalDependency(input, constraint)) { |
243 | // At most one destination value | 243 | // At most one destination value |
244 | costEstimate = min(costEstimate, 1.0); | 244 | costEstimate = min(costEstimate, 1.0); |
245 | } | 245 | } |
246 | 246 | ||
247 | return costEstimate.orElse(DEFAULT_COST); | 247 | return costEstimate.orElse(DEFAULT_COST); |
248 | 248 | ||
249 | } | 249 | } |
@@ -275,7 +275,7 @@ public abstract class StatisticsBasedConstraintCostFunction implements ICostFunc | |||
275 | functionalDependencies); | 275 | functionalDependencies); |
276 | return ((impliedVariables != null) && impliedVariables.containsAll(determined)); | 276 | return ((impliedVariables != null) && impliedVariables.containsAll(determined)); |
277 | } | 277 | } |
278 | 278 | ||
279 | protected double calculateUnaryConstraintCost(final TypeConstraint constraint, | 279 | protected double calculateUnaryConstraintCost(final TypeConstraint constraint, |
280 | final IConstraintEvaluationContext input) { | 280 | final IConstraintEvaluationContext input) { |
281 | PVariable variable = (PVariable) constraint.getVariablesTuple().get(0); | 281 | PVariable variable = (PVariable) constraint.getVariablesTuple().get(0); |
@@ -304,8 +304,8 @@ public abstract class StatisticsBasedConstraintCostFunction implements ICostFunc | |||
304 | if (input.getBoundVariables().contains(variable)) boundPositions.add(i); | 304 | if (input.getBoundVariables().contains(variable)) boundPositions.add(i); |
305 | } | 305 | } |
306 | TupleMask projMask = TupleMask.fromSelectedIndices(parameters.size(), boundPositions); | 306 | TupleMask projMask = TupleMask.fromSelectedIndices(parameters.size(), boundPositions); |
307 | 307 | ||
308 | return bucketSize(patternCall, input, projMask).orElse(DEFAULT_COST); | 308 | return bucketSize(patternCall, input, projMask).orElse(DEFAULT_COST); |
309 | } | 309 | } |
310 | 310 | ||
311 | 311 | ||
@@ -320,51 +320,51 @@ public abstract class StatisticsBasedConstraintCostFunction implements ICostFunc | |||
320 | : 1.0; | 320 | : 1.0; |
321 | return _calculateCost((PConstraint) evaluation, input) * multiplier; | 321 | return _calculateCost((PConstraint) evaluation, input) * multiplier; |
322 | } | 322 | } |
323 | 323 | ||
324 | /** | 324 | /** |
325 | * @since 1.7 | 325 | * @since 1.7 |
326 | */ | 326 | */ |
327 | protected double _calculateCost(final Inequality inequality, final IConstraintEvaluationContext input) { | 327 | protected double _calculateCost(final Inequality inequality, final IConstraintEvaluationContext input) { |
328 | return _calculateCost((PConstraint)inequality, input); | 328 | return _calculateCost((PConstraint)inequality, input); |
329 | } | 329 | } |
330 | 330 | ||
331 | /** | 331 | /** |
332 | * @since 1.7 | 332 | * @since 1.7 |
333 | */ | 333 | */ |
334 | protected double _calculateCost(final AggregatorConstraint aggregator, final IConstraintEvaluationContext input) { | 334 | protected double _calculateCost(final AggregatorConstraint aggregator, final IConstraintEvaluationContext input) { |
335 | return _calculateCost((PConstraint)aggregator, input); | 335 | return _calculateCost((PConstraint)aggregator, input); |
336 | } | 336 | } |
337 | 337 | ||
338 | /** | 338 | /** |
339 | * @since 1.7 | 339 | * @since 1.7 |
340 | */ | 340 | */ |
341 | protected double _calculateCost(final NegativePatternCall call, final IConstraintEvaluationContext input) { | 341 | protected double _calculateCost(final NegativePatternCall call, final IConstraintEvaluationContext input) { |
342 | return _calculateCost((PConstraint)call, input); | 342 | return _calculateCost((PConstraint)call, input); |
343 | } | 343 | } |
344 | 344 | ||
345 | /** | 345 | /** |
346 | * @since 1.7 | 346 | * @since 1.7 |
347 | */ | 347 | */ |
348 | protected double _calculateCost(final PatternMatchCounter counter, final IConstraintEvaluationContext input) { | 348 | protected double _calculateCost(final PatternMatchCounter counter, final IConstraintEvaluationContext input) { |
349 | return _calculateCost((PConstraint)counter, input); | 349 | return _calculateCost((PConstraint)counter, input); |
350 | } | 350 | } |
351 | 351 | ||
352 | /** | 352 | /** |
353 | * @since 1.7 | 353 | * @since 1.7 |
354 | */ | 354 | */ |
355 | protected double _calculateCost(final BinaryTransitiveClosure closure, final IConstraintEvaluationContext input) { | 355 | protected double _calculateCost(final BinaryTransitiveClosure closure, final IConstraintEvaluationContext input) { |
356 | // if (input.getFreeVariables().size() == 1) return 3.0; | 356 | // if (input.getFreeVariables().size() == 1) return 3.0; |
357 | return StatisticsBasedConstraintCostFunction.DEFAULT_COST; | 357 | return StatisticsBasedConstraintCostFunction.DEFAULT_COST; |
358 | } | 358 | } |
359 | 359 | ||
360 | /** | 360 | /** |
361 | * @since 2.0 | 361 | * @since 2.0 |
362 | */ | 362 | */ |
363 | protected double _calculateCost(final BinaryReflexiveTransitiveClosure closure, final IConstraintEvaluationContext input) { | 363 | protected double _calculateCost(final BinaryReflexiveTransitiveClosure closure, final IConstraintEvaluationContext input) { |
364 | // if (input.getFreeVariables().size() == 1) return 3.0; | 364 | // if (input.getFreeVariables().size() == 1) return 3.0; |
365 | return StatisticsBasedConstraintCostFunction.DEFAULT_COST; | 365 | return StatisticsBasedConstraintCostFunction.DEFAULT_COST; |
366 | } | 366 | } |
367 | 367 | ||
368 | /** | 368 | /** |
369 | * Default cost calculation strategy | 369 | * Default cost calculation strategy |
370 | */ | 370 | */ |
@@ -377,7 +377,7 @@ public abstract class StatisticsBasedConstraintCostFunction implements ICostFunc | |||
377 | } | 377 | } |
378 | 378 | ||
379 | /** | 379 | /** |
380 | * @throws ViatraQueryRuntimeException | 380 | * @throws InterpreterRuntimeException |
381 | */ | 381 | */ |
382 | public double calculateCost(final PConstraint constraint, final IConstraintEvaluationContext input) { | 382 | public double calculateCost(final PConstraint constraint, final IConstraintEvaluationContext input) { |
383 | Preconditions.checkArgument(constraint != null, "Set constraint value correctly"); | 383 | Preconditions.checkArgument(constraint != null, "Set constraint value correctly"); |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/impl/VariableBindingBasedCostFunction.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/impl/VariableBindingBasedCostFunction.java index a517af25..50168130 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/cost/impl/VariableBindingBasedCostFunction.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/cost/impl/VariableBindingBasedCostFunction.java | |||
@@ -3,39 +3,39 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner.cost.impl; | 9 | package tools.refinery.interpreter.localsearch.planner.cost.impl; |
10 | 10 | ||
11 | import java.util.Set; | 11 | import java.util.Set; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.localsearch.planner.cost.IConstraintEvaluationContext; | 13 | import tools.refinery.interpreter.localsearch.planner.cost.IConstraintEvaluationContext; |
14 | import tools.refinery.viatra.runtime.localsearch.planner.cost.ICostFunction; | 14 | import tools.refinery.interpreter.localsearch.planner.cost.ICostFunction; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 15 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 16 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.AggregatorConstraint; | 17 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.AggregatorConstraint; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 18 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExportedParameter; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | 19 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.NegativePatternCall; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.BinaryTransitiveClosure; | 20 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.BinaryTransitiveClosure; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.ConstantValue; | 21 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.ConstantValue; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * This class can be used to calculate cost of application of a constraint with a given adornment. | 24 | * This class can be used to calculate cost of application of a constraint with a given adornment. |
25 | * | 25 | * |
26 | * For now the logic is based on the following principles: | 26 | * For now the logic is based on the following principles: |
27 | * | 27 | * |
28 | * <li>The transitive closures, NACs and count finds are the most expensive operations | 28 | * <li>The transitive closures, NACs and count finds are the most expensive operations |
29 | * | 29 | * |
30 | * <li>The number of free variables increase the cost | 30 | * <li>The number of free variables increase the cost |
31 | * | 31 | * |
32 | * <li>If all the variables of a constraint are free, then its cost equals to twice the number of its parameter | 32 | * <li>If all the variables of a constraint are free, then its cost equals to twice the number of its parameter |
33 | * variables. This solves the problem of unnecessary iteration over instances at the beginning of a plan (thus causing | 33 | * variables. This solves the problem of unnecessary iteration over instances at the beginning of a plan (thus causing |
34 | * very long run times when executing the plan) by applying constraints based on structural features as soon as | 34 | * very long run times when executing the plan) by applying constraints based on structural features as soon as |
35 | * possible. | 35 | * possible. |
36 | * | 36 | * |
37 | * <br> | 37 | * <br> |
38 | * | 38 | * |
39 | * @author Marton Bur | 39 | * @author Marton Bur |
40 | * @since 1.4 | 40 | * @since 1.4 |
41 | * | 41 | * |
@@ -49,7 +49,7 @@ public class VariableBindingBasedCostFunction implements ICostFunction { | |||
49 | private static int nacCost = MAX - 100; | 49 | private static int nacCost = MAX - 100; |
50 | private static int aggregatorCost = MAX - 200; | 50 | private static int aggregatorCost = MAX - 200; |
51 | private static int constantCost = 0; | 51 | private static int constantCost = 0; |
52 | 52 | ||
53 | @Override | 53 | @Override |
54 | public double apply(IConstraintEvaluationContext input) { | 54 | public double apply(IConstraintEvaluationContext input) { |
55 | PConstraint constraint = input.getConstraint(); | 55 | PConstraint constraint = input.getConstraint(); |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/util/CompilerHelper.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/util/CompilerHelper.java index 9b4e9ea5..3e2e2a60 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/util/CompilerHelper.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/util/CompilerHelper.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner.util; | 9 | package tools.refinery.interpreter.localsearch.planner.util; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -16,29 +16,29 @@ import java.util.List; | |||
16 | import java.util.Map; | 16 | import java.util.Map; |
17 | import java.util.Set; | 17 | import java.util.Set; |
18 | 18 | ||
19 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 19 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
20 | import tools.refinery.viatra.runtime.matchers.planning.operations.PApply; | 20 | import tools.refinery.interpreter.matchers.planning.operations.PApply; |
21 | import tools.refinery.viatra.runtime.matchers.planning.operations.POperation; | 21 | import tools.refinery.interpreter.matchers.planning.operations.POperation; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 22 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
23 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 23 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 24 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExportedParameter; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 25 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * | 28 | * |
29 | * Helper methods for compiling SubPlans | 29 | * Helper methods for compiling SubPlans |
30 | * | 30 | * |
31 | * @author Marton Bur | 31 | * @author Marton Bur |
32 | * | 32 | * |
33 | */ | 33 | */ |
34 | public class CompilerHelper { | 34 | public class CompilerHelper { |
35 | 35 | ||
36 | private CompilerHelper() {/*Utility class constructor*/} | 36 | private CompilerHelper() {/*Utility class constructor*/} |
37 | 37 | ||
38 | private static boolean isUserSpecified(PVariable var) { | 38 | private static boolean isUserSpecified(PVariable var) { |
39 | return !var.isVirtual() && !var.getName().startsWith("_"); | 39 | return !var.isVirtual() && !var.getName().startsWith("_"); |
40 | } | 40 | } |
41 | 41 | ||
42 | public static Map<PVariable, Integer> createVariableMapping(SubPlan plan) { | 42 | public static Map<PVariable, Integer> createVariableMapping(SubPlan plan) { |
43 | Map<PVariable, Integer> variableMapping = new HashMap<>(); | 43 | Map<PVariable, Integer> variableMapping = new HashMap<>(); |
44 | 44 | ||
@@ -90,7 +90,7 @@ public class CompilerHelper { | |||
90 | PConstraint pConstraint = ((PApply) operation).getPConstraint(); | 90 | PConstraint pConstraint = ((PApply) operation).getPConstraint(); |
91 | Set<Integer> boundVariableIndices = getParametersBoundByParentPlan(variableMappings, subPlan); | 91 | Set<Integer> boundVariableIndices = getParametersBoundByParentPlan(variableMappings, subPlan); |
92 | boundVariableIndices.addAll(externallyBoundVariables); | 92 | boundVariableIndices.addAll(externallyBoundVariables); |
93 | 93 | ||
94 | variableBindings.put(pConstraint, boundVariableIndices); | 94 | variableBindings.put(pConstraint, boundVariableIndices); |
95 | } | 95 | } |
96 | } | 96 | } |
@@ -157,7 +157,7 @@ public class CompilerHelper { | |||
157 | 157 | ||
158 | /** | 158 | /** |
159 | * Transforms the index of a parameter into the index of a variable of the normalized body. | 159 | * Transforms the index of a parameter into the index of a variable of the normalized body. |
160 | * | 160 | * |
161 | * @param plan | 161 | * @param plan |
162 | * the SubPlan containing the original body and its parameters | 162 | * the SubPlan containing the original body and its parameters |
163 | * @param variableMappings | 163 | * @param variableMappings |
@@ -172,7 +172,7 @@ public class CompilerHelper { | |||
172 | for (ExportedParameter constraint : plan.getBody().getSymbolicParameters()) { | 172 | for (ExportedParameter constraint : plan.getBody().getSymbolicParameters()) { |
173 | parameterMapping.put(constraint.getPatternParameter(), constraint.getParameterVariable()); | 173 | parameterMapping.put(constraint.getPatternParameter(), constraint.getParameterVariable()); |
174 | } | 174 | } |
175 | 175 | ||
176 | Set<Integer> variableIndices = new HashSet<>(); | 176 | Set<Integer> variableIndices = new HashSet<>(); |
177 | for (PParameter parameter : parameters) { | 177 | for (PParameter parameter : parameters) { |
178 | PVariable parameterVariable = parameterMapping.get(parameter); | 178 | PVariable parameterVariable = parameterMapping.get(parameter); |
@@ -188,7 +188,7 @@ public class CompilerHelper { | |||
188 | 188 | ||
189 | /** | 189 | /** |
190 | * Extracts the operations from a SubPlan into a list of POperations in the order of execution | 190 | * Extracts the operations from a SubPlan into a list of POperations in the order of execution |
191 | * | 191 | * |
192 | * @param plan | 192 | * @param plan |
193 | * the SubPlan from wich the POperations should be extracted | 193 | * the SubPlan from wich the POperations should be extracted |
194 | * @return list of POperations extracted from the <code>plan</code> | 194 | * @return list of POperations extracted from the <code>plan</code> |
@@ -201,9 +201,9 @@ public class CompilerHelper { | |||
201 | plan = parentPlan; | 201 | plan = parentPlan; |
202 | } | 202 | } |
203 | operationsList.add(plan.getOperation()); | 203 | operationsList.add(plan.getOperation()); |
204 | 204 | ||
205 | Collections.reverse(operationsList); | 205 | Collections.reverse(operationsList); |
206 | return operationsList; | 206 | return operationsList; |
207 | } | 207 | } |
208 | 208 | ||
209 | } | 209 | } |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/util/OperationCostComparator.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/util/OperationCostComparator.java index 58f4fc41..27cf79f2 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/planner/util/OperationCostComparator.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/planner/util/OperationCostComparator.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.planner.util; | 9 | package tools.refinery.interpreter.localsearch.planner.util; |
10 | 10 | ||
11 | import java.util.Comparator; | 11 | import java.util.Comparator; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.localsearch.planner.PConstraintInfo; | 13 | import tools.refinery.interpreter.localsearch.planner.PConstraintInfo; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * @author Marton Bur | 16 | * @author Marton Bur |
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/profiler/LocalSearchProfilerAdapter.java b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/profiler/LocalSearchProfilerAdapter.java index 8c50c694..a866f976 100644 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/profiler/LocalSearchProfilerAdapter.java +++ b/subprojects/interpreter-localsearch/src/main/java/tools/refinery/interpreter/localsearch/profiler/LocalSearchProfilerAdapter.java | |||
@@ -3,27 +3,27 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.localsearch.profiler; | 9 | package tools.refinery.interpreter.localsearch.profiler; |
10 | 10 | ||
11 | import java.util.HashMap; | 11 | import java.util.HashMap; |
12 | import java.util.List; | 12 | import java.util.List; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.stream.Collectors; | 14 | import java.util.stream.Collectors; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.localsearch.MatchingFrame; | 16 | import tools.refinery.interpreter.localsearch.operations.ISearchOperation; |
17 | import tools.refinery.viatra.runtime.localsearch.matcher.ILocalSearchAdapter; | 17 | import tools.refinery.interpreter.localsearch.MatchingFrame; |
18 | import tools.refinery.viatra.runtime.localsearch.matcher.LocalSearchMatcher; | 18 | import tools.refinery.interpreter.localsearch.matcher.ILocalSearchAdapter; |
19 | import tools.refinery.viatra.runtime.localsearch.matcher.MatcherReference; | 19 | import tools.refinery.interpreter.localsearch.matcher.LocalSearchMatcher; |
20 | import tools.refinery.viatra.runtime.localsearch.operations.ISearchOperation; | 20 | import tools.refinery.interpreter.localsearch.matcher.MatcherReference; |
21 | import tools.refinery.viatra.runtime.localsearch.plan.SearchPlan; | 21 | import tools.refinery.interpreter.localsearch.plan.SearchPlan; |
22 | import tools.refinery.viatra.runtime.localsearch.plan.SearchPlanExecutor; | 22 | import tools.refinery.interpreter.localsearch.plan.SearchPlanExecutor; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * This is a simple {@link ILocalSearchAdapter} which capable of counting | 25 | * This is a simple {@link ILocalSearchAdapter} which capable of counting |
26 | * each search operation execution then printing it in human readably form | 26 | * each search operation execution then printing it in human readably form |
27 | * (along with the executed plans) using {@link #toString()} | 27 | * (along with the executed plans) using {@link #toString()} |
28 | * @author Grill Balázs | 28 | * @author Grill Balázs |
29 | * @since 1.5 | 29 | * @since 1.5 |
@@ -32,7 +32,7 @@ import tools.refinery.viatra.runtime.localsearch.plan.SearchPlanExecutor; | |||
32 | public class LocalSearchProfilerAdapter implements ILocalSearchAdapter { | 32 | public class LocalSearchProfilerAdapter implements ILocalSearchAdapter { |
33 | 33 | ||
34 | private final Map<MatcherReference, List<SearchPlan>> planReference = new HashMap<>(); | 34 | private final Map<MatcherReference, List<SearchPlan>> planReference = new HashMap<>(); |
35 | 35 | ||
36 | private final Map<ISearchOperation, Integer> successfulOperationCounts = new HashMap<>(); | 36 | private final Map<ISearchOperation, Integer> successfulOperationCounts = new HashMap<>(); |
37 | private final Map<ISearchOperation, Integer> failedOperationCounts = new HashMap<>(); | 37 | private final Map<ISearchOperation, Integer> failedOperationCounts = new HashMap<>(); |
38 | 38 | ||
@@ -46,8 +46,8 @@ public class LocalSearchProfilerAdapter implements ILocalSearchAdapter { | |||
46 | @Override | 46 | @Override |
47 | public void operationExecuted(SearchPlan plan, ISearchOperation operation, MatchingFrame frame, boolean isSuccessful) { | 47 | public void operationExecuted(SearchPlan plan, ISearchOperation operation, MatchingFrame frame, boolean isSuccessful) { |
48 | Map<ISearchOperation, Integer> counts = isSuccessful ? successfulOperationCounts : failedOperationCounts; | 48 | Map<ISearchOperation, Integer> counts = isSuccessful ? successfulOperationCounts : failedOperationCounts; |
49 | counts.merge(operation, | 49 | counts.merge(operation, |
50 | /*no previous entry*/1, | 50 | /*no previous entry*/1, |
51 | /*increase previous value*/(oldValue, v) -> oldValue + 1); | 51 | /*increase previous value*/(oldValue, v) -> oldValue + 1); |
52 | } | 52 | } |
53 | 53 | ||
@@ -57,9 +57,9 @@ public class LocalSearchProfilerAdapter implements ILocalSearchAdapter { | |||
57 | for (java.util.Map.Entry<MatcherReference, List<SearchPlan>> entry: planReference.entrySet()){ | 57 | for (java.util.Map.Entry<MatcherReference, List<SearchPlan>> entry: planReference.entrySet()){ |
58 | sb.append(entry.getKey()); | 58 | sb.append(entry.getKey()); |
59 | sb.append("\n"); | 59 | sb.append("\n"); |
60 | 60 | ||
61 | sb.append(entry.getValue()); | 61 | sb.append(entry.getValue()); |
62 | 62 | ||
63 | List<SearchPlan> bodies = entry.getValue(); | 63 | List<SearchPlan> bodies = entry.getValue(); |
64 | sb.append("{\n"); | 64 | sb.append("{\n"); |
65 | for(int i=0;i<bodies.size();i++){ | 65 | for(int i=0;i<bodies.size();i++){ |
@@ -79,5 +79,5 @@ public class LocalSearchProfilerAdapter implements ILocalSearchAdapter { | |||
79 | } | 79 | } |
80 | return sb.toString(); | 80 | return sb.toString(); |
81 | } | 81 | } |
82 | 82 | ||
83 | } | 83 | } |
diff --git a/subprojects/viatra-runtime-rete-recipes/META-INF/MANIFEST.MF b/subprojects/interpreter-rete-recipes/META-INF/MANIFEST.MF index c732af46..c732af46 100644 --- a/subprojects/viatra-runtime-rete-recipes/META-INF/MANIFEST.MF +++ b/subprojects/interpreter-rete-recipes/META-INF/MANIFEST.MF | |||
diff --git a/subprojects/viatra-runtime-rete-recipes/META-INF/MANIFEST.MF.license b/subprojects/interpreter-rete-recipes/META-INF/MANIFEST.MF.license index 03d1d42b..03d1d42b 100644 --- a/subprojects/viatra-runtime-rete-recipes/META-INF/MANIFEST.MF.license +++ b/subprojects/interpreter-rete-recipes/META-INF/MANIFEST.MF.license | |||
diff --git a/subprojects/interpreter-rete-recipes/NOTICE.md b/subprojects/interpreter-rete-recipes/NOTICE.md new file mode 100644 index 00000000..94c1d803 --- /dev/null +++ b/subprojects/interpreter-rete-recipes/NOTICE.md | |||
@@ -0,0 +1,94 @@ | |||
1 | <!-- | ||
2 | Copyright (c) 2018-2019, Zoltan Ujhelyi, IncQuery Labs Ltd. | ||
3 | Copyright (c) 2023 The Refinery Authors <https://refinery.tools/> | ||
4 | |||
5 | SPDX-License-Identifier: EPL-2.0 | ||
6 | --> | ||
7 | |||
8 | This module contains source code from the [Eclipse VIATRA™ project](https://projects.eclipse.org/projects/modeling.viatra), which is available under the terms of the [Eclipse Public License v 2.0](http://www.eclipse.org/legal/epl-v20.html). | ||
9 | |||
10 | Eclipse®, VIATRA™ and ‘Eclipse VIATRA™’ are trademarks of Eclipse Foundation, Inc. | ||
11 | |||
12 | To comply with the [Eclipse Foundation Trademark Usage Policy](https://www.eclipse.org/legal/logo_guidelines.php), we replaced the Eclipse VIATRA™ branding in this repository with the name _Refinery Interpreter_, since the [Eclipse Public License - v 2.0](https://www.eclipse.org/legal/epl-2.0/) does not grant trademark usage rights to derived projects. | ||
13 | _Refinery Interpreter_ is not endorsed or sponsored by Eclipse Foundation, Inc. or any other organizations using the Eclipse VIATRA™ trademark. | ||
14 | |||
15 | We publish our modifications to Eclipse VIATRA™ for use within the Refinery framework under the name _Refinery Interpreter_. When not using _Refinery Interpreter_ directly in the Refinery framework, users are strongly encouraged to rely on [Eclipse VIATRA™](https://eclipse.dev/viatra/) instead. In particular, _Refinery Interpreter_ does not provide any API stability guarantees that are provided by Eclipse VIATRA™. | ||
16 | |||
17 | We reproduce the [accompanying notices of Eclipse VIATRA™](https://github.com/viatra/org.eclipse.viatra/blob/d422bcc626a99c4640c0d13931f393ccea0d2326/NOTICE.md) in full below: | ||
18 | |||
19 | # Notices for Eclipse VIATRA™ | ||
20 | |||
21 | This content is produced and maintained by the Eclipse VIATRA project. | ||
22 | |||
23 | * Project home: https://projects.eclipse.org/projects/modeling.viatra | ||
24 | |||
25 | ## Trademarks | ||
26 | |||
27 | Eclipse VIATRA, and VIATRA are trademarks of the Eclipse Foundation. | ||
28 | |||
29 | ## Copyright | ||
30 | |||
31 | All content is the property of the respective authors or their employers. For | ||
32 | more information regarding authorship of content, please consult the listed | ||
33 | source code repository logs. | ||
34 | |||
35 | ## Declared Project Licenses | ||
36 | |||
37 | This program and the accompanying materials are made available under the terms | ||
38 | of the Eclipse Public License v. 2.0 which is available at | ||
39 | http://www.eclipse.org/legal/epl-v20.html. | ||
40 | |||
41 | SPDX-License-Identifier: EPL-2.0 | ||
42 | |||
43 | ## Source Code | ||
44 | |||
45 | The project maintains the following source code repositories: | ||
46 | |||
47 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra.git | ||
48 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra.modelobfuscator.git | ||
49 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra.examples.git | ||
50 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra2.vpm.git | ||
51 | |||
52 | ## Third-party Content | ||
53 | |||
54 | This project leverages the following third party content. | ||
55 | |||
56 | ANTLR Runtime only: (3.2) | ||
57 | |||
58 | * License: New BSD license | ||
59 | |||
60 | Apache Commons Language Library (2.1) | ||
61 | |||
62 | * License: Apache License, 2.0 | ||
63 | |||
64 | Google Guice / Inject Core API (3.0.0) | ||
65 | |||
66 | * License: Apache License, 2.0 | ||
67 | |||
68 | Google Guice / Inject Core API (3.0.0) | ||
69 | |||
70 | * License: Apache License 2.0 | ||
71 | |||
72 | Guava (10.0.1) | ||
73 | |||
74 | * License: Apache License, 2.0 | ||
75 | |||
76 | Guice (2.0) | ||
77 | |||
78 | * License: Apache License, 2.0 | ||
79 | |||
80 | guice-multibindings (3.0.0) | ||
81 | |||
82 | * License: Apache License, 2.0 | ||
83 | |||
84 | log4j (1.2.15) | ||
85 | |||
86 | * License: Apache License 2.0 | ||
87 | |||
88 | LPG Java Runtime (lpgjavaruntime.jar) (1.1) | ||
89 | |||
90 | * License: Eclipse Public License | ||
91 | |||
92 | mockito (1.9.5) | ||
93 | |||
94 | * License: Apache License, 2.0, New BSD license, MIT license | ||
diff --git a/subprojects/viatra-runtime-rete-recipes/about.html b/subprojects/interpreter-rete-recipes/about.html index d1d5593a..d1d5593a 100644 --- a/subprojects/viatra-runtime-rete-recipes/about.html +++ b/subprojects/interpreter-rete-recipes/about.html | |||
diff --git a/subprojects/viatra-runtime-rete-recipes/build.gradle.kts b/subprojects/interpreter-rete-recipes/build.gradle.kts index b0d0139a..1b892e4e 100644 --- a/subprojects/viatra-runtime-rete-recipes/build.gradle.kts +++ b/subprojects/interpreter-rete-recipes/build.gradle.kts | |||
@@ -7,17 +7,13 @@ | |||
7 | import tools.refinery.gradle.utils.SonarPropertiesUtils | 7 | import tools.refinery.gradle.utils.SonarPropertiesUtils |
8 | 8 | ||
9 | plugins { | 9 | plugins { |
10 | id("tools.refinery.gradle.java-library") | 10 | id("tools.refinery.gradle.interpreter-library") |
11 | id("tools.refinery.gradle.mwe2") | 11 | id("tools.refinery.gradle.mwe2") |
12 | id("tools.refinery.gradle.sonarqube") | 12 | id("tools.refinery.gradle.sonarqube") |
13 | // Vendor code from Eclipse VIATRA is maintained by the VIATRA project, | ||
14 | // so we don't need to keep track of coverage ourselves. | ||
15 | // Our own modifications are covered by tests in the `store-query-viatra` subproject. | ||
16 | id("tools.refinery.gradle.skip-coverage") | ||
17 | } | 13 | } |
18 | 14 | ||
19 | dependencies { | 15 | dependencies { |
20 | api(project(":refinery-viatra-runtime")) | 16 | api(project(":refinery-interpreter")) |
21 | api(libs.ecore) | 17 | api(libs.ecore) |
22 | mwe2(libs.ecore.codegen) | 18 | mwe2(libs.ecore.codegen) |
23 | mwe2(libs.mwe.utils) | 19 | mwe2(libs.mwe.utils) |
@@ -37,7 +33,7 @@ tasks { | |||
37 | val generateEPackage by registering(JavaExec::class) { | 33 | val generateEPackage by registering(JavaExec::class) { |
38 | mainClass.set("org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher") | 34 | mainClass.set("org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher") |
39 | classpath(configurations.mwe2) | 35 | classpath(configurations.mwe2) |
40 | inputs.file("src/main/java/tools/refinery/viatra/runtime/rete/recipes/GenerateReteRecipes.mwe2") | 36 | inputs.file("src/main/java/tools/refinery/interpreter/rete/recipes/GenerateReteRecipes.mwe2") |
41 | inputs.file("src/main/resources/model/recipes.ecore") | 37 | inputs.file("src/main/resources/model/recipes.ecore") |
42 | inputs.file("src/main/resources/model/rete-recipes.genmodel") | 38 | inputs.file("src/main/resources/model/rete-recipes.genmodel") |
43 | outputs.file("build.properties") | 39 | outputs.file("build.properties") |
@@ -45,7 +41,7 @@ tasks { | |||
45 | outputs.file("plugin.xml") | 41 | outputs.file("plugin.xml") |
46 | outputs.file("plugin.properties") | 42 | outputs.file("plugin.properties") |
47 | outputs.dir("src/main/emf-gen") | 43 | outputs.dir("src/main/emf-gen") |
48 | args("src/main/java/tools/refinery/viatra/runtime/rete/recipes/GenerateReteRecipes.mwe2", | 44 | args("src/main/java/tools/refinery/interpreter/rete/recipes/GenerateReteRecipes.mwe2", |
49 | "-p", "rootPath=/$projectDir") | 45 | "-p", "rootPath=/$projectDir") |
50 | } | 46 | } |
51 | 47 | ||
diff --git a/subprojects/viatra-runtime-rete-recipes/build.properties b/subprojects/interpreter-rete-recipes/build.properties index 97e4d6bd..97e4d6bd 100644 --- a/subprojects/viatra-runtime-rete-recipes/build.properties +++ b/subprojects/interpreter-rete-recipes/build.properties | |||
diff --git a/subprojects/viatra-runtime-rete-recipes/plugin.properties b/subprojects/interpreter-rete-recipes/plugin.properties index 43a7236d..43a7236d 100644 --- a/subprojects/viatra-runtime-rete-recipes/plugin.properties +++ b/subprojects/interpreter-rete-recipes/plugin.properties | |||
diff --git a/subprojects/viatra-runtime-rete-recipes/plugin.xml b/subprojects/interpreter-rete-recipes/plugin.xml index e4917f5d..3106788c 100644 --- a/subprojects/viatra-runtime-rete-recipes/plugin.xml +++ b/subprojects/interpreter-rete-recipes/plugin.xml | |||
@@ -6,7 +6,7 @@ | |||
6 | This program and the accompanying materials are made available under the | 6 | This program and the accompanying materials are made available under the |
7 | terms of the Eclipse Public License v. 2.0 which is available at | 7 | terms of the Eclipse Public License v. 2.0 which is available at |
8 | http://www.eclipse.org/legal/epl-v20.html. | 8 | http://www.eclipse.org/legal/epl-v20.html. |
9 | 9 | ||
10 | SPDX-License-Identifier: EPL-2.0 | 10 | SPDX-License-Identifier: EPL-2.0 |
11 | --> | 11 | --> |
12 | 12 | ||
@@ -15,8 +15,8 @@ | |||
15 | <extension point="org.eclipse.emf.ecore.generated_package"> | 15 | <extension point="org.eclipse.emf.ecore.generated_package"> |
16 | <!-- @generated rete-recipes --> | 16 | <!-- @generated rete-recipes --> |
17 | <package | 17 | <package |
18 | uri="https://refinery.tools/emf/2023/ViatraReteRecipes" | 18 | uri="https://refinery.tools/emf/2023/InterpreterReteRecipes" |
19 | class="tools.refinery.viatra.runtime.rete.recipes.RecipesPackage" | 19 | class="tools.refinery.interpreter.rete.recipes.RecipesPackage" |
20 | genModel="src/main/resources/model/rete-recipes.genmodel"/> | 20 | genModel="src/main/resources/model/rete-recipes.genmodel"/> |
21 | </extension> | 21 | </extension> |
22 | 22 | ||
diff --git a/subprojects/viatra-runtime-rete-recipes/src/main/java/tools/refinery/viatra/runtime/rete/recipes/GenerateReteRecipes.mwe2 b/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/GenerateReteRecipes.mwe2 index 424cc9f5..324d93a5 100644 --- a/subprojects/viatra-runtime-rete-recipes/src/main/java/tools/refinery/viatra/runtime/rete/recipes/GenerateReteRecipes.mwe2 +++ b/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/GenerateReteRecipes.mwe2 | |||
@@ -8,7 +8,7 @@ module tools.refinery.viatra.runtime.rete.recipes.GenerateReteRecipes | |||
8 | Workflow { | 8 | Workflow { |
9 | bean = org.eclipse.emf.mwe.utils.StandaloneSetup { | 9 | bean = org.eclipse.emf.mwe.utils.StandaloneSetup { |
10 | projectMapping = { | 10 | projectMapping = { |
11 | projectName = "tools.refinery.refinery-viatra-runtime-rete-recipes" | 11 | projectName = "tools.refinery.refinery-interpreter-rete-recipes" |
12 | path = "." | 12 | path = "." |
13 | } | 13 | } |
14 | } | 14 | } |
@@ -19,7 +19,7 @@ Workflow { | |||
19 | 19 | ||
20 | component = org.eclipse.emf.mwe2.ecore.EcoreGenerator { | 20 | component = org.eclipse.emf.mwe2.ecore.EcoreGenerator { |
21 | generateCustomClasses = false | 21 | generateCustomClasses = false |
22 | genModel = "platform:/resource/tools.refinery.refinery-viatra-runtime-rete-recipes/src/main/resources/model/rete-recipes.genmodel" | 22 | genModel = "platform:/resource/tools.refinery.refinery-interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel" |
23 | srcPath = "platform:/resource/tools.refinery.refinery-viatra-runtime-rete-recipes/src/main/emf-gen" | 23 | srcPath = "platform:/resource/tools.refinery.refinery-interpreter-rete-recipes/src/main/emf-gen" |
24 | } | 24 | } |
25 | } | 25 | } |
diff --git a/subprojects/viatra-runtime-rete-recipes/src/main/java/tools/refinery/viatra/runtime/rete/recipes/helper/RecipeRecognizer.java b/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/helper/RecipeRecognizer.java index 2c252593..ed551b6e 100644 --- a/subprojects/viatra-runtime-rete-recipes/src/main/java/tools/refinery/viatra/runtime/rete/recipes/helper/RecipeRecognizer.java +++ b/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/helper/RecipeRecognizer.java | |||
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.recipes.helper; | 9 | package tools.refinery.interpreter.rete.recipes.helper; |
10 | 10 | ||
11 | import org.eclipse.emf.common.util.EList; | 11 | import org.eclipse.emf.common.util.EList; |
12 | import org.eclipse.emf.ecore.EAttribute; | 12 | import org.eclipse.emf.ecore.EAttribute; |
@@ -14,9 +14,9 @@ import org.eclipse.emf.ecore.EClass; | |||
14 | import org.eclipse.emf.ecore.EObject; | 14 | import org.eclipse.emf.ecore.EObject; |
15 | import org.eclipse.emf.ecore.EStructuralFeature; | 15 | import org.eclipse.emf.ecore.EStructuralFeature; |
16 | import org.eclipse.emf.ecore.util.EcoreUtil; | 16 | import org.eclipse.emf.ecore.util.EcoreUtil; |
17 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 17 | import tools.refinery.interpreter.rete.recipes.RecipesPackage; |
18 | import tools.refinery.viatra.runtime.rete.recipes.RecipesPackage; | 18 | import tools.refinery.interpreter.rete.recipes.ReteNodeRecipe; |
19 | import tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe; | 19 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
20 | 20 | ||
21 | import java.util.*; | 21 | import java.util.*; |
22 | 22 | ||
diff --git a/subprojects/viatra-runtime-rete-recipes/src/main/java/tools/refinery/viatra/runtime/rete/recipes/helper/RecipesHelper.java b/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/helper/RecipesHelper.java index 3070fcf5..763989ea 100644 --- a/subprojects/viatra-runtime-rete-recipes/src/main/java/tools/refinery/viatra/runtime/rete/recipes/helper/RecipesHelper.java +++ b/subprojects/interpreter-rete-recipes/src/main/java/tools/refinery/interpreter/rete/recipes/helper/RecipesHelper.java | |||
@@ -6,10 +6,10 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | */ | 8 | */ |
9 | package tools.refinery.viatra.runtime.rete.recipes.helper; | 9 | package tools.refinery.interpreter.rete.recipes.helper; |
10 | 10 | ||
11 | import org.eclipse.emf.common.util.EList; | 11 | import org.eclipse.emf.common.util.EList; |
12 | import tools.refinery.viatra.runtime.rete.recipes.*; | 12 | import tools.refinery.interpreter.rete.recipes.*; |
13 | 13 | ||
14 | import java.util.Collection; | 14 | import java.util.Collection; |
15 | 15 | ||
diff --git a/subprojects/viatra-runtime-rete-recipes/src/main/resources/model/recipes.ecore b/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore index 4eda701e..a4617833 100644 --- a/subprojects/viatra-runtime-rete-recipes/src/main/resources/model/recipes.ecore +++ b/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore | |||
@@ -1,6 +1,6 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 2 | <ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
3 | xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="recipes" nsURI="https://refinery.tools/emf/2023/ViatraReteRecipes" | 3 | xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="recipes" nsURI="https://refinery.tools/emf/2023/InterpreterReteRecipes" |
4 | nsPrefix="recipes"> | 4 | nsPrefix="recipes"> |
5 | <eClassifiers xsi:type="ecore:EClass" name="ReteRecipe"> | 5 | <eClassifiers xsi:type="ecore:EClass" name="ReteRecipe"> |
6 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 6 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
@@ -48,7 +48,7 @@ | |||
48 | eSuperTypes="#//ReteNodeRecipe"> | 48 | eSuperTypes="#//ReteNodeRecipe"> |
49 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> | 49 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> |
50 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 50 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
51 | <details key="body" value="<%org.eclipse.emf.common.util.EList%><<%tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe%>> _parents = this.getParents();
<%tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe%> _get = _parents.get(0);
return _get.getArity();"/> | 51 | <details key="body" value="<%org.eclipse.emf.common.util.EList%><<%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%>> _parents = this.getParents();
<%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _get = _parents.get(0);
return _get.getArity();"/> |
52 | </eAnnotations> | 52 | </eAnnotations> |
53 | </eOperations> | 53 | </eOperations> |
54 | <eStructuralFeatures xsi:type="ecore:EReference" name="parents" upperBound="-1" | 54 | <eStructuralFeatures xsi:type="ecore:EReference" name="parents" upperBound="-1" |
@@ -95,7 +95,7 @@ | |||
95 | </eAnnotations> | 95 | </eAnnotations> |
96 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> | 96 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> |
97 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 97 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
98 | <details key="body" value="<%tools.refinery.viatra.runtime.rete.recipes.Mask%> _mask = this.getMask();
return _mask.getSourceArity();"/> | 98 | <details key="body" value="<%tools.refinery.interpreter.rete.recipes.Mask%> _mask = this.getMask();
return _mask.getSourceArity();"/> |
99 | </eAnnotations> | 99 | </eAnnotations> |
100 | </eOperations> | 100 | </eOperations> |
101 | <eStructuralFeatures xsi:type="ecore:EReference" name="mask" eType="#//Mask" containment="true" | 101 | <eStructuralFeatures xsi:type="ecore:EReference" name="mask" eType="#//Mask" containment="true" |
@@ -200,7 +200,7 @@ | |||
200 | </eAnnotations> | 200 | </eAnnotations> |
201 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> | 201 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> |
202 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 202 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
203 | <details key="body" value="<%tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> | 203 | <details key="body" value="<%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> |
204 | </eAnnotations> | 204 | </eAnnotations> |
205 | </eOperations> | 205 | </eOperations> |
206 | </eClassifiers> | 206 | </eClassifiers> |
@@ -221,7 +221,7 @@ | |||
221 | </eAnnotations> | 221 | </eAnnotations> |
222 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> | 222 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> |
223 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 223 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
224 | <details key="body" value="<%tools.refinery.viatra.runtime.rete.recipes.Mask%> _mask = this.getMask();
<%org.eclipse.emf.common.util.EList%><<%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();
return _sourceIndices.size();"/> | 224 | <details key="body" value="<%tools.refinery.interpreter.rete.recipes.Mask%> _mask = this.getMask();
<%org.eclipse.emf.common.util.EList%><<%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();
return _sourceIndices.size();"/> |
225 | </eAnnotations> | 225 | </eAnnotations> |
226 | </eOperations> | 226 | </eOperations> |
227 | <eStructuralFeatures xsi:type="ecore:EReference" name="mask" eType="#//Mask" containment="true" | 227 | <eStructuralFeatures xsi:type="ecore:EReference" name="mask" eType="#//Mask" containment="true" |
@@ -234,7 +234,7 @@ | |||
234 | <eClassifiers xsi:type="ecore:EClass" name="ExpressionEnforcerRecipe" abstract="true" | 234 | <eClassifiers xsi:type="ecore:EClass" name="ExpressionEnforcerRecipe" abstract="true" |
235 | eSuperTypes="#//AlphaRecipe"> | 235 | eSuperTypes="#//AlphaRecipe"> |
236 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 236 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
237 | <details key="documentation" value="type RuntimeExpressionEvaluator wraps tools.refinery.viatra.runtime.matchers.psystem.IExpressionEvaluator
class RuntimeExpressionDefinition extends ExpressionDefinition {
	RuntimeExpressionEvaluator evaluator
}"/> | 237 | <details key="documentation" value="type RuntimeExpressionEvaluator wraps psystem.matchers.tools.refinery.interpreter.IExpressionEvaluator
class RuntimeExpressionDefinition extends ExpressionDefinition {
	RuntimeExpressionEvaluator evaluator
}"/> |
238 | </eAnnotations> | 238 | </eAnnotations> |
239 | <eStructuralFeatures xsi:type="ecore:EReference" name="expression" eType="#//ExpressionDefinition" | 239 | <eStructuralFeatures xsi:type="ecore:EReference" name="expression" eType="#//ExpressionDefinition" |
240 | containment="true" resolveProxies="false"> | 240 | containment="true" resolveProxies="false"> |
@@ -256,7 +256,7 @@ | |||
256 | </eAnnotations> | 256 | </eAnnotations> |
257 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> | 257 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> |
258 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 258 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
259 | <details key="body" value="<%tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> | 259 | <details key="body" value="<%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> |
260 | </eAnnotations> | 260 | </eAnnotations> |
261 | </eOperations> | 261 | </eOperations> |
262 | </eClassifiers> | 262 | </eClassifiers> |
@@ -266,7 +266,7 @@ | |||
266 | </eAnnotations> | 266 | </eAnnotations> |
267 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> | 267 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> |
268 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 268 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
269 | <details key="body" value="<%tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
int _arity = _parent.getArity();
return (1 + _arity);"/> | 269 | <details key="body" value="<%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
int _arity = _parent.getArity();
return (1 + _arity);"/> |
270 | </eAnnotations> | 270 | </eAnnotations> |
271 | </eOperations> | 271 | </eOperations> |
272 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="unwinding" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"> | 272 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="unwinding" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"> |
@@ -282,7 +282,7 @@ | |||
282 | </eAnnotations> | 282 | </eAnnotations> |
283 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> | 283 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> |
284 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 284 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
285 | <details key="body" value="<%tools.refinery.viatra.runtime.rete.recipes.ProjectionIndexerRecipe%> _parent = this.getParent();
<%tools.refinery.viatra.runtime.rete.recipes.Mask%> _mask = _parent.getMask();
<%org.eclipse.emf.common.util.EList%><<%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();
int _size = _sourceIndices.size();
return (1 + _size);"/> | 285 | <details key="body" value="<%tools.refinery.interpreter.rete.recipes.ProjectionIndexerRecipe%> _parent = this.getParent();
<%tools.refinery.interpreter.rete.recipes.Mask%> _mask = _parent.getMask();
<%org.eclipse.emf.common.util.EList%><<%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();
int _size = _sourceIndices.size();
return (1 + _size);"/> |
286 | </eAnnotations> | 286 | </eAnnotations> |
287 | </eOperations> | 287 | </eOperations> |
288 | <eStructuralFeatures xsi:type="ecore:EReference" name="parent" eType="#//ProjectionIndexerRecipe" | 288 | <eStructuralFeatures xsi:type="ecore:EReference" name="parent" eType="#//ProjectionIndexerRecipe" |
@@ -299,7 +299,7 @@ | |||
299 | </eAnnotations> | 299 | </eAnnotations> |
300 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> | 300 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> |
301 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 301 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
302 | <details key="body" value="<%tools.refinery.viatra.runtime.rete.recipes.ProjectionIndexerRecipe%> _leftParent = this.getLeftParent();
int _arity = _leftParent.getArity();
<%tools.refinery.viatra.runtime.rete.recipes.IndexerRecipe%> _rightParent = this.getRightParent();
int _arity_1 = _rightParent.getArity();
int _plus = (_arity + _arity_1);
<%tools.refinery.viatra.runtime.rete.recipes.IndexerRecipe%> _rightParent_1 = this.getRightParent();
<%tools.refinery.viatra.runtime.rete.recipes.Mask%> _mask = _rightParent_1.getMask();
<%org.eclipse.emf.common.util.EList%><<%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();
int _size = _sourceIndices.size();
return (_plus - _size);"/> | 302 | <details key="body" value="<%tools.refinery.interpreter.rete.recipes.ProjectionIndexerRecipe%> _leftParent = this.getLeftParent();
int _arity = _leftParent.getArity();
<%tools.refinery.interpreter.rete.recipes.IndexerRecipe%> _rightParent = this.getRightParent();
int _arity_1 = _rightParent.getArity();
int _plus = (_arity + _arity_1);
<%tools.refinery.interpreter.rete.recipes.IndexerRecipe%> _rightParent_1 = this.getRightParent();
<%tools.refinery.interpreter.rete.recipes.Mask%> _mask = _rightParent_1.getMask();
<%org.eclipse.emf.common.util.EList%><<%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();
int _size = _sourceIndices.size();
return (_plus - _size);"/> |
303 | </eAnnotations> | 303 | </eAnnotations> |
304 | </eOperations> | 304 | </eOperations> |
305 | <eStructuralFeatures xsi:type="ecore:EReference" name="rightParentComplementaryMask" | 305 | <eStructuralFeatures xsi:type="ecore:EReference" name="rightParentComplementaryMask" |
@@ -312,7 +312,7 @@ | |||
312 | </eAnnotations> | 312 | </eAnnotations> |
313 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> | 313 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> |
314 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 314 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
315 | <details key="body" value="<%tools.refinery.viatra.runtime.rete.recipes.ProjectionIndexerRecipe%> _leftParent = this.getLeftParent();
return _leftParent.getArity();"/> | 315 | <details key="body" value="<%tools.refinery.interpreter.rete.recipes.ProjectionIndexerRecipe%> _leftParent = this.getLeftParent();
return _leftParent.getArity();"/> |
316 | </eAnnotations> | 316 | </eAnnotations> |
317 | </eOperations> | 317 | </eOperations> |
318 | </eClassifiers> | 318 | </eClassifiers> |
@@ -340,7 +340,7 @@ | |||
340 | <eClassifiers xsi:type="ecore:EClass" name="SingleColumnAggregatorRecipe" eSuperTypes="#//AlphaRecipe #//RederivableNodeRecipe"> | 340 | <eClassifiers xsi:type="ecore:EClass" name="SingleColumnAggregatorRecipe" eSuperTypes="#//AlphaRecipe #//RederivableNodeRecipe"> |
341 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> | 341 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> |
342 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 342 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
343 | <details key="body" value="<%tools.refinery.viatra.runtime.rete.recipes.MonotonicityInfo%> info = getOptionalMonotonicityInfo();
if (info == null) {
	return 1 + getGroupByMask().getSourceIndices().size();
} else {	
	return info.getCoreMask().getSourceIndices().size() + info.getPosetMask().getSourceIndices().size();
}"/> | 343 | <details key="body" value="<%tools.refinery.interpreter.rete.recipes.MonotonicityInfo%> info = getOptionalMonotonicityInfo();
if (info == null) {
	return 1 + getGroupByMask().getSourceIndices().size();
} else {	
	return info.getCoreMask().getSourceIndices().size() + info.getPosetMask().getSourceIndices().size();
}"/> |
344 | </eAnnotations> | 344 | </eAnnotations> |
345 | </eOperations> | 345 | </eOperations> |
346 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="multisetAggregationOperator" | 346 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="multisetAggregationOperator" |
@@ -349,14 +349,14 @@ | |||
349 | <eStructuralFeatures xsi:type="ecore:EReference" name="groupByMask" lowerBound="1" | 349 | <eStructuralFeatures xsi:type="ecore:EReference" name="groupByMask" lowerBound="1" |
350 | eType="#//Mask" containment="true"/> | 350 | eType="#//Mask" containment="true"/> |
351 | </eClassifiers> | 351 | </eClassifiers> |
352 | <eClassifiers xsi:type="ecore:EDataType" name="AggregationOperator" instanceTypeName="tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator<?, ?, ?>"/> | 352 | <eClassifiers xsi:type="ecore:EDataType" name="AggregationOperator" instanceTypeName="tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator<?, ?, ?>"/> |
353 | <eClassifiers xsi:type="ecore:EClass" name="DiscriminatorDispatcherRecipe" eSuperTypes="#//SingleParentNodeRecipe"> | 353 | <eClassifiers xsi:type="ecore:EClass" name="DiscriminatorDispatcherRecipe" eSuperTypes="#//SingleParentNodeRecipe"> |
354 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 354 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
355 | <details key="documentation" value="Node that sends tuples off to different buckets (attached as children) based on the value of a given column."/> | 355 | <details key="documentation" value="Node that sends tuples off to different buckets (attached as children) based on the value of a given column."/> |
356 | </eAnnotations> | 356 | </eAnnotations> |
357 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> | 357 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> |
358 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 358 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
359 | <details key="body" value="<%tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> | 359 | <details key="body" value="<%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> |
360 | </eAnnotations> | 360 | </eAnnotations> |
361 | </eOperations> | 361 | </eOperations> |
362 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="discriminationColumnIndex" | 362 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="discriminationColumnIndex" |
@@ -368,7 +368,7 @@ | |||
368 | </eAnnotations> | 368 | </eAnnotations> |
369 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> | 369 | <eOperations name="getArity" unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"> |
370 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> | 370 | <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> |
371 | <details key="body" value="<%tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> | 371 | <details key="body" value="<%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> |
372 | </eAnnotations> | 372 | </eAnnotations> |
373 | </eOperations> | 373 | </eOperations> |
374 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="bucketKey" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/> | 374 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="bucketKey" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/> |
@@ -396,5 +396,5 @@ | |||
396 | </eOperations> | 396 | </eOperations> |
397 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="connectivity" eType="#//Connectivity"/> | 397 | <eStructuralFeatures xsi:type="ecore:EAttribute" name="connectivity" eType="#//Connectivity"/> |
398 | </eClassifiers> | 398 | </eClassifiers> |
399 | <eClassifiers xsi:type="ecore:EDataType" name="Connectivity" instanceClassName="tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.Connectivity"/> | 399 | <eClassifiers xsi:type="ecore:EDataType" name="Connectivity" instanceClassName="tools.refinery.interpreter.matchers.psystem.basicenumerables.Connectivity"/> |
400 | </ecore:EPackage> | 400 | </ecore:EPackage> |
diff --git a/subprojects/viatra-runtime-rete-recipes/src/main/resources/model/recipes.ecore.license b/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore.license index 03d1d42b..03d1d42b 100644 --- a/subprojects/viatra-runtime-rete-recipes/src/main/resources/model/recipes.ecore.license +++ b/subprojects/interpreter-rete-recipes/src/main/resources/model/recipes.ecore.license | |||
diff --git a/subprojects/viatra-runtime-rete-recipes/src/main/resources/model/rete-recipes.genmodel b/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel index 6b44fde6..89ff6e3a 100644 --- a/subprojects/viatra-runtime-rete-recipes/src/main/resources/model/rete-recipes.genmodel +++ b/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel | |||
@@ -1,8 +1,8 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" | 2 | <genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" |
3 | xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyright (c) 2004-2014 Gabor Bergmann and Daniel Varro
Copyright (c) 2023 The Refinery Authors <https://refinery.tools>
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-v20.html.

SPDX-License-Identifier: EPL-2.0" | 3 | xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyright (c) 2004-2014 Gabor Bergmann and Daniel Varro
Copyright (c) 2023 The Refinery Authors <https://refinery.tools>
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0 which is available at
http://www.eclipse.org/legal/epl-v20.html.

SPDX-License-Identifier: EPL-2.0" |
4 | modelDirectory="/tools.refinery.refinery-viatra-runtime-rete-recipes/src/main/emf-gen" | 4 | modelDirectory="/tools.refinery.refinery-interpreter-rete-recipes/src/main/emf-gen" |
5 | modelPluginID="viatra-runtime-rete-recipes" runtimeJar="true" forceOverwrite="true" | 5 | modelPluginID="tools.refinery.refinery-interpreter-rete-recipes" runtimeJar="true" forceOverwrite="true" |
6 | modelName="Rete-recipes" updateClasspath="false" nonNLSMarkers="true" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" | 6 | modelName="Rete-recipes" updateClasspath="false" nonNLSMarkers="true" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" |
7 | testsDirectory="" importerID="org.eclipse.emf.importer.ecore" containmentProxies="true" | 7 | testsDirectory="" importerID="org.eclipse.emf.importer.ecore" containmentProxies="true" |
8 | complianceLevel="7.0" language="en" operationReflection="true"> | 8 | complianceLevel="7.0" language="en" operationReflection="true"> |
@@ -21,7 +21,7 @@ | |||
21 | <foreignModel>recipes.ecore</foreignModel> | 21 | <foreignModel>recipes.ecore</foreignModel> |
22 | <modelPluginVariables>org.eclipse.xtext.xbase.lib</modelPluginVariables> | 22 | <modelPluginVariables>org.eclipse.xtext.xbase.lib</modelPluginVariables> |
23 | <modelPluginVariables>org.eclipse.emf.ecore.xcore.lib</modelPluginVariables> | 23 | <modelPluginVariables>org.eclipse.emf.ecore.xcore.lib</modelPluginVariables> |
24 | <genPackages prefix="Recipes" basePackage="tools.refinery.viatra.runtime.rete" disposableProviderFactory="true" | 24 | <genPackages prefix="Recipes" basePackage="tools.refinery.interpreter.rete" disposableProviderFactory="true" |
25 | ecorePackage="recipes.ecore#/"> | 25 | ecorePackage="recipes.ecore#/"> |
26 | <genDataTypes ecoreDataType="recipes.ecore#//Index"/> | 26 | <genDataTypes ecoreDataType="recipes.ecore#//Index"/> |
27 | <genDataTypes ecoreDataType="recipes.ecore#//AggregationOperator"/> | 27 | <genDataTypes ecoreDataType="recipes.ecore#//AggregationOperator"/> |
@@ -41,7 +41,7 @@ | |||
41 | <genClasses image="false" ecoreClass="recipes.ecore#//MultiParentNodeRecipe"> | 41 | <genClasses image="false" ecoreClass="recipes.ecore#//MultiParentNodeRecipe"> |
42 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference recipes.ecore#//MultiParentNodeRecipe/parents"/> | 42 | <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference recipes.ecore#//MultiParentNodeRecipe/parents"/> |
43 | <genOperations ecoreOperation="recipes.ecore#//MultiParentNodeRecipe/getArity" | 43 | <genOperations ecoreOperation="recipes.ecore#//MultiParentNodeRecipe/getArity" |
44 | body="<%org.eclipse.emf.common.util.EList%><<%tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe%>> _parents = this.getParents();
<%tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe%> _get = _parents.get(0);
return _get.getArity();"/> | 44 | body="<%org.eclipse.emf.common.util.EList%><<%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%>> _parents = this.getParents();
<%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _get = _parents.get(0);
return _get.getArity();"/> |
45 | </genClasses> | 45 | </genClasses> |
46 | <genClasses ecoreClass="recipes.ecore#//MonotonicityInfo"> | 46 | <genClasses ecoreClass="recipes.ecore#//MonotonicityInfo"> |
47 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//MonotonicityInfo/coreMask"/> | 47 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//MonotonicityInfo/coreMask"/> |
@@ -57,7 +57,7 @@ | |||
57 | </genClasses> | 57 | </genClasses> |
58 | <genClasses image="false" ecoreClass="recipes.ecore#//IndexerRecipe"> | 58 | <genClasses image="false" ecoreClass="recipes.ecore#//IndexerRecipe"> |
59 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//IndexerRecipe/mask"/> | 59 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//IndexerRecipe/mask"/> |
60 | <genOperations ecoreOperation="recipes.ecore#//IndexerRecipe/getArity" body="<%tools.refinery.viatra.runtime.rete.recipes.Mask%> _mask = this.getMask();
return _mask.getSourceArity();"/> | 60 | <genOperations ecoreOperation="recipes.ecore#//IndexerRecipe/getArity" body="<%tools.refinery.interpreter.rete.recipes.Mask%> _mask = this.getMask();
return _mask.getSourceArity();"/> |
61 | </genClasses> | 61 | </genClasses> |
62 | <genClasses ecoreClass="recipes.ecore#//ProjectionIndexerRecipe"/> | 62 | <genClasses ecoreClass="recipes.ecore#//ProjectionIndexerRecipe"/> |
63 | <genClasses ecoreClass="recipes.ecore#//AggregatorIndexerRecipe"/> | 63 | <genClasses ecoreClass="recipes.ecore#//AggregatorIndexerRecipe"/> |
@@ -88,7 +88,7 @@ | |||
88 | body="return 2;"/> | 88 | body="return 2;"/> |
89 | </genClasses> | 89 | </genClasses> |
90 | <genClasses image="false" ecoreClass="recipes.ecore#//FilterRecipe"> | 90 | <genClasses image="false" ecoreClass="recipes.ecore#//FilterRecipe"> |
91 | <genOperations ecoreOperation="recipes.ecore#//FilterRecipe/getArity" body="<%tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> | 91 | <genOperations ecoreOperation="recipes.ecore#//FilterRecipe/getArity" body="<%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> |
92 | </genClasses> | 92 | </genClasses> |
93 | <genClasses ecoreClass="recipes.ecore#//InequalityFilterRecipe"> | 93 | <genClasses ecoreClass="recipes.ecore#//InequalityFilterRecipe"> |
94 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//InequalityFilterRecipe/subject"/> | 94 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//InequalityFilterRecipe/subject"/> |
@@ -100,7 +100,7 @@ | |||
100 | <genClasses ecoreClass="recipes.ecore#//TransparentRecipe"/> | 100 | <genClasses ecoreClass="recipes.ecore#//TransparentRecipe"/> |
101 | <genClasses ecoreClass="recipes.ecore#//TrimmerRecipe"> | 101 | <genClasses ecoreClass="recipes.ecore#//TrimmerRecipe"> |
102 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//TrimmerRecipe/mask"/> | 102 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//TrimmerRecipe/mask"/> |
103 | <genOperations ecoreOperation="recipes.ecore#//TrimmerRecipe/getArity" body="<%tools.refinery.viatra.runtime.rete.recipes.Mask%> _mask = this.getMask();
<%org.eclipse.emf.common.util.EList%><<%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();
return _sourceIndices.size();"/> | 103 | <genOperations ecoreOperation="recipes.ecore#//TrimmerRecipe/getArity" body="<%tools.refinery.interpreter.rete.recipes.Mask%> _mask = this.getMask();
<%org.eclipse.emf.common.util.EList%><<%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();
return _sourceIndices.size();"/> |
104 | </genClasses> | 104 | </genClasses> |
105 | <genClasses ecoreClass="recipes.ecore#//ExpressionDefinition"> | 105 | <genClasses ecoreClass="recipes.ecore#//ExpressionDefinition"> |
106 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ExpressionDefinition/evaluator"/> | 106 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ExpressionDefinition/evaluator"/> |
@@ -111,25 +111,25 @@ | |||
111 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ExpressionEnforcerRecipe/cacheOutput"/> | 111 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//ExpressionEnforcerRecipe/cacheOutput"/> |
112 | </genClasses> | 112 | </genClasses> |
113 | <genClasses ecoreClass="recipes.ecore#//CheckRecipe"> | 113 | <genClasses ecoreClass="recipes.ecore#//CheckRecipe"> |
114 | <genOperations ecoreOperation="recipes.ecore#//CheckRecipe/getArity" body="<%tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> | 114 | <genOperations ecoreOperation="recipes.ecore#//CheckRecipe/getArity" body="<%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> |
115 | </genClasses> | 115 | </genClasses> |
116 | <genClasses ecoreClass="recipes.ecore#//EvalRecipe"> | 116 | <genClasses ecoreClass="recipes.ecore#//EvalRecipe"> |
117 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//EvalRecipe/unwinding"/> | 117 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//EvalRecipe/unwinding"/> |
118 | <genOperations ecoreOperation="recipes.ecore#//EvalRecipe/getArity" body="<%tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
int _arity = _parent.getArity();
return (1 + _arity);"/> | 118 | <genOperations ecoreOperation="recipes.ecore#//EvalRecipe/getArity" body="<%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
int _arity = _parent.getArity();
return (1 + _arity);"/> |
119 | </genClasses> | 119 | </genClasses> |
120 | <genClasses image="false" ecoreClass="recipes.ecore#//IndexerBasedAggregatorRecipe"> | 120 | <genClasses image="false" ecoreClass="recipes.ecore#//IndexerBasedAggregatorRecipe"> |
121 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//IndexerBasedAggregatorRecipe/parent"/> | 121 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//IndexerBasedAggregatorRecipe/parent"/> |
122 | <genOperations ecoreOperation="recipes.ecore#//IndexerBasedAggregatorRecipe/getArity" | 122 | <genOperations ecoreOperation="recipes.ecore#//IndexerBasedAggregatorRecipe/getArity" |
123 | body="<%tools.refinery.viatra.runtime.rete.recipes.ProjectionIndexerRecipe%> _parent = this.getParent();
<%tools.refinery.viatra.runtime.rete.recipes.Mask%> _mask = _parent.getMask();
<%org.eclipse.emf.common.util.EList%><<%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();
int _size = _sourceIndices.size();
return (1 + _size);"/> | 123 | body="<%tools.refinery.interpreter.rete.recipes.ProjectionIndexerRecipe%> _parent = this.getParent();
<%tools.refinery.interpreter.rete.recipes.Mask%> _mask = _parent.getMask();
<%org.eclipse.emf.common.util.EList%><<%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();
int _size = _sourceIndices.size();
return (1 + _size);"/> |
124 | </genClasses> | 124 | </genClasses> |
125 | <genClasses ecoreClass="recipes.ecore#//CountAggregatorRecipe"/> | 125 | <genClasses ecoreClass="recipes.ecore#//CountAggregatorRecipe"/> |
126 | <genClasses ecoreClass="recipes.ecore#//JoinRecipe"> | 126 | <genClasses ecoreClass="recipes.ecore#//JoinRecipe"> |
127 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//JoinRecipe/rightParentComplementaryMask"/> | 127 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//JoinRecipe/rightParentComplementaryMask"/> |
128 | <genOperations ecoreOperation="recipes.ecore#//JoinRecipe/getArity" body="<%tools.refinery.viatra.runtime.rete.recipes.ProjectionIndexerRecipe%> _leftParent = this.getLeftParent();
int _arity = _leftParent.getArity();
<%tools.refinery.viatra.runtime.rete.recipes.IndexerRecipe%> _rightParent = this.getRightParent();
int _arity_1 = _rightParent.getArity();
int _plus = (_arity + _arity_1);
<%tools.refinery.viatra.runtime.rete.recipes.IndexerRecipe%> _rightParent_1 = this.getRightParent();
<%tools.refinery.viatra.runtime.rete.recipes.Mask%> _mask = _rightParent_1.getMask();
<%org.eclipse.emf.common.util.EList%><<%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();
int _size = _sourceIndices.size();
return (_plus - _size);"/> | 128 | <genOperations ecoreOperation="recipes.ecore#//JoinRecipe/getArity" body="<%tools.refinery.interpreter.rete.recipes.ProjectionIndexerRecipe%> _leftParent = this.getLeftParent();
int _arity = _leftParent.getArity();
<%tools.refinery.interpreter.rete.recipes.IndexerRecipe%> _rightParent = this.getRightParent();
int _arity_1 = _rightParent.getArity();
int _plus = (_arity + _arity_1);
<%tools.refinery.interpreter.rete.recipes.IndexerRecipe%> _rightParent_1 = this.getRightParent();
<%tools.refinery.interpreter.rete.recipes.Mask%> _mask = _rightParent_1.getMask();
<%org.eclipse.emf.common.util.EList%><<%java.lang.Integer%>> _sourceIndices = _mask.getSourceIndices();
int _size = _sourceIndices.size();
return (_plus - _size);"/> |
129 | </genClasses> | 129 | </genClasses> |
130 | <genClasses image="false" ecoreClass="recipes.ecore#//ExistenceJoinRecipe"> | 130 | <genClasses image="false" ecoreClass="recipes.ecore#//ExistenceJoinRecipe"> |
131 | <genOperations ecoreOperation="recipes.ecore#//ExistenceJoinRecipe/getArity" | 131 | <genOperations ecoreOperation="recipes.ecore#//ExistenceJoinRecipe/getArity" |
132 | body="<%tools.refinery.viatra.runtime.rete.recipes.ProjectionIndexerRecipe%> _leftParent = this.getLeftParent();
return _leftParent.getArity();"/> | 132 | body="<%tools.refinery.interpreter.rete.recipes.ProjectionIndexerRecipe%> _leftParent = this.getLeftParent();
return _leftParent.getArity();"/> |
133 | </genClasses> | 133 | </genClasses> |
134 | <genClasses ecoreClass="recipes.ecore#//SemiJoinRecipe"/> | 134 | <genClasses ecoreClass="recipes.ecore#//SemiJoinRecipe"/> |
135 | <genClasses ecoreClass="recipes.ecore#//AntiJoinRecipe"/> | 135 | <genClasses ecoreClass="recipes.ecore#//AntiJoinRecipe"/> |
@@ -143,17 +143,17 @@ | |||
143 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//SingleColumnAggregatorRecipe/aggregableIndex"/> | 143 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//SingleColumnAggregatorRecipe/aggregableIndex"/> |
144 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//SingleColumnAggregatorRecipe/groupByMask"/> | 144 | <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference recipes.ecore#//SingleColumnAggregatorRecipe/groupByMask"/> |
145 | <genOperations ecoreOperation="recipes.ecore#//SingleColumnAggregatorRecipe/getArity" | 145 | <genOperations ecoreOperation="recipes.ecore#//SingleColumnAggregatorRecipe/getArity" |
146 | body="<%tools.refinery.viatra.runtime.rete.recipes.MonotonicityInfo%> info = getOptionalMonotonicityInfo();
if (info == null) {
	return 1 + getGroupByMask().getSourceIndices().size();
} else {	
	return info.getCoreMask().getSourceIndices().size() + info.getPosetMask().getSourceIndices().size();
}"/> | 146 | body="<%tools.refinery.interpreter.rete.recipes.MonotonicityInfo%> info = getOptionalMonotonicityInfo();
if (info == null) {
	return 1 + getGroupByMask().getSourceIndices().size();
} else {	
	return info.getCoreMask().getSourceIndices().size() + info.getPosetMask().getSourceIndices().size();
}"/> |
147 | </genClasses> | 147 | </genClasses> |
148 | <genClasses ecoreClass="recipes.ecore#//DiscriminatorDispatcherRecipe"> | 148 | <genClasses ecoreClass="recipes.ecore#//DiscriminatorDispatcherRecipe"> |
149 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//DiscriminatorDispatcherRecipe/discriminationColumnIndex"/> | 149 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//DiscriminatorDispatcherRecipe/discriminationColumnIndex"/> |
150 | <genOperations ecoreOperation="recipes.ecore#//DiscriminatorDispatcherRecipe/getArity" | 150 | <genOperations ecoreOperation="recipes.ecore#//DiscriminatorDispatcherRecipe/getArity" |
151 | body="<%tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> | 151 | body="<%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> |
152 | </genClasses> | 152 | </genClasses> |
153 | <genClasses ecoreClass="recipes.ecore#//DiscriminatorBucketRecipe"> | 153 | <genClasses ecoreClass="recipes.ecore#//DiscriminatorBucketRecipe"> |
154 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//DiscriminatorBucketRecipe/bucketKey"/> | 154 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//DiscriminatorBucketRecipe/bucketKey"/> |
155 | <genOperations ecoreOperation="recipes.ecore#//DiscriminatorBucketRecipe/getArity" | 155 | <genOperations ecoreOperation="recipes.ecore#//DiscriminatorBucketRecipe/getArity" |
156 | body="<%tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> | 156 | body="<%tools.refinery.interpreter.rete.recipes.ReteNodeRecipe%> _parent = this.getParent();
return _parent.getArity();"/> |
157 | </genClasses> | 157 | </genClasses> |
158 | <genClasses image="false" ecoreClass="recipes.ecore#//RederivableNodeRecipe"> | 158 | <genClasses image="false" ecoreClass="recipes.ecore#//RederivableNodeRecipe"> |
159 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//RederivableNodeRecipe/deleteRederiveEvaluation"/> | 159 | <genFeatures createChild="false" ecoreFeature="ecore:EAttribute recipes.ecore#//RederivableNodeRecipe/deleteRederiveEvaluation"/> |
diff --git a/subprojects/viatra-runtime-rete-recipes/src/main/resources/model/rete-recipes.genmodel.license b/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel.license index 03d1d42b..03d1d42b 100644 --- a/subprojects/viatra-runtime-rete-recipes/src/main/resources/model/rete-recipes.genmodel.license +++ b/subprojects/interpreter-rete-recipes/src/main/resources/model/rete-recipes.genmodel.license | |||
diff --git a/subprojects/interpreter-rete/NOTICE.md b/subprojects/interpreter-rete/NOTICE.md new file mode 100644 index 00000000..94c1d803 --- /dev/null +++ b/subprojects/interpreter-rete/NOTICE.md | |||
@@ -0,0 +1,94 @@ | |||
1 | <!-- | ||
2 | Copyright (c) 2018-2019, Zoltan Ujhelyi, IncQuery Labs Ltd. | ||
3 | Copyright (c) 2023 The Refinery Authors <https://refinery.tools/> | ||
4 | |||
5 | SPDX-License-Identifier: EPL-2.0 | ||
6 | --> | ||
7 | |||
8 | This module contains source code from the [Eclipse VIATRA™ project](https://projects.eclipse.org/projects/modeling.viatra), which is available under the terms of the [Eclipse Public License v 2.0](http://www.eclipse.org/legal/epl-v20.html). | ||
9 | |||
10 | Eclipse®, VIATRA™ and ‘Eclipse VIATRA™’ are trademarks of Eclipse Foundation, Inc. | ||
11 | |||
12 | To comply with the [Eclipse Foundation Trademark Usage Policy](https://www.eclipse.org/legal/logo_guidelines.php), we replaced the Eclipse VIATRA™ branding in this repository with the name _Refinery Interpreter_, since the [Eclipse Public License - v 2.0](https://www.eclipse.org/legal/epl-2.0/) does not grant trademark usage rights to derived projects. | ||
13 | _Refinery Interpreter_ is not endorsed or sponsored by Eclipse Foundation, Inc. or any other organizations using the Eclipse VIATRA™ trademark. | ||
14 | |||
15 | We publish our modifications to Eclipse VIATRA™ for use within the Refinery framework under the name _Refinery Interpreter_. When not using _Refinery Interpreter_ directly in the Refinery framework, users are strongly encouraged to rely on [Eclipse VIATRA™](https://eclipse.dev/viatra/) instead. In particular, _Refinery Interpreter_ does not provide any API stability guarantees that are provided by Eclipse VIATRA™. | ||
16 | |||
17 | We reproduce the [accompanying notices of Eclipse VIATRA™](https://github.com/viatra/org.eclipse.viatra/blob/d422bcc626a99c4640c0d13931f393ccea0d2326/NOTICE.md) in full below: | ||
18 | |||
19 | # Notices for Eclipse VIATRA™ | ||
20 | |||
21 | This content is produced and maintained by the Eclipse VIATRA project. | ||
22 | |||
23 | * Project home: https://projects.eclipse.org/projects/modeling.viatra | ||
24 | |||
25 | ## Trademarks | ||
26 | |||
27 | Eclipse VIATRA, and VIATRA are trademarks of the Eclipse Foundation. | ||
28 | |||
29 | ## Copyright | ||
30 | |||
31 | All content is the property of the respective authors or their employers. For | ||
32 | more information regarding authorship of content, please consult the listed | ||
33 | source code repository logs. | ||
34 | |||
35 | ## Declared Project Licenses | ||
36 | |||
37 | This program and the accompanying materials are made available under the terms | ||
38 | of the Eclipse Public License v. 2.0 which is available at | ||
39 | http://www.eclipse.org/legal/epl-v20.html. | ||
40 | |||
41 | SPDX-License-Identifier: EPL-2.0 | ||
42 | |||
43 | ## Source Code | ||
44 | |||
45 | The project maintains the following source code repositories: | ||
46 | |||
47 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra.git | ||
48 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra.modelobfuscator.git | ||
49 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra.examples.git | ||
50 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra2.vpm.git | ||
51 | |||
52 | ## Third-party Content | ||
53 | |||
54 | This project leverages the following third party content. | ||
55 | |||
56 | ANTLR Runtime only: (3.2) | ||
57 | |||
58 | * License: New BSD license | ||
59 | |||
60 | Apache Commons Language Library (2.1) | ||
61 | |||
62 | * License: Apache License, 2.0 | ||
63 | |||
64 | Google Guice / Inject Core API (3.0.0) | ||
65 | |||
66 | * License: Apache License, 2.0 | ||
67 | |||
68 | Google Guice / Inject Core API (3.0.0) | ||
69 | |||
70 | * License: Apache License 2.0 | ||
71 | |||
72 | Guava (10.0.1) | ||
73 | |||
74 | * License: Apache License, 2.0 | ||
75 | |||
76 | Guice (2.0) | ||
77 | |||
78 | * License: Apache License, 2.0 | ||
79 | |||
80 | guice-multibindings (3.0.0) | ||
81 | |||
82 | * License: Apache License, 2.0 | ||
83 | |||
84 | log4j (1.2.15) | ||
85 | |||
86 | * License: Apache License 2.0 | ||
87 | |||
88 | LPG Java Runtime (lpgjavaruntime.jar) (1.1) | ||
89 | |||
90 | * License: Eclipse Public License | ||
91 | |||
92 | mockito (1.9.5) | ||
93 | |||
94 | * License: Apache License, 2.0, New BSD license, MIT license | ||
diff --git a/subprojects/viatra-runtime-rete/about.html b/subprojects/interpreter-rete/about.html index d1d5593a..d1d5593a 100644 --- a/subprojects/viatra-runtime-rete/about.html +++ b/subprojects/interpreter-rete/about.html | |||
diff --git a/subprojects/interpreter-rete/build.gradle.kts b/subprojects/interpreter-rete/build.gradle.kts new file mode 100644 index 00000000..978e668c --- /dev/null +++ b/subprojects/interpreter-rete/build.gradle.kts | |||
@@ -0,0 +1,15 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | plugins { | ||
8 | id("tools.refinery.gradle.interpreter-library") | ||
9 | } | ||
10 | |||
11 | dependencies { | ||
12 | implementation(project(":refinery-interpreter")) | ||
13 | implementation(project(":refinery-interpreter-rete-recipes")) | ||
14 | implementation(libs.slf4j.log4j) | ||
15 | } | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/AbstractColumnAggregatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/AbstractColumnAggregatorNode.java index 2588bde1..3cf3f642 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/AbstractColumnAggregatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/AbstractColumnAggregatorNode.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.aggregation; | 9 | package tools.refinery.interpreter.rete.aggregation; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -14,22 +14,22 @@ import java.util.Map; | |||
14 | import java.util.Map.Entry; | 14 | import java.util.Map.Entry; |
15 | import java.util.Objects; | 15 | import java.util.Objects; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 17 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 18 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 19 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
20 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 20 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
21 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
22 | import tools.refinery.viatra.runtime.matchers.util.Clearable; | 22 | import tools.refinery.interpreter.matchers.util.Clearable; |
23 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 23 | import tools.refinery.interpreter.matchers.util.Direction; |
24 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 24 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
25 | import tools.refinery.viatra.runtime.rete.index.Indexer; | 25 | import tools.refinery.interpreter.rete.index.Indexer; |
26 | import tools.refinery.viatra.runtime.rete.index.StandardIndexer; | 26 | import tools.refinery.interpreter.rete.index.StandardIndexer; |
27 | import tools.refinery.viatra.runtime.rete.network.Node; | 27 | import tools.refinery.interpreter.rete.network.Node; |
28 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 28 | import tools.refinery.interpreter.rete.network.Receiver; |
29 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 29 | import tools.refinery.interpreter.rete.network.ReteContainer; |
30 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTracker; | 30 | import tools.refinery.interpreter.rete.network.communication.CommunicationTracker; |
31 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 31 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
32 | import tools.refinery.viatra.runtime.rete.single.SingleInputNode; | 32 | import tools.refinery.interpreter.rete.single.SingleInputNode; |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Groups incoming tuples by the given mask, and aggregates values at a specific index in each group. | 35 | * Groups incoming tuples by the given mask, and aggregates values at a specific index in each group. |
@@ -37,7 +37,7 @@ import tools.refinery.viatra.runtime.rete.single.SingleInputNode; | |||
37 | * Direct children are not supported, use via outer join indexers instead. | 37 | * Direct children are not supported, use via outer join indexers instead. |
38 | * <p> | 38 | * <p> |
39 | * There are both timeless and timely implementations. | 39 | * There are both timeless and timely implementations. |
40 | * | 40 | * |
41 | * @author Tamas Szabo | 41 | * @author Tamas Szabo |
42 | * @since 2.2 | 42 | * @since 2.2 |
43 | * | 43 | * |
@@ -79,7 +79,7 @@ public abstract class AbstractColumnAggregatorNode<Domain, Accumulator, Aggregat | |||
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Creates a new column aggregator node. | 81 | * Creates a new column aggregator node. |
82 | * | 82 | * |
83 | * @param reteContainer | 83 | * @param reteContainer |
84 | * the RETE container of the node | 84 | * the RETE container of the node |
85 | * @param operator | 85 | * @param operator |
@@ -109,7 +109,7 @@ public abstract class AbstractColumnAggregatorNode<Domain, Accumulator, Aggregat | |||
109 | 109 | ||
110 | /** | 110 | /** |
111 | * Creates a new column aggregator node. | 111 | * Creates a new column aggregator node. |
112 | * | 112 | * |
113 | * @param reteContainer | 113 | * @param reteContainer |
114 | * the RETE container of the node | 114 | * the RETE container of the node |
115 | * @param operator | 115 | * @param operator |
@@ -228,10 +228,10 @@ public abstract class AbstractColumnAggregatorNode<Domain, Accumulator, Aggregat | |||
228 | /** | 228 | /** |
229 | * A special non-iterable index that retrieves the aggregated, packed result (signature+aggregate) for the original | 229 | * A special non-iterable index that retrieves the aggregated, packed result (signature+aggregate) for the original |
230 | * signature. | 230 | * signature. |
231 | * | 231 | * |
232 | * @author Gabor Bergmann | 232 | * @author Gabor Bergmann |
233 | * @author Tamas Szabo | 233 | * @author Tamas Szabo |
234 | * | 234 | * |
235 | */ | 235 | */ |
236 | protected class AggregatorOuterIndexer extends StandardIndexer { | 236 | protected class AggregatorOuterIndexer extends StandardIndexer { |
237 | 237 | ||
@@ -333,7 +333,7 @@ public abstract class AbstractColumnAggregatorNode<Domain, Accumulator, Aggregat | |||
333 | * A special non-iterable index that checks a suspected aggregate value for a given signature. The signature for | 333 | * A special non-iterable index that checks a suspected aggregate value for a given signature. The signature for |
334 | * this index is the original 'group by' masked tuple, with the suspected result inserted at position | 334 | * this index is the original 'group by' masked tuple, with the suspected result inserted at position |
335 | * resultPositionInSignature. | 335 | * resultPositionInSignature. |
336 | * | 336 | * |
337 | * @author Gabor Bergmann | 337 | * @author Gabor Bergmann |
338 | * @author Tamas Szabo | 338 | * @author Tamas Szabo |
339 | * | 339 | * |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/ColumnAggregatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/ColumnAggregatorNode.java index 4480aed8..b1a25807 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/ColumnAggregatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/ColumnAggregatorNode.java | |||
@@ -3,30 +3,30 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.aggregation; | 9 | package tools.refinery.interpreter.rete.aggregation; |
10 | 10 | ||
11 | import java.util.Map; | 11 | import java.util.Map; |
12 | import java.util.Map.Entry; | 12 | import java.util.Map.Entry; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.context.IPosetComparator; | 14 | import tools.refinery.interpreter.matchers.context.IPosetComparator; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 15 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 17 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
18 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 18 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
19 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 19 | import tools.refinery.interpreter.matchers.util.Direction; |
20 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 20 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
21 | import tools.refinery.viatra.runtime.rete.network.PosetAwareReceiver; | 21 | import tools.refinery.interpreter.rete.network.PosetAwareReceiver; |
22 | import tools.refinery.viatra.runtime.rete.network.RederivableNode; | 22 | import tools.refinery.interpreter.rete.network.RederivableNode; |
23 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 23 | import tools.refinery.interpreter.rete.network.ReteContainer; |
24 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 24 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
25 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 25 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
26 | import tools.refinery.viatra.runtime.rete.network.communication.timeless.RecursiveCommunicationGroup; | 26 | import tools.refinery.interpreter.rete.network.communication.timeless.RecursiveCommunicationGroup; |
27 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 27 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
28 | import tools.refinery.viatra.runtime.rete.network.mailbox.timeless.BehaviorChangingMailbox; | 28 | import tools.refinery.interpreter.rete.network.mailbox.timeless.BehaviorChangingMailbox; |
29 | import tools.refinery.viatra.runtime.rete.network.mailbox.timeless.PosetAwareMailbox; | 29 | import tools.refinery.interpreter.rete.network.mailbox.timeless.PosetAwareMailbox; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Timeless implementation of the column aggregator node. | 32 | * Timeless implementation of the column aggregator node. |
@@ -34,7 +34,7 @@ import tools.refinery.viatra.runtime.rete.network.mailbox.timeless.PosetAwareMai | |||
34 | * The node is capable of operating in the delete and re-derive mode. In this mode, it is also possible to equip the | 34 | * The node is capable of operating in the delete and re-derive mode. In this mode, it is also possible to equip the |
35 | * node with an {@link IPosetComparator} to identify monotone changes; thus, ensuring that a fix-point can be reached | 35 | * node with an {@link IPosetComparator} to identify monotone changes; thus, ensuring that a fix-point can be reached |
36 | * during the evaluation. | 36 | * during the evaluation. |
37 | * | 37 | * |
38 | * @author Gabor Bergmann | 38 | * @author Gabor Bergmann |
39 | * @author Tamas Szabo | 39 | * @author Tamas Szabo |
40 | * @since 1.4 | 40 | * @since 1.4 |
@@ -70,7 +70,7 @@ public class ColumnAggregatorNode<Domain, Accumulator, AggregateResult> | |||
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Creates a new column aggregator node. | 72 | * Creates a new column aggregator node. |
73 | * | 73 | * |
74 | * @param reteContainer | 74 | * @param reteContainer |
75 | * the RETE container of the node | 75 | * the RETE container of the node |
76 | * @param operator | 76 | * @param operator |
@@ -100,7 +100,7 @@ public class ColumnAggregatorNode<Domain, Accumulator, AggregateResult> | |||
100 | 100 | ||
101 | /** | 101 | /** |
102 | * Creates a new column aggregator node. | 102 | * Creates a new column aggregator node. |
103 | * | 103 | * |
104 | * @param reteContainer | 104 | * @param reteContainer |
105 | * the RETE container of the node | 105 | * the RETE container of the node |
106 | * @param operator | 106 | * @param operator |
@@ -293,7 +293,7 @@ public class ColumnAggregatorNode<Domain, Accumulator, AggregateResult> | |||
293 | 293 | ||
294 | /** | 294 | /** |
295 | * Returns true if the accumulator was stored, false otherwise. | 295 | * Returns true if the accumulator was stored, false otherwise. |
296 | * | 296 | * |
297 | * @since 1.6 | 297 | * @since 1.6 |
298 | */ | 298 | */ |
299 | protected boolean storeIfNotNeutral(final Tuple key, final Accumulator accumulator, | 299 | protected boolean storeIfNotNeutral(final Tuple key, final Accumulator accumulator, |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/CountNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/CountNode.java index 7c98de0d..644bef4a 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/CountNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/CountNode.java | |||
@@ -3,20 +3,20 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.aggregation; | 10 | package tools.refinery.interpreter.rete.aggregation; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 14 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
15 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 15 | import tools.refinery.interpreter.rete.network.ReteContainer; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * An aggregation node that simply counts the number of tuples conforming to the signature. | 18 | * An aggregation node that simply counts the number of tuples conforming to the signature. |
19 | * | 19 | * |
20 | * @author Gabor Bergmann | 20 | * @author Gabor Bergmann |
21 | * @since 1.4 | 21 | * @since 1.4 |
22 | */ | 22 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/GroupedMap.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/GroupedMap.java index 3c7850de..4e4ac62d 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/GroupedMap.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/GroupedMap.java | |||
@@ -3,28 +3,28 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.aggregation; | 9 | package tools.refinery.interpreter.rete.aggregation; |
10 | 10 | ||
11 | import java.util.AbstractMap.SimpleEntry; | 11 | import java.util.AbstractMap.SimpleEntry; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 16 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * An optimized {@link Map} implementation where each key is produced by joining together a group tuple and some other | 21 | * An optimized {@link Map} implementation where each key is produced by joining together a group tuple and some other |
22 | * object (via left inheritance). Only a select few {@link Map} operations are supported. This collection is | 22 | * object (via left inheritance). Only a select few {@link Map} operations are supported. This collection is |
23 | * unmodifiable. | 23 | * unmodifiable. |
24 | * | 24 | * |
25 | * Operations on this map assume that client queries also obey the contract that keys are constructed from a group tuple | 25 | * Operations on this map assume that client queries also obey the contract that keys are constructed from a group tuple |
26 | * and an additional object. | 26 | * and an additional object. |
27 | * | 27 | * |
28 | * @author Tamas Szabo | 28 | * @author Tamas Szabo |
29 | * @since 2.4 | 29 | * @since 2.4 |
30 | */ | 30 | */ |
@@ -117,4 +117,4 @@ public class GroupedMap<GroupedKeyType, ValueType> implements Map<Tuple, ValueTy | |||
117 | }); | 117 | }); |
118 | } | 118 | } |
119 | 119 | ||
120 | } \ No newline at end of file | 120 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/GroupedSet.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/GroupedSet.java index 65561e53..b2700084 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/GroupedSet.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/GroupedSet.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.aggregation; | 9 | package tools.refinery.interpreter.rete.aggregation; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
@@ -17,7 +17,7 @@ import java.util.function.BiFunction; | |||
17 | * An optimized {@link Set} implementation where each contained value is produced by combining together a grouping value | 17 | * An optimized {@link Set} implementation where each contained value is produced by combining together a grouping value |
18 | * and some other (key) object. The way of combining together these two values is specified by the closure passed to the | 18 | * and some other (key) object. The way of combining together these two values is specified by the closure passed to the |
19 | * constructor. Only a select few {@link Set} operations are supported. This collection is unmodifiable. | 19 | * constructor. Only a select few {@link Set} operations are supported. This collection is unmodifiable. |
20 | * | 20 | * |
21 | * @author Tamas Szabo | 21 | * @author Tamas Szabo |
22 | * @since 2.4 | 22 | * @since 2.4 |
23 | */ | 23 | */ |
@@ -111,4 +111,4 @@ public class GroupedSet<GroupingValueType, GroupedKeyType, WholeKeyType> impleme | |||
111 | throw new UnsupportedOperationException(); | 111 | throw new UnsupportedOperationException(); |
112 | } | 112 | } |
113 | 113 | ||
114 | } \ No newline at end of file | 114 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/IAggregatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/IAggregatorNode.java index 6c286364..1d30cfce 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/IAggregatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/IAggregatorNode.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.aggregation; | 9 | package tools.refinery.interpreter.rete.aggregation; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.index.Indexer; | 11 | import tools.refinery.interpreter.rete.index.Indexer; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Expresses that aggregators expose specialized non-enumerable indexers for outer joining. | 14 | * Expresses that aggregators expose specialized non-enumerable indexers for outer joining. |
15 | * @author Gabor Bergmann | 15 | * @author Gabor Bergmann |
16 | * | 16 | * |
17 | * @since 1.4 | 17 | * @since 1.4 |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | public interface IAggregatorNode { | 20 | public interface IAggregatorNode { |
21 | 21 | ||
@@ -23,4 +23,4 @@ public interface IAggregatorNode { | |||
23 | 23 | ||
24 | Indexer getAggregatorOuterIdentityIndexer(int resultPositionInSignature); | 24 | Indexer getAggregatorOuterIdentityIndexer(int resultPositionInSignature); |
25 | 25 | ||
26 | } \ No newline at end of file | 26 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/IndexerBasedAggregatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/IndexerBasedAggregatorNode.java index d9a94a82..e689c0eb 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/IndexerBasedAggregatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/IndexerBasedAggregatorNode.java | |||
@@ -3,39 +3,39 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.aggregation; | 10 | package tools.refinery.interpreter.rete.aggregation; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Collections; | 13 | import java.util.Collections; |
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | import java.util.Map.Entry; | 15 | import java.util.Map.Entry; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 17 | import tools.refinery.interpreter.rete.traceability.TraceInfo; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 19 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
20 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 20 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
21 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 21 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
22 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 22 | import tools.refinery.interpreter.matchers.util.Direction; |
23 | import tools.refinery.viatra.runtime.rete.index.DefaultIndexerListener; | 23 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
24 | import tools.refinery.viatra.runtime.rete.index.Indexer; | 24 | import tools.refinery.interpreter.rete.index.DefaultIndexerListener; |
25 | import tools.refinery.viatra.runtime.rete.index.ProjectionIndexer; | 25 | import tools.refinery.interpreter.rete.index.Indexer; |
26 | import tools.refinery.viatra.runtime.rete.index.StandardIndexer; | 26 | import tools.refinery.interpreter.rete.index.ProjectionIndexer; |
27 | import tools.refinery.viatra.runtime.rete.network.Node; | 27 | import tools.refinery.interpreter.rete.index.StandardIndexer; |
28 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 28 | import tools.refinery.interpreter.rete.network.Node; |
29 | import tools.refinery.viatra.runtime.rete.network.StandardNode; | 29 | import tools.refinery.interpreter.rete.network.ReteContainer; |
30 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 30 | import tools.refinery.interpreter.rete.network.StandardNode; |
31 | import tools.refinery.viatra.runtime.rete.traceability.TraceInfo; | 31 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * A special node depending on a projection indexer to aggregate tuple groups with the same projection. Only propagates | 34 | * A special node depending on a projection indexer to aggregate tuple groups with the same projection. Only propagates |
35 | * the aggregates of non-empty groups. Use the outer indexers to circumvent. | 35 | * the aggregates of non-empty groups. Use the outer indexers to circumvent. |
36 | * <p> | 36 | * <p> |
37 | * This node cannot be used in recursive differential dataflow evaluation. | 37 | * This node cannot be used in recursive differential dataflow evaluation. |
38 | * | 38 | * |
39 | * @author Gabor Bergmann | 39 | * @author Gabor Bergmann |
40 | * @since 1.4 | 40 | * @since 1.4 |
41 | */ | 41 | */ |
@@ -57,7 +57,7 @@ public abstract class IndexerBasedAggregatorNode extends StandardNode implements | |||
57 | this.me = this; | 57 | this.me = this; |
58 | mainAggregates = CollectionsFactory.createMap(); | 58 | mainAggregates = CollectionsFactory.createMap(); |
59 | } | 59 | } |
60 | 60 | ||
61 | @Override | 61 | @Override |
62 | public void networkStructureChanged() { | 62 | public void networkStructureChanged() { |
63 | if (this.reteContainer.isTimelyEvaluation() && this.reteContainer.getCommunicationTracker().isInRecursiveGroup(this)) { | 63 | if (this.reteContainer.isTimelyEvaluation() && this.reteContainer.getCommunicationTracker().isInRecursiveGroup(this)) { |
@@ -65,7 +65,7 @@ public abstract class IndexerBasedAggregatorNode extends StandardNode implements | |||
65 | } | 65 | } |
66 | super.networkStructureChanged(); | 66 | super.networkStructureChanged(); |
67 | } | 67 | } |
68 | 68 | ||
69 | /** | 69 | /** |
70 | * @param projection | 70 | * @param projection |
71 | * the projection indexer whose tuple groups should be aggregated | 71 | * the projection indexer whose tuple groups should be aggregated |
@@ -73,7 +73,7 @@ public abstract class IndexerBasedAggregatorNode extends StandardNode implements | |||
73 | public void initializeWith(ProjectionIndexer projection) { | 73 | public void initializeWith(ProjectionIndexer projection) { |
74 | this.projection = projection; | 74 | this.projection = projection; |
75 | this.sourceWidth = projection.getMask().indices.length; | 75 | this.sourceWidth = projection.getMask().indices.length; |
76 | 76 | ||
77 | for (Tuple signature : projection.getSignatures()) { | 77 | for (Tuple signature : projection.getSignatures()) { |
78 | mainAggregates.put(signature, aggregateGroup(signature, projection.get(signature))); | 78 | mainAggregates.put(signature, aggregateGroup(signature, projection.get(signature))); |
79 | } | 79 | } |
@@ -90,7 +90,7 @@ public abstract class IndexerBasedAggregatorNode extends StandardNode implements | |||
90 | */ | 90 | */ |
91 | public abstract Object aggregateGroup(Tuple signature, Collection<Tuple> group); | 91 | public abstract Object aggregateGroup(Tuple signature, Collection<Tuple> group); |
92 | 92 | ||
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Aggregates (reduces) a group of tuples, having access to the previous aggregated value (before the update) and | 95 | * Aggregates (reduces) a group of tuples, having access to the previous aggregated value (before the update) and |
96 | * the update definition. Defaults to aggregateGroup(). Override to increase performance. | 96 | * the update definition. Defaults to aggregateGroup(). Override to increase performance. |
@@ -134,7 +134,7 @@ public abstract class IndexerBasedAggregatorNode extends StandardNode implements | |||
134 | collector.add(packResult(aggregateEntry.getKey(), aggregateEntry.getValue())); | 134 | collector.add(packResult(aggregateEntry.getKey(), aggregateEntry.getValue())); |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | @Override | 138 | @Override |
139 | public void pullIntoWithTimeline(final Map<Tuple, Timeline<Timestamp>> collector, final boolean flush) { | 139 | public void pullIntoWithTimeline(final Map<Tuple, Timeline<Timestamp>> collector, final boolean flush) { |
140 | // use all zero timestamps because this node cannot be used in recursive groups anyway | 140 | // use all zero timestamps because this node cannot be used in recursive groups anyway |
@@ -182,7 +182,7 @@ public abstract class IndexerBasedAggregatorNode extends StandardNode implements | |||
182 | Object aggregate = mainAggregates.get(signature); | 182 | Object aggregate = mainAggregates.get(signature); |
183 | return aggregate == null ? aggregateGroup(signature, null) : aggregate; | 183 | return aggregate == null ? aggregateGroup(signature, null) : aggregate; |
184 | } | 184 | } |
185 | 185 | ||
186 | @Override | 186 | @Override |
187 | public void assignTraceInfo(TraceInfo traceInfo) { | 187 | public void assignTraceInfo(TraceInfo traceInfo) { |
188 | super.assignTraceInfo(traceInfo); | 188 | super.assignTraceInfo(traceInfo); |
@@ -193,7 +193,7 @@ public abstract class IndexerBasedAggregatorNode extends StandardNode implements | |||
193 | /** | 193 | /** |
194 | * A special non-iterable index that retrieves the aggregated, packed result (signature+aggregate) for the original | 194 | * A special non-iterable index that retrieves the aggregated, packed result (signature+aggregate) for the original |
195 | * signature. | 195 | * signature. |
196 | * | 196 | * |
197 | * @author Gabor Bergmann | 197 | * @author Gabor Bergmann |
198 | */ | 198 | */ |
199 | class AggregatorOuterIndexer extends StandardIndexer { | 199 | class AggregatorOuterIndexer extends StandardIndexer { |
@@ -224,7 +224,7 @@ public abstract class IndexerBasedAggregatorNode extends StandardNode implements | |||
224 | * A special non-iterable index that checks a suspected aggregate value for a given signature. The signature for | 224 | * A special non-iterable index that checks a suspected aggregate value for a given signature. The signature for |
225 | * this index is the original signature of the projection index, with the suspected result inserted at position | 225 | * this index is the original signature of the projection index, with the suspected result inserted at position |
226 | * resultPositionInSignature. | 226 | * resultPositionInSignature. |
227 | * | 227 | * |
228 | * @author Gabor Bergmann | 228 | * @author Gabor Bergmann |
229 | */ | 229 | */ |
230 | 230 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FaithfulParallelTimelyColumnAggregatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FaithfulParallelTimelyColumnAggregatorNode.java index 19e02f10..13cd9662 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FaithfulParallelTimelyColumnAggregatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FaithfulParallelTimelyColumnAggregatorNode.java | |||
@@ -6,18 +6,18 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.aggregation.timely; | 9 | package tools.refinery.interpreter.rete.aggregation.timely; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 11 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 12 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
13 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 13 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
14 | import tools.refinery.viatra.runtime.matchers.util.*; | 14 | import tools.refinery.interpreter.matchers.util.*; |
15 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 15 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
16 | import tools.refinery.viatra.runtime.rete.aggregation.timely.FaithfulParallelTimelyColumnAggregatorNode.CumulativeAggregate; | 16 | import tools.refinery.interpreter.rete.aggregation.timely.FaithfulParallelTimelyColumnAggregatorNode.CumulativeAggregate; |
17 | import tools.refinery.viatra.runtime.rete.aggregation.timely.FaithfulParallelTimelyColumnAggregatorNode.FoldingState; | 17 | import tools.refinery.interpreter.rete.aggregation.timely.FaithfulParallelTimelyColumnAggregatorNode.FoldingState; |
18 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 18 | import tools.refinery.interpreter.rete.network.ReteContainer; |
19 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 19 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
20 | import tools.refinery.viatra.runtime.rete.network.communication.timely.ResumableNode; | 20 | import tools.refinery.interpreter.rete.network.communication.timely.ResumableNode; |
21 | 21 | ||
22 | import java.util.Collections; | 22 | import java.util.Collections; |
23 | import java.util.Map; | 23 | import java.util.Map; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FaithfulSequentialTimelyColumnAggregatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FaithfulSequentialTimelyColumnAggregatorNode.java index cf2c2b2d..72e52f7e 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FaithfulSequentialTimelyColumnAggregatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FaithfulSequentialTimelyColumnAggregatorNode.java | |||
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.aggregation.timely; | 9 | package tools.refinery.interpreter.rete.aggregation.timely; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Map; | 12 | import java.util.Map; |
@@ -14,20 +14,20 @@ import java.util.Map.Entry; | |||
14 | import java.util.Objects; | 14 | import java.util.Objects; |
15 | import java.util.TreeMap; | 15 | import java.util.TreeMap; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 17 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 19 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
20 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 20 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
21 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 21 | import tools.refinery.interpreter.matchers.util.Direction; |
22 | import tools.refinery.viatra.runtime.matchers.util.IDeltaBag; | 22 | import tools.refinery.interpreter.matchers.util.IDeltaBag; |
23 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 23 | import tools.refinery.interpreter.matchers.util.Preconditions; |
24 | import tools.refinery.viatra.runtime.matchers.util.Signed; | 24 | import tools.refinery.interpreter.matchers.util.Signed; |
25 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 25 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
26 | import tools.refinery.viatra.runtime.rete.aggregation.timely.FaithfulSequentialTimelyColumnAggregatorNode.CumulativeAggregate; | 26 | import tools.refinery.interpreter.rete.aggregation.timely.FaithfulSequentialTimelyColumnAggregatorNode.CumulativeAggregate; |
27 | import tools.refinery.viatra.runtime.rete.aggregation.timely.FaithfulSequentialTimelyColumnAggregatorNode.FoldingState; | 27 | import tools.refinery.interpreter.rete.aggregation.timely.FaithfulSequentialTimelyColumnAggregatorNode.FoldingState; |
28 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 28 | import tools.refinery.interpreter.rete.network.ReteContainer; |
29 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 29 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
30 | import tools.refinery.viatra.runtime.rete.network.communication.timely.ResumableNode; | 30 | import tools.refinery.interpreter.rete.network.communication.timely.ResumableNode; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Faithful column aggregator with sequential aggregation architecture. | 33 | * Faithful column aggregator with sequential aggregation architecture. |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FaithfulTimelyColumnAggregatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FaithfulTimelyColumnAggregatorNode.java index 8fe9a4e9..89486f7d 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FaithfulTimelyColumnAggregatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FaithfulTimelyColumnAggregatorNode.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.aggregation.timely; | 9 | package tools.refinery.interpreter.rete.aggregation.timely; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Map; | 12 | import java.util.Map; |
@@ -14,23 +14,23 @@ import java.util.Map.Entry; | |||
14 | import java.util.Objects; | 14 | import java.util.Objects; |
15 | import java.util.TreeMap; | 15 | import java.util.TreeMap; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 17 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 19 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
20 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 20 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
21 | import tools.refinery.viatra.runtime.matchers.util.Signed; | 21 | import tools.refinery.interpreter.matchers.util.Signed; |
22 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 22 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
23 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 23 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
24 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timelines; | 24 | import tools.refinery.interpreter.matchers.util.timeline.Timelines; |
25 | import tools.refinery.viatra.runtime.rete.aggregation.AbstractColumnAggregatorNode; | 25 | import tools.refinery.interpreter.rete.aggregation.AbstractColumnAggregatorNode; |
26 | import tools.refinery.viatra.runtime.rete.aggregation.GroupedMap; | 26 | import tools.refinery.interpreter.rete.aggregation.GroupedMap; |
27 | import tools.refinery.viatra.runtime.rete.aggregation.timely.FaithfulTimelyColumnAggregatorNode.MergeableFoldingState; | 27 | import tools.refinery.interpreter.rete.aggregation.timely.FaithfulTimelyColumnAggregatorNode.MergeableFoldingState; |
28 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 28 | import tools.refinery.interpreter.rete.network.ReteContainer; |
29 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 29 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
30 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 30 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
31 | import tools.refinery.viatra.runtime.rete.network.communication.timely.ResumableNode; | 31 | import tools.refinery.interpreter.rete.network.communication.timely.ResumableNode; |
32 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 32 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
33 | import tools.refinery.viatra.runtime.rete.network.mailbox.timely.TimelyMailbox; | 33 | import tools.refinery.interpreter.rete.network.mailbox.timely.TimelyMailbox; |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Faithful timely implementation of the column aggregator node. Complete timelines (series of appearance & | 36 | * Faithful timely implementation of the column aggregator node. Complete timelines (series of appearance & |
@@ -40,7 +40,7 @@ import tools.refinery.viatra.runtime.rete.network.mailbox.timely.TimelyMailbox; | |||
40 | * type parameter for that. <br> | 40 | * type parameter for that. <br> |
41 | * <br> | 41 | * <br> |
42 | * This node supports recursive aggregation. | 42 | * This node supports recursive aggregation. |
43 | * | 43 | * |
44 | * @author Tamas Szabo | 44 | * @author Tamas Szabo |
45 | * @since 2.4 | 45 | * @since 2.4 |
46 | */ | 46 | */ |
@@ -81,8 +81,8 @@ public abstract class FaithfulTimelyColumnAggregatorNode<Domain, Accumulator, Ag | |||
81 | /** | 81 | /** |
82 | * Registers the given folding state for the specified timestamp and tuple. If there is already a state stored, the | 82 | * Registers the given folding state for the specified timestamp and tuple. If there is already a state stored, the |
83 | * two states will be merged together. | 83 | * two states will be merged together. |
84 | * | 84 | * |
85 | * | 85 | * |
86 | */ | 86 | */ |
87 | protected void addFoldingState(final Tuple group, final FoldingState state, final Timestamp timestamp) { | 87 | protected void addFoldingState(final Tuple group, final FoldingState state, final Timestamp timestamp) { |
88 | // assert !state.delta.isEmpty(); | 88 | // assert !state.delta.isEmpty(); |
@@ -244,4 +244,4 @@ public abstract class FaithfulTimelyColumnAggregatorNode<Domain, Accumulator, Ag | |||
244 | 244 | ||
245 | } | 245 | } |
246 | 246 | ||
247 | } \ No newline at end of file | 247 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FirstOnlyParallelTimelyColumnAggregatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FirstOnlyParallelTimelyColumnAggregatorNode.java index 733d2585..9f5c55eb 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FirstOnlyParallelTimelyColumnAggregatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FirstOnlyParallelTimelyColumnAggregatorNode.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.aggregation.timely; | 9 | package tools.refinery.interpreter.rete.aggregation.timely; |
10 | 10 | ||
11 | import java.util.Map.Entry; | 11 | import java.util.Map.Entry; |
12 | import java.util.TreeMap; | 12 | import java.util.TreeMap; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 14 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 16 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
17 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 17 | import tools.refinery.interpreter.matchers.util.Direction; |
18 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 18 | import tools.refinery.interpreter.rete.network.ReteContainer; |
19 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 19 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * First-only column aggregator with parallel aggregation architecture. | 22 | * First-only column aggregator with parallel aggregation architecture. |
23 | * | 23 | * |
24 | * @author Tamas Szabo | 24 | * @author Tamas Szabo |
25 | * @since 2.4 | 25 | * @since 2.4 |
26 | */ | 26 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FirstOnlySequentialTimelyColumnAggregatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FirstOnlySequentialTimelyColumnAggregatorNode.java index 79197aac..c90115c9 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FirstOnlySequentialTimelyColumnAggregatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FirstOnlySequentialTimelyColumnAggregatorNode.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.aggregation.timely; | 9 | package tools.refinery.interpreter.rete.aggregation.timely; |
10 | 10 | ||
11 | import java.util.Objects; | 11 | import java.util.Objects; |
12 | import java.util.TreeMap; | 12 | import java.util.TreeMap; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 14 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 16 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
17 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 17 | import tools.refinery.interpreter.matchers.util.Direction; |
18 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 18 | import tools.refinery.interpreter.rete.network.ReteContainer; |
19 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 19 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * First-only column aggregator with sequential aggregation architecture. | 22 | * First-only column aggregator with sequential aggregation architecture. |
23 | * | 23 | * |
24 | * @author Tamas Szabo | 24 | * @author Tamas Szabo |
25 | * @since 2.4 | 25 | * @since 2.4 |
26 | */ | 26 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FirstOnlyTimelyColumnAggregatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FirstOnlyTimelyColumnAggregatorNode.java index 0c73000e..da076681 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/aggregation/timely/FirstOnlyTimelyColumnAggregatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/aggregation/timely/FirstOnlyTimelyColumnAggregatorNode.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.aggregation.timely; | 9 | package tools.refinery.interpreter.rete.aggregation.timely; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -15,28 +15,28 @@ import java.util.Map.Entry; | |||
15 | import java.util.Objects; | 15 | import java.util.Objects; |
16 | import java.util.TreeMap; | 16 | import java.util.TreeMap; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 18 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 19 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
20 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 20 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
21 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 21 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
22 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 22 | import tools.refinery.interpreter.matchers.util.Direction; |
23 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 23 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
24 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timelines; | 24 | import tools.refinery.interpreter.matchers.util.timeline.Timelines; |
25 | import tools.refinery.viatra.runtime.rete.aggregation.AbstractColumnAggregatorNode; | 25 | import tools.refinery.interpreter.rete.aggregation.AbstractColumnAggregatorNode; |
26 | import tools.refinery.viatra.runtime.rete.aggregation.GroupedMap; | 26 | import tools.refinery.interpreter.rete.aggregation.GroupedMap; |
27 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 27 | import tools.refinery.interpreter.rete.network.ReteContainer; |
28 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 28 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
29 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 29 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
30 | import tools.refinery.viatra.runtime.rete.network.mailbox.timely.TimelyMailbox; | 30 | import tools.refinery.interpreter.rete.network.mailbox.timely.TimelyMailbox; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * First-only timely implementation of the column aggregator node. Only timestamps of appearance are maintained for | 33 | * First-only timely implementation of the column aggregator node. Only timestamps of appearance are maintained for |
34 | * tuples instead of complete timelines. | 34 | * tuples instead of complete timelines. |
35 | * <br><br> | 35 | * <br><br> |
36 | * Subclasses are responsible for implementing the aggregator architecture, and they must make use of the inner class {@link CumulativeAggregate}. | 36 | * Subclasses are responsible for implementing the aggregator architecture, and they must make use of the inner class {@link CumulativeAggregate}. |
37 | * <br><br> | 37 | * <br><br> |
38 | * This node supports recursive aggregation. | 38 | * This node supports recursive aggregation. |
39 | * | 39 | * |
40 | * @author Tamas Szabo | 40 | * @author Tamas Szabo |
41 | * @since 2.4 | 41 | * @since 2.4 |
42 | */ | 42 | */ |
@@ -119,10 +119,10 @@ public abstract class FirstOnlyTimelyColumnAggregatorNode<Domain, Accumulator, A | |||
119 | } | 119 | } |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * Returns the aggregation architecture-specific accumulator at the specified timestamp for the given group. | 122 | * Returns the aggregation architecture-specific accumulator at the specified timestamp for the given group. |
123 | */ | 123 | */ |
124 | protected abstract Accumulator getAccumulator(final Tuple group, final Timestamp timestamp); | 124 | protected abstract Accumulator getAccumulator(final Tuple group, final Timestamp timestamp); |
125 | 125 | ||
126 | protected AggregateResult getResultRaw(final Tuple group, final Timestamp timestamp, final boolean lower) { | 126 | protected AggregateResult getResultRaw(final Tuple group, final Timestamp timestamp, final boolean lower) { |
127 | final TreeMap<Timestamp, CumulativeAggregate<Accumulator, AggregateResult>> entryMap = this.memory.get(group); | 127 | final TreeMap<Timestamp, CumulativeAggregate<Accumulator, AggregateResult>> entryMap = this.memory.get(group); |
128 | if (entryMap == null) { | 128 | if (entryMap == null) { |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/Disconnectable.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/Disconnectable.java index 7bbf74ea..9e9992f8 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/Disconnectable.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/Disconnectable.java | |||
@@ -3,17 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.boundary; | 10 | package tools.refinery.interpreter.rete.boundary; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * For objects that connect a RETE implementation to the underlying model. | 13 | * For objects that connect a RETE implementation to the underlying model. |
14 | * | 14 | * |
15 | * @author Gabor Bergmann | 15 | * @author Gabor Bergmann |
16 | * | 16 | * |
17 | */ | 17 | */ |
18 | public interface Disconnectable { | 18 | public interface Disconnectable { |
19 | 19 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/ExternalInputEnumeratorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/ExternalInputEnumeratorNode.java index 51f89b52..6ea60ac3 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/ExternalInputEnumeratorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/ExternalInputEnumeratorNode.java | |||
@@ -3,43 +3,43 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.boundary; | 9 | package tools.refinery.interpreter.rete.boundary; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 15 | import tools.refinery.interpreter.matchers.context.IInputKey; |
16 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 16 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
17 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 17 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
18 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContextListener; | 18 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContextListener; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 19 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
20 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 20 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
21 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
22 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 22 | import tools.refinery.interpreter.matchers.util.Direction; |
23 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 23 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
24 | import tools.refinery.viatra.runtime.rete.matcher.ReteEngine; | 24 | import tools.refinery.interpreter.rete.matcher.ReteEngine; |
25 | import tools.refinery.viatra.runtime.rete.network.Network; | 25 | import tools.refinery.interpreter.rete.network.Network; |
26 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 26 | import tools.refinery.interpreter.rete.network.Receiver; |
27 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 27 | import tools.refinery.interpreter.rete.network.ReteContainer; |
28 | import tools.refinery.viatra.runtime.rete.network.StandardNode; | 28 | import tools.refinery.interpreter.rete.network.StandardNode; |
29 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 29 | import tools.refinery.interpreter.rete.network.Supplier; |
30 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 30 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
31 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 31 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
32 | import tools.refinery.viatra.runtime.rete.network.mailbox.timeless.BehaviorChangingMailbox; | 32 | import tools.refinery.interpreter.rete.network.mailbox.timeless.BehaviorChangingMailbox; |
33 | import tools.refinery.viatra.runtime.rete.network.mailbox.timely.TimelyMailbox; | 33 | import tools.refinery.interpreter.rete.network.mailbox.timely.TimelyMailbox; |
34 | import tools.refinery.viatra.runtime.rete.remote.Address; | 34 | import tools.refinery.interpreter.rete.remote.Address; |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * An input node representing an enumerable extensional input relation and receiving external updates. | 37 | * An input node representing an enumerable extensional input relation and receiving external updates. |
38 | * | 38 | * |
39 | * <p> | 39 | * <p> |
40 | * Contains those tuples that are in the extensional relation identified by the input key, and also conform to the | 40 | * Contains those tuples that are in the extensional relation identified by the input key, and also conform to the |
41 | * global seed (if any). | 41 | * global seed (if any). |
42 | * | 42 | * |
43 | * @author Bergmann Gabor | 43 | * @author Bergmann Gabor |
44 | * | 44 | * |
45 | */ | 45 | */ |
@@ -72,7 +72,7 @@ public class ExternalInputEnumeratorNode extends StandardNode | |||
72 | /** | 72 | /** |
73 | * Instantiates the {@link Mailbox} of this receiver. Subclasses may override this method to provide their own | 73 | * Instantiates the {@link Mailbox} of this receiver. Subclasses may override this method to provide their own |
74 | * mailbox implementation. | 74 | * mailbox implementation. |
75 | * | 75 | * |
76 | * @return the mailbox | 76 | * @return the mailbox |
77 | * @since 2.0 | 77 | * @since 2.0 |
78 | */ | 78 | */ |
@@ -119,7 +119,7 @@ public class ExternalInputEnumeratorNode extends StandardNode | |||
119 | */ | 119 | */ |
120 | protected Iterable<Tuple> getTuplesInternal() { | 120 | protected Iterable<Tuple> getTuplesInternal() { |
121 | Iterable<Tuple> tuples = null; | 121 | Iterable<Tuple> tuples = null; |
122 | 122 | ||
123 | if (context != null) { // if connected | 123 | if (context != null) { // if connected |
124 | if (globalSeed == null) { | 124 | if (globalSeed == null) { |
125 | tuples = context.enumerateTuples(inputKey, TupleMask.empty(inputKey.getArity()), | 125 | tuples = context.enumerateTuples(inputKey, TupleMask.empty(inputKey.getArity()), |
@@ -129,7 +129,7 @@ public class ExternalInputEnumeratorNode extends StandardNode | |||
129 | tuples = context.enumerateTuples(inputKey, mask, mask.transform(globalSeed)); | 129 | tuples = context.enumerateTuples(inputKey, mask, mask.transform(globalSeed)); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | return tuples; | 133 | return tuples; |
134 | } | 134 | } |
135 | 135 | ||
@@ -139,7 +139,7 @@ public class ExternalInputEnumeratorNode extends StandardNode | |||
139 | if (tuples != null) { | 139 | if (tuples != null) { |
140 | for (final Tuple tuple : tuples) { | 140 | for (final Tuple tuple : tuples) { |
141 | collector.add(tuple); | 141 | collector.add(tuple); |
142 | } | 142 | } |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
@@ -149,7 +149,7 @@ public class ExternalInputEnumeratorNode extends StandardNode | |||
149 | if (tuples != null) { | 149 | if (tuples != null) { |
150 | for (final Tuple tuple : tuples) { | 150 | for (final Tuple tuple : tuples) { |
151 | collector.put(tuple, Timestamp.INSERT_AT_ZERO_TIMELINE); | 151 | collector.put(tuple, Timestamp.INSERT_AT_ZERO_TIMELINE); |
152 | } | 152 | } |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
@@ -167,7 +167,7 @@ public class ExternalInputEnumeratorNode extends StandardNode | |||
167 | // just propagate the input | 167 | // just propagate the input |
168 | update(direction(isInsertion), update, Timestamp.ZERO); | 168 | update(direction(isInsertion), update, Timestamp.ZERO); |
169 | } | 169 | } |
170 | // if the the update method is called from within a delayed execution, | 170 | // if the the update method is called from within a delayed execution, |
171 | // the following invocation will be a no-op | 171 | // the following invocation will be a no-op |
172 | network.waitForReteTermination(); | 172 | network.waitForReteTermination(); |
173 | } | 173 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/ExternalInputStatelessFilterNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/ExternalInputStatelessFilterNode.java index 57e06911..32054481 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/ExternalInputStatelessFilterNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/ExternalInputStatelessFilterNode.java | |||
@@ -3,29 +3,29 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.boundary; | 9 | package tools.refinery.interpreter.rete.boundary; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 11 | import tools.refinery.interpreter.matchers.context.IInputKey; |
12 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 12 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
13 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 13 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
14 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 14 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
15 | import tools.refinery.viatra.runtime.rete.matcher.ReteEngine; | 15 | import tools.refinery.interpreter.rete.matcher.ReteEngine; |
16 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 16 | import tools.refinery.interpreter.rete.network.ReteContainer; |
17 | import tools.refinery.viatra.runtime.rete.single.FilterNode; | 17 | import tools.refinery.interpreter.rete.single.FilterNode; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * A filter node representing a (stateless, typically non-enumerable) extensional input relation. | 20 | * A filter node representing a (stateless, typically non-enumerable) extensional input relation. |
21 | * | 21 | * |
22 | * <p> Contains those tuples of its parents, that (when transformed by a mask, if given) are present in the extensional relation identified by the input key. | 22 | * <p> Contains those tuples of its parents, that (when transformed by a mask, if given) are present in the extensional relation identified by the input key. |
23 | * | 23 | * |
24 | * @author Bergmann Gabor | 24 | * @author Bergmann Gabor |
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | public class ExternalInputStatelessFilterNode extends FilterNode implements Disconnectable { | 27 | public class ExternalInputStatelessFilterNode extends FilterNode implements Disconnectable { |
28 | 28 | ||
29 | IQueryRuntimeContext context = null; | 29 | IQueryRuntimeContext context = null; |
30 | IInputKey inputKey; | 30 | IInputKey inputKey; |
31 | private InputConnector inputConnector; | 31 | private InputConnector inputConnector; |
@@ -36,31 +36,31 @@ public class ExternalInputStatelessFilterNode extends FilterNode implements Disc | |||
36 | this.mask = mask; | 36 | this.mask = mask; |
37 | this.inputConnector = reteContainer.getNetwork().getInputConnector(); | 37 | this.inputConnector = reteContainer.getNetwork().getInputConnector(); |
38 | } | 38 | } |
39 | 39 | ||
40 | @Override | 40 | @Override |
41 | public boolean check(Tuple ps) { | 41 | public boolean check(Tuple ps) { |
42 | if (mask != null) | 42 | if (mask != null) |
43 | ps = mask.transform(ps); | 43 | ps = mask.transform(ps); |
44 | return context.containsTuple(inputKey, ps); | 44 | return context.containsTuple(inputKey, ps); |
45 | } | 45 | } |
46 | 46 | ||
47 | 47 | ||
48 | public void connectThroughContext(ReteEngine engine, IInputKey inputKey) { | 48 | public void connectThroughContext(ReteEngine engine, IInputKey inputKey) { |
49 | this.inputKey = inputKey; | 49 | this.inputKey = inputKey; |
50 | setTag(inputKey); | 50 | setTag(inputKey); |
51 | 51 | ||
52 | final IQueryRuntimeContext context = engine.getRuntimeContext(); | 52 | final IQueryRuntimeContext context = engine.getRuntimeContext(); |
53 | if (!context.getMetaContext().isStateless(inputKey)) | 53 | if (!context.getMetaContext().isStateless(inputKey)) |
54 | throw new IllegalArgumentException( | 54 | throw new IllegalArgumentException( |
55 | this.getClass().getSimpleName() + | 55 | this.getClass().getSimpleName() + |
56 | " only applicable for stateless input keys; received instead " + | 56 | " only applicable for stateless input keys; received instead " + |
57 | inputKey); | 57 | inputKey); |
58 | 58 | ||
59 | this.context = context; | 59 | this.context = context; |
60 | 60 | ||
61 | engine.addDisconnectable(this); | 61 | engine.addDisconnectable(this); |
62 | } | 62 | } |
63 | 63 | ||
64 | @Override | 64 | @Override |
65 | public void disconnect() { | 65 | public void disconnect() { |
66 | this.context = null; | 66 | this.context = null; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/InputConnector.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/InputConnector.java index c044850f..3aeaf9ec 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/InputConnector.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/InputConnector.java | |||
@@ -3,37 +3,37 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.boundary; | 9 | package tools.refinery.interpreter.rete.boundary; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.stream.Stream; | 14 | import java.util.stream.Stream; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 16 | import tools.refinery.interpreter.matchers.context.IInputKey; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
19 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 19 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
20 | import tools.refinery.viatra.runtime.rete.network.Network; | 20 | import tools.refinery.interpreter.rete.network.Network; |
21 | import tools.refinery.viatra.runtime.rete.network.Node; | 21 | import tools.refinery.interpreter.rete.network.Node; |
22 | import tools.refinery.viatra.runtime.rete.recipes.InputFilterRecipe; | 22 | import tools.refinery.interpreter.rete.recipes.InputFilterRecipe; |
23 | import tools.refinery.viatra.runtime.rete.recipes.InputRecipe; | 23 | import tools.refinery.interpreter.rete.recipes.InputRecipe; |
24 | import tools.refinery.viatra.runtime.rete.remote.Address; | 24 | import tools.refinery.interpreter.rete.remote.Address; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * A class responsible for connecting input nodes to the runtime context. | 27 | * A class responsible for connecting input nodes to the runtime context. |
28 | * | 28 | * |
29 | * @author Bergmann Gabor | 29 | * @author Bergmann Gabor |
30 | * | 30 | * |
31 | */ | 31 | */ |
32 | public final class InputConnector { | 32 | public final class InputConnector { |
33 | Network network; | 33 | Network network; |
34 | 34 | ||
35 | private Map<IInputKey, Map<Tuple, Address<ExternalInputEnumeratorNode>>> externalInputRoots = CollectionsFactory.createMap(); | 35 | private Map<IInputKey, Map<Tuple, Address<ExternalInputEnumeratorNode>>> externalInputRoots = CollectionsFactory.createMap(); |
36 | 36 | ||
37 | // /* | 37 | // /* |
38 | // * arity:1 used as simple entity constraints label is the object representing the type null label means all entities | 38 | // * arity:1 used as simple entity constraints label is the object representing the type null label means all entities |
39 | // * regardless of type (global supertype), if allowed | 39 | // * regardless of type (global supertype), if allowed |
@@ -49,20 +49,20 @@ public final class InputConnector { | |||
49 | // * the type null label means all entities regardless of type if allowed (global supertype), if allowed | 49 | // * the type null label means all entities regardless of type if allowed (global supertype), if allowed |
50 | // */ | 50 | // */ |
51 | // protected Map<Object, Address<? extends Tunnel>> binaryEdgeRoots = CollectionsFactory.getMap(); | 51 | // protected Map<Object, Address<? extends Tunnel>> binaryEdgeRoots = CollectionsFactory.getMap(); |
52 | // | 52 | // |
53 | // protected Address<? extends Tunnel> containmentRoot = null; | 53 | // protected Address<? extends Tunnel> containmentRoot = null; |
54 | // protected Address<? extends Supplier> containmentTransitiveRoot = null; | 54 | // protected Address<? extends Supplier> containmentTransitiveRoot = null; |
55 | // protected Address<? extends Tunnel> instantiationRoot = null; | 55 | // protected Address<? extends Tunnel> instantiationRoot = null; |
56 | // protected Address<? extends Supplier> instantiationTransitiveRoot = null; | 56 | // protected Address<? extends Supplier> instantiationTransitiveRoot = null; |
57 | // protected Address<? extends Tunnel> generalizationRoot = null; | 57 | // protected Address<? extends Tunnel> generalizationRoot = null; |
58 | // protected Address<? extends Supplier> generalizationTransitiveRoot = null; | 58 | // protected Address<? extends Supplier> generalizationTransitiveRoot = null; |
59 | 59 | ||
60 | 60 | ||
61 | public InputConnector(Network network) { | 61 | public InputConnector(Network network) { |
62 | super(); | 62 | super(); |
63 | this.network = network; | 63 | this.network = network; |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | ||
67 | public Network getNetwork() { | 67 | public Network getNetwork() { |
68 | return network; | 68 | return network; |
@@ -74,7 +74,7 @@ public final class InputConnector { | |||
74 | */ | 74 | */ |
75 | public void connectInputFilter(InputFilterRecipe recipe, Node freshNode) { | 75 | public void connectInputFilter(InputFilterRecipe recipe, Node freshNode) { |
76 | final ExternalInputStatelessFilterNode inputNode = (ExternalInputStatelessFilterNode)freshNode; | 76 | final ExternalInputStatelessFilterNode inputNode = (ExternalInputStatelessFilterNode)freshNode; |
77 | 77 | ||
78 | IInputKey inputKey = (IInputKey) recipe.getInputKey(); | 78 | IInputKey inputKey = (IInputKey) recipe.getInputKey(); |
79 | inputNode.connectThroughContext(network.getEngine(), inputKey); | 79 | inputNode.connectThroughContext(network.getEngine(), inputKey); |
80 | } | 80 | } |
@@ -85,23 +85,23 @@ public final class InputConnector { | |||
85 | */ | 85 | */ |
86 | public void connectInput(InputRecipe recipe, Node freshNode) { | 86 | public void connectInput(InputRecipe recipe, Node freshNode) { |
87 | final ExternalInputEnumeratorNode inputNode = (ExternalInputEnumeratorNode)freshNode; | 87 | final ExternalInputEnumeratorNode inputNode = (ExternalInputEnumeratorNode)freshNode; |
88 | 88 | ||
89 | IInputKey inputKey = (IInputKey) recipe.getInputKey(); | 89 | IInputKey inputKey = (IInputKey) recipe.getInputKey(); |
90 | Tuple seed = nopSeed(inputKey); // no preseeding as of now | 90 | Tuple seed = nopSeed(inputKey); // no preseeding as of now |
91 | final Address<ExternalInputEnumeratorNode> freshAddress = Address.of(inputNode); | 91 | final Address<ExternalInputEnumeratorNode> freshAddress = Address.of(inputNode); |
92 | externalInputRoots.computeIfAbsent(inputKey, k -> CollectionsFactory.createMap()).put(seed, freshAddress); | 92 | externalInputRoots.computeIfAbsent(inputKey, k -> CollectionsFactory.createMap()).put(seed, freshAddress); |
93 | inputNode.connectThroughContext(network.getEngine(), inputKey, seed); | 93 | inputNode.connectThroughContext(network.getEngine(), inputKey, seed); |
94 | 94 | ||
95 | // final Address<Tunnel> freshAddress = Address.of((Tunnel)freshNode); | 95 | // final Address<Tunnel> freshAddress = Address.of((Tunnel)freshNode); |
96 | // if (recipe instanceof TypeInputRecipe) { | 96 | // if (recipe instanceof TypeInputRecipe) { |
97 | // final Object typeKey = ((TypeInputRecipe) recipe).getTypeKey(); | 97 | // final Object typeKey = ((TypeInputRecipe) recipe).getTypeKey(); |
98 | // | 98 | // |
99 | // if (recipe instanceof UnaryInputRecipe) { | 99 | // if (recipe instanceof UnaryInputRecipe) { |
100 | // unaryRoots.put(typeKey, freshAddress); | 100 | // unaryRoots.put(typeKey, freshAddress); |
101 | // new EntityFeeder(freshAddress, this, typeKey).feed(); | 101 | // new EntityFeeder(freshAddress, this, typeKey).feed(); |
102 | //// if (typeObject != null && generalizationQueryDirection == GeneralizationQueryDirection.BOTH) { | 102 | //// if (typeObject != null && generalizationQueryDirection == GeneralizationQueryDirection.BOTH) { |
103 | //// Collection<? extends Object> subTypes = context.enumerateDirectUnarySubtypes(typeObject); | 103 | //// Collection<? extends Object> subTypes = context.enumerateDirectUnarySubtypes(typeObject); |
104 | //// | 104 | //// |
105 | //// for (Object subType : subTypes) { | 105 | //// for (Object subType : subTypes) { |
106 | //// Address<? extends Tunnel> subRoot = accessUnaryRoot(subType); | 106 | //// Address<? extends Tunnel> subRoot = accessUnaryRoot(subType); |
107 | //// network.connectRemoteNodes(subRoot, tn, true); | 107 | //// network.connectRemoteNodes(subRoot, tn, true); |
@@ -120,12 +120,12 @@ public final class InputConnector { | |||
120 | // // } | 120 | // // } |
121 | // // } | 121 | // // } |
122 | // } | 122 | // } |
123 | // | 123 | // |
124 | // | 124 | // |
125 | // } | 125 | // } |
126 | 126 | ||
127 | } | 127 | } |
128 | 128 | ||
129 | // /** | 129 | // /** |
130 | // * fetches the entity Root node under specified label; returns null if it doesn't exist yet | 130 | // * fetches the entity Root node under specified label; returns null if it doesn't exist yet |
131 | // */ | 131 | // */ |
@@ -147,7 +147,7 @@ public final class InputConnector { | |||
147 | // public Collection<Address<? extends Tunnel>> getAllTernaryEdgeRoots() { | 147 | // public Collection<Address<? extends Tunnel>> getAllTernaryEdgeRoots() { |
148 | // return ternaryEdgeRoots.values(); | 148 | // return ternaryEdgeRoots.values(); |
149 | // } | 149 | // } |
150 | // | 150 | // |
151 | // /** | 151 | // /** |
152 | // * fetches the reference Root node under specified label; returns null if it doesn't exist yet | 152 | // * fetches the reference Root node under specified label; returns null if it doesn't exist yet |
153 | // */ | 153 | // */ |
@@ -184,7 +184,7 @@ public final class InputConnector { | |||
184 | // return generalizationRoot; | 184 | // return generalizationRoot; |
185 | // } | 185 | // } |
186 | 186 | ||
187 | 187 | ||
188 | public Stream<Address<ExternalInputEnumeratorNode>> getAllExternalInputNodes() { | 188 | public Stream<Address<ExternalInputEnumeratorNode>> getAllExternalInputNodes() { |
189 | return externalInputRoots.values().stream().flatMap(map -> map.values().stream()); | 189 | return externalInputRoots.values().stream().flatMap(map -> map.values().stream()); |
190 | } | 190 | } |
@@ -203,6 +203,6 @@ public final class InputConnector { | |||
203 | Tuple nopSeed(IInputKey inputKey) { | 203 | Tuple nopSeed(IInputKey inputKey) { |
204 | return Tuples.flatTupleOf(new Object[inputKey.getArity()]); | 204 | return Tuples.flatTupleOf(new Object[inputKey.getArity()]); |
205 | } | 205 | } |
206 | 206 | ||
207 | 207 | ||
208 | } | 208 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/ReteBoundary.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/ReteBoundary.java index fe9c795e..6be2aaea 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/boundary/ReteBoundary.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/boundary/ReteBoundary.java | |||
@@ -3,38 +3,38 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.boundary; | 10 | package tools.refinery.interpreter.rete.boundary; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 16 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
17 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 17 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 18 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 19 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
20 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 20 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
21 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 21 | import tools.refinery.interpreter.matchers.util.Direction; |
22 | import tools.refinery.viatra.runtime.rete.matcher.ReteEngine; | 22 | import tools.refinery.interpreter.rete.matcher.ReteEngine; |
23 | import tools.refinery.viatra.runtime.rete.network.Network; | 23 | import tools.refinery.interpreter.rete.network.Network; |
24 | import tools.refinery.viatra.runtime.rete.network.ProductionNode; | 24 | import tools.refinery.interpreter.rete.network.ProductionNode; |
25 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 25 | import tools.refinery.interpreter.rete.network.Receiver; |
26 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 26 | import tools.refinery.interpreter.rete.network.ReteContainer; |
27 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 27 | import tools.refinery.interpreter.rete.network.Supplier; |
28 | import tools.refinery.viatra.runtime.rete.remote.Address; | 28 | import tools.refinery.interpreter.rete.remote.Address; |
29 | import tools.refinery.viatra.runtime.rete.traceability.CompiledQuery; | 29 | import tools.refinery.interpreter.rete.traceability.CompiledQuery; |
30 | import tools.refinery.viatra.runtime.rete.traceability.RecipeTraceInfo; | 30 | import tools.refinery.interpreter.rete.traceability.RecipeTraceInfo; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Responsible for the storage, maintenance and communication of the nodes of the network that are accessible form the | 33 | * Responsible for the storage, maintenance and communication of the nodes of the network that are accessible form the |
34 | * outside for various reasons. | 34 | * outside for various reasons. |
35 | * | 35 | * |
36 | * @author Gabor Bergmann | 36 | * @author Gabor Bergmann |
37 | * | 37 | * |
38 | * <p> TODO: should eventually be merged into {@link InputConnector} and deleted | 38 | * <p> TODO: should eventually be merged into {@link InputConnector} and deleted |
39 | * | 39 | * |
40 | */ | 40 | */ |
@@ -340,9 +340,9 @@ public class ReteBoundary /*implements IPatternMatcherRuntimeContextListener*/ { | |||
340 | 340 | ||
341 | /** | 341 | /** |
342 | * accesses the production node for specified pattern; builds pattern matcher if it doesn't exist yet | 342 | * accesses the production node for specified pattern; builds pattern matcher if it doesn't exist yet |
343 | * @throws ViatraQueryRuntimeException | 343 | * @throws InterpreterRuntimeException |
344 | */ | 344 | */ |
345 | public synchronized RecipeTraceInfo accessProductionTrace(PQuery query) | 345 | public synchronized RecipeTraceInfo accessProductionTrace(PQuery query) |
346 | { | 346 | { |
347 | final CompiledQuery compiled = engine.getCompiler().getCompiledForm(query); | 347 | final CompiledQuery compiled = engine.getCompiler().getCompiledForm(query); |
348 | return compiled; | 348 | return compiled; |
@@ -362,7 +362,7 @@ public class ReteBoundary /*implements IPatternMatcherRuntimeContextListener*/ { | |||
362 | } | 362 | } |
363 | /** | 363 | /** |
364 | * accesses the production node for specified pattern; builds pattern matcher if it doesn't exist yet | 364 | * accesses the production node for specified pattern; builds pattern matcher if it doesn't exist yet |
365 | * @throws ViatraQueryRuntimeException | 365 | * @throws InterpreterRuntimeException |
366 | */ | 366 | */ |
367 | public synchronized Address<? extends ProductionNode> accessProductionNode(PQuery query) { | 367 | public synchronized Address<? extends ProductionNode> accessProductionNode(PQuery query) { |
368 | final RecipeTraceInfo productionTrace = accessProductionTrace(query); | 368 | final RecipeTraceInfo productionTrace = accessProductionTrace(query); |
@@ -451,11 +451,11 @@ public class ReteBoundary /*implements IPatternMatcherRuntimeContextListener*/ { | |||
451 | 451 | ||
452 | // updaters for change notification | 452 | // updaters for change notification |
453 | // if the corresponding rete input isn't created yet, call is ignored | 453 | // if the corresponding rete input isn't created yet, call is ignored |
454 | 454 | ||
455 | private static Direction direction(boolean isInsertion) { | 455 | private static Direction direction(boolean isInsertion) { |
456 | return isInsertion ? Direction.INSERT : Direction.DELETE; | 456 | return isInsertion ? Direction.INSERT : Direction.DELETE; |
457 | } | 457 | } |
458 | 458 | ||
459 | // @Override | 459 | // @Override |
460 | // public void updateUnary(boolean isInsertion, Object entity, Object typeObject) { | 460 | // public void updateUnary(boolean isInsertion, Object entity, Object typeObject) { |
461 | // Address<? extends Tunnel> root = inputConnector.getUnaryRoot(typeObject); | 461 | // Address<? extends Tunnel> root = inputConnector.getUnaryRoot(typeObject); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/RetePatternBuildException.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/RetePatternBuildException.java index bd1b219e..592a343f 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/RetePatternBuildException.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/RetePatternBuildException.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.construction; | 10 | package tools.refinery.interpreter.rete.construction; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.planning.QueryProcessingException; | 12 | import tools.refinery.interpreter.matchers.planning.QueryProcessingException; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * A problem has occurred during the construction of the RETE net. | 15 | * A problem has occurred during the construction of the RETE net. |
16 | * | 16 | * |
17 | * @author Gabor Bergmann | 17 | * @author Gabor Bergmann |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | public class RetePatternBuildException extends QueryProcessingException { | 20 | public class RetePatternBuildException extends QueryProcessingException { |
21 | 21 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/basiclinear/BasicLinearLayout.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/basiclinear/BasicLinearLayout.java index bd22e1a0..cfcc4ee0 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/basiclinear/BasicLinearLayout.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/basiclinear/BasicLinearLayout.java | |||
@@ -3,49 +3,49 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.construction.basiclinear; | 10 | package tools.refinery.interpreter.rete.construction.basiclinear; |
11 | 11 | ||
12 | import java.util.Arrays; | 12 | import java.util.Arrays; |
13 | import java.util.Collections; | 13 | import java.util.Collections; |
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import org.apache.log4j.Logger; | 16 | import org.apache.log4j.Logger; |
17 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendHintProvider; | 17 | import tools.refinery.interpreter.matchers.backend.IQueryBackendHintProvider; |
18 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 18 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
19 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 19 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
20 | import tools.refinery.viatra.runtime.matchers.planning.IQueryPlannerStrategy; | 20 | import tools.refinery.interpreter.matchers.planning.IQueryPlannerStrategy; |
21 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 21 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
22 | import tools.refinery.viatra.runtime.matchers.planning.SubPlanFactory; | 22 | import tools.refinery.interpreter.matchers.planning.SubPlanFactory; |
23 | import tools.refinery.viatra.runtime.matchers.planning.helpers.BuildHelper; | 23 | import tools.refinery.interpreter.matchers.planning.helpers.BuildHelper; |
24 | import tools.refinery.viatra.runtime.matchers.planning.operations.PApply; | 24 | import tools.refinery.interpreter.matchers.planning.operations.PApply; |
25 | import tools.refinery.viatra.runtime.matchers.planning.operations.PProject; | 25 | import tools.refinery.interpreter.matchers.planning.operations.PProject; |
26 | import tools.refinery.viatra.runtime.matchers.planning.operations.PStart; | 26 | import tools.refinery.interpreter.matchers.planning.operations.PStart; |
27 | import tools.refinery.viatra.runtime.matchers.psystem.DeferredPConstraint; | 27 | import tools.refinery.interpreter.matchers.psystem.DeferredPConstraint; |
28 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 28 | import tools.refinery.interpreter.matchers.psystem.PBody; |
29 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 29 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
30 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 30 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
31 | import tools.refinery.viatra.runtime.matchers.psystem.VariableDeferredPConstraint; | 31 | import tools.refinery.interpreter.matchers.psystem.VariableDeferredPConstraint; |
32 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.Equality; | 32 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.Equality; |
33 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 33 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExportedParameter; |
34 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | 34 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExpressionEvaluation; |
35 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 35 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
36 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 36 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
37 | import tools.refinery.viatra.runtime.rete.construction.RetePatternBuildException; | 37 | import tools.refinery.interpreter.rete.construction.RetePatternBuildException; |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Basic layout that builds a linear RETE net based on a heuristic ordering of constraints. | 40 | * Basic layout that builds a linear RETE net based on a heuristic ordering of constraints. |
41 | * | 41 | * |
42 | * @author Gabor Bergmann | 42 | * @author Gabor Bergmann |
43 | * | 43 | * |
44 | */ | 44 | */ |
45 | public class BasicLinearLayout implements IQueryPlannerStrategy { | 45 | public class BasicLinearLayout implements IQueryPlannerStrategy { |
46 | 46 | ||
47 | //SubPlanProcessor planProcessor = new SubPlanProcessor(); | 47 | //SubPlanProcessor planProcessor = new SubPlanProcessor(); |
48 | 48 | ||
49 | private IQueryBackendHintProvider hintProvider; | 49 | private IQueryBackendHintProvider hintProvider; |
50 | private IQueryBackendContext bContext; | 50 | private IQueryBackendContext bContext; |
51 | /** | 51 | /** |
@@ -65,7 +65,7 @@ public class BasicLinearLayout implements IQueryPlannerStrategy { | |||
65 | try { | 65 | try { |
66 | logger.debug(String.format( | 66 | logger.debug(String.format( |
67 | "%s: patternbody build started for %s", | 67 | "%s: patternbody build started for %s", |
68 | getClass().getSimpleName(), | 68 | getClass().getSimpleName(), |
69 | query.getFullyQualifiedName())); | 69 | query.getFullyQualifiedName())); |
70 | 70 | ||
71 | // STARTING THE LINE | 71 | // STARTING THE LINE |
@@ -87,21 +87,21 @@ public class BasicLinearLayout implements IQueryPlannerStrategy { | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | // TODO integrate the check above in SubPlan / POperation?? | 89 | // TODO integrate the check above in SubPlan / POperation?? |
90 | 90 | ||
91 | // replace incumbent plan with its child | 91 | // replace incumbent plan with its child |
92 | plan = planFactory.createSubPlan(new PApply(pConstraint), plan); | 92 | plan = planFactory.createSubPlan(new PApply(pConstraint), plan); |
93 | } | 93 | } |
94 | 94 | ||
95 | // PROJECT TO PARAMETERS | 95 | // PROJECT TO PARAMETERS |
96 | SubPlan finalPlan = planFactory.createSubPlan(new PProject(pSystem.getSymbolicParameterVariables()), plan); | 96 | SubPlan finalPlan = planFactory.createSubPlan(new PProject(pSystem.getSymbolicParameterVariables()), plan); |
97 | 97 | ||
98 | // FINAL CHECK, whether all exported variables are present + all constraint satisfied | 98 | // FINAL CHECK, whether all exported variables are present + all constraint satisfied |
99 | BuildHelper.finalCheck(pSystem, finalPlan, context); | 99 | BuildHelper.finalCheck(pSystem, finalPlan, context); |
100 | // TODO integrate the check above in SubPlan / POperation | 100 | // TODO integrate the check above in SubPlan / POperation |
101 | 101 | ||
102 | logger.debug(String.format( | 102 | logger.debug(String.format( |
103 | "%s: patternbody query plan concluded for %s as: %s", | 103 | "%s: patternbody query plan concluded for %s as: %s", |
104 | getClass().getSimpleName(), | 104 | getClass().getSimpleName(), |
105 | query.getFullyQualifiedName(), | 105 | query.getFullyQualifiedName(), |
106 | finalPlan.toLongString())); | 106 | finalPlan.toLongString())); |
107 | 107 | ||
@@ -115,7 +115,7 @@ public class BasicLinearLayout implements IQueryPlannerStrategy { | |||
115 | 115 | ||
116 | /** | 116 | /** |
117 | * Called when the constraint is not ready, but cannot be deferred further. | 117 | * Called when the constraint is not ready, but cannot be deferred further. |
118 | * | 118 | * |
119 | * @param plan | 119 | * @param plan |
120 | * @throws RetePatternBuildException | 120 | * @throws RetePatternBuildException |
121 | * to indicate the error in detail. | 121 | * to indicate the error in detail. |
@@ -131,7 +131,7 @@ public class BasicLinearLayout implements IQueryPlannerStrategy { | |||
131 | raiseForeverDeferredError(constraint, plan, context); | 131 | raiseForeverDeferredError(constraint, plan, context); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
135 | private void raiseForeverDeferredError(Equality constraint, SubPlan plan, IQueryMetaContext context) { | 135 | private void raiseForeverDeferredError(Equality constraint, SubPlan plan, IQueryMetaContext context) { |
136 | String[] args = { constraint.getWho().toString(), constraint.getWithWhom().toString() }; | 136 | String[] args = { constraint.getWho().toString(), constraint.getWithWhom().toString() }; |
137 | String msg = "Cannot express equality of variables {1} and {2} if neither of them is deducable."; | 137 | String msg = "Cannot express equality of variables {1} and {2} if neither of them is deducable."; |
@@ -166,6 +166,6 @@ public class BasicLinearLayout implements IQueryPlannerStrategy { | |||
166 | String shortMsg = "Could not check all constraints due to undeducible variables"; | 166 | String shortMsg = "Could not check all constraints due to undeducible variables"; |
167 | throw new RetePatternBuildException(msg, args, shortMsg, null); | 167 | throw new RetePatternBuildException(msg, args, shortMsg, null); |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
171 | } | 171 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/basiclinear/OrderingHeuristics.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/basiclinear/OrderingHeuristics.java index 2b4e8890..9dfb70f8 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/basiclinear/OrderingHeuristics.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/basiclinear/OrderingHeuristics.java | |||
@@ -3,28 +3,28 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.construction.basiclinear; | 10 | package tools.refinery.interpreter.rete.construction.basiclinear; |
11 | 11 | ||
12 | import java.util.Comparator; | 12 | import java.util.Comparator; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 15 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
16 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 16 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.DeferredPConstraint; | 17 | import tools.refinery.interpreter.matchers.psystem.DeferredPConstraint; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.EnumerablePConstraint; | 18 | import tools.refinery.interpreter.matchers.psystem.EnumerablePConstraint; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 19 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 20 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.ConstantValue; | 21 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.ConstantValue; |
22 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 22 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
23 | import tools.refinery.viatra.runtime.rete.util.OrderingCompareAgent; | 23 | import tools.refinery.interpreter.rete.util.OrderingCompareAgent; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * @author Gabor Bergmann | 26 | * @author Gabor Bergmann |
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | public class OrderingHeuristics implements Comparator<PConstraint> { | 29 | public class OrderingHeuristics implements Comparator<PConstraint> { |
30 | private SubPlan plan; | 30 | private SubPlan plan; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/plancompiler/CompilerHelper.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/plancompiler/CompilerHelper.java index da2fb432..9df1f545 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/plancompiler/CompilerHelper.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/plancompiler/CompilerHelper.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.construction.plancompiler; | 9 | package tools.refinery.interpreter.rete.construction.plancompiler; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
@@ -21,38 +21,38 @@ import java.util.Set; | |||
21 | import java.util.SortedSet; | 21 | import java.util.SortedSet; |
22 | import java.util.TreeSet; | 22 | import java.util.TreeSet; |
23 | 23 | ||
24 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 24 | import tools.refinery.interpreter.rete.recipes.IndexerBasedAggregatorRecipe; |
25 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 25 | import tools.refinery.interpreter.rete.recipes.MonotonicityInfo; |
26 | import tools.refinery.viatra.runtime.matchers.context.IPosetComparator; | 26 | import tools.refinery.interpreter.rete.recipes.ProjectionIndexerRecipe; |
27 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 27 | import tools.refinery.interpreter.rete.recipes.ReteNodeRecipe; |
28 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 28 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
29 | import tools.refinery.viatra.runtime.matchers.planning.helpers.TypeHelper; | 29 | import tools.refinery.interpreter.matchers.context.IInputKey; |
30 | import tools.refinery.viatra.runtime.matchers.psystem.EnumerablePConstraint; | 30 | import tools.refinery.interpreter.matchers.context.IPosetComparator; |
31 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 31 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
32 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 32 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
33 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 33 | import tools.refinery.interpreter.matchers.planning.helpers.TypeHelper; |
34 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 34 | import tools.refinery.interpreter.matchers.psystem.EnumerablePConstraint; |
35 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 35 | import tools.refinery.interpreter.matchers.psystem.PBody; |
36 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 36 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
37 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration; | 37 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
38 | import tools.refinery.viatra.runtime.rete.recipes.EqualityFilterRecipe; | 38 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
39 | import tools.refinery.viatra.runtime.rete.recipes.IndexerBasedAggregatorRecipe; | 39 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
40 | import tools.refinery.viatra.runtime.rete.recipes.IndexerRecipe; | 40 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
41 | import tools.refinery.viatra.runtime.rete.recipes.JoinRecipe; | 41 | import tools.refinery.interpreter.rete.matcher.TimelyConfiguration; |
42 | import tools.refinery.viatra.runtime.rete.recipes.Mask; | 42 | import tools.refinery.interpreter.rete.recipes.EqualityFilterRecipe; |
43 | import tools.refinery.viatra.runtime.rete.recipes.MonotonicityInfo; | 43 | import tools.refinery.interpreter.rete.recipes.IndexerRecipe; |
44 | import tools.refinery.viatra.runtime.rete.recipes.ProductionRecipe; | 44 | import tools.refinery.interpreter.rete.recipes.JoinRecipe; |
45 | import tools.refinery.viatra.runtime.rete.recipes.ProjectionIndexerRecipe; | 45 | import tools.refinery.interpreter.rete.recipes.Mask; |
46 | import tools.refinery.viatra.runtime.rete.recipes.RecipesFactory; | 46 | import tools.refinery.interpreter.rete.recipes.ProductionRecipe; |
47 | import tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe; | 47 | import tools.refinery.interpreter.rete.recipes.RecipesFactory; |
48 | import tools.refinery.viatra.runtime.rete.recipes.SingleColumnAggregatorRecipe; | 48 | import tools.refinery.interpreter.rete.recipes.SingleColumnAggregatorRecipe; |
49 | import tools.refinery.viatra.runtime.rete.recipes.TrimmerRecipe; | 49 | import tools.refinery.interpreter.rete.recipes.TrimmerRecipe; |
50 | import tools.refinery.viatra.runtime.rete.recipes.helper.RecipesHelper; | 50 | import tools.refinery.interpreter.rete.recipes.helper.RecipesHelper; |
51 | import tools.refinery.viatra.runtime.rete.traceability.CompiledQuery; | 51 | import tools.refinery.interpreter.rete.traceability.CompiledQuery; |
52 | import tools.refinery.viatra.runtime.rete.traceability.CompiledSubPlan; | 52 | import tools.refinery.interpreter.rete.traceability.CompiledSubPlan; |
53 | import tools.refinery.viatra.runtime.rete.traceability.PlanningTrace; | 53 | import tools.refinery.interpreter.rete.traceability.PlanningTrace; |
54 | import tools.refinery.viatra.runtime.rete.traceability.RecipeTraceInfo; | 54 | import tools.refinery.interpreter.rete.traceability.RecipeTraceInfo; |
55 | import tools.refinery.viatra.runtime.rete.util.ReteHintOptions; | 55 | import tools.refinery.interpreter.rete.util.ReteHintOptions; |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * @author Bergmann Gabor | 58 | * @author Bergmann Gabor |
@@ -61,14 +61,14 @@ import tools.refinery.viatra.runtime.rete.util.ReteHintOptions; | |||
61 | public class CompilerHelper { | 61 | public class CompilerHelper { |
62 | 62 | ||
63 | private CompilerHelper() {/*Utility class constructor*/} | 63 | private CompilerHelper() {/*Utility class constructor*/} |
64 | 64 | ||
65 | static final RecipesFactory FACTORY = RecipesFactory.eINSTANCE; | 65 | static final RecipesFactory FACTORY = RecipesFactory.eINSTANCE; |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * Makes sure that all variables in the tuple are different so that it can be used as {@link CompiledSubPlan}. If a | 68 | * Makes sure that all variables in the tuple are different so that it can be used as {@link CompiledSubPlan}. If a |
69 | * variable occurs multiple times, equality checks are applied and then the results are trimmed so that duplicates | 69 | * variable occurs multiple times, equality checks are applied and then the results are trimmed so that duplicates |
70 | * are hidden. If no manipulation is necessary, the original trace is returned. | 70 | * are hidden. If no manipulation is necessary, the original trace is returned. |
71 | * | 71 | * |
72 | * <p> | 72 | * <p> |
73 | * to be used whenever a constraint introduces new variables. | 73 | * to be used whenever a constraint introduces new variables. |
74 | */ | 74 | */ |
@@ -114,7 +114,7 @@ public class CompilerHelper { | |||
114 | // trim so that each variable occurs only once | 114 | // trim so that each variable occurs only once |
115 | TrimmerRecipe trimmerRecipe = FACTORY.createTrimmerRecipe(); | 115 | TrimmerRecipe trimmerRecipe = FACTORY.createTrimmerRecipe(); |
116 | trimmerRecipe.setParent(lastTrace.getRecipe()); | 116 | trimmerRecipe.setParent(lastTrace.getRecipe()); |
117 | trimmerRecipe.setMask(tools.refinery.viatra.runtime.rete.recipes.helper.RecipesHelper | 117 | trimmerRecipe.setMask(RecipesHelper |
118 | .mask(constraintArity, trimIndices)); | 118 | .mask(constraintArity, trimIndices)); |
119 | return new PlanningTrace(plan, trimmedVariablesTuple, trimmerRecipe, lastTrace); | 119 | return new PlanningTrace(plan, trimmedVariablesTuple, trimmerRecipe, lastTrace); |
120 | } | 120 | } |
@@ -213,8 +213,8 @@ public class CompilerHelper { | |||
213 | } | 213 | } |
214 | return computePosetInfo(keys, context); | 214 | return computePosetInfo(keys, context); |
215 | } | 215 | } |
216 | 216 | ||
217 | 217 | ||
218 | 218 | ||
219 | /** | 219 | /** |
220 | * @since 1.6 | 220 | * @since 1.6 |
@@ -255,21 +255,21 @@ public class CompilerHelper { | |||
255 | 255 | ||
256 | /** | 256 | /** |
257 | * Creates a recipe for a production node and the corresponding trace. | 257 | * Creates a recipe for a production node and the corresponding trace. |
258 | * <p> PRE: in case this is a recursion cutoff point (see {@link RecursionCutoffPoint}) | 258 | * <p> PRE: in case this is a recursion cutoff point (see {@link RecursionCutoffPoint}) |
259 | * and bodyFinalTraces will be filled later, | 259 | * and bodyFinalTraces will be filled later, |
260 | * the object yielded now by bodyFinalTraces.values() must return up-to-date results later | 260 | * the object yielded now by bodyFinalTraces.values() must return up-to-date results later |
261 | * @since 2.4 | 261 | * @since 2.4 |
262 | */ | 262 | */ |
263 | public static CompiledQuery makeQueryTrace(PQuery query, Map<PBody, RecipeTraceInfo> bodyFinalTraces, | 263 | public static CompiledQuery makeQueryTrace(PQuery query, Map<PBody, RecipeTraceInfo> bodyFinalTraces, |
264 | Collection<ReteNodeRecipe> bodyFinalRecipes, QueryEvaluationHint hint, IQueryMetaContext context, | 264 | Collection<ReteNodeRecipe> bodyFinalRecipes, QueryEvaluationHint hint, IQueryMetaContext context, |
265 | boolean deleteAndRederiveEvaluation, TimelyConfiguration timelyEvaluation) { | 265 | boolean deleteAndRederiveEvaluation, TimelyConfiguration timelyEvaluation) { |
266 | ProductionRecipe recipe = ReteRecipeCompiler.FACTORY.createProductionRecipe(); | 266 | ProductionRecipe recipe = ReteRecipeCompiler.FACTORY.createProductionRecipe(); |
267 | 267 | ||
268 | // temporary solution to support the deprecated option for now | 268 | // temporary solution to support the deprecated option for now |
269 | boolean deleteAndRederiveEvaluationDep = deleteAndRederiveEvaluation || ReteHintOptions.deleteRederiveEvaluation.getValueOrDefault(hint); | 269 | boolean deleteAndRederiveEvaluationDep = deleteAndRederiveEvaluation || ReteHintOptions.deleteRederiveEvaluation.getValueOrDefault(hint); |
270 | 270 | ||
271 | recipe.setDeleteRederiveEvaluation(deleteAndRederiveEvaluationDep); | 271 | recipe.setDeleteRederiveEvaluation(deleteAndRederiveEvaluationDep); |
272 | 272 | ||
273 | if (deleteAndRederiveEvaluationDep || (timelyEvaluation != null)) { | 273 | if (deleteAndRederiveEvaluationDep || (timelyEvaluation != null)) { |
274 | PosetTriplet triplet = computePosetInfo(query.getParameters(), context); | 274 | PosetTriplet triplet = computePosetInfo(query.getParameters(), context); |
275 | if (triplet.comparator != null) { | 275 | if (triplet.comparator != null) { |
@@ -294,9 +294,9 @@ public class CompilerHelper { | |||
294 | 294 | ||
295 | /** | 295 | /** |
296 | * Calculated index mappings for a join, based on the common variables of the two parent subplans. | 296 | * Calculated index mappings for a join, based on the common variables of the two parent subplans. |
297 | * | 297 | * |
298 | * @author Gabor Bergmann | 298 | * @author Gabor Bergmann |
299 | * | 299 | * |
300 | */ | 300 | */ |
301 | public static class JoinHelper { | 301 | public static class JoinHelper { |
302 | private TupleMask primaryMask; | 302 | private TupleMask primaryMask; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/plancompiler/RecursionCutoffPoint.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/plancompiler/RecursionCutoffPoint.java index 7d1e4d3a..24d001e8 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/plancompiler/RecursionCutoffPoint.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/plancompiler/RecursionCutoffPoint.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.construction.plancompiler; | 9 | package tools.refinery.interpreter.rete.construction.plancompiler; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.HashMap; | 12 | import java.util.HashMap; |
@@ -14,24 +14,24 @@ import java.util.List; | |||
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | import java.util.stream.Collectors; | 15 | import java.util.stream.Collectors; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 17 | import tools.refinery.interpreter.rete.recipes.ReteNodeRecipe; |
18 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 18 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 19 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 20 | import tools.refinery.interpreter.matchers.psystem.PBody; |
21 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration; | 21 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
22 | import tools.refinery.viatra.runtime.rete.recipes.ProductionRecipe; | 22 | import tools.refinery.interpreter.rete.matcher.TimelyConfiguration; |
23 | import tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe; | 23 | import tools.refinery.interpreter.rete.recipes.ProductionRecipe; |
24 | import tools.refinery.viatra.runtime.rete.traceability.CompiledQuery; | 24 | import tools.refinery.interpreter.rete.traceability.CompiledQuery; |
25 | import tools.refinery.viatra.runtime.rete.traceability.RecipeTraceInfo; | 25 | import tools.refinery.interpreter.rete.traceability.RecipeTraceInfo; |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * In a recursive query structure, query composition references can be cut off so that the remaining structure is DAG. | 28 | * In a recursive query structure, query composition references can be cut off so that the remaining structure is DAG. |
29 | * {@link RecursionCutoffPoint} represents one such cut off query composition. | 29 | * {@link RecursionCutoffPoint} represents one such cut off query composition. |
30 | * When the compilation of the recursive query finishes and the compiled form becomes available, | 30 | * When the compilation of the recursive query finishes and the compiled form becomes available, |
31 | * the {@link RecursionCutoffPoint} has to be signaled to update parent traces and recipes of the recursive call. | 31 | * the {@link RecursionCutoffPoint} has to be signaled to update parent traces and recipes of the recursive call. |
32 | * | 32 | * |
33 | * @author Bergmann Gabor | 33 | * @author Bergmann Gabor |
34 | * @noreference This class is not intended to be referenced by clients | 34 | * @noreference This class is not intended to be referenced by clients |
35 | * | 35 | * |
36 | */ | 36 | */ |
37 | public class RecursionCutoffPoint { | 37 | public class RecursionCutoffPoint { |
@@ -39,7 +39,7 @@ public class RecursionCutoffPoint { | |||
39 | final CompiledQuery compiledQuery; | 39 | final CompiledQuery compiledQuery; |
40 | final ProductionRecipe recipe; | 40 | final ProductionRecipe recipe; |
41 | final QueryEvaluationHint hint; | 41 | final QueryEvaluationHint hint; |
42 | 42 | ||
43 | public RecursionCutoffPoint(PQuery query, QueryEvaluationHint hint, IQueryMetaContext context, boolean deleteAndRederiveEvaluation, TimelyConfiguration timelyEvaluation) { | 43 | public RecursionCutoffPoint(PQuery query, QueryEvaluationHint hint, IQueryMetaContext context, boolean deleteAndRederiveEvaluation, TimelyConfiguration timelyEvaluation) { |
44 | super(); | 44 | super(); |
45 | this.hint = hint; | 45 | this.hint = hint; |
@@ -47,23 +47,23 @@ public class RecursionCutoffPoint { | |||
47 | this.compiledQuery = CompilerHelper.makeQueryTrace(query, futureTraceMap, Collections.<ReteNodeRecipe>emptySet(), hint, context, deleteAndRederiveEvaluation, timelyEvaluation); | 47 | this.compiledQuery = CompilerHelper.makeQueryTrace(query, futureTraceMap, Collections.<ReteNodeRecipe>emptySet(), hint, context, deleteAndRederiveEvaluation, timelyEvaluation); |
48 | this.recipe = (ProductionRecipe)compiledQuery.getRecipe(); | 48 | this.recipe = (ProductionRecipe)compiledQuery.getRecipe(); |
49 | if (!compiledQuery.getParentRecipeTraces().isEmpty()) { | 49 | if (!compiledQuery.getParentRecipeTraces().isEmpty()) { |
50 | throw new IllegalArgumentException(String.format("Recursion cut-off point of query %s has trace parents: %s", | 50 | throw new IllegalArgumentException(String.format("Recursion cut-off point of query %s has trace parents: %s", |
51 | compiledQuery.getQuery(), | 51 | compiledQuery.getQuery(), |
52 | prettyPrintParentRecipeTraces(compiledQuery.getParentRecipeTraces()))); | 52 | prettyPrintParentRecipeTraces(compiledQuery.getParentRecipeTraces()))); |
53 | } | 53 | } |
54 | if (!recipe.getParents().isEmpty()) { | 54 | if (!recipe.getParents().isEmpty()) { |
55 | throw new IllegalArgumentException(String.format("Recursion cut-off point of query %s has recipe parents: %s", | 55 | throw new IllegalArgumentException(String.format("Recursion cut-off point of query %s has recipe parents: %s", |
56 | compiledQuery.getQuery(), | 56 | compiledQuery.getQuery(), |
57 | prettyPrintParentRecipeTraces(compiledQuery.getParentRecipeTraces()))); | 57 | prettyPrintParentRecipeTraces(compiledQuery.getParentRecipeTraces()))); |
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | 62 | ||
63 | private String prettyPrintParentRecipeTraces(List<RecipeTraceInfo> trace) { | 63 | private String prettyPrintParentRecipeTraces(List<RecipeTraceInfo> trace) { |
64 | return trace.stream().map(Object::toString).collect(Collectors.joining(", ")); | 64 | return trace.stream().map(Object::toString).collect(Collectors.joining(", ")); |
65 | } | 65 | } |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * Signals that compilation of the recursive query has terminated, culminating into the given compiled form. | 68 | * Signals that compilation of the recursive query has terminated, culminating into the given compiled form. |
69 | * The query composition that has been cut off will be connected now. | 69 | * The query composition that has been cut off will be connected now. |
@@ -80,7 +80,7 @@ public class RecursionCutoffPoint { | |||
80 | public ProductionRecipe getRecipe() { | 80 | public ProductionRecipe getRecipe() { |
81 | return recipe; | 81 | return recipe; |
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | ||
85 | 85 | ||
86 | } | 86 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/plancompiler/ReteRecipeCompiler.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/plancompiler/ReteRecipeCompiler.java index 5df3a971..f84eae0a 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/plancompiler/ReteRecipeCompiler.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/plancompiler/ReteRecipeCompiler.java | |||
@@ -7,43 +7,41 @@ | |||
7 | * | 7 | * |
8 | * SPDX-License-Identifier: EPL-2.0 | 8 | * SPDX-License-Identifier: EPL-2.0 |
9 | *******************************************************************************/ | 9 | *******************************************************************************/ |
10 | package tools.refinery.viatra.runtime.rete.construction.plancompiler; | 10 | package tools.refinery.interpreter.rete.construction.plancompiler; |
11 | 11 | ||
12 | import org.apache.log4j.Logger; | 12 | import org.apache.log4j.Logger; |
13 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 13 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
14 | import tools.refinery.viatra.runtime.matchers.backend.CommonQueryHintOptions; | 14 | import tools.refinery.interpreter.matchers.backend.CommonQueryHintOptions; |
15 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendHintProvider; | 15 | import tools.refinery.interpreter.matchers.backend.IQueryBackendHintProvider; |
16 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 16 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
17 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 17 | import tools.refinery.interpreter.matchers.context.IInputKey; |
18 | import tools.refinery.viatra.runtime.matchers.context.IPosetComparator; | 18 | import tools.refinery.interpreter.matchers.context.IPosetComparator; |
19 | import tools.refinery.viatra.runtime.matchers.context.IQueryCacheContext; | 19 | import tools.refinery.interpreter.matchers.context.IQueryCacheContext; |
20 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 20 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
21 | import tools.refinery.viatra.runtime.matchers.planning.IQueryPlannerStrategy; | 21 | import tools.refinery.interpreter.matchers.planning.IQueryPlannerStrategy; |
22 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 22 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
23 | import tools.refinery.viatra.runtime.matchers.planning.helpers.BuildHelper; | 23 | import tools.refinery.interpreter.matchers.planning.helpers.BuildHelper; |
24 | import tools.refinery.viatra.runtime.matchers.planning.operations.*; | 24 | import tools.refinery.interpreter.matchers.planning.operations.*; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.*; | 25 | import tools.refinery.interpreter.matchers.psystem.*; |
26 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 26 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
27 | import tools.refinery.viatra.runtime.matchers.psystem.analysis.QueryAnalyzer; | 27 | import tools.refinery.interpreter.matchers.psystem.analysis.QueryAnalyzer; |
28 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.*; | 28 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.*; |
29 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.*; | 29 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.*; |
30 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 30 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
31 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 31 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
32 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PVisibility; | 32 | import tools.refinery.interpreter.matchers.psystem.queries.PVisibility; |
33 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.*; | 33 | import tools.refinery.interpreter.matchers.psystem.rewriters.*; |
34 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 34 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
35 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 35 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
36 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 36 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
37 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 37 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
38 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | 38 | import tools.refinery.interpreter.matchers.util.CollectionsFactory.MemoryType; |
39 | import tools.refinery.viatra.runtime.matchers.util.IMultiLookup; | 39 | import tools.refinery.interpreter.matchers.util.IMultiLookup; |
40 | import tools.refinery.viatra.runtime.rete.construction.plancompiler.CompilerHelper.JoinHelper; | 40 | import tools.refinery.interpreter.rete.matcher.TimelyConfiguration; |
41 | import tools.refinery.viatra.runtime.rete.construction.plancompiler.CompilerHelper.PosetTriplet; | 41 | import tools.refinery.interpreter.rete.recipes.*; |
42 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration; | 42 | import tools.refinery.interpreter.rete.recipes.helper.RecipesHelper; |
43 | import tools.refinery.viatra.runtime.rete.recipes.*; | 43 | import tools.refinery.interpreter.rete.traceability.*; |
44 | import tools.refinery.viatra.runtime.rete.recipes.helper.RecipesHelper; | 44 | import tools.refinery.interpreter.rete.util.ReteHintOptions; |
45 | import tools.refinery.viatra.runtime.rete.traceability.*; | ||
46 | import tools.refinery.viatra.runtime.rete.util.ReteHintOptions; | ||
47 | 45 | ||
48 | import java.util.*; | 46 | import java.util.*; |
49 | import java.util.Map.Entry; | 47 | import java.util.Map.Entry; |
@@ -136,7 +134,7 @@ public class ReteRecipeCompiler { | |||
136 | 134 | ||
137 | /** | 135 | /** |
138 | * Returns a {@link CompiledQuery} compiled from a query | 136 | * Returns a {@link CompiledQuery} compiled from a query |
139 | * @throws ViatraQueryRuntimeException | 137 | * @throws InterpreterRuntimeException |
140 | */ | 138 | */ |
141 | public CompiledQuery getCompiledForm(PQuery query) { | 139 | public CompiledQuery getCompiledForm(PQuery query) { |
142 | CompiledQuery compiled = queryCompilerCache.get(query); | 140 | CompiledQuery compiled = queryCompilerCache.get(query); |
@@ -174,7 +172,7 @@ public class ReteRecipeCompiler { | |||
174 | 172 | ||
175 | /** | 173 | /** |
176 | * Returns a {@link CompiledSubPlan} compiled from a query plan | 174 | * Returns a {@link CompiledSubPlan} compiled from a query plan |
177 | * @throws ViatraQueryRuntimeException | 175 | * @throws InterpreterRuntimeException |
178 | */ | 176 | */ |
179 | public CompiledSubPlan getCompiledForm(SubPlan plan) { | 177 | public CompiledSubPlan getCompiledForm(SubPlan plan) { |
180 | CompiledSubPlan compiled = subPlanCompilerCache.get(plan); | 178 | CompiledSubPlan compiled = subPlanCompilerCache.get(plan); |
@@ -187,7 +185,7 @@ public class ReteRecipeCompiler { | |||
187 | } | 185 | } |
188 | 186 | ||
189 | /** | 187 | /** |
190 | * @throws ViatraQueryRuntimeException | 188 | * @throws InterpreterRuntimeException |
191 | */ | 189 | */ |
192 | public SubPlan getPlan(PBody pBody) { | 190 | public SubPlan getPlan(PBody pBody) { |
193 | // if the query is not marked as being compiled, initiate compilation | 191 | // if the query is not marked as being compiled, initiate compilation |
@@ -422,7 +420,7 @@ public class ReteRecipeCompiler { | |||
422 | final PlanningTrace callTrace = referQuery(constraint.getReferredQuery(), plan, | 420 | final PlanningTrace callTrace = referQuery(constraint.getReferredQuery(), plan, |
423 | constraint.getActualParametersTuple()); | 421 | constraint.getActualParametersTuple()); |
424 | 422 | ||
425 | JoinHelper joinHelper = new JoinHelper(plan, parentCompiled, callTrace); | 423 | CompilerHelper.JoinHelper joinHelper = new CompilerHelper.JoinHelper(plan, parentCompiled, callTrace); |
426 | final RecipeTraceInfo primaryIndexer = joinHelper.getPrimaryIndexer(); | 424 | final RecipeTraceInfo primaryIndexer = joinHelper.getPrimaryIndexer(); |
427 | final RecipeTraceInfo secondaryIndexer = joinHelper.getSecondaryIndexer(); | 425 | final RecipeTraceInfo secondaryIndexer = joinHelper.getSecondaryIndexer(); |
428 | 426 | ||
@@ -440,7 +438,7 @@ public class ReteRecipeCompiler { | |||
440 | constraint.getActualParametersTuple()); | 438 | constraint.getActualParametersTuple()); |
441 | 439 | ||
442 | // hack: use some mask computations (+ the indexers) from a fake natural join against the called query | 440 | // hack: use some mask computations (+ the indexers) from a fake natural join against the called query |
443 | JoinHelper fakeJoinHelper = new JoinHelper(plan, parentCompiled, callTrace); | 441 | CompilerHelper.JoinHelper fakeJoinHelper = new CompilerHelper.JoinHelper(plan, parentCompiled, callTrace); |
444 | final RecipeTraceInfo primaryIndexer = fakeJoinHelper.getPrimaryIndexer(); | 442 | final RecipeTraceInfo primaryIndexer = fakeJoinHelper.getPrimaryIndexer(); |
445 | final RecipeTraceInfo callProjectionIndexer = fakeJoinHelper.getSecondaryIndexer(); | 443 | final RecipeTraceInfo callProjectionIndexer = fakeJoinHelper.getSecondaryIndexer(); |
446 | 444 | ||
@@ -502,7 +500,7 @@ public class ReteRecipeCompiler { | |||
502 | constraint.getActualParametersTuple()); | 500 | constraint.getActualParametersTuple()); |
503 | 501 | ||
504 | // hack: use some mask computations (+ the indexers) from a fake natural join against the called query | 502 | // hack: use some mask computations (+ the indexers) from a fake natural join against the called query |
505 | JoinHelper fakeJoinHelper = new JoinHelper(plan, parentCompiled, callTrace); | 503 | CompilerHelper.JoinHelper fakeJoinHelper = new CompilerHelper.JoinHelper(plan, parentCompiled, callTrace); |
506 | final RecipeTraceInfo primaryIndexer = fakeJoinHelper.getPrimaryIndexer(); | 504 | final RecipeTraceInfo primaryIndexer = fakeJoinHelper.getPrimaryIndexer(); |
507 | TupleMask callGroupMask = fakeJoinHelper.getSecondaryMask(); | 505 | TupleMask callGroupMask = fakeJoinHelper.getSecondaryMask(); |
508 | 506 | ||
@@ -654,7 +652,7 @@ public class ReteRecipeCompiler { | |||
654 | } | 652 | } |
655 | 653 | ||
656 | // ELSE: ACTUAL JOIN | 654 | // ELSE: ACTUAL JOIN |
657 | JoinHelper joinHelper = new JoinHelper(plan, leftCompiled, rightCompiled); | 655 | CompilerHelper.JoinHelper joinHelper = new CompilerHelper.JoinHelper(plan, leftCompiled, rightCompiled); |
658 | return new CompiledSubPlan(plan, joinHelper.getNaturalJoinVariablesTuple(), joinHelper.getNaturalJoinRecipe(), | 656 | return new CompiledSubPlan(plan, joinHelper.getNaturalJoinVariablesTuple(), joinHelper.getNaturalJoinRecipe(), |
659 | joinHelper.getPrimaryIndexer(), joinHelper.getSecondaryIndexer()); | 657 | joinHelper.getPrimaryIndexer(), joinHelper.getSecondaryIndexer()); |
660 | } | 658 | } |
@@ -720,7 +718,7 @@ public class ReteRecipeCompiler { | |||
720 | 718 | ||
721 | recipe.setDeleteRederiveEvaluation(deleteAndRederiveEvaluationDep); | 719 | recipe.setDeleteRederiveEvaluation(deleteAndRederiveEvaluationDep); |
722 | if (deleteAndRederiveEvaluationDep || (this.timelyEvaluation != null)) { | 720 | if (deleteAndRederiveEvaluationDep || (this.timelyEvaluation != null)) { |
723 | PosetTriplet triplet = CompilerHelper.computePosetInfo(targetVariables, parentPlan.getBody(), metaContext); | 721 | CompilerHelper.PosetTriplet triplet = CompilerHelper.computePosetInfo(targetVariables, parentPlan.getBody(), metaContext); |
724 | 722 | ||
725 | if (triplet.comparator != null) { | 723 | if (triplet.comparator != null) { |
726 | MonotonicityInfo info = FACTORY.createMonotonicityInfo(); | 724 | MonotonicityInfo info = FACTORY.createMonotonicityInfo(); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/quasitree/JoinCandidate.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/JoinCandidate.java index 45350099..ae79b21a 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/quasitree/JoinCandidate.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/JoinCandidate.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.construction.quasitree; | 10 | package tools.refinery.interpreter.rete.construction.quasitree; |
11 | 11 | ||
12 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
13 | import java.util.Collections; | 13 | import java.util.Collections; |
@@ -17,32 +17,32 @@ import java.util.Set; | |||
17 | import java.util.stream.Collectors; | 17 | import java.util.stream.Collectors; |
18 | import java.util.stream.Stream; | 18 | import java.util.stream.Stream; |
19 | 19 | ||
20 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 20 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
21 | import tools.refinery.viatra.runtime.matchers.planning.SubPlanFactory; | 21 | import tools.refinery.interpreter.matchers.planning.SubPlanFactory; |
22 | import tools.refinery.viatra.runtime.matchers.planning.helpers.FunctionalDependencyHelper; | 22 | import tools.refinery.interpreter.matchers.planning.helpers.FunctionalDependencyHelper; |
23 | import tools.refinery.viatra.runtime.matchers.planning.operations.PJoin; | 23 | import tools.refinery.interpreter.matchers.planning.operations.PJoin; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 24 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 25 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
26 | import tools.refinery.viatra.runtime.matchers.psystem.analysis.QueryAnalyzer; | 26 | import tools.refinery.interpreter.matchers.psystem.analysis.QueryAnalyzer; |
27 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 27 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * @author Gabor Bergmann | 30 | * @author Gabor Bergmann |
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | class JoinCandidate { | 33 | class JoinCandidate { |
34 | private QueryAnalyzer analyzer; | 34 | private QueryAnalyzer analyzer; |
35 | 35 | ||
36 | SubPlan primary; | 36 | SubPlan primary; |
37 | SubPlan secondary; | 37 | SubPlan secondary; |
38 | 38 | ||
39 | Set<PVariable> varPrimary; | 39 | Set<PVariable> varPrimary; |
40 | Set<PVariable> varSecondary; | 40 | Set<PVariable> varSecondary; |
41 | Set<PVariable> varCommon; | 41 | Set<PVariable> varCommon; |
42 | 42 | ||
43 | List<PConstraint> consPrimary; | 43 | List<PConstraint> consPrimary; |
44 | List<PConstraint> consSecondary; | 44 | List<PConstraint> consSecondary; |
45 | 45 | ||
46 | 46 | ||
47 | JoinCandidate(SubPlan primary, SubPlan secondary, QueryAnalyzer analyzer) { | 47 | JoinCandidate(SubPlan primary, SubPlan secondary, QueryAnalyzer analyzer) { |
48 | super(); | 48 | super(); |
@@ -54,15 +54,15 @@ class JoinCandidate { | |||
54 | varSecondary = getSecondary().getVisibleVariables(); | 54 | varSecondary = getSecondary().getVisibleVariables(); |
55 | varCommon = CollectionsFactory.createSet(varPrimary); | 55 | varCommon = CollectionsFactory.createSet(varPrimary); |
56 | varCommon.retainAll(varSecondary); | 56 | varCommon.retainAll(varSecondary); |
57 | 57 | ||
58 | consPrimary = new ArrayList<PConstraint>(primary.getAllEnforcedConstraints()); | 58 | consPrimary = new ArrayList<PConstraint>(primary.getAllEnforcedConstraints()); |
59 | Collections.sort(consPrimary, TieBreaker.CONSTRAINT_COMPARATOR); | 59 | Collections.sort(consPrimary, TieBreaker.CONSTRAINT_COMPARATOR); |
60 | consSecondary = new ArrayList<PConstraint>(secondary.getAllEnforcedConstraints()); | 60 | consSecondary = new ArrayList<PConstraint>(secondary.getAllEnforcedConstraints()); |
61 | Collections.sort(consSecondary, TieBreaker.CONSTRAINT_COMPARATOR); | 61 | Collections.sort(consSecondary, TieBreaker.CONSTRAINT_COMPARATOR); |
62 | } | 62 | } |
63 | 63 | ||
64 | 64 | ||
65 | 65 | ||
66 | /** | 66 | /** |
67 | * @return the a | 67 | * @return the a |
68 | */ | 68 | */ |
@@ -82,10 +82,10 @@ class JoinCandidate { | |||
82 | if (isTrivial()) | 82 | if (isTrivial()) |
83 | return primary; | 83 | return primary; |
84 | if (isSubsumption()) | 84 | if (isSubsumption()) |
85 | return | 85 | return |
86 | (consPrimary.size() > consSecondary.size()) ? primary : secondary; | 86 | (consPrimary.size() > consSecondary.size()) ? primary : secondary; |
87 | 87 | ||
88 | 88 | ||
89 | // default case | 89 | // default case |
90 | return factory.createSubPlan(new PJoin(), primary, secondary); | 90 | return factory.createSubPlan(new PJoin(), primary, secondary); |
91 | } | 91 | } |
@@ -108,7 +108,7 @@ class JoinCandidate { | |||
108 | public Set<PVariable> getVarSecondary() { | 108 | public Set<PVariable> getVarSecondary() { |
109 | return varSecondary; | 109 | return varSecondary; |
110 | } | 110 | } |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * @return constraints of primary, sorted according to {@link TieBreaker#CONSTRAINT_COMPARATOR}. | 113 | * @return constraints of primary, sorted according to {@link TieBreaker#CONSTRAINT_COMPARATOR}. |
114 | */ | 114 | */ |
@@ -127,7 +127,7 @@ class JoinCandidate { | |||
127 | public boolean isTrivial() { | 127 | public boolean isTrivial() { |
128 | return getPrimary().equals(getSecondary()); | 128 | return getPrimary().equals(getSecondary()); |
129 | } | 129 | } |
130 | 130 | ||
131 | public boolean isSubsumption() { | 131 | public boolean isSubsumption() { |
132 | return consPrimary.containsAll(consSecondary) || consSecondary.containsAll(consPrimary); | 132 | return consPrimary.containsAll(consSecondary) || consSecondary.containsAll(consPrimary); |
133 | } | 133 | } |
@@ -149,7 +149,7 @@ class JoinCandidate { | |||
149 | primary.getAllEnforcedConstraints().stream(), | 149 | primary.getAllEnforcedConstraints().stream(), |
150 | secondary.getAllEnforcedConstraints().stream() | 150 | secondary.getAllEnforcedConstraints().stream() |
151 | ).collect(Collectors.toSet()); | 151 | ).collect(Collectors.toSet()); |
152 | Map<Set<PVariable>, Set<PVariable>> dependencies = | 152 | Map<Set<PVariable>, Set<PVariable>> dependencies = |
153 | analyzer.getFunctionalDependencies(union, false); | 153 | analyzer.getFunctionalDependencies(union, false); |
154 | // does varCommon determine either varPrimary or varSecondary? | 154 | // does varCommon determine either varPrimary or varSecondary? |
155 | Set<PVariable> varCommonClosure = FunctionalDependencyHelper.closureOf(varCommon, dependencies); | 155 | Set<PVariable> varCommonClosure = FunctionalDependencyHelper.closureOf(varCommon, dependencies); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/quasitree/JoinOrderingHeuristics.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/JoinOrderingHeuristics.java index 0ea7c1d9..3278d72c 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/quasitree/JoinOrderingHeuristics.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/JoinOrderingHeuristics.java | |||
@@ -3,20 +3,20 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.construction.quasitree; | 10 | package tools.refinery.interpreter.rete.construction.quasitree; |
11 | 11 | ||
12 | import java.util.Comparator; | 12 | import java.util.Comparator; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.rete.util.Options; | 14 | import tools.refinery.interpreter.rete.util.Options; |
15 | import tools.refinery.viatra.runtime.rete.util.OrderingCompareAgent; | 15 | import tools.refinery.interpreter.rete.util.OrderingCompareAgent; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * @author Gabor Bergmann | 18 | * @author Gabor Bergmann |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | public class JoinOrderingHeuristics implements Comparator<JoinCandidate> { | 21 | public class JoinOrderingHeuristics implements Comparator<JoinCandidate> { |
22 | 22 | ||
@@ -28,7 +28,7 @@ public class JoinOrderingHeuristics implements Comparator<JoinCandidate> { | |||
28 | swallowBoolean(true && consider(preferTrue(a.isTrivial(), b.isTrivial())) | 28 | swallowBoolean(true && consider(preferTrue(a.isTrivial(), b.isTrivial())) |
29 | && consider(preferTrue(a.isSubsumption(), b.isSubsumption())) | 29 | && consider(preferTrue(a.isSubsumption(), b.isSubsumption())) |
30 | && consider(preferTrue(a.isCheckOnly(), b.isCheckOnly())) | 30 | && consider(preferTrue(a.isCheckOnly(), b.isCheckOnly())) |
31 | && consider( | 31 | && consider( |
32 | Options.functionalDependencyOption == Options.FunctionalDependencyOption.OFF ? | 32 | Options.functionalDependencyOption == Options.FunctionalDependencyOption.OFF ? |
33 | dontCare() : | 33 | dontCare() : |
34 | preferTrue(a.isHeath(), b.isHeath()) | 34 | preferTrue(a.isHeath(), b.isHeath()) |
@@ -46,4 +46,4 @@ public class JoinOrderingHeuristics implements Comparator<JoinCandidate> { | |||
46 | 46 | ||
47 | } | 47 | } |
48 | 48 | ||
49 | } \ No newline at end of file | 49 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/quasitree/QuasiTreeLayout.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/QuasiTreeLayout.java index 9b814376..85d1bdd8 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/quasitree/QuasiTreeLayout.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/QuasiTreeLayout.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.construction.quasitree; | 10 | package tools.refinery.interpreter.rete.construction.quasitree; |
11 | 11 | ||
12 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
13 | import java.util.Collections; | 13 | import java.util.Collections; |
@@ -16,33 +16,33 @@ import java.util.List; | |||
16 | import java.util.Set; | 16 | import java.util.Set; |
17 | 17 | ||
18 | import org.apache.log4j.Logger; | 18 | import org.apache.log4j.Logger; |
19 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 19 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
20 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendHintProvider; | 20 | import tools.refinery.interpreter.matchers.backend.IQueryBackendHintProvider; |
21 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 21 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
22 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 22 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
23 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 23 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
24 | import tools.refinery.viatra.runtime.matchers.planning.IQueryPlannerStrategy; | 24 | import tools.refinery.interpreter.matchers.planning.IQueryPlannerStrategy; |
25 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 25 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
26 | import tools.refinery.viatra.runtime.matchers.planning.SubPlanFactory; | 26 | import tools.refinery.interpreter.matchers.planning.SubPlanFactory; |
27 | import tools.refinery.viatra.runtime.matchers.planning.helpers.BuildHelper; | 27 | import tools.refinery.interpreter.matchers.planning.helpers.BuildHelper; |
28 | import tools.refinery.viatra.runtime.matchers.planning.operations.PApply; | 28 | import tools.refinery.interpreter.matchers.planning.operations.PApply; |
29 | import tools.refinery.viatra.runtime.matchers.planning.operations.PEnumerate; | 29 | import tools.refinery.interpreter.matchers.planning.operations.PEnumerate; |
30 | import tools.refinery.viatra.runtime.matchers.planning.operations.PProject; | 30 | import tools.refinery.interpreter.matchers.planning.operations.PProject; |
31 | import tools.refinery.viatra.runtime.matchers.planning.operations.PStart; | 31 | import tools.refinery.interpreter.matchers.planning.operations.PStart; |
32 | import tools.refinery.viatra.runtime.matchers.psystem.DeferredPConstraint; | 32 | import tools.refinery.interpreter.matchers.psystem.DeferredPConstraint; |
33 | import tools.refinery.viatra.runtime.matchers.psystem.EnumerablePConstraint; | 33 | import tools.refinery.interpreter.matchers.psystem.EnumerablePConstraint; |
34 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 34 | import tools.refinery.interpreter.matchers.psystem.PBody; |
35 | import tools.refinery.viatra.runtime.matchers.psystem.analysis.QueryAnalyzer; | 35 | import tools.refinery.interpreter.matchers.psystem.analysis.QueryAnalyzer; |
36 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.ConstantValue; | 36 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.ConstantValue; |
37 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 37 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
38 | import tools.refinery.viatra.runtime.rete.construction.RetePatternBuildException; | 38 | import tools.refinery.interpreter.rete.construction.RetePatternBuildException; |
39 | import tools.refinery.viatra.runtime.rete.util.ReteHintOptions; | 39 | import tools.refinery.interpreter.rete.util.ReteHintOptions; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * Layout ideas: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=398763 | 42 | * Layout ideas: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=398763 |
43 | * | 43 | * |
44 | * @author Gabor Bergmann | 44 | * @author Gabor Bergmann |
45 | * | 45 | * |
46 | */ | 46 | */ |
47 | public class QuasiTreeLayout implements IQueryPlannerStrategy { | 47 | public class QuasiTreeLayout implements IQueryPlannerStrategy { |
48 | 48 | ||
@@ -88,25 +88,25 @@ public class QuasiTreeLayout implements IQueryPlannerStrategy { | |||
88 | query = pSystem.getPattern(); | 88 | query = pSystem.getPattern(); |
89 | //this.compiler = compiler; | 89 | //this.compiler = compiler; |
90 | //planProcessor.setCompiler(compiler); | 90 | //planProcessor.setCompiler(compiler); |
91 | 91 | ||
92 | hints = hintProvider.getQueryEvaluationHint(query); | 92 | hints = hintProvider.getQueryEvaluationHint(query); |
93 | } | 93 | } |
94 | 94 | ||
95 | /** | 95 | /** |
96 | * @throws ViatraQueryRuntimeException | 96 | * @throws InterpreterRuntimeException |
97 | */ | 97 | */ |
98 | public SubPlan run() { | 98 | public SubPlan run() { |
99 | try { | 99 | try { |
100 | logger.debug(String.format( | 100 | logger.debug(String.format( |
101 | "%s: patternbody build started for %s", | 101 | "%s: patternbody build started for %s", |
102 | getClass().getSimpleName(), | 102 | getClass().getSimpleName(), |
103 | query.getFullyQualifiedName())); | 103 | query.getFullyQualifiedName())); |
104 | 104 | ||
105 | // PROCESS CONSTRAINTS | 105 | // PROCESS CONSTRAINTS |
106 | deferredConstraints = pSystem.getConstraintsOfType(DeferredPConstraint.class); | 106 | deferredConstraints = pSystem.getConstraintsOfType(DeferredPConstraint.class); |
107 | enumerableConstraints = pSystem.getConstraintsOfType(EnumerablePConstraint.class); | 107 | enumerableConstraints = pSystem.getConstraintsOfType(EnumerablePConstraint.class); |
108 | constantConstraints = pSystem.getConstraintsOfType(ConstantValue.class); | 108 | constantConstraints = pSystem.getConstraintsOfType(ConstantValue.class); |
109 | 109 | ||
110 | for (EnumerablePConstraint enumerable : enumerableConstraints) { | 110 | for (EnumerablePConstraint enumerable : enumerableConstraints) { |
111 | SubPlan plan = planFactory.createSubPlan(new PEnumerate(enumerable)); | 111 | SubPlan plan = planFactory.createSubPlan(new PEnumerate(enumerable)); |
112 | admitSubPlan(plan); | 112 | admitSubPlan(plan); |
@@ -130,14 +130,14 @@ public class QuasiTreeLayout implements IQueryPlannerStrategy { | |||
130 | // PROJECT TO PARAMETERS | 130 | // PROJECT TO PARAMETERS |
131 | SubPlan preFinalPlan = forefront.iterator().next(); | 131 | SubPlan preFinalPlan = forefront.iterator().next(); |
132 | SubPlan finalPlan = planFactory.createSubPlan(new PProject(pSystem.getSymbolicParameterVariables()), preFinalPlan); | 132 | SubPlan finalPlan = planFactory.createSubPlan(new PProject(pSystem.getSymbolicParameterVariables()), preFinalPlan); |
133 | 133 | ||
134 | // FINAL CHECK, whether all exported variables are present + all constraint satisfied | 134 | // FINAL CHECK, whether all exported variables are present + all constraint satisfied |
135 | BuildHelper.finalCheck(pSystem, finalPlan, context); | 135 | BuildHelper.finalCheck(pSystem, finalPlan, context); |
136 | // TODO integrate the check above in SubPlan / POperation | 136 | // TODO integrate the check above in SubPlan / POperation |
137 | 137 | ||
138 | logger.debug(String.format( | 138 | logger.debug(String.format( |
139 | "%s: patternbody query plan concluded for %s as: %s", | 139 | "%s: patternbody query plan concluded for %s as: %s", |
140 | getClass().getSimpleName(), | 140 | getClass().getSimpleName(), |
141 | query.getFullyQualifiedName(), | 141 | query.getFullyQualifiedName(), |
142 | finalPlan.toLongString())); | 142 | finalPlan.toLongString())); |
143 | return finalPlan; | 143 | return finalPlan; |
@@ -169,7 +169,7 @@ public class QuasiTreeLayout implements IQueryPlannerStrategy { | |||
169 | if (!plan.getAllEnforcedConstraints().contains(constantConstraint) && | 169 | if (!plan.getAllEnforcedConstraints().contains(constantConstraint) && |
170 | plan.getVisibleVariables().containsAll(constantConstraint.getAffectedVariables())) { | 170 | plan.getVisibleVariables().containsAll(constantConstraint.getAffectedVariables())) { |
171 | plan = planFactory.createSubPlan(new PApply(constantConstraint), plan); | 171 | plan = planFactory.createSubPlan(new PApply(constantConstraint), plan); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | } | 174 | } |
175 | // are there any variables that will not be needed anymore and are worth trimming? | 175 | // are there any variables that will not be needed anymore and are worth trimming? |
@@ -180,7 +180,7 @@ public class QuasiTreeLayout implements IQueryPlannerStrategy { | |||
180 | final SubPlan trimmed = BuildHelper.trimUnneccessaryVariables( | 180 | final SubPlan trimmed = BuildHelper.trimUnneccessaryVariables( |
181 | planFactory, plan, true, queryAnalyzer); | 181 | planFactory, plan, true, queryAnalyzer); |
182 | plan = trimmed; | 182 | plan = trimmed; |
183 | } | 183 | } |
184 | // are there any checkable constraints? | 184 | // are there any checkable constraints? |
185 | for (DeferredPConstraint deferred : deferredConstraints) { | 185 | for (DeferredPConstraint deferred : deferredConstraints) { |
186 | if (!plan.getAllEnforcedConstraints().contains(deferred)) { | 186 | if (!plan.getAllEnforcedConstraints().contains(deferred)) { |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/quasitree/TieBreaker.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/TieBreaker.java index 0b955922..7d015cd4 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/construction/quasitree/TieBreaker.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/construction/quasitree/TieBreaker.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.construction.quasitree; | 9 | package tools.refinery.interpreter.rete.construction.quasitree; |
10 | 10 | ||
11 | import java.util.Comparator; | 11 | import java.util.Comparator; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 13 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
14 | import tools.refinery.viatra.runtime.rete.util.LexicographicComparator; | 14 | import tools.refinery.interpreter.rete.util.LexicographicComparator; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Class providing comparators for breaking ties somewhat more deterministically. | 17 | * Class providing comparators for breaking ties somewhat more deterministically. |
@@ -19,12 +19,12 @@ import tools.refinery.viatra.runtime.rete.util.LexicographicComparator; | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | public class TieBreaker { | 21 | public class TieBreaker { |
22 | 22 | ||
23 | private TieBreaker() {/*Utility class constructor*/} | 23 | private TieBreaker() {/*Utility class constructor*/} |
24 | 24 | ||
25 | public static final Comparator<PConstraint> CONSTRAINT_COMPARATOR = (arg0, arg1) -> arg0.getMonotonousID() - arg1.getMonotonousID(); | 25 | public static final Comparator<PConstraint> CONSTRAINT_COMPARATOR = (arg0, arg1) -> arg0.getMonotonousID() - arg1.getMonotonousID(); |
26 | 26 | ||
27 | public static final Comparator<Iterable<? extends PConstraint>> CONSTRAINT_LIST_COMPARATOR = | 27 | public static final Comparator<Iterable<? extends PConstraint>> CONSTRAINT_LIST_COMPARATOR = |
28 | new LexicographicComparator<PConstraint>(CONSTRAINT_COMPARATOR); | 28 | new LexicographicComparator<PConstraint>(CONSTRAINT_COMPARATOR); |
29 | 29 | ||
30 | } | 30 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/AbstractEvaluatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/AbstractEvaluatorNode.java index d32a0449..ba282fca 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/AbstractEvaluatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/AbstractEvaluatorNode.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.eval; | 9 | package tools.refinery.interpreter.rete.eval; |
10 | 10 | ||
11 | import java.util.Iterator; | 11 | import java.util.Iterator; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 13 | import tools.refinery.interpreter.rete.network.ReteContainer; |
14 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 14 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
15 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 15 | import tools.refinery.interpreter.rete.single.SingleInputNode; |
16 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 16 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
17 | import tools.refinery.viatra.runtime.rete.single.SingleInputNode; | 17 | import tools.refinery.interpreter.matchers.util.Direction; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * @author Bergmann Gabor | 20 | * @author Bergmann Gabor |
21 | */ | 21 | */ |
22 | public abstract class AbstractEvaluatorNode extends SingleInputNode implements IEvaluatorNode { | 22 | public abstract class AbstractEvaluatorNode extends SingleInputNode implements IEvaluatorNode { |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * @since 1.5 | 25 | * @since 1.5 |
26 | */ | 26 | */ |
@@ -35,7 +35,7 @@ public abstract class AbstractEvaluatorNode extends SingleInputNode implements I | |||
35 | this.core = core; | 35 | this.core = core; |
36 | core.init(this); | 36 | core.init(this); |
37 | } | 37 | } |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * @since 1.5 | 40 | * @since 1.5 |
41 | */ | 41 | */ |
@@ -43,7 +43,7 @@ public abstract class AbstractEvaluatorNode extends SingleInputNode implements I | |||
43 | public ReteContainer getReteContainer() { | 43 | public ReteContainer getReteContainer() { |
44 | return getContainer(); | 44 | return getContainer(); |
45 | } | 45 | } |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * @since 1.5 | 48 | * @since 1.5 |
49 | */ | 49 | */ |
@@ -51,7 +51,7 @@ public abstract class AbstractEvaluatorNode extends SingleInputNode implements I | |||
51 | public String prettyPrintTraceInfoPatternList() { | 51 | public String prettyPrintTraceInfoPatternList() { |
52 | return getTraceInfoPatternsEnumerated(); | 52 | return getTraceInfoPatternsEnumerated(); |
53 | } | 53 | } |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * @since 2.4 | 56 | * @since 2.4 |
57 | */ | 57 | */ |
@@ -61,5 +61,5 @@ public abstract class AbstractEvaluatorNode extends SingleInputNode implements I | |||
61 | propagateUpdate(direction, itr.next(), timestamp); | 61 | propagateUpdate(direction, itr.next(), timestamp); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | } | 65 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/EvaluatorCore.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/EvaluatorCore.java index c45c6048..b695645e 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/EvaluatorCore.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/EvaluatorCore.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.eval; | 9 | package tools.refinery.interpreter.rete.eval; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
@@ -14,16 +14,16 @@ import java.util.Map; | |||
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import org.apache.log4j.Logger; | 16 | import org.apache.log4j.Logger; |
17 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 17 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.IExpressionEvaluator; | 18 | import tools.refinery.interpreter.matchers.psystem.IExpressionEvaluator; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 19 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
20 | import tools.refinery.viatra.runtime.matchers.tuple.TupleValueProvider; | 20 | import tools.refinery.interpreter.matchers.tuple.TupleValueProvider; |
21 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
22 | import tools.refinery.viatra.runtime.matchers.util.Sets; | 22 | import tools.refinery.interpreter.matchers.util.Sets; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * An instance of this class performs the evaluation of Java expressions. | 25 | * An instance of this class performs the evaluation of Java expressions. |
26 | * | 26 | * |
27 | * @author Bergmann Gabor | 27 | * @author Bergmann Gabor |
28 | * @author Tamas Szabo | 28 | * @author Tamas Szabo |
29 | * @since 1.5 | 29 | * @since 1.5 |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/IEvaluatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/IEvaluatorNode.java index 177433ab..129f5586 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/IEvaluatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/IEvaluatorNode.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.eval; | 9 | package tools.refinery.interpreter.rete.eval; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 11 | import tools.refinery.interpreter.rete.network.ReteContainer; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * This interface is required for the communication between the evaluation core end the evaluator node. | 14 | * This interface is required for the communication between the evaluation core end the evaluator node. |
@@ -20,6 +20,6 @@ public interface IEvaluatorNode { | |||
20 | ReteContainer getReteContainer(); | 20 | ReteContainer getReteContainer(); |
21 | 21 | ||
22 | String prettyPrintTraceInfoPatternList(); | 22 | String prettyPrintTraceInfoPatternList(); |
23 | 23 | ||
24 | 24 | ||
25 | } | 25 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/MemorylessEvaluatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/MemorylessEvaluatorNode.java index 8928645c..805272ed 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/MemorylessEvaluatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/MemorylessEvaluatorNode.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.eval; | 9 | package tools.refinery.interpreter.rete.eval; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
@@ -14,12 +14,12 @@ import java.util.Iterator; | |||
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | import java.util.Map.Entry; | 15 | import java.util.Map.Entry; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 17 | import tools.refinery.interpreter.rete.network.ReteContainer; |
18 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 18 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
19 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 19 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
20 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 20 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
21 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 21 | import tools.refinery.interpreter.matchers.util.Direction; |
22 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 22 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * @author Bergmann Gabor | 25 | * @author Bergmann Gabor |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/OutputCachingEvaluatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/OutputCachingEvaluatorNode.java index 40a20c4e..653975ed 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/OutputCachingEvaluatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/OutputCachingEvaluatorNode.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.eval; | 9 | package tools.refinery.interpreter.rete.eval; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -14,25 +14,25 @@ import java.util.Iterator; | |||
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | import java.util.Map.Entry; | 15 | import java.util.Map.Entry; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 17 | import tools.refinery.interpreter.rete.matcher.TimelyConfiguration; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 18 | import tools.refinery.interpreter.rete.network.ReteContainer; |
19 | import tools.refinery.viatra.runtime.matchers.util.Clearable; | 19 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
20 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 20 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
21 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 21 | import tools.refinery.interpreter.rete.network.communication.timely.ResumableNode; |
22 | import tools.refinery.viatra.runtime.matchers.util.Signed; | 22 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
23 | import tools.refinery.viatra.runtime.matchers.util.TimelyMemory; | 23 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
24 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 24 | import tools.refinery.interpreter.matchers.util.Clearable; |
25 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 25 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
26 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration.TimelineRepresentation; | 26 | import tools.refinery.interpreter.matchers.util.Direction; |
27 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 27 | import tools.refinery.interpreter.matchers.util.Signed; |
28 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 28 | import tools.refinery.interpreter.matchers.util.TimelyMemory; |
29 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 29 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
30 | import tools.refinery.viatra.runtime.rete.network.communication.timely.ResumableNode; | 30 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * An evaluator node that caches the evaluation result. This node is also capable of caching the timestamps associated | 33 | * An evaluator node that caches the evaluation result. This node is also capable of caching the timestamps associated |
34 | * with the result tuples if it is used in recursive differential dataflow evaluation. | 34 | * with the result tuples if it is used in recursive differential dataflow evaluation. |
35 | * | 35 | * |
36 | * @author Bergmann Gabor | 36 | * @author Bergmann Gabor |
37 | * @author Tamas Szabo | 37 | * @author Tamas Szabo |
38 | */ | 38 | */ |
@@ -51,7 +51,7 @@ public class OutputCachingEvaluatorNode extends AbstractEvaluatorNode implements | |||
51 | /** | 51 | /** |
52 | * Maps input tuples to timestamps. It is wrong to map evaluation result to timestamps because the different input | 52 | * Maps input tuples to timestamps. It is wrong to map evaluation result to timestamps because the different input |
53 | * tuples may yield the same evaluation result. This field is null as long as this node is in a non-recursive group. | 53 | * tuples may yield the same evaluation result. This field is null as long as this node is in a non-recursive group. |
54 | * | 54 | * |
55 | * @since 2.4 | 55 | * @since 2.4 |
56 | */ | 56 | */ |
57 | protected TimelyMemory<Timestamp> memory; | 57 | protected TimelyMemory<Timestamp> memory; |
@@ -103,7 +103,7 @@ public class OutputCachingEvaluatorNode extends AbstractEvaluatorNode implements | |||
103 | && this.reteContainer.getCommunicationTracker().isInRecursiveGroup(this)) { | 103 | && this.reteContainer.getCommunicationTracker().isInRecursiveGroup(this)) { |
104 | if (this.memory == null) { | 104 | if (this.memory == null) { |
105 | this.memory = new TimelyMemory<Timestamp>(reteContainer.isTimelyEvaluation() && reteContainer | 105 | this.memory = new TimelyMemory<Timestamp>(reteContainer.isTimelyEvaluation() && reteContainer |
106 | .getTimelyConfiguration().getTimelineRepresentation() == TimelineRepresentation.FAITHFUL); | 106 | .getTimelyConfiguration().getTimelineRepresentation() == TimelyConfiguration.TimelineRepresentation.FAITHFUL); |
107 | } | 107 | } |
108 | return TIMELY; | 108 | return TIMELY; |
109 | } else { | 109 | } else { |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/RelationEvaluatorNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/RelationEvaluatorNode.java index 68d277e8..640ac43b 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/eval/RelationEvaluatorNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/eval/RelationEvaluatorNode.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.eval; | 9 | package tools.refinery.interpreter.rete.eval; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
@@ -15,27 +15,27 @@ import java.util.Map; | |||
15 | import java.util.Map.Entry; | 15 | import java.util.Map.Entry; |
16 | import java.util.Set; | 16 | import java.util.Set; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.matchers.psystem.IRelationEvaluator; | 18 | import tools.refinery.interpreter.rete.misc.SimpleReceiver; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.RelationEvaluation; | 19 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
20 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 20 | import tools.refinery.interpreter.rete.single.AbstractUniquenessEnforcerNode; |
21 | import tools.refinery.viatra.runtime.matchers.util.Clearable; | 21 | import tools.refinery.interpreter.matchers.psystem.IRelationEvaluator; |
22 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 22 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.RelationEvaluation; |
23 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 23 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
24 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timelines; | 24 | import tools.refinery.interpreter.matchers.util.Clearable; |
25 | import tools.refinery.viatra.runtime.rete.misc.SimpleReceiver; | 25 | import tools.refinery.interpreter.matchers.util.Direction; |
26 | import tools.refinery.viatra.runtime.rete.network.ProductionNode; | 26 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
27 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 27 | import tools.refinery.interpreter.matchers.util.timeline.Timelines; |
28 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 28 | import tools.refinery.interpreter.rete.network.ProductionNode; |
29 | import tools.refinery.viatra.runtime.rete.network.StandardNode; | 29 | import tools.refinery.interpreter.rete.network.Receiver; |
30 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 30 | import tools.refinery.interpreter.rete.network.ReteContainer; |
31 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 31 | import tools.refinery.interpreter.rete.network.StandardNode; |
32 | import tools.refinery.viatra.runtime.rete.single.AbstractUniquenessEnforcerNode; | 32 | import tools.refinery.interpreter.rete.network.Supplier; |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * A node that operates in batch-style (see {@link Receiver#doesProcessUpdatesInBatch()} and evaluates arbitrary Java | 35 | * A node that operates in batch-style (see {@link Receiver#doesProcessUpdatesInBatch()} and evaluates arbitrary Java |
36 | * logic represented by an {@link IRelationEvaluator} on the input relations. This is the backing computation node of a | 36 | * logic represented by an {@link IRelationEvaluator} on the input relations. This is the backing computation node of a |
37 | * {@link RelationEvaluation} constraint. | 37 | * {@link RelationEvaluation} constraint. |
38 | * | 38 | * |
39 | * @author Tamas Szabo | 39 | * @author Tamas Szabo |
40 | * @since 2.8 | 40 | * @since 2.8 |
41 | */ | 41 | */ |
@@ -51,7 +51,7 @@ public class RelationEvaluatorNode extends StandardNode implements Supplier, Cle | |||
51 | this.evaluator = evaluator; | 51 | this.evaluator = evaluator; |
52 | this.reteContainer.registerClearable(this); | 52 | this.reteContainer.registerClearable(this); |
53 | } | 53 | } |
54 | 54 | ||
55 | @Override | 55 | @Override |
56 | public void clear() { | 56 | public void clear() { |
57 | this.cachedOutputs.clear(); | 57 | this.cachedOutputs.clear(); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/DefaultIndexerListener.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/DefaultIndexerListener.java index 6306a482..6ab37044 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/DefaultIndexerListener.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/DefaultIndexerListener.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.index; | 9 | package tools.refinery.interpreter.rete.index; |
10 | 10 | ||
11 | import java.lang.ref.WeakReference; | 11 | import java.lang.ref.WeakReference; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.rete.network.Node; | 13 | import tools.refinery.interpreter.rete.network.Node; |
14 | 14 | ||
15 | public abstract class DefaultIndexerListener implements IndexerListener { | 15 | public abstract class DefaultIndexerListener implements IndexerListener { |
16 | 16 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/DualInputNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/DualInputNode.java index 170ac460..c0529d8b 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/DualInputNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/DualInputNode.java | |||
@@ -3,34 +3,33 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.network.NetworkStructureChangeSensitiveNode; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 17 | import tools.refinery.interpreter.rete.network.Receiver; |
18 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 18 | import tools.refinery.interpreter.rete.network.ReteContainer; |
19 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 19 | import tools.refinery.interpreter.rete.network.StandardNode; |
20 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 20 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
21 | import tools.refinery.viatra.runtime.rete.network.NetworkStructureChangeSensitiveNode; | 21 | import tools.refinery.interpreter.rete.network.delayed.DelayedConnectCommand; |
22 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 22 | import tools.refinery.interpreter.rete.traceability.TraceInfo; |
23 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 23 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
24 | import tools.refinery.viatra.runtime.rete.network.StandardNode; | 24 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
25 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 25 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
26 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp.AllZeroMap; | 26 | import tools.refinery.interpreter.matchers.util.Direction; |
27 | import tools.refinery.viatra.runtime.rete.network.delayed.DelayedConnectCommand; | 27 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
28 | import tools.refinery.viatra.runtime.rete.traceability.TraceInfo; | 28 | import tools.refinery.interpreter.rete.util.Options; |
29 | import tools.refinery.viatra.runtime.rete.util.Options; | ||
30 | 29 | ||
31 | /** | 30 | /** |
32 | * Abstract superclass for nodes with two inputs that are matched against each other. | 31 | * Abstract superclass for nodes with two inputs that are matched against each other. |
33 | * | 32 | * |
34 | * @author Gabor Bergmann | 33 | * @author Gabor Bergmann |
35 | */ | 34 | */ |
36 | public abstract class DualInputNode extends StandardNode implements NetworkStructureChangeSensitiveNode { | 35 | public abstract class DualInputNode extends StandardNode implements NetworkStructureChangeSensitiveNode { |
@@ -50,7 +49,7 @@ public abstract class DualInputNode extends StandardNode implements NetworkStruc | |||
50 | 49 | ||
51 | /** | 50 | /** |
52 | * @author Gabor Bergmann | 51 | * @author Gabor Bergmann |
53 | * | 52 | * |
54 | */ | 53 | */ |
55 | public enum Side { | 54 | public enum Side { |
56 | PRIMARY, SECONDARY, BOTH; | 55 | PRIMARY, SECONDARY, BOTH; |
@@ -158,7 +157,7 @@ public abstract class DualInputNode extends StandardNode implements NetworkStruc | |||
158 | this.reteContainer.getDelayedCommandQueue() | 157 | this.reteContainer.getDelayedCommandQueue() |
159 | .add(new DelayedConnectCommand(this, receiver, this.reteContainer)); | 158 | .add(new DelayedConnectCommand(this, receiver, this.reteContainer)); |
160 | } | 159 | } |
161 | 160 | ||
162 | // Given that connectToIndexers registers new dependencies, the networkStructureChanged() method will be called | 161 | // Given that connectToIndexers registers new dependencies, the networkStructureChanged() method will be called |
163 | // by the CommunicationTracker, and the implementation of that method in turn will call refreshIndexerGroupCache() anyway. | 162 | // by the CommunicationTracker, and the implementation of that method in turn will call refreshIndexerGroupCache() anyway. |
164 | this.refreshIndexerGroupCache(); | 163 | this.refreshIndexerGroupCache(); |
@@ -308,7 +307,7 @@ public abstract class DualInputNode extends StandardNode implements NetworkStruc | |||
308 | if (tuples == null) { | 307 | if (tuples == null) { |
309 | return null; | 308 | return null; |
310 | } else { | 309 | } else { |
311 | return new AllZeroMap<Tuple>((Set<Tuple>) tuples); | 310 | return new Timestamp.AllZeroMap<Tuple>((Set<Tuple>) tuples); |
312 | } | 311 | } |
313 | } | 312 | } |
314 | } | 313 | } |
@@ -320,7 +319,7 @@ public abstract class DualInputNode extends StandardNode implements NetworkStruc | |||
320 | 319 | ||
321 | /** | 320 | /** |
322 | * Abstract handler for update event. | 321 | * Abstract handler for update event. |
323 | * | 322 | * |
324 | * @param side | 323 | * @param side |
325 | * The side on which the event occurred. | 324 | * The side on which the event occurred. |
326 | * @param direction | 325 | * @param direction |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/ExistenceNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/ExistenceNode.java index 275ff638..7400053d 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/ExistenceNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/ExistenceNode.java | |||
@@ -3,31 +3,31 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.rete.network.ReteContainer; |
16 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 16 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
17 | import tools.refinery.viatra.runtime.matchers.util.Signed; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 18 | import tools.refinery.interpreter.matchers.util.Direction; |
19 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 19 | import tools.refinery.interpreter.matchers.util.Signed; |
20 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 20 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * Propagates all substitutions arriving at the PRIMARY slot if and only if (a matching substitution on the SECONDARY is | 23 | * Propagates all substitutions arriving at the PRIMARY slot if and only if (a matching substitution on the SECONDARY is |
24 | * present) xor (NEGATIVE). | 24 | * present) xor (NEGATIVE). |
25 | * | 25 | * |
26 | * The negative parameter specifies whether this node checks for existence or non-existence. | 26 | * The negative parameter specifies whether this node checks for existence or non-existence. |
27 | * <p> | 27 | * <p> |
28 | * It is mandatory in differential dataflow evaluation that the secondary parent is in an upstream dependency component | 28 | * It is mandatory in differential dataflow evaluation that the secondary parent is in an upstream dependency component |
29 | * (so that every secondary tuple comes with zero timestamp). | 29 | * (so that every secondary tuple comes with zero timestamp). |
30 | * | 30 | * |
31 | * @author Gabor Bergmann | 31 | * @author Gabor Bergmann |
32 | */ | 32 | */ |
33 | public class ExistenceNode extends DualInputNode { | 33 | public class ExistenceNode extends DualInputNode { |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/GenericProjectionIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/GenericProjectionIndexer.java index 3de10def..db5a4f0d 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/GenericProjectionIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/GenericProjectionIndexer.java | |||
@@ -3,30 +3,30 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Iterator; | 13 | import java.util.Iterator; |
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.network.Receiver; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 17 | import tools.refinery.interpreter.rete.network.ReteContainer; |
18 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 18 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
19 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 19 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
20 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 20 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
21 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 21 | import tools.refinery.interpreter.matchers.util.Direction; |
22 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 22 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * A generic Indexer capable of indexing along any valid TupleMask. Does not keep track of parents, because will not | 25 | * A generic Indexer capable of indexing along any valid TupleMask. Does not keep track of parents, because will not |
26 | * ever pull parents. | 26 | * ever pull parents. |
27 | * | 27 | * |
28 | * @author Gabor Bergmann | 28 | * @author Gabor Bergmann |
29 | * | 29 | * |
30 | */ | 30 | */ |
31 | public class GenericProjectionIndexer extends IndexerWithMemory implements ProjectionIndexer { | 31 | public class GenericProjectionIndexer extends IndexerWithMemory implements ProjectionIndexer { |
32 | 32 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/IdentityIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/IdentityIndexer.java index 6c158f2c..ec98e70a 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/IdentityIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/IdentityIndexer.java | |||
@@ -3,30 +3,30 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Collections; | 13 | import java.util.Collections; |
14 | import java.util.Iterator; | 14 | import java.util.Iterator; |
15 | import java.util.List; | 15 | import java.util.List; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 17 | import tools.refinery.interpreter.rete.network.Node; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 18 | import tools.refinery.interpreter.rete.network.ReteContainer; |
19 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 19 | import tools.refinery.interpreter.rete.network.Supplier; |
20 | import tools.refinery.viatra.runtime.rete.network.Node; | 20 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
21 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
22 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 22 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
23 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 23 | import tools.refinery.interpreter.matchers.util.Direction; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * Defines an abstract trivial indexer that identically projects the contents of some stateful node, and can therefore | 26 | * Defines an abstract trivial indexer that identically projects the contents of some stateful node, and can therefore |
27 | * save space. Can only exist in connection with a stateful store, and must be operated by another node (the active | 27 | * save space. Can only exist in connection with a stateful store, and must be operated by another node (the active |
28 | * node). Do not attach parents directly! | 28 | * node). Do not attach parents directly! |
29 | * | 29 | * |
30 | * @author Gabor Bergmann | 30 | * @author Gabor Bergmann |
31 | * @noimplement Rely on the provided implementations | 31 | * @noimplement Rely on the provided implementations |
32 | * @noreference Use only via standard Node and Indexer interfaces | 32 | * @noreference Use only via standard Node and Indexer interfaces |
@@ -36,8 +36,8 @@ public abstract class IdentityIndexer extends SpecializedProjectionIndexer { | |||
36 | 36 | ||
37 | protected abstract Collection<Tuple> getTuples(); | 37 | protected abstract Collection<Tuple> getTuples(); |
38 | 38 | ||
39 | public IdentityIndexer(ReteContainer reteContainer, int tupleWidth, Supplier parent, | 39 | public IdentityIndexer(ReteContainer reteContainer, int tupleWidth, Supplier parent, |
40 | Node activeNode, List<ListenerSubscription> sharedSubscriptionList) { | 40 | Node activeNode, List<ListenerSubscription> sharedSubscriptionList) { |
41 | super(reteContainer, TupleMask.identity(tupleWidth), parent, activeNode, sharedSubscriptionList); | 41 | super(reteContainer, TupleMask.identity(tupleWidth), parent, activeNode, sharedSubscriptionList); |
42 | } | 42 | } |
43 | 43 | ||
@@ -48,7 +48,7 @@ public abstract class IdentityIndexer extends SpecializedProjectionIndexer { | |||
48 | } else | 48 | } else |
49 | return null; | 49 | return null; |
50 | } | 50 | } |
51 | 51 | ||
52 | protected boolean contains(Tuple signature) { | 52 | protected boolean contains(Tuple signature) { |
53 | return getTuples().contains(signature); | 53 | return getTuples().contains(signature); |
54 | } | 54 | } |
@@ -57,20 +57,20 @@ public abstract class IdentityIndexer extends SpecializedProjectionIndexer { | |||
57 | public Collection<Tuple> getSignatures() { | 57 | public Collection<Tuple> getSignatures() { |
58 | return getTuples(); | 58 | return getTuples(); |
59 | } | 59 | } |
60 | 60 | ||
61 | @Override | 61 | @Override |
62 | public int getBucketCount() { | 62 | public int getBucketCount() { |
63 | return getTuples().size(); | 63 | return getTuples().size(); |
64 | } | 64 | } |
65 | 65 | ||
66 | @Override | 66 | @Override |
67 | public Iterator<Tuple> iterator() { | 67 | public Iterator<Tuple> iterator() { |
68 | return getTuples().iterator(); | 68 | return getTuples().iterator(); |
69 | } | 69 | } |
70 | 70 | ||
71 | @Override | 71 | @Override |
72 | public void propagateToListener(IndexerListener listener, Direction direction, Tuple updateElement, Timestamp timestamp) { | 72 | public void propagateToListener(IndexerListener listener, Direction direction, Tuple updateElement, Timestamp timestamp) { |
73 | listener.notifyIndexerUpdate(direction, updateElement, updateElement, true, timestamp); | 73 | listener.notifyIndexerUpdate(direction, updateElement, updateElement, true, timestamp); |
74 | } | 74 | } |
75 | 75 | ||
76 | } \ No newline at end of file | 76 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/Indexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/Indexer.java index fc9d7781..200bdbc9 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/Indexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/Indexer.java | |||
@@ -3,29 +3,29 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.rete.network.Node; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 16 | import tools.refinery.interpreter.rete.network.Supplier; |
17 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 17 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
18 | import tools.refinery.viatra.runtime.rete.network.Node; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 19 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
20 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 20 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * A node that indexes incoming Tuples by their signatures as specified by a TupleMask. Notifies listeners about such | 23 | * A node that indexes incoming Tuples by their signatures as specified by a TupleMask. Notifies listeners about such |
24 | * update events through the IndexerListener. | 24 | * update events through the IndexerListener. |
25 | * | 25 | * |
26 | * Signature tuples are created by transforming the update tuples using the mask. Tuples stored with the same signature | 26 | * Signature tuples are created by transforming the update tuples using the mask. Tuples stored with the same signature |
27 | * are grouped together. The group or a reduction thereof is retrievable. | 27 | * are grouped together. The group or a reduction thereof is retrievable. |
28 | * | 28 | * |
29 | * @author Gabor Bergmann | 29 | * @author Gabor Bergmann |
30 | */ | 30 | */ |
31 | public interface Indexer extends Node { | 31 | public interface Indexer extends Node { |
@@ -44,7 +44,7 @@ public interface Indexer extends Node { | |||
44 | * modify! | 44 | * modify! |
45 | */ | 45 | */ |
46 | public Collection<Tuple> get(Tuple signature); | 46 | public Collection<Tuple> get(Tuple signature); |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * @since 2.4 | 49 | * @since 2.4 |
50 | */ | 50 | */ |
@@ -56,14 +56,14 @@ public interface Indexer extends Node { | |||
56 | * This indexer will be updated whenever a Rete update is sent to the active node (or an equivalent time slot | 56 | * This indexer will be updated whenever a Rete update is sent to the active node (or an equivalent time slot |
57 | * allotted to it). The active node is typically the indexer itself, but it can be a different node such as its | 57 | * allotted to it). The active node is typically the indexer itself, but it can be a different node such as its |
58 | * parent. | 58 | * parent. |
59 | * | 59 | * |
60 | * @return the active node that operates this indexer | 60 | * @return the active node that operates this indexer |
61 | */ | 61 | */ |
62 | public Node getActiveNode(); | 62 | public Node getActiveNode(); |
63 | 63 | ||
64 | 64 | ||
65 | public Collection<IndexerListener> getListeners(); | 65 | public Collection<IndexerListener> getListeners(); |
66 | 66 | ||
67 | public void attachListener(IndexerListener listener); | 67 | public void attachListener(IndexerListener listener); |
68 | 68 | ||
69 | public void detachListener(IndexerListener listener); | 69 | public void detachListener(IndexerListener listener); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/IndexerListener.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/IndexerListener.java index f52b6a06..b7a724ef 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/IndexerListener.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/IndexerListener.java | |||
@@ -3,28 +3,28 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 12 | import tools.refinery.interpreter.rete.network.Node; |
13 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 13 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
14 | import tools.refinery.viatra.runtime.rete.network.Node; | 14 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
15 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 15 | import tools.refinery.interpreter.matchers.util.Direction; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * A listener for update events concerning an Indexer. | 18 | * A listener for update events concerning an Indexer. |
19 | * | 19 | * |
20 | * @author Gabor Bergmann | 20 | * @author Gabor Bergmann |
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | public interface IndexerListener { | 23 | public interface IndexerListener { |
24 | /** | 24 | /** |
25 | * Notifies recipient that the indexer has just received an update. Contract: indexer already reflects the updated | 25 | * Notifies recipient that the indexer has just received an update. Contract: indexer already reflects the updated |
26 | * state. | 26 | * state. |
27 | * | 27 | * |
28 | * @param direction | 28 | * @param direction |
29 | * the direction of the update. | 29 | * the direction of the update. |
30 | * @param updateElement | 30 | * @param updateElement |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/IndexerWithMemory.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/IndexerWithMemory.java index a31562e9..75a72daf 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/IndexerWithMemory.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/IndexerWithMemory.java | |||
@@ -3,36 +3,36 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Collections; | 13 | import java.util.Collections; |
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | import java.util.Map.Entry; | 15 | import java.util.Map.Entry; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.memories.MaskedTupleMemory; | 17 | import tools.refinery.interpreter.rete.matcher.TimelyConfiguration; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 18 | import tools.refinery.interpreter.rete.network.NetworkStructureChangeSensitiveNode; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 19 | import tools.refinery.interpreter.rete.network.Receiver; |
20 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 20 | import tools.refinery.interpreter.rete.network.ReteContainer; |
21 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | 21 | import tools.refinery.interpreter.rete.network.Supplier; |
22 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 22 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
23 | import tools.refinery.viatra.runtime.matchers.util.Signed; | 23 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
24 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 24 | import tools.refinery.interpreter.rete.network.communication.timely.ResumableNode; |
25 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration.TimelineRepresentation; | 25 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
26 | import tools.refinery.viatra.runtime.rete.network.NetworkStructureChangeSensitiveNode; | 26 | import tools.refinery.interpreter.rete.network.mailbox.timeless.BehaviorChangingMailbox; |
27 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 27 | import tools.refinery.interpreter.rete.network.mailbox.timely.TimelyMailbox; |
28 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 28 | import tools.refinery.interpreter.matchers.memories.MaskedTupleMemory; |
29 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 29 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
30 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 30 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
31 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 31 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
32 | import tools.refinery.viatra.runtime.rete.network.communication.timely.ResumableNode; | 32 | import tools.refinery.interpreter.matchers.util.CollectionsFactory.MemoryType; |
33 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 33 | import tools.refinery.interpreter.matchers.util.Direction; |
34 | import tools.refinery.viatra.runtime.rete.network.mailbox.timeless.BehaviorChangingMailbox; | 34 | import tools.refinery.interpreter.matchers.util.Signed; |
35 | import tools.refinery.viatra.runtime.rete.network.mailbox.timely.TimelyMailbox; | 35 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * @author Gabor Bergmann | 38 | * @author Gabor Bergmann |
@@ -63,7 +63,7 @@ public abstract class IndexerWithMemory extends StandardIndexer | |||
63 | final boolean isTimely = reteContainer.isTimelyEvaluation() | 63 | final boolean isTimely = reteContainer.isTimelyEvaluation() |
64 | && reteContainer.getCommunicationTracker().isInRecursiveGroup(this); | 64 | && reteContainer.getCommunicationTracker().isInRecursiveGroup(this); |
65 | memory = MaskedTupleMemory.create(mask, MemoryType.SETS, this, isTimely, isTimely && reteContainer | 65 | memory = MaskedTupleMemory.create(mask, MemoryType.SETS, this, isTimely, isTimely && reteContainer |
66 | .getTimelyConfiguration().getTimelineRepresentation() == TimelineRepresentation.FAITHFUL); | 66 | .getTimelyConfiguration().getTimelineRepresentation() == TimelyConfiguration.TimelineRepresentation.FAITHFUL); |
67 | reteContainer.registerClearable(memory); | 67 | reteContainer.registerClearable(memory); |
68 | mailbox = instantiateMailbox(); | 68 | mailbox = instantiateMailbox(); |
69 | reteContainer.registerClearable(mailbox); | 69 | reteContainer.registerClearable(mailbox); |
@@ -89,7 +89,7 @@ public abstract class IndexerWithMemory extends StandardIndexer | |||
89 | if (wasTimely != isTimely) { | 89 | if (wasTimely != isTimely) { |
90 | final MaskedTupleMemory<Timestamp> newMemory = MaskedTupleMemory.create(mask, MemoryType.SETS, this, | 90 | final MaskedTupleMemory<Timestamp> newMemory = MaskedTupleMemory.create(mask, MemoryType.SETS, this, |
91 | isTimely, isTimely && reteContainer.getTimelyConfiguration() | 91 | isTimely, isTimely && reteContainer.getTimelyConfiguration() |
92 | .getTimelineRepresentation() == TimelineRepresentation.FAITHFUL); | 92 | .getTimelineRepresentation() == TimelyConfiguration.TimelineRepresentation.FAITHFUL); |
93 | newMemory.initializeWith(this.memory, Timestamp.ZERO); | 93 | newMemory.initializeWith(this.memory, Timestamp.ZERO); |
94 | memory.clear(); | 94 | memory.clear(); |
95 | memory = newMemory; | 95 | memory = newMemory; |
@@ -100,7 +100,7 @@ public abstract class IndexerWithMemory extends StandardIndexer | |||
100 | /** | 100 | /** |
101 | * Instantiates the {@link Mailbox} of this receiver. Subclasses may override this method to provide their own | 101 | * Instantiates the {@link Mailbox} of this receiver. Subclasses may override this method to provide their own |
102 | * mailbox implementation. | 102 | * mailbox implementation. |
103 | * | 103 | * |
104 | * @return the mailbox | 104 | * @return the mailbox |
105 | * @since 2.0 | 105 | * @since 2.0 |
106 | */ | 106 | */ |
@@ -131,7 +131,7 @@ public abstract class IndexerWithMemory extends StandardIndexer | |||
131 | 131 | ||
132 | /** | 132 | /** |
133 | * Refined version of update | 133 | * Refined version of update |
134 | * | 134 | * |
135 | * @since 2.4 | 135 | * @since 2.4 |
136 | */ | 136 | */ |
137 | protected abstract void update(final Direction direction, final Tuple updateElement, final Tuple signature, | 137 | protected abstract void update(final Direction direction, final Tuple updateElement, final Tuple signature, |
@@ -281,4 +281,4 @@ public abstract class IndexerWithMemory extends StandardIndexer | |||
281 | 281 | ||
282 | }; | 282 | }; |
283 | 283 | ||
284 | } \ No newline at end of file | 284 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/IterableIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/IterableIndexer.java index d6f8ef05..553708a1 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/IterableIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/IterableIndexer.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 12 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * An indexer that allows the iteration of all retrievable tuple groups (or reduced groups). | 15 | * An indexer that allows the iteration of all retrievable tuple groups (or reduced groups). |
16 | * | 16 | * |
17 | * @author Gabor Bergmann | 17 | * @author Gabor Bergmann |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | public interface IterableIndexer extends Indexer, Iterable<Tuple> { | 20 | public interface IterableIndexer extends Indexer, Iterable<Tuple> { |
21 | 21 | ||
@@ -30,5 +30,5 @@ public interface IterableIndexer extends Indexer, Iterable<Tuple> { | |||
30 | * @since 2.0 | 30 | * @since 2.0 |
31 | */ | 31 | */ |
32 | public int getBucketCount(); | 32 | public int getBucketCount(); |
33 | 33 | ||
34 | } | 34 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/JoinNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/JoinNode.java index 9a6a0de9..ab97b490 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/JoinNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/JoinNode.java | |||
@@ -3,26 +3,26 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.rete.network.ReteContainer; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 16 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
17 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.matchers.util.Signed; | 18 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
19 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 19 | import tools.refinery.interpreter.matchers.util.Direction; |
20 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 20 | import tools.refinery.interpreter.matchers.util.Signed; |
21 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 21 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * @author Gabor Bergmann | 24 | * @author Gabor Bergmann |
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | public class JoinNode extends DualInputNode { | 27 | public class JoinNode extends DualInputNode { |
28 | 28 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/MemoryIdentityIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/MemoryIdentityIndexer.java index 59b75c33..27bd68fe 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/MemoryIdentityIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/MemoryIdentityIndexer.java | |||
@@ -3,25 +3,25 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.List; | 13 | import java.util.List; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.rete.network.Receiver; |
16 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 16 | import tools.refinery.interpreter.rete.network.ReteContainer; |
17 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 17 | import tools.refinery.interpreter.rete.network.Supplier; |
18 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * Defines a trivial indexer that identically projects the contents of a memory-equipped node, and can therefore save | 21 | * Defines a trivial indexer that identically projects the contents of a memory-equipped node, and can therefore save |
22 | * space. Can only exist in connection with a memory, and must be operated by another node. Do not attach parents | 22 | * space. Can only exist in connection with a memory, and must be operated by another node. Do not attach parents |
23 | * directly! | 23 | * directly! |
24 | * | 24 | * |
25 | * @noimplement Rely on the provided implementations | 25 | * @noimplement Rely on the provided implementations |
26 | * @noreference Use only via standard Node and Indexer interfaces | 26 | * @noreference Use only via standard Node and Indexer interfaces |
27 | * @noinstantiate This class is not intended to be instantiated by clients. | 27 | * @noinstantiate This class is not intended to be instantiated by clients. |
@@ -42,7 +42,7 @@ public class MemoryIdentityIndexer extends IdentityIndexer { | |||
42 | * the parent node that owns the memory | 42 | * the parent node that owns the memory |
43 | */ | 43 | */ |
44 | public MemoryIdentityIndexer(ReteContainer reteContainer, int tupleWidth, Collection<Tuple> memory, | 44 | public MemoryIdentityIndexer(ReteContainer reteContainer, int tupleWidth, Collection<Tuple> memory, |
45 | Supplier parent, Receiver activeNode, List<ListenerSubscription> sharedSubscriptionList) { | 45 | Supplier parent, Receiver activeNode, List<ListenerSubscription> sharedSubscriptionList) { |
46 | super(reteContainer, tupleWidth, parent, activeNode, sharedSubscriptionList); | 46 | super(reteContainer, tupleWidth, parent, activeNode, sharedSubscriptionList); |
47 | this.memory = memory; | 47 | this.memory = memory; |
48 | } | 48 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/MemoryNullIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/MemoryNullIndexer.java index 204fe433..b6e55cca 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/MemoryNullIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/MemoryNullIndexer.java | |||
@@ -3,25 +3,25 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.List; | 13 | import java.util.List; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.rete.network.Receiver; |
16 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 16 | import tools.refinery.interpreter.rete.network.ReteContainer; |
17 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 17 | import tools.refinery.interpreter.rete.network.Supplier; |
18 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * Defines a trivial indexer that projects the contents of a memory-equipped node to the empty tuple, and can therefore | 21 | * Defines a trivial indexer that projects the contents of a memory-equipped node to the empty tuple, and can therefore |
22 | * save space. Can only exist in connection with a memory, and must be operated by another node. Do not attach parents | 22 | * save space. Can only exist in connection with a memory, and must be operated by another node. Do not attach parents |
23 | * directly! | 23 | * directly! |
24 | * | 24 | * |
25 | * @author Gabor Bergmann | 25 | * @author Gabor Bergmann |
26 | * @noimplement Rely on the provided implementations | 26 | * @noimplement Rely on the provided implementations |
27 | * @noreference Use only via standard Node and Indexer interfaces | 27 | * @noreference Use only via standard Node and Indexer interfaces |
@@ -41,7 +41,7 @@ public class MemoryNullIndexer extends NullIndexer { | |||
41 | * the parent node that owns the memory | 41 | * the parent node that owns the memory |
42 | */ | 42 | */ |
43 | public MemoryNullIndexer(ReteContainer reteContainer, int tupleWidth, Collection<Tuple> memory, | 43 | public MemoryNullIndexer(ReteContainer reteContainer, int tupleWidth, Collection<Tuple> memory, |
44 | Supplier parent, Receiver activeNode, List<ListenerSubscription> sharedSubscriptionList) { | 44 | Supplier parent, Receiver activeNode, List<ListenerSubscription> sharedSubscriptionList) { |
45 | super(reteContainer, tupleWidth, parent, activeNode, sharedSubscriptionList); | 45 | super(reteContainer, tupleWidth, parent, activeNode, sharedSubscriptionList); |
46 | this.memory = memory; | 46 | this.memory = memory; |
47 | } | 47 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/NullIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/NullIndexer.java index a875b29f..68bb8d2d 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/NullIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/NullIndexer.java | |||
@@ -3,31 +3,31 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Collections; | 13 | import java.util.Collections; |
14 | import java.util.Iterator; | 14 | import java.util.Iterator; |
15 | import java.util.List; | 15 | import java.util.List; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 17 | import tools.refinery.interpreter.rete.network.Node; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 18 | import tools.refinery.interpreter.rete.network.ReteContainer; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 19 | import tools.refinery.interpreter.rete.network.Supplier; |
20 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 20 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
21 | import tools.refinery.viatra.runtime.rete.network.Node; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
22 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 22 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
23 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 23 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
24 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 24 | import tools.refinery.interpreter.matchers.util.Direction; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Defines an abstract trivial indexer that projects the contents of some stateful node to the empty tuple, and can | 27 | * Defines an abstract trivial indexer that projects the contents of some stateful node to the empty tuple, and can |
28 | * therefore save space. Can only exist in connection with a stateful store, and must be operated by another node (the | 28 | * therefore save space. Can only exist in connection with a stateful store, and must be operated by another node (the |
29 | * active node). Do not attach parents directly! | 29 | * active node). Do not attach parents directly! |
30 | * | 30 | * |
31 | * @author Gabor Bergmann | 31 | * @author Gabor Bergmann |
32 | * @noimplement Rely on the provided implementations | 32 | * @noimplement Rely on the provided implementations |
33 | * @noreference Use only via standard Node and Indexer interfaces | 33 | * @noreference Use only via standard Node and Indexer interfaces |
@@ -42,7 +42,7 @@ public abstract class NullIndexer extends SpecializedProjectionIndexer { | |||
42 | protected static final Collection<Tuple> emptySet = Collections.emptySet(); | 42 | protected static final Collection<Tuple> emptySet = Collections.emptySet(); |
43 | 43 | ||
44 | public NullIndexer(ReteContainer reteContainer, int tupleWidth, Supplier parent, Node activeNode, | 44 | public NullIndexer(ReteContainer reteContainer, int tupleWidth, Supplier parent, Node activeNode, |
45 | List<ListenerSubscription> sharedSubscriptionList) { | 45 | List<ListenerSubscription> sharedSubscriptionList) { |
46 | super(reteContainer, TupleMask.linear(0, tupleWidth), parent, activeNode, sharedSubscriptionList); | 46 | super(reteContainer, TupleMask.linear(0, tupleWidth), parent, activeNode, sharedSubscriptionList); |
47 | } | 47 | } |
48 | 48 | ||
@@ -85,4 +85,4 @@ public abstract class NullIndexer extends SpecializedProjectionIndexer { | |||
85 | listener.notifyIndexerUpdate(direction, updateElement, nullSignature, radical, timestamp); | 85 | listener.notifyIndexerUpdate(direction, updateElement, nullSignature, radical, timestamp); |
86 | } | 86 | } |
87 | 87 | ||
88 | } \ No newline at end of file | 88 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/OnetimeIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/OnetimeIndexer.java index fef84bb1..52e79130 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/OnetimeIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/OnetimeIndexer.java | |||
@@ -3,18 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 14 | import tools.refinery.interpreter.rete.network.ReteContainer; |
15 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 15 | import tools.refinery.interpreter.rete.network.Supplier; |
16 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 16 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
17 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 17 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
18 | import tools.refinery.interpreter.rete.util.Options; | ||
18 | 19 | ||
19 | /** | 20 | /** |
20 | * @author Gabor Bergmann Indexer whose lifetime last until the first get() DO NOT connect to nodes! | 21 | * @author Gabor Bergmann Indexer whose lifetime last until the first get() DO NOT connect to nodes! |
@@ -27,7 +28,7 @@ public class OnetimeIndexer extends GenericProjectionIndexer { | |||
27 | 28 | ||
28 | @Override | 29 | @Override |
29 | public Collection<Tuple> get(Tuple signature) { | 30 | public Collection<Tuple> get(Tuple signature) { |
30 | if (tools.refinery.viatra.runtime.rete.util.Options.releaseOnetimeIndexers) { | 31 | if (Options.releaseOnetimeIndexers) { |
31 | reteContainer.unregisterClearable(memory); | 32 | reteContainer.unregisterClearable(memory); |
32 | reteContainer.unregisterNode(this); | 33 | reteContainer.unregisterNode(this); |
33 | } | 34 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/ProjectionIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/ProjectionIndexer.java index 58e593d9..587ad3eb 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/ProjectionIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/ProjectionIndexer.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * An iterable indexer that receives updates from a node, and groups received tuples intact, i.e. it does not reduce | 13 | * An iterable indexer that receives updates from a node, and groups received tuples intact, i.e. it does not reduce |
14 | * tuple groups. | 14 | * tuple groups. |
15 | * | 15 | * |
16 | * @author Gabor Bergmann | 16 | * @author Gabor Bergmann |
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | public interface ProjectionIndexer extends IterableIndexer { | 19 | public interface ProjectionIndexer extends IterableIndexer { |
20 | 20 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/SpecializedProjectionIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/SpecializedProjectionIndexer.java index 9c647aa9..27ba3976 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/SpecializedProjectionIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/SpecializedProjectionIndexer.java | |||
@@ -3,32 +3,32 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
13 | import java.util.List; | 13 | import java.util.List; |
14 | import java.util.Objects; | 14 | import java.util.Objects; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.network.Node; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 17 | import tools.refinery.interpreter.rete.network.ReteContainer; |
18 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 18 | import tools.refinery.interpreter.rete.network.Supplier; |
19 | import tools.refinery.viatra.runtime.rete.network.Node; | 19 | import tools.refinery.interpreter.rete.network.communication.CommunicationTracker; |
20 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 20 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
21 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
22 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTracker; | 22 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
23 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 23 | import tools.refinery.interpreter.matchers.util.Direction; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * A specialized projection indexer that can be memory-less (relying on an external source of information). | 26 | * A specialized projection indexer that can be memory-less (relying on an external source of information). |
27 | * | 27 | * |
28 | * <p> | 28 | * <p> |
29 | * All specialized projection indexers of a single node will share the same listener list, so that notification order is | 29 | * All specialized projection indexers of a single node will share the same listener list, so that notification order is |
30 | * maintained (see Bug 518434). | 30 | * maintained (see Bug 518434). |
31 | * | 31 | * |
32 | * @author Gabor Bergmann | 32 | * @author Gabor Bergmann |
33 | * @noimplement Rely on the provided implementations | 33 | * @noimplement Rely on the provided implementations |
34 | * @noreference Use only via standard Node and Indexer interfaces | 34 | * @noreference Use only via standard Node and Indexer interfaces |
@@ -43,7 +43,7 @@ public abstract class SpecializedProjectionIndexer extends StandardIndexer imple | |||
43 | * @since 1.7 | 43 | * @since 1.7 |
44 | */ | 44 | */ |
45 | public SpecializedProjectionIndexer(final ReteContainer reteContainer, final TupleMask mask, final Supplier parent, | 45 | public SpecializedProjectionIndexer(final ReteContainer reteContainer, final TupleMask mask, final Supplier parent, |
46 | final Node activeNode, final List<ListenerSubscription> subscriptions) { | 46 | final Node activeNode, final List<ListenerSubscription> subscriptions) { |
47 | super(reteContainer, mask); | 47 | super(reteContainer, mask); |
48 | this.parent = parent; | 48 | this.parent = parent; |
49 | this.activeNode = activeNode; | 49 | this.activeNode = activeNode; |
@@ -118,7 +118,7 @@ public abstract class SpecializedProjectionIndexer extends StandardIndexer imple | |||
118 | 118 | ||
119 | /** | 119 | /** |
120 | * Infrastructure to share subscriptions between specialized indexers of the same parent node. | 120 | * Infrastructure to share subscriptions between specialized indexers of the same parent node. |
121 | * | 121 | * |
122 | * @author Gabor Bergmann | 122 | * @author Gabor Bergmann |
123 | * @since 1.7 | 123 | * @since 1.7 |
124 | */ | 124 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/StandardIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/StandardIndexer.java index 9847a8dd..36b58ac7 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/StandardIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/StandardIndexer.java | |||
@@ -3,31 +3,31 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.index; | 10 | package tools.refinery.interpreter.rete.index; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.List; | 13 | import java.util.List; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.rete.network.BaseNode; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 16 | import tools.refinery.interpreter.rete.network.NetworkStructureChangeSensitiveNode; |
17 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 17 | import tools.refinery.interpreter.rete.network.ReteContainer; |
18 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 18 | import tools.refinery.interpreter.rete.network.Supplier; |
19 | import tools.refinery.viatra.runtime.rete.network.BaseNode; | 19 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
20 | import tools.refinery.viatra.runtime.rete.network.NetworkStructureChangeSensitiveNode; | 20 | import tools.refinery.interpreter.rete.traceability.TraceInfo; |
21 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
22 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 22 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
23 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 23 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
24 | import tools.refinery.viatra.runtime.rete.traceability.TraceInfo; | 24 | import tools.refinery.interpreter.matchers.util.Direction; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * An abstract standard implementation of the Indexer interface, providing common bookkeeping functionality. | 27 | * An abstract standard implementation of the Indexer interface, providing common bookkeeping functionality. |
28 | * | 28 | * |
29 | * @author Gabor Bergmann | 29 | * @author Gabor Bergmann |
30 | * | 30 | * |
31 | */ | 31 | */ |
32 | public abstract class StandardIndexer extends BaseNode implements Indexer, NetworkStructureChangeSensitiveNode { | 32 | public abstract class StandardIndexer extends BaseNode implements Indexer, NetworkStructureChangeSensitiveNode { |
33 | 33 | ||
@@ -70,7 +70,7 @@ public abstract class StandardIndexer extends BaseNode implements Indexer, Netwo | |||
70 | final IndexerListener proxy = this.getCommunicationTracker().proxifyIndexerListener(this, listener); | 70 | final IndexerListener proxy = this.getCommunicationTracker().proxifyIndexerListener(this, listener); |
71 | // See Bug 518434 | 71 | // See Bug 518434 |
72 | // Must add to the first position, so that the later listeners are notified earlier. | 72 | // Must add to the first position, so that the later listeners are notified earlier. |
73 | // Thus if the beta node added as listener is also an indirect descendant of the same indexer on its opposite slot, | 73 | // Thus if the beta node added as listener is also an indirect descendant of the same indexer on its opposite slot, |
74 | // then the beta node is connected later than its ancestor's listener, therefore it will be notified earlier, | 74 | // then the beta node is connected later than its ancestor's listener, therefore it will be notified earlier, |
75 | // eliminating duplicate insertions and lost deletions that would result from fall-through update propagation | 75 | // eliminating duplicate insertions and lost deletions that would result from fall-through update propagation |
76 | this.originalListeners.add(0, listener); | 76 | this.originalListeners.add(0, listener); |
@@ -91,7 +91,7 @@ public abstract class StandardIndexer extends BaseNode implements Indexer, Netwo | |||
91 | this.proxyListeners.remove(listenerToRemove); | 91 | this.proxyListeners.remove(listenerToRemove); |
92 | this.getCommunicationTracker().unregisterDependency(this, listener.getOwner()); | 92 | this.getCommunicationTracker().unregisterDependency(this, listener.getOwner()); |
93 | } | 93 | } |
94 | 94 | ||
95 | @Override | 95 | @Override |
96 | public void networkStructureChanged() { | 96 | public void networkStructureChanged() { |
97 | this.proxyListeners.clear(); | 97 | this.proxyListeners.clear(); |
@@ -114,7 +114,7 @@ public abstract class StandardIndexer extends BaseNode implements Indexer, Netwo | |||
114 | protected String toStringCore() { | 114 | protected String toStringCore() { |
115 | return super.toStringCore() + "(" + parent + "/" + mask + ")"; | 115 | return super.toStringCore() + "(" + parent + "/" + mask + ")"; |
116 | } | 116 | } |
117 | 117 | ||
118 | @Override | 118 | @Override |
119 | public void assignTraceInfo(TraceInfo traceInfo) { | 119 | public void assignTraceInfo(TraceInfo traceInfo) { |
120 | super.assignTraceInfo(traceInfo); | 120 | super.assignTraceInfo(traceInfo); |
@@ -123,5 +123,5 @@ public abstract class StandardIndexer extends BaseNode implements Indexer, Netwo | |||
123 | parent.acceptPropagatedTraceInfo(traceInfo); | 123 | parent.acceptPropagatedTraceInfo(traceInfo); |
124 | } | 124 | } |
125 | 125 | ||
126 | 126 | ||
127 | } | 127 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/TransitiveClosureNodeIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/TransitiveClosureNodeIndexer.java index 77202004..8b2a5270 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/TransitiveClosureNodeIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/TransitiveClosureNodeIndexer.java | |||
@@ -6,28 +6,28 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.index; | 9 | package tools.refinery.interpreter.rete.index; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.Iterator; | 13 | import java.util.Iterator; |
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.rete.itc.alg.incscc.IncSCCAlg; | 16 | import tools.refinery.interpreter.rete.itc.alg.misc.Tuple; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.MaskedTuple; | 17 | import tools.refinery.interpreter.rete.network.Receiver; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 18 | import tools.refinery.interpreter.rete.single.TransitiveClosureNode; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 19 | import tools.refinery.interpreter.rete.itc.alg.incscc.IncSCCAlg; |
20 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 20 | import tools.refinery.interpreter.matchers.tuple.MaskedTuple; |
21 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 21 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
22 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 22 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
23 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 23 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
24 | import tools.refinery.viatra.runtime.rete.single.TransitiveClosureNode; | 24 | import tools.refinery.interpreter.matchers.util.Direction; |
25 | 25 | ||
26 | // UNFINISHED, not used yet | 26 | // UNFINISHED, not used yet |
27 | public class TransitiveClosureNodeIndexer extends StandardIndexer implements IterableIndexer { | 27 | public class TransitiveClosureNodeIndexer extends StandardIndexer implements IterableIndexer { |
28 | private TransitiveClosureNode tcNode; | 28 | private TransitiveClosureNode tcNode; |
29 | private IncSCCAlg<Object> tcAlg; | 29 | private IncSCCAlg<Object> tcAlg; |
30 | private Collection<Tuple> emptySet; | 30 | private Collection<tools.refinery.interpreter.matchers.tuple.Tuple> emptySet; |
31 | 31 | ||
32 | public TransitiveClosureNodeIndexer(TupleMask mask, IncSCCAlg<Object> tcAlg, TransitiveClosureNode tcNode) { | 32 | public TransitiveClosureNodeIndexer(TupleMask mask, IncSCCAlg<Object> tcAlg, TransitiveClosureNode tcNode) { |
33 | super(tcNode.getContainer(), mask); | 33 | super(tcNode.getContainer(), mask); |
@@ -38,13 +38,13 @@ public class TransitiveClosureNodeIndexer extends StandardIndexer implements Ite | |||
38 | } | 38 | } |
39 | 39 | ||
40 | @Override | 40 | @Override |
41 | public Collection<Tuple> get(Tuple signature) { | 41 | public Collection<tools.refinery.interpreter.matchers.tuple.Tuple> get(tools.refinery.interpreter.matchers.tuple.Tuple signature) { |
42 | if (signature.getSize() == mask.sourceWidth) { | 42 | if (signature.getSize() == mask.sourceWidth) { |
43 | if (mask.indices.length == 0) { | 43 | if (mask.indices.length == 0) { |
44 | // mask ()/2 | 44 | // mask ()/2 |
45 | return getSignatures(); | 45 | return getSignatures(); |
46 | } else if (mask.indices.length == 1) { | 46 | } else if (mask.indices.length == 1) { |
47 | Set<Tuple> retSet = CollectionsFactory.createSet(); | 47 | Set<tools.refinery.interpreter.matchers.tuple.Tuple> retSet = CollectionsFactory.createSet(); |
48 | 48 | ||
49 | // mask (0)/2 | 49 | // mask (0)/2 |
50 | if (mask.indices[0] == 0) { | 50 | if (mask.indices[0] == 0) { |
@@ -67,14 +67,14 @@ public class TransitiveClosureNodeIndexer extends StandardIndexer implements Ite | |||
67 | if (mask.indices[0] == 0 && mask.indices[1] == 1) { | 67 | if (mask.indices[0] == 0 && mask.indices[1] == 1) { |
68 | Object source = signature.get(0); | 68 | Object source = signature.get(0); |
69 | Object target = signature.get(1); | 69 | Object target = signature.get(1); |
70 | Tuple singleton = Tuples.staticArityFlatTupleOf(source, target); | 70 | tools.refinery.interpreter.matchers.tuple.Tuple singleton = Tuples.staticArityFlatTupleOf(source, target); |
71 | return (tcAlg.isReachable(source, target) ? Collections.singleton(singleton) : emptySet); | 71 | return (tcAlg.isReachable(source, target) ? Collections.singleton(singleton) : emptySet); |
72 | } | 72 | } |
73 | // mask (1,0)/2 | 73 | // mask (1,0)/2 |
74 | if (mask.indices[0] == 1 && mask.indices[1] == 0) { | 74 | if (mask.indices[0] == 1 && mask.indices[1] == 0) { |
75 | Object source = signature.get(1); | 75 | Object source = signature.get(1); |
76 | Object target = signature.get(0); | 76 | Object target = signature.get(0); |
77 | Tuple singleton = Tuples.staticArityFlatTupleOf(source, target); | 77 | tools.refinery.interpreter.matchers.tuple.Tuple singleton = Tuples.staticArityFlatTupleOf(source, target); |
78 | return (tcAlg.isReachable(source, target) ? Collections.singleton(singleton) : emptySet); | 78 | return (tcAlg.isReachable(source, target) ? Collections.singleton(singleton) : emptySet); |
79 | } | 79 | } |
80 | } | 80 | } |
@@ -88,19 +88,19 @@ public class TransitiveClosureNodeIndexer extends StandardIndexer implements Ite | |||
88 | } | 88 | } |
89 | 89 | ||
90 | @Override | 90 | @Override |
91 | public Collection<Tuple> getSignatures() { | 91 | public Collection<tools.refinery.interpreter.matchers.tuple.Tuple> getSignatures() { |
92 | return asTupleCollection(tcAlg.getTcRelation()); | 92 | return asTupleCollection(tcAlg.getTcRelation()); |
93 | } | 93 | } |
94 | 94 | ||
95 | @Override | 95 | @Override |
96 | public Iterator<Tuple> iterator() { | 96 | public Iterator<tools.refinery.interpreter.matchers.tuple.Tuple> iterator() { |
97 | return asTupleCollection(tcAlg.getTcRelation()).iterator(); | 97 | return asTupleCollection(tcAlg.getTcRelation()).iterator(); |
98 | } | 98 | } |
99 | 99 | ||
100 | private Collection<Tuple> asTupleCollection( | 100 | private Collection<tools.refinery.interpreter.matchers.tuple.Tuple> asTupleCollection( |
101 | Collection<tools.refinery.viatra.runtime.rete.itc.alg.misc.Tuple<Object>> tuples) { | 101 | Collection<Tuple<Object>> tuples) { |
102 | Set<Tuple> retSet = CollectionsFactory.createSet(); | 102 | Set<tools.refinery.interpreter.matchers.tuple.Tuple> retSet = CollectionsFactory.createSet(); |
103 | for (tools.refinery.viatra.runtime.rete.itc.alg.misc.Tuple<Object> tuple : tuples) { | 103 | for (Tuple<Object> tuple : tuples) { |
104 | retSet.add(Tuples.staticArityFlatTupleOf(tuple.getSource(), tuple.getTarget())); | 104 | retSet.add(Tuples.staticArityFlatTupleOf(tuple.getSource(), tuple.getTarget())); |
105 | } | 105 | } |
106 | return retSet; | 106 | return retSet; |
@@ -109,7 +109,7 @@ public class TransitiveClosureNodeIndexer extends StandardIndexer implements Ite | |||
109 | /** | 109 | /** |
110 | * @since 2.4 | 110 | * @since 2.4 |
111 | */ | 111 | */ |
112 | public void propagate(Direction direction, Tuple updateElement, boolean change) { | 112 | public void propagate(Direction direction, tools.refinery.interpreter.matchers.tuple.Tuple updateElement, boolean change) { |
113 | propagate(direction, updateElement, new MaskedTuple(updateElement, mask), change, null); | 113 | propagate(direction, updateElement, new MaskedTuple(updateElement, mask), change, null); |
114 | } | 114 | } |
115 | 115 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/timely/TimelyMemoryIdentityIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/timely/TimelyMemoryIdentityIndexer.java index 4319ee29..962b3137 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/timely/TimelyMemoryIdentityIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/timely/TimelyMemoryIdentityIndexer.java | |||
@@ -3,32 +3,32 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.index.timely; | 9 | package tools.refinery.interpreter.rete.index.timely; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.List; | 13 | import java.util.List; |
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.network.Receiver; |
17 | import tools.refinery.viatra.runtime.matchers.util.TimelyMemory; | 17 | import tools.refinery.interpreter.rete.network.ReteContainer; |
18 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 18 | import tools.refinery.interpreter.rete.network.Supplier; |
19 | import tools.refinery.viatra.runtime.rete.index.IdentityIndexer; | 19 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
20 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 20 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
21 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 21 | import tools.refinery.interpreter.matchers.util.TimelyMemory; |
22 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 22 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
23 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 23 | import tools.refinery.interpreter.rete.index.IdentityIndexer; |
24 | 24 | ||
25 | public class TimelyMemoryIdentityIndexer extends IdentityIndexer { | 25 | public class TimelyMemoryIdentityIndexer extends IdentityIndexer { |
26 | 26 | ||
27 | protected final TimelyMemory<Timestamp> memory; | 27 | protected final TimelyMemory<Timestamp> memory; |
28 | 28 | ||
29 | public TimelyMemoryIdentityIndexer(final ReteContainer reteContainer, final int tupleWidth, | 29 | public TimelyMemoryIdentityIndexer(final ReteContainer reteContainer, final int tupleWidth, |
30 | final TimelyMemory<Timestamp> memory, final Supplier parent, final Receiver activeNode, | 30 | final TimelyMemory<Timestamp> memory, final Supplier parent, final Receiver activeNode, |
31 | final List<ListenerSubscription> sharedSubscriptionList) { | 31 | final List<ListenerSubscription> sharedSubscriptionList) { |
32 | super(reteContainer, tupleWidth, parent, activeNode, sharedSubscriptionList); | 32 | super(reteContainer, tupleWidth, parent, activeNode, sharedSubscriptionList); |
33 | this.memory = memory; | 33 | this.memory = memory; |
34 | } | 34 | } |
@@ -42,7 +42,7 @@ public class TimelyMemoryIdentityIndexer extends IdentityIndexer { | |||
42 | return null; | 42 | return null; |
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | @Override | 46 | @Override |
47 | protected Collection<Tuple> getTuples() { | 47 | protected Collection<Tuple> getTuples() { |
48 | return this.memory.getTuplesAtInfinity(); | 48 | return this.memory.getTuplesAtInfinity(); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/timely/TimelyMemoryNullIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/timely/TimelyMemoryNullIndexer.java index 0386b006..3ec8529b 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/index/timely/TimelyMemoryNullIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/index/timely/TimelyMemoryNullIndexer.java | |||
@@ -3,31 +3,31 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.index.timely; | 9 | package tools.refinery.interpreter.rete.index.timely; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.List; | 12 | import java.util.List; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.rete.network.Receiver; |
16 | import tools.refinery.viatra.runtime.matchers.util.TimelyMemory; | 16 | import tools.refinery.interpreter.rete.network.ReteContainer; |
17 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 17 | import tools.refinery.interpreter.rete.network.Supplier; |
18 | import tools.refinery.viatra.runtime.rete.index.NullIndexer; | 18 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
19 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 19 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
20 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 20 | import tools.refinery.interpreter.matchers.util.TimelyMemory; |
21 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 21 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
22 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 22 | import tools.refinery.interpreter.rete.index.NullIndexer; |
23 | 23 | ||
24 | public class TimelyMemoryNullIndexer extends NullIndexer { | 24 | public class TimelyMemoryNullIndexer extends NullIndexer { |
25 | 25 | ||
26 | protected final TimelyMemory<Timestamp> memory; | 26 | protected final TimelyMemory<Timestamp> memory; |
27 | 27 | ||
28 | public TimelyMemoryNullIndexer(final ReteContainer reteContainer, final int tupleWidth, | 28 | public TimelyMemoryNullIndexer(final ReteContainer reteContainer, final int tupleWidth, |
29 | final TimelyMemory<Timestamp> memory, final Supplier parent, | 29 | final TimelyMemory<Timestamp> memory, final Supplier parent, |
30 | final Receiver activeNode, final List<ListenerSubscription> sharedSubscriptionList) { | 30 | final Receiver activeNode, final List<ListenerSubscription> sharedSubscriptionList) { |
31 | super(reteContainer, tupleWidth, parent, activeNode, sharedSubscriptionList); | 31 | super(reteContainer, tupleWidth, parent, activeNode, sharedSubscriptionList); |
32 | this.memory = memory; | 32 | this.memory = memory; |
33 | } | 33 | } |
@@ -40,7 +40,7 @@ public class TimelyMemoryNullIndexer extends NullIndexer { | |||
40 | return null; | 40 | return null; |
41 | } | 41 | } |
42 | } | 42 | } |
43 | 43 | ||
44 | @Override | 44 | @Override |
45 | protected Collection<Tuple> getTuples() { | 45 | protected Collection<Tuple> getTuples() { |
46 | return this.memory.getTuplesAtInfinity(); | 46 | return this.memory.getTuplesAtInfinity(); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/counting/CountingAlg.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/counting/CountingAlg.java index 199b44b1..7382498b 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/counting/CountingAlg.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/counting/CountingAlg.java | |||
@@ -7,22 +7,22 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.alg.counting; | 10 | package tools.refinery.interpreter.rete.itc.alg.counting; |
11 | 11 | ||
12 | import java.util.List; | 12 | import java.util.List; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.DFSPathFinder; | 15 | import tools.refinery.interpreter.rete.itc.alg.misc.DFSPathFinder; |
16 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.IGraphPathFinder; | 16 | import tools.refinery.interpreter.rete.itc.alg.misc.IGraphPathFinder; |
17 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.ITcRelation; | 17 | import tools.refinery.interpreter.rete.itc.alg.misc.ITcRelation; |
18 | import tools.refinery.viatra.runtime.rete.itc.igraph.IBiDirectionalGraphDataSource; | 18 | import tools.refinery.interpreter.rete.itc.igraph.IBiDirectionalGraphDataSource; |
19 | import tools.refinery.viatra.runtime.rete.itc.igraph.IBiDirectionalWrapper; | 19 | import tools.refinery.interpreter.rete.itc.igraph.IBiDirectionalWrapper; |
20 | import tools.refinery.viatra.runtime.rete.itc.igraph.IGraphDataSource; | 20 | import tools.refinery.interpreter.rete.itc.igraph.IGraphDataSource; |
21 | import tools.refinery.viatra.runtime.rete.itc.igraph.IGraphObserver; | 21 | import tools.refinery.interpreter.rete.itc.igraph.IGraphObserver; |
22 | import tools.refinery.viatra.runtime.rete.itc.igraph.ITcDataSource; | 22 | import tools.refinery.interpreter.rete.itc.igraph.ITcDataSource; |
23 | import tools.refinery.viatra.runtime.rete.itc.igraph.ITcObserver; | 23 | import tools.refinery.interpreter.rete.itc.igraph.ITcObserver; |
24 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 24 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
25 | import tools.refinery.viatra.runtime.matchers.util.IMemoryView; | 25 | import tools.refinery.interpreter.matchers.util.IMemoryView; |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * This class is the optimized implementation of the Counting algorithm. | 28 | * This class is the optimized implementation of the Counting algorithm. |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/counting/CountingTcRelation.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/counting/CountingTcRelation.java index 474c7461..790b37ef 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/counting/CountingTcRelation.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/counting/CountingTcRelation.java | |||
@@ -7,20 +7,20 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.alg.counting; | 10 | package tools.refinery.interpreter.rete.itc.alg.counting; |
11 | 11 | ||
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.List; | 13 | import java.util.List; |
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.topsort.TopologicalSorting; | 16 | import tools.refinery.interpreter.rete.itc.igraph.IBiDirectionalGraphDataSource; |
17 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.ITcRelation; | 17 | import tools.refinery.interpreter.rete.itc.alg.misc.topsort.TopologicalSorting; |
18 | import tools.refinery.viatra.runtime.rete.itc.igraph.IBiDirectionalGraphDataSource; | 18 | import tools.refinery.interpreter.rete.itc.alg.misc.ITcRelation; |
19 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 19 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
20 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | 20 | import tools.refinery.interpreter.matchers.util.CollectionsFactory.MemoryType; |
21 | import tools.refinery.viatra.runtime.matchers.util.IMemoryView; | 21 | import tools.refinery.interpreter.matchers.util.IMemoryView; |
22 | import tools.refinery.viatra.runtime.matchers.util.IMultiLookup; | 22 | import tools.refinery.interpreter.matchers.util.IMultiLookup; |
23 | import tools.refinery.viatra.runtime.matchers.util.IMultiLookup.ChangeGranularity; | 23 | import tools.refinery.interpreter.matchers.util.IMultiLookup.ChangeGranularity; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * Transitive closure relation implementation for the Counting algorithm. | 26 | * Transitive closure relation implementation for the Counting algorithm. |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/incscc/CountingListener.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/incscc/CountingListener.java index 7d507d82..ca5c4769 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/incscc/CountingListener.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/incscc/CountingListener.java | |||
@@ -6,10 +6,10 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.itc.alg.incscc; | 9 | package tools.refinery.interpreter.rete.itc.alg.incscc; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.itc.igraph.ITcObserver; | 11 | import tools.refinery.interpreter.rete.itc.igraph.ITcObserver; |
12 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 12 | import tools.refinery.interpreter.matchers.util.Direction; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * @author Tamas Szabo | 15 | * @author Tamas Szabo |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/incscc/IncSCCAlg.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/incscc/IncSCCAlg.java index 774e55eb..6956b401 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/incscc/IncSCCAlg.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/incscc/IncSCCAlg.java | |||
@@ -7,23 +7,23 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.alg.incscc; | 10 | package tools.refinery.interpreter.rete.itc.alg.incscc; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.algorithms.UnionFind; | 12 | import tools.refinery.interpreter.matchers.algorithms.UnionFind; |
13 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 13 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
14 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 14 | import tools.refinery.interpreter.matchers.util.Direction; |
15 | import tools.refinery.viatra.runtime.matchers.util.IMemoryView; | 15 | import tools.refinery.interpreter.matchers.util.IMemoryView; |
16 | import tools.refinery.viatra.runtime.rete.itc.alg.counting.CountingAlg; | 16 | import tools.refinery.interpreter.rete.itc.alg.counting.CountingAlg; |
17 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.DFSPathFinder; | 17 | import tools.refinery.interpreter.rete.itc.alg.misc.DFSPathFinder; |
18 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.GraphHelper; | 18 | import tools.refinery.interpreter.rete.itc.alg.misc.GraphHelper; |
19 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.IGraphPathFinder; | 19 | import tools.refinery.interpreter.rete.itc.alg.misc.IGraphPathFinder; |
20 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.Tuple; | 20 | import tools.refinery.interpreter.rete.itc.alg.misc.Tuple; |
21 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.bfs.BFS; | 21 | import tools.refinery.interpreter.rete.itc.alg.misc.bfs.BFS; |
22 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.scc.SCC; | 22 | import tools.refinery.interpreter.rete.itc.alg.misc.scc.SCC; |
23 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.scc.SCCResult; | 23 | import tools.refinery.interpreter.rete.itc.alg.misc.scc.SCCResult; |
24 | import tools.refinery.viatra.runtime.rete.itc.alg.util.CollectionHelper; | 24 | import tools.refinery.interpreter.rete.itc.alg.util.CollectionHelper; |
25 | import tools.refinery.viatra.runtime.rete.itc.graphimpl.Graph; | 25 | import tools.refinery.interpreter.rete.itc.graphimpl.Graph; |
26 | import tools.refinery.viatra.runtime.rete.itc.igraph.*; | 26 | import tools.refinery.interpreter.rete.itc.igraph.*; |
27 | 27 | ||
28 | import java.util.*; | 28 | import java.util.*; |
29 | import java.util.Map.Entry; | 29 | import java.util.Map.Entry; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/DFSPathFinder.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/DFSPathFinder.java index 2cec33a2..ea94653e 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/DFSPathFinder.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/DFSPathFinder.java | |||
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.itc.alg.misc; | 9 | package tools.refinery.interpreter.rete.itc.alg.misc; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Deque; | 12 | import java.util.Deque; |
@@ -16,9 +16,9 @@ import java.util.LinkedList; | |||
16 | import java.util.List; | 16 | import java.util.List; |
17 | import java.util.Set; | 17 | import java.util.Set; |
18 | 18 | ||
19 | import tools.refinery.viatra.runtime.rete.itc.igraph.IGraphDataSource; | 19 | import tools.refinery.interpreter.rete.itc.igraph.IGraphDataSource; |
20 | import tools.refinery.viatra.runtime.rete.itc.igraph.ITcDataSource; | 20 | import tools.refinery.interpreter.rete.itc.igraph.ITcDataSource; |
21 | import tools.refinery.viatra.runtime.matchers.util.IMemoryView; | 21 | import tools.refinery.interpreter.matchers.util.IMemoryView; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * A depth-first search implementation of the {@link IGraphPathFinder}. | 24 | * A depth-first search implementation of the {@link IGraphPathFinder}. |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/Edge.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/Edge.java index 862c99b3..98646340 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/Edge.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/Edge.java | |||
@@ -7,7 +7,7 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.alg.misc; | 10 | package tools.refinery.interpreter.rete.itc.alg.misc; |
11 | 11 | ||
12 | public class Edge<V> { | 12 | public class Edge<V> { |
13 | private V source; | 13 | private V source; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/GraphHelper.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/GraphHelper.java index b79e4d45..9d1c3bcd 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/GraphHelper.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/GraphHelper.java | |||
@@ -6,12 +6,12 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.itc.alg.misc; | 9 | package tools.refinery.interpreter.rete.itc.alg.misc; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.util.IMemoryView; | 11 | import tools.refinery.interpreter.rete.itc.graphimpl.Graph; |
12 | import tools.refinery.viatra.runtime.rete.itc.graphimpl.Graph; | 12 | import tools.refinery.interpreter.rete.itc.igraph.IBiDirectionalGraphDataSource; |
13 | import tools.refinery.viatra.runtime.rete.itc.igraph.IBiDirectionalGraphDataSource; | 13 | import tools.refinery.interpreter.rete.itc.igraph.IGraphDataSource; |
14 | import tools.refinery.viatra.runtime.rete.itc.igraph.IGraphDataSource; | 14 | import tools.refinery.interpreter.matchers.util.IMemoryView; |
15 | 15 | ||
16 | import java.util.*; | 16 | import java.util.*; |
17 | import java.util.Map.Entry; | 17 | import java.util.Map.Entry; |
@@ -35,7 +35,7 @@ public class GraphHelper { | |||
35 | * @return the subgraph associated to the given nodes | 35 | * @return the subgraph associated to the given nodes |
36 | */ | 36 | */ |
37 | public static <V> Graph<V> getSubGraph(Collection<V> nodesInSubGraph, | 37 | public static <V> Graph<V> getSubGraph(Collection<V> nodesInSubGraph, |
38 | IBiDirectionalGraphDataSource<V> graphDataSource) { | 38 | IBiDirectionalGraphDataSource<V> graphDataSource) { |
39 | Graph<V> g = new Graph<V>(); | 39 | Graph<V> g = new Graph<V>(); |
40 | if (nodesInSubGraph != null) { | 40 | if (nodesInSubGraph != null) { |
41 | for (V node : nodesInSubGraph) { | 41 | for (V node : nodesInSubGraph) { |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/IGraphPathFinder.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/IGraphPathFinder.java index 624f9f7d..6f1544df 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/IGraphPathFinder.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/IGraphPathFinder.java | |||
@@ -6,12 +6,12 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.itc.alg.misc; | 9 | package tools.refinery.interpreter.rete.itc.alg.misc; |
10 | 10 | ||
11 | import java.util.Deque; | 11 | import java.util.Deque; |
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.rete.itc.igraph.ITcDataSource; | 14 | import tools.refinery.interpreter.rete.itc.igraph.ITcDataSource; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * The path finder provides methods for retrieving paths in a graph between a source node and one or more target nodes. | 17 | * The path finder provides methods for retrieving paths in a graph between a source node and one or more target nodes. |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/ITcRelation.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/ITcRelation.java index 9fd85ae1..5b0c8d98 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/ITcRelation.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/ITcRelation.java | |||
@@ -7,7 +7,7 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.alg.misc; | 10 | package tools.refinery.interpreter.rete.itc.alg.misc; |
11 | 11 | ||
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/Tuple.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/Tuple.java index 84c79dcf..0a74f932 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/Tuple.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/Tuple.java | |||
@@ -7,7 +7,7 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.alg.misc; | 10 | package tools.refinery.interpreter.rete.itc.alg.misc; |
11 | 11 | ||
12 | public class Tuple<V> { | 12 | public class Tuple<V> { |
13 | 13 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/bfs/BFS.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/bfs/BFS.java index 22ce8962..ecd164c0 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/bfs/BFS.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/bfs/BFS.java | |||
@@ -7,10 +7,10 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.alg.misc.bfs; | 10 | package tools.refinery.interpreter.rete.itc.alg.misc.bfs; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.rete.itc.igraph.IBiDirectionalGraphDataSource; | 12 | import tools.refinery.interpreter.rete.itc.igraph.IBiDirectionalGraphDataSource; |
13 | import tools.refinery.viatra.runtime.rete.itc.igraph.IGraphDataSource; | 13 | import tools.refinery.interpreter.rete.itc.igraph.IGraphDataSource; |
14 | 14 | ||
15 | import java.util.*; | 15 | import java.util.*; |
16 | 16 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/scc/PKAlg.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/scc/PKAlg.java index 892d048e..0aaf8a0d 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/scc/PKAlg.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/scc/PKAlg.java | |||
@@ -7,7 +7,7 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.alg.misc.scc; | 10 | package tools.refinery.interpreter.rete.itc.alg.misc.scc; |
11 | 11 | ||
12 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
13 | import java.util.Collections; | 13 | import java.util.Collections; |
@@ -15,10 +15,10 @@ import java.util.HashMap; | |||
15 | import java.util.List; | 15 | import java.util.List; |
16 | import java.util.Map; | 16 | import java.util.Map; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.rete.itc.igraph.IBiDirectionalGraphDataSource; | 18 | import tools.refinery.interpreter.rete.itc.igraph.IBiDirectionalGraphDataSource; |
19 | import tools.refinery.viatra.runtime.rete.itc.igraph.IBiDirectionalWrapper; | 19 | import tools.refinery.interpreter.rete.itc.igraph.IBiDirectionalWrapper; |
20 | import tools.refinery.viatra.runtime.rete.itc.igraph.IGraphDataSource; | 20 | import tools.refinery.interpreter.rete.itc.igraph.IGraphDataSource; |
21 | import tools.refinery.viatra.runtime.rete.itc.igraph.IGraphObserver; | 21 | import tools.refinery.interpreter.rete.itc.igraph.IGraphObserver; |
22 | 22 | ||
23 | public class PKAlg<V> implements IGraphObserver<V> { | 23 | public class PKAlg<V> implements IGraphObserver<V> { |
24 | 24 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/scc/SCC.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/scc/SCC.java index de070839..da145fb1 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/scc/SCC.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/scc/SCC.java | |||
@@ -7,10 +7,10 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.alg.misc.scc; | 10 | package tools.refinery.interpreter.rete.itc.alg.misc.scc; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 12 | import tools.refinery.interpreter.rete.itc.igraph.IGraphDataSource; |
13 | import tools.refinery.viatra.runtime.rete.itc.igraph.IGraphDataSource; | 13 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
14 | 14 | ||
15 | import java.util.*; | 15 | import java.util.*; |
16 | 16 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/scc/SCCProperty.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/scc/SCCProperty.java index 51ee834e..727766fe 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/scc/SCCProperty.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/scc/SCCProperty.java | |||
@@ -7,7 +7,7 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.alg.misc.scc; | 10 | package tools.refinery.interpreter.rete.itc.alg.misc.scc; |
11 | 11 | ||
12 | public class SCCProperty { | 12 | public class SCCProperty { |
13 | private int index; | 13 | private int index; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/scc/SCCResult.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/scc/SCCResult.java index 2e511fd6..51edcca8 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/scc/SCCResult.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/scc/SCCResult.java | |||
@@ -7,12 +7,12 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.alg.misc.scc; | 10 | package tools.refinery.interpreter.rete.itc.alg.misc.scc; |
11 | 11 | ||
12 | import java.util.Map.Entry; | 12 | import java.util.Map.Entry; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.rete.itc.igraph.IGraphDataSource; | 15 | import tools.refinery.interpreter.rete.itc.igraph.IGraphDataSource; |
16 | 16 | ||
17 | public class SCCResult<V> { | 17 | public class SCCResult<V> { |
18 | 18 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/topsort/TopologicalSorting.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/topsort/TopologicalSorting.java index 89be6804..0a4351f0 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/misc/topsort/TopologicalSorting.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/misc/topsort/TopologicalSorting.java | |||
@@ -7,9 +7,9 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.alg.misc.topsort; | 10 | package tools.refinery.interpreter.rete.itc.alg.misc.topsort; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.rete.itc.igraph.IGraphDataSource; | 12 | import tools.refinery.interpreter.rete.itc.igraph.IGraphDataSource; |
13 | 13 | ||
14 | import java.util.*; | 14 | import java.util.*; |
15 | 15 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/representative/RepresentativeElectionAlgorithm.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/representative/RepresentativeElectionAlgorithm.java index 794dabc0..4d3ad759 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/representative/RepresentativeElectionAlgorithm.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/representative/RepresentativeElectionAlgorithm.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.viatra.runtime.rete.itc.alg.representative; | 6 | package tools.refinery.interpreter.rete.itc.alg.representative; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.rete.itc.graphimpl.Graph; | 8 | import tools.refinery.interpreter.rete.itc.graphimpl.Graph; |
9 | import tools.refinery.viatra.runtime.rete.itc.igraph.IGraphObserver; | 9 | import tools.refinery.interpreter.rete.itc.igraph.IGraphObserver; |
10 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 10 | import tools.refinery.interpreter.matchers.util.Direction; |
11 | 11 | ||
12 | import java.util.HashMap; | 12 | import java.util.HashMap; |
13 | import java.util.HashSet; | 13 | import java.util.HashSet; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/representative/RepresentativeObserver.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/representative/RepresentativeObserver.java index 6b772fa8..7844f1c7 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/representative/RepresentativeObserver.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/representative/RepresentativeObserver.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.viatra.runtime.rete.itc.alg.representative; | 6 | package tools.refinery.interpreter.rete.itc.alg.representative; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 8 | import tools.refinery.interpreter.matchers.util.Direction; |
9 | 9 | ||
10 | public interface RepresentativeObserver { | 10 | public interface RepresentativeObserver { |
11 | void tupleChanged(Object node, Object representative, Direction direction); | 11 | void tupleChanged(Object node, Object representative, Direction direction); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/representative/StronglyConnectedComponentAlgorithm.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/representative/StronglyConnectedComponentAlgorithm.java index 0463301b..44afd73e 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/representative/StronglyConnectedComponentAlgorithm.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/representative/StronglyConnectedComponentAlgorithm.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.viatra.runtime.rete.itc.alg.representative; | 6 | package tools.refinery.interpreter.rete.itc.alg.representative; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.GraphHelper; | 8 | import tools.refinery.interpreter.rete.itc.graphimpl.Graph; |
9 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.bfs.BFS; | 9 | import tools.refinery.interpreter.rete.itc.alg.misc.GraphHelper; |
10 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.scc.SCC; | 10 | import tools.refinery.interpreter.rete.itc.alg.misc.bfs.BFS; |
11 | import tools.refinery.viatra.runtime.rete.itc.graphimpl.Graph; | 11 | import tools.refinery.interpreter.rete.itc.alg.misc.scc.SCC; |
12 | 12 | ||
13 | import java.util.Collection; | 13 | import java.util.Collection; |
14 | import java.util.Set; | 14 | import java.util.Set; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/representative/WeaklyConnectedComponentAlgorithm.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/representative/WeaklyConnectedComponentAlgorithm.java index 704f0235..58227c44 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/representative/WeaklyConnectedComponentAlgorithm.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/representative/WeaklyConnectedComponentAlgorithm.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.viatra.runtime.rete.itc.alg.representative; | 6 | package tools.refinery.interpreter.rete.itc.alg.representative; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.rete.itc.graphimpl.Graph; | 8 | import tools.refinery.interpreter.rete.itc.graphimpl.Graph; |
9 | 9 | ||
10 | import java.util.ArrayDeque; | 10 | import java.util.ArrayDeque; |
11 | import java.util.HashSet; | 11 | import java.util.HashSet; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/util/CollectionHelper.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/util/CollectionHelper.java index 6655be6d..4cb227d7 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/alg/util/CollectionHelper.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/alg/util/CollectionHelper.java | |||
@@ -6,9 +6,9 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.itc.alg.util; | 9 | package tools.refinery.interpreter.rete.itc.alg.util; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 11 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
12 | 12 | ||
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/graphimpl/DotGenerator.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/graphimpl/DotGenerator.java index f7f6b5ed..b0998aa9 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/graphimpl/DotGenerator.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/graphimpl/DotGenerator.java | |||
@@ -6,11 +6,11 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.itc.graphimpl; | 9 | package tools.refinery.interpreter.rete.itc.graphimpl; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.scc.SCC; | 11 | import tools.refinery.interpreter.rete.itc.alg.misc.scc.SCC; |
12 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.scc.SCCResult; | 12 | import tools.refinery.interpreter.rete.itc.alg.misc.scc.SCCResult; |
13 | import tools.refinery.viatra.runtime.matchers.util.IMemoryView; | 13 | import tools.refinery.interpreter.matchers.util.IMemoryView; |
14 | 14 | ||
15 | import java.util.HashMap; | 15 | import java.util.HashMap; |
16 | import java.util.Map; | 16 | import java.util.Map; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/graphimpl/Graph.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/graphimpl/Graph.java index 91604cb2..1639fef4 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/graphimpl/Graph.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/graphimpl/Graph.java | |||
@@ -7,15 +7,15 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.graphimpl; | 10 | package tools.refinery.interpreter.rete.itc.graphimpl; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.rete.itc.igraph.IGraphDataSource; | 12 | import tools.refinery.interpreter.rete.itc.igraph.IGraphDataSource; |
13 | import tools.refinery.viatra.runtime.rete.itc.igraph.IGraphObserver; | 13 | import tools.refinery.interpreter.rete.itc.igraph.IGraphObserver; |
14 | import tools.refinery.viatra.runtime.rete.itc.igraph.IBiDirectionalGraphDataSource; | 14 | import tools.refinery.interpreter.rete.itc.igraph.IBiDirectionalGraphDataSource; |
15 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 15 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
16 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | 16 | import tools.refinery.interpreter.matchers.util.CollectionsFactory.MemoryType; |
17 | import tools.refinery.viatra.runtime.matchers.util.IMemoryView; | 17 | import tools.refinery.interpreter.matchers.util.IMemoryView; |
18 | import tools.refinery.viatra.runtime.matchers.util.IMultiLookup; | 18 | import tools.refinery.interpreter.matchers.util.IMultiLookup; |
19 | 19 | ||
20 | import java.util.List; | 20 | import java.util.List; |
21 | import java.util.Map; | 21 | import java.util.Map; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/IBiDirectionalGraphDataSource.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/IBiDirectionalGraphDataSource.java index 4fcaa71f..8119e607 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/IBiDirectionalGraphDataSource.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/IBiDirectionalGraphDataSource.java | |||
@@ -7,10 +7,10 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.igraph; | 10 | package tools.refinery.interpreter.rete.itc.igraph; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.util.IMemoryView; | 12 | import tools.refinery.interpreter.matchers.util.IMemoryView; |
13 | import tools.refinery.viatra.runtime.matchers.util.IMultiset; | 13 | import tools.refinery.interpreter.matchers.util.IMultiset; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * A bi-directional graph data source supports all operations that an {@link IGraphDataSource} does, but it | 16 | * A bi-directional graph data source supports all operations that an {@link IGraphDataSource} does, but it |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/IBiDirectionalWrapper.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/IBiDirectionalWrapper.java index c4315ca2..5e3f6430 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/IBiDirectionalWrapper.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/IBiDirectionalWrapper.java | |||
@@ -7,14 +7,14 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.igraph; | 10 | package tools.refinery.interpreter.rete.itc.igraph; |
11 | 11 | ||
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 14 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
15 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | 15 | import tools.refinery.interpreter.matchers.util.CollectionsFactory.MemoryType; |
16 | import tools.refinery.viatra.runtime.matchers.util.IMemoryView; | 16 | import tools.refinery.interpreter.matchers.util.IMemoryView; |
17 | import tools.refinery.viatra.runtime.matchers.util.IMultiLookup; | 17 | import tools.refinery.interpreter.matchers.util.IMultiLookup; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * This class can be used to wrap an {@link IGraphDataSource} into an {@link IBiDirectionalGraphDataSource}. This class | 20 | * This class can be used to wrap an {@link IGraphDataSource} into an {@link IBiDirectionalGraphDataSource}. This class |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/IGraphDataSource.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/IGraphDataSource.java index 9159a692..615088ed 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/IGraphDataSource.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/IGraphDataSource.java | |||
@@ -7,10 +7,10 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.igraph; | 10 | package tools.refinery.interpreter.rete.itc.igraph; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.util.IMemoryView; | 12 | import tools.refinery.interpreter.matchers.util.IMemoryView; |
13 | import tools.refinery.viatra.runtime.matchers.util.IMultiset; | 13 | import tools.refinery.interpreter.matchers.util.IMultiset; |
14 | 14 | ||
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | 16 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/IGraphObserver.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/IGraphObserver.java index a282216d..fb1ddcbd 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/IGraphObserver.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/IGraphObserver.java | |||
@@ -7,7 +7,7 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.igraph; | 10 | package tools.refinery.interpreter.rete.itc.igraph; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * Interface GraphObserver is used to observ the changes in a graph; edge and node insertion/deleteion. | 13 | * Interface GraphObserver is used to observ the changes in a graph; edge and node insertion/deleteion. |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/ITcDataSource.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/ITcDataSource.java index 5ede600f..c9b086d8 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/ITcDataSource.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/ITcDataSource.java | |||
@@ -7,11 +7,11 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.igraph; | 10 | package tools.refinery.interpreter.rete.itc.igraph; |
11 | 11 | ||
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.IGraphPathFinder; | 14 | import tools.refinery.interpreter.rete.itc.alg.misc.IGraphPathFinder; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * This interface defines those methods that a transitive reachability data source should provide. | 17 | * This interface defines those methods that a transitive reachability data source should provide. |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/ITcObserver.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/ITcObserver.java index 74e0cb75..97f855ad 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/itc/igraph/ITcObserver.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/itc/igraph/ITcObserver.java | |||
@@ -7,7 +7,7 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.itc.igraph; | 10 | package tools.refinery.interpreter.rete.itc.igraph; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * Interface ITcObserver is used to observe the changes in a transitive closure relation; tuple insertion/deletion. | 13 | * Interface ITcObserver is used to observe the changes in a transitive closure relation; tuple insertion/deletion. |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/DRedReteBackendFactory.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/DRedReteBackendFactory.java index 83e86fe6..1e0352eb 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/DRedReteBackendFactory.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/DRedReteBackendFactory.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.matcher; | 9 | package tools.refinery.interpreter.rete.matcher; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackend; | 11 | import tools.refinery.interpreter.matchers.backend.IQueryBackend; |
12 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 12 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * A {@link ReteBackendFactory} implementation that creates {@link ReteEngine}s that use delete and re-derive | 15 | * A {@link ReteBackendFactory} implementation that creates {@link ReteEngine}s that use delete and re-derive |
16 | * evaluation. | 16 | * evaluation. |
17 | * | 17 | * |
18 | * @author Tamas Szabo | 18 | * @author Tamas Szabo |
19 | * @since 2.2 | 19 | * @since 2.2 |
20 | */ | 20 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/HintConfigurator.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/HintConfigurator.java index a4fa4914..8e177303 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/HintConfigurator.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/HintConfigurator.java | |||
@@ -3,26 +3,26 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.matcher; | 9 | package tools.refinery.interpreter.rete.matcher; |
10 | 10 | ||
11 | import java.util.HashMap; | 11 | import java.util.HashMap; |
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendHintProvider; | 14 | import tools.refinery.interpreter.matchers.backend.IQueryBackendHintProvider; |
15 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 15 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 16 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * A configurable hint provider that gathers hints for queries during runtime, and delegates defaults to an external hint provider. | 19 | * A configurable hint provider that gathers hints for queries during runtime, and delegates defaults to an external hint provider. |
20 | * | 20 | * |
21 | * @author Gabor Bergmann | 21 | * @author Gabor Bergmann |
22 | * @since 1.5 | 22 | * @since 1.5 |
23 | */ | 23 | */ |
24 | class HintConfigurator implements IQueryBackendHintProvider { | 24 | class HintConfigurator implements IQueryBackendHintProvider { |
25 | 25 | ||
26 | private IQueryBackendHintProvider defaultHintProvider; | 26 | private IQueryBackendHintProvider defaultHintProvider; |
27 | private Map<PQuery, QueryEvaluationHint> storedHints = new HashMap<PQuery, QueryEvaluationHint>(); | 27 | private Map<PQuery, QueryEvaluationHint> storedHints = new HashMap<PQuery, QueryEvaluationHint>(); |
28 | 28 | ||
@@ -34,7 +34,7 @@ class HintConfigurator implements IQueryBackendHintProvider { | |||
34 | public QueryEvaluationHint getQueryEvaluationHint(PQuery query) { | 34 | public QueryEvaluationHint getQueryEvaluationHint(PQuery query) { |
35 | return defaultHintProvider.getQueryEvaluationHint(query).overrideBy(storedHints.get(query)); | 35 | return defaultHintProvider.getQueryEvaluationHint(query).overrideBy(storedHints.get(query)); |
36 | } | 36 | } |
37 | 37 | ||
38 | public void storeHint(PQuery query, QueryEvaluationHint hint) { | 38 | public void storeHint(PQuery query, QueryEvaluationHint hint) { |
39 | QueryEvaluationHint oldHint = storedHints.get(query); | 39 | QueryEvaluationHint oldHint = storedHints.get(query); |
40 | if (oldHint == null) | 40 | if (oldHint == null) |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/IncrementalMatcherCapability.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/IncrementalMatcherCapability.java index 4c64a1a1..735634de 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/IncrementalMatcherCapability.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/IncrementalMatcherCapability.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.matcher; | 9 | package tools.refinery.interpreter.rete.matcher; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.backend.IMatcherCapability; | 11 | import tools.refinery.interpreter.matchers.backend.IMatcherCapability; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * @author Grill Balázs | 14 | * @author Grill Balázs |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/ReteBackendFactory.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/ReteBackendFactory.java index 347cabc4..f84bd592 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/ReteBackendFactory.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/ReteBackendFactory.java | |||
@@ -3,20 +3,20 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.matcher; | 9 | package tools.refinery.interpreter.rete.matcher; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.backend.IMatcherCapability; | 11 | import tools.refinery.interpreter.rete.construction.plancompiler.ReteRecipeCompiler; |
12 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackend; | 12 | import tools.refinery.interpreter.matchers.backend.IMatcherCapability; |
13 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendFactory; | 13 | import tools.refinery.interpreter.matchers.backend.IQueryBackend; |
14 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendHintProvider; | 14 | import tools.refinery.interpreter.matchers.backend.IQueryBackendFactory; |
15 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 15 | import tools.refinery.interpreter.matchers.backend.IQueryBackendHintProvider; |
16 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 16 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 17 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
18 | import tools.refinery.viatra.runtime.rete.construction.plancompiler.ReteRecipeCompiler; | 18 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
19 | import tools.refinery.viatra.runtime.rete.util.Options; | 19 | import tools.refinery.interpreter.rete.util.Options; |
20 | 20 | ||
21 | public class ReteBackendFactory implements IQueryBackendFactory { | 21 | public class ReteBackendFactory implements IQueryBackendFactory { |
22 | /** | 22 | /** |
@@ -97,4 +97,4 @@ public class ReteBackendFactory implements IQueryBackendFactory { | |||
97 | return true; | 97 | return true; |
98 | } | 98 | } |
99 | 99 | ||
100 | } \ No newline at end of file | 100 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/ReteBackendFactoryProvider.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/ReteBackendFactoryProvider.java index 98775ab3..91c50c80 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/ReteBackendFactoryProvider.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/ReteBackendFactoryProvider.java | |||
@@ -3,13 +3,13 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.matcher; | 9 | package tools.refinery.interpreter.rete.matcher; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendFactory; | 11 | import tools.refinery.interpreter.matchers.backend.IQueryBackendFactory; |
12 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendFactoryProvider; | 12 | import tools.refinery.interpreter.matchers.backend.IQueryBackendFactoryProvider; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * @since 2.0 | 15 | * @since 2.0 |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/ReteEngine.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/ReteEngine.java index 9bd499f4..aa793e11 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/ReteEngine.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/ReteEngine.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.matcher; | 10 | package tools.refinery.interpreter.rete.matcher; |
11 | 11 | ||
12 | import java.lang.reflect.InvocationTargetException; | 12 | import java.lang.reflect.InvocationTargetException; |
13 | import java.util.Collection; | 13 | import java.util.Collection; |
@@ -16,26 +16,26 @@ import java.util.Map; | |||
16 | import java.util.concurrent.Callable; | 16 | import java.util.concurrent.Callable; |
17 | 17 | ||
18 | import org.apache.log4j.Logger; | 18 | import org.apache.log4j.Logger; |
19 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 19 | import tools.refinery.interpreter.rete.boundary.Disconnectable; |
20 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackend; | 20 | import tools.refinery.interpreter.rete.boundary.ReteBoundary; |
21 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendFactory; | 21 | import tools.refinery.interpreter.rete.construction.RetePatternBuildException; |
22 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendHintProvider; | 22 | import tools.refinery.interpreter.rete.construction.plancompiler.ReteRecipeCompiler; |
23 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 23 | import tools.refinery.interpreter.rete.network.Network; |
24 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 24 | import tools.refinery.interpreter.rete.network.NodeProvisioner; |
25 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 25 | import tools.refinery.interpreter.rete.network.ReteContainer; |
26 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 26 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
27 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 27 | import tools.refinery.interpreter.matchers.backend.IQueryBackend; |
28 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 28 | import tools.refinery.interpreter.matchers.backend.IQueryBackendFactory; |
29 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 29 | import tools.refinery.interpreter.matchers.backend.IQueryBackendHintProvider; |
30 | import tools.refinery.viatra.runtime.rete.boundary.Disconnectable; | 30 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
31 | import tools.refinery.viatra.runtime.rete.boundary.ReteBoundary; | 31 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
32 | import tools.refinery.viatra.runtime.rete.construction.RetePatternBuildException; | 32 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
33 | import tools.refinery.viatra.runtime.rete.construction.plancompiler.ReteRecipeCompiler; | 33 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
34 | import tools.refinery.viatra.runtime.rete.index.Indexer; | 34 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
35 | import tools.refinery.viatra.runtime.rete.network.Network; | 35 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
36 | import tools.refinery.viatra.runtime.rete.network.NodeProvisioner; | 36 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
37 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 37 | import tools.refinery.interpreter.rete.index.Indexer; |
38 | import tools.refinery.viatra.runtime.rete.traceability.RecipeTraceInfo; | 38 | import tools.refinery.interpreter.rete.traceability.RecipeTraceInfo; |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * @author Gabor Bergmann | 41 | * @author Gabor Bergmann |
@@ -46,7 +46,7 @@ public class ReteEngine implements IQueryBackend { | |||
46 | protected Network reteNet; | 46 | protected Network reteNet; |
47 | protected final int reteThreads; | 47 | protected final int reteThreads; |
48 | protected ReteBoundary boundary; | 48 | protected ReteBoundary boundary; |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * @since 2.2 | 51 | * @since 2.2 |
52 | */ | 52 | */ |
@@ -69,7 +69,7 @@ public class ReteEngine implements IQueryBackend { | |||
69 | protected final boolean parallelExecutionEnabled; // TRUE if model manipulation can go on | 69 | protected final boolean parallelExecutionEnabled; // TRUE if model manipulation can go on |
70 | 70 | ||
71 | private boolean disposedOrUninitialized = true; | 71 | private boolean disposedOrUninitialized = true; |
72 | 72 | ||
73 | private HintConfigurator hintConfigurator; | 73 | private HintConfigurator hintConfigurator; |
74 | 74 | ||
75 | /** | 75 | /** |
@@ -82,7 +82,7 @@ public class ReteEngine implements IQueryBackend { | |||
82 | public ReteEngine(IQueryBackendContext context, int reteThreads) { | 82 | public ReteEngine(IQueryBackendContext context, int reteThreads) { |
83 | this(context, reteThreads, false, null); | 83 | this(context, reteThreads, false, null); |
84 | } | 84 | } |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * @since 2.4 | 87 | * @since 2.4 |
88 | */ | 88 | */ |
@@ -98,21 +98,21 @@ public class ReteEngine implements IQueryBackend { | |||
98 | initEngine(); | 98 | initEngine(); |
99 | this.compiler = null; | 99 | this.compiler = null; |
100 | } | 100 | } |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * @since 1.6 | 103 | * @since 1.6 |
104 | */ | 104 | */ |
105 | public IQueryBackendContext getBackendContext() { | 105 | public IQueryBackendContext getBackendContext() { |
106 | return context; | 106 | return context; |
107 | } | 107 | } |
108 | 108 | ||
109 | /** | 109 | /** |
110 | * @since 2.2 | 110 | * @since 2.2 |
111 | */ | 111 | */ |
112 | public boolean isDeleteAndRederiveEvaluation() { | 112 | public boolean isDeleteAndRederiveEvaluation() { |
113 | return this.deleteAndRederiveEvaluation; | 113 | return this.deleteAndRederiveEvaluation; |
114 | } | 114 | } |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * @since 2.4 | 117 | * @since 2.4 |
118 | */ | 118 | */ |
@@ -128,9 +128,9 @@ public class ReteEngine implements IQueryBackend { | |||
128 | this.disconnectables = new LinkedList<Disconnectable>(); | 128 | this.disconnectables = new LinkedList<Disconnectable>(); |
129 | // this.caughtExceptions = new LinkedBlockingQueue<Throwable>(); | 129 | // this.caughtExceptions = new LinkedBlockingQueue<Throwable>(); |
130 | 130 | ||
131 | 131 | ||
132 | this.hintConfigurator = new HintConfigurator(context.getHintProvider()); | 132 | this.hintConfigurator = new HintConfigurator(context.getHintProvider()); |
133 | 133 | ||
134 | this.reteNet = new Network(reteThreads, this); | 134 | this.reteNet = new Network(reteThreads, this); |
135 | this.boundary = new ReteBoundary(this); // prerequisite: network | 135 | this.boundary = new ReteBoundary(this); // prerequisite: network |
136 | 136 | ||
@@ -143,7 +143,7 @@ public class ReteEngine implements IQueryBackend { | |||
143 | // this.traceListener = context.subscribePatternMatcherForTraceInfluences(this); | 143 | // this.traceListener = context.subscribePatternMatcherForTraceInfluences(this); |
144 | 144 | ||
145 | } | 145 | } |
146 | 146 | ||
147 | @Override | 147 | @Override |
148 | public void flushUpdates() { | 148 | public void flushUpdates() { |
149 | for (ReteContainer container : this.reteNet.getContainers()) { | 149 | for (ReteContainer container : this.reteNet.getContainers()) { |
@@ -168,7 +168,7 @@ public class ReteEngine implements IQueryBackend { | |||
168 | 168 | ||
169 | this.reteNet = null; | 169 | this.reteNet = null; |
170 | this.boundary = null; | 170 | this.boundary = null; |
171 | 171 | ||
172 | this.hintConfigurator = null; | 172 | this.hintConfigurator = null; |
173 | 173 | ||
174 | // this.machineListener = new MachineListener(this); // prerequisite: | 174 | // this.machineListener = new MachineListener(this); // prerequisite: |
@@ -207,7 +207,7 @@ public class ReteEngine implements IQueryBackend { | |||
207 | * @param query | 207 | * @param query |
208 | * the pattern to be matched. | 208 | * the pattern to be matched. |
209 | * @return a patternmatcher object that can match occurences of the given pattern. | 209 | * @return a patternmatcher object that can match occurences of the given pattern. |
210 | * @throws ViatraQueryRuntimeException | 210 | * @throws InterpreterRuntimeException |
211 | * if construction fails. | 211 | * if construction fails. |
212 | */ | 212 | */ |
213 | public synchronized RetePatternMatcher accessMatcher(final PQuery query) { | 213 | public synchronized RetePatternMatcher accessMatcher(final PQuery query) { |
@@ -230,13 +230,13 @@ public class ReteEngine implements IQueryBackend { | |||
230 | }); | 230 | }); |
231 | matcher = matchers.get(query); | 231 | matcher = matchers.get(query); |
232 | } | 232 | } |
233 | 233 | ||
234 | executeDelayedCommands(); | 234 | executeDelayedCommands(); |
235 | 235 | ||
236 | return matcher; | 236 | return matcher; |
237 | } | 237 | } |
238 | 238 | ||
239 | 239 | ||
240 | /** | 240 | /** |
241 | * Constructs RETE pattern matchers for a collection of patterns, if they are not available yet. Model traversal | 241 | * Constructs RETE pattern matchers for a collection of patterns, if they are not available yet. Model traversal |
242 | * during the whole construction period is coalesced (which may have an effect on performance, depending on the | 242 | * during the whole construction period is coalesced (which may have an effect on performance, depending on the |
@@ -245,7 +245,7 @@ public class ReteEngine implements IQueryBackend { | |||
245 | * @pre: builder is set. | 245 | * @pre: builder is set. |
246 | * @param specifications | 246 | * @param specifications |
247 | * the patterns to be matched. | 247 | * the patterns to be matched. |
248 | * @throws ViatraQueryRuntimeException | 248 | * @throws InterpreterRuntimeException |
249 | * if construction fails. | 249 | * if construction fails. |
250 | */ | 250 | */ |
251 | public synchronized void buildMatchersCoalesced(final Collection<PQuery> specifications) { | 251 | public synchronized void buildMatchersCoalesced(final Collection<PQuery> specifications) { |
@@ -269,9 +269,9 @@ public class ReteEngine implements IQueryBackend { | |||
269 | reteNet.getStructuralChangeLock().lock(); | 269 | reteNet.getStructuralChangeLock().lock(); |
270 | try { | 270 | try { |
271 | try { | 271 | try { |
272 | result = runtimeContext.coalesceTraversals(() -> { | 272 | result = runtimeContext.coalesceTraversals(() -> { |
273 | T innerResult = payload.call(); | 273 | T innerResult = payload.call(); |
274 | this.executeDelayedCommands(); | 274 | this.executeDelayedCommands(); |
275 | return innerResult; | 275 | return innerResult; |
276 | }); | 276 | }); |
277 | } catch (InvocationTargetException ex) { | 277 | } catch (InvocationTargetException ex) { |
@@ -360,7 +360,7 @@ public class ReteEngine implements IQueryBackend { | |||
360 | NodeProvisioner nodeProvisioner = reteNet.getHeadContainer().getProvisioner(); | 360 | NodeProvisioner nodeProvisioner = reteNet.getHeadContainer().getProvisioner(); |
361 | Indexer result = nodeProvisioner.peekProjectionIndexer(production, mask); | 361 | Indexer result = nodeProvisioner.peekProjectionIndexer(production, mask); |
362 | if (result == null) { | 362 | if (result == null) { |
363 | result = constructionWrapper(() -> | 363 | result = constructionWrapper(() -> |
364 | nodeProvisioner.accessProjectionIndexerOnetime(production, mask) | 364 | nodeProvisioner.accessProjectionIndexerOnetime(production, mask) |
365 | ); | 365 | ); |
366 | } | 366 | } |
@@ -398,7 +398,7 @@ public class ReteEngine implements IQueryBackend { | |||
398 | container.executeDelayedCommands(); | 398 | container.executeDelayedCommands(); |
399 | } | 399 | } |
400 | } | 400 | } |
401 | 401 | ||
402 | /** | 402 | /** |
403 | * Waits until the pattern matcher is in a steady state and output can be retrieved. | 403 | * Waits until the pattern matcher is in a steady state and output can be retrieved. |
404 | */ | 404 | */ |
@@ -532,12 +532,12 @@ public class ReteEngine implements IQueryBackend { | |||
532 | throw new IllegalStateException("Trying to use a Rete engine that has been disposed or has not yet been initialized."); | 532 | throw new IllegalStateException("Trying to use a Rete engine that has been disposed or has not yet been initialized."); |
533 | 533 | ||
534 | } | 534 | } |
535 | 535 | ||
536 | @Override | 536 | @Override |
537 | public IQueryResultProvider getResultProvider(PQuery query) { | 537 | public IQueryResultProvider getResultProvider(PQuery query) { |
538 | return accessMatcher(query); | 538 | return accessMatcher(query); |
539 | } | 539 | } |
540 | 540 | ||
541 | /** | 541 | /** |
542 | * @since 1.4 | 542 | * @since 1.4 |
543 | */ | 543 | */ |
@@ -557,7 +557,7 @@ public class ReteEngine implements IQueryBackend { | |||
557 | public void dispose() { | 557 | public void dispose() { |
558 | killEngine(); | 558 | killEngine(); |
559 | } | 559 | } |
560 | 560 | ||
561 | @Override | 561 | @Override |
562 | public boolean isCaching() { | 562 | public boolean isCaching() { |
563 | return true; | 563 | return true; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/RetePatternMatcher.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/RetePatternMatcher.java index 5f0f1892..5d04081c 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/RetePatternMatcher.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/RetePatternMatcher.java | |||
@@ -8,27 +8,27 @@ | |||
8 | * SPDX-License-Identifier: EPL-2.0 | 8 | * SPDX-License-Identifier: EPL-2.0 |
9 | *******************************************************************************/ | 9 | *******************************************************************************/ |
10 | 10 | ||
11 | package tools.refinery.viatra.runtime.rete.matcher; | 11 | package tools.refinery.interpreter.rete.matcher; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackend; | 13 | import tools.refinery.interpreter.rete.network.Node; |
14 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 14 | import tools.refinery.interpreter.rete.network.ProductionNode; |
15 | import tools.refinery.viatra.runtime.matchers.backend.IUpdateable; | 15 | import tools.refinery.interpreter.rete.network.Receiver; |
16 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 16 | import tools.refinery.interpreter.matchers.backend.IQueryBackend; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 17 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 18 | import tools.refinery.interpreter.matchers.backend.IUpdateable; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 19 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
20 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 20 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
21 | import tools.refinery.viatra.runtime.matchers.util.Accuracy; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
22 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 22 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
23 | import tools.refinery.viatra.runtime.rete.index.Indexer; | 23 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
24 | import tools.refinery.viatra.runtime.rete.index.IterableIndexer; | 24 | import tools.refinery.interpreter.matchers.util.Accuracy; |
25 | import tools.refinery.viatra.runtime.rete.network.Node; | 25 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
26 | import tools.refinery.viatra.runtime.rete.network.ProductionNode; | 26 | import tools.refinery.interpreter.rete.index.Indexer; |
27 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 27 | import tools.refinery.interpreter.rete.index.IterableIndexer; |
28 | import tools.refinery.viatra.runtime.rete.remote.Address; | 28 | import tools.refinery.interpreter.rete.remote.Address; |
29 | import tools.refinery.viatra.runtime.rete.single.CallbackNode; | 29 | import tools.refinery.interpreter.rete.single.CallbackNode; |
30 | import tools.refinery.viatra.runtime.rete.single.TransformerNode; | 30 | import tools.refinery.interpreter.rete.single.TransformerNode; |
31 | import tools.refinery.viatra.runtime.rete.traceability.RecipeTraceInfo; | 31 | import tools.refinery.interpreter.rete.traceability.RecipeTraceInfo; |
32 | 32 | ||
33 | import java.util.Collection; | 33 | import java.util.Collection; |
34 | import java.util.Map; | 34 | import java.util.Map; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/TimelyConfiguration.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/TimelyConfiguration.java index 876ddc99..cd9e4266 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/TimelyConfiguration.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/TimelyConfiguration.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.matcher; | 9 | package tools.refinery.interpreter.rete.matcher; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Configuration of timely evaluation. | 12 | * Configuration of timely evaluation. |
13 | * | 13 | * |
14 | * @author Tamas Szabo | 14 | * @author Tamas Szabo |
15 | * @since 2.4 | 15 | * @since 2.4 |
16 | */ | 16 | */ |
@@ -35,25 +35,25 @@ public class TimelyConfiguration { | |||
35 | 35 | ||
36 | public enum AggregatorArchitecture { | 36 | public enum AggregatorArchitecture { |
37 | /** | 37 | /** |
38 | * Aggregands are copied over from lower timestamps to higher timestamps. | 38 | * Aggregands are copied over from lower timestamps to higher timestamps. |
39 | */ | 39 | */ |
40 | PARALLEL, | 40 | PARALLEL, |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Aggregands are only present at the timestamp where they are inserted at. | 43 | * Aggregands are only present at the timestamp where they are inserted at. |
44 | * Only aggregate results are pushed towards higher timestamps during folding. | 44 | * Only aggregate results are pushed towards higher timestamps during folding. |
45 | */ | 45 | */ |
46 | SEQUENTIAL | 46 | SEQUENTIAL |
47 | } | 47 | } |
48 | 48 | ||
49 | public enum TimelineRepresentation { | 49 | public enum TimelineRepresentation { |
50 | /** | 50 | /** |
51 | * Only the first moment (timestamp) of appearance is maintained per tuple. | 51 | * Only the first moment (timestamp) of appearance is maintained per tuple. |
52 | */ | 52 | */ |
53 | FIRST_ONLY, | 53 | FIRST_ONLY, |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Complete timeline (series of appearance & disappearance) is maintained per tuple. | 56 | * Complete timeline (series of appearance & disappearance) is maintained per tuple. |
57 | */ | 57 | */ |
58 | FAITHFUL | 58 | FAITHFUL |
59 | } | 59 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/TimelyReteBackendFactory.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/TimelyReteBackendFactory.java index 2777f169..8e9151ac 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/matcher/TimelyReteBackendFactory.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/matcher/TimelyReteBackendFactory.java | |||
@@ -3,36 +3,34 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.matcher; | 9 | package tools.refinery.interpreter.rete.matcher; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackend; | 11 | import tools.refinery.interpreter.matchers.backend.IQueryBackend; |
12 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 12 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
13 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration.AggregatorArchitecture; | ||
14 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration.TimelineRepresentation; | ||
15 | 13 | ||
16 | /** | 14 | /** |
17 | * A {@link ReteBackendFactory} implementation that creates {@link ReteEngine}s that use non-scattered timely | 15 | * A {@link ReteBackendFactory} implementation that creates {@link ReteEngine}s that use non-scattered timely |
18 | * evaluation. | 16 | * evaluation. |
19 | * | 17 | * |
20 | * @author Tamas Szabo | 18 | * @author Tamas Szabo |
21 | * @since 2.4 | 19 | * @since 2.4 |
22 | */ | 20 | */ |
23 | public class TimelyReteBackendFactory extends ReteBackendFactory { | 21 | public class TimelyReteBackendFactory extends ReteBackendFactory { |
24 | 22 | ||
25 | private final TimelyConfiguration configuration; | 23 | private final TimelyConfiguration configuration; |
26 | 24 | ||
27 | public static final TimelyReteBackendFactory FIRST_ONLY_SEQUENTIAL = new TimelyReteBackendFactory( | 25 | public static final TimelyReteBackendFactory FIRST_ONLY_SEQUENTIAL = new TimelyReteBackendFactory( |
28 | new TimelyConfiguration(TimelineRepresentation.FIRST_ONLY, AggregatorArchitecture.SEQUENTIAL)); | 26 | new TimelyConfiguration(TimelyConfiguration.TimelineRepresentation.FIRST_ONLY, TimelyConfiguration.AggregatorArchitecture.SEQUENTIAL)); |
29 | public static final TimelyReteBackendFactory FIRST_ONLY_PARALLEL = new TimelyReteBackendFactory( | 27 | public static final TimelyReteBackendFactory FIRST_ONLY_PARALLEL = new TimelyReteBackendFactory( |
30 | new TimelyConfiguration(TimelineRepresentation.FIRST_ONLY, AggregatorArchitecture.PARALLEL)); | 28 | new TimelyConfiguration(TimelyConfiguration.TimelineRepresentation.FIRST_ONLY, TimelyConfiguration.AggregatorArchitecture.PARALLEL)); |
31 | public static final TimelyReteBackendFactory FAITHFUL_SEQUENTIAL = new TimelyReteBackendFactory( | 29 | public static final TimelyReteBackendFactory FAITHFUL_SEQUENTIAL = new TimelyReteBackendFactory( |
32 | new TimelyConfiguration(TimelineRepresentation.FAITHFUL, AggregatorArchitecture.SEQUENTIAL)); | 30 | new TimelyConfiguration(TimelyConfiguration.TimelineRepresentation.FAITHFUL, TimelyConfiguration.AggregatorArchitecture.SEQUENTIAL)); |
33 | public static final TimelyReteBackendFactory FAITHFUL_PARALLEL = new TimelyReteBackendFactory( | 31 | public static final TimelyReteBackendFactory FAITHFUL_PARALLEL = new TimelyReteBackendFactory( |
34 | new TimelyConfiguration(TimelineRepresentation.FAITHFUL, AggregatorArchitecture.PARALLEL)); | 32 | new TimelyConfiguration(TimelyConfiguration.TimelineRepresentation.FAITHFUL, TimelyConfiguration.AggregatorArchitecture.PARALLEL)); |
35 | 33 | ||
36 | public TimelyReteBackendFactory(final TimelyConfiguration configuration) { | 34 | public TimelyReteBackendFactory(final TimelyConfiguration configuration) { |
37 | this.configuration = configuration; | 35 | this.configuration = configuration; |
38 | } | 36 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/Bag.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/Bag.java index 4aef0f96..db3c7c7e 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/Bag.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/Bag.java | |||
@@ -3,23 +3,23 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.misc; | 10 | package tools.refinery.interpreter.rete.misc; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.LinkedList; | 13 | import java.util.LinkedList; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.rete.network.ReteContainer; |
16 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 16 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
17 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 18 | import tools.refinery.interpreter.matchers.util.Direction; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * @author Gabor Bergmann | 21 | * @author Gabor Bergmann |
22 | * | 22 | * |
23 | * A bag is a container that tuples can be dumped into. Does NOT propagate updates! Optimized for small contents | 23 | * A bag is a container that tuples can be dumped into. Does NOT propagate updates! Optimized for small contents |
24 | * size OR positive updates only. | 24 | * size OR positive updates only. |
25 | */ | 25 | */ |
@@ -39,5 +39,5 @@ public class Bag extends SimpleReceiver { | |||
39 | else | 39 | else |
40 | contents.remove(updateElement); | 40 | contents.remove(updateElement); |
41 | } | 41 | } |
42 | 42 | ||
43 | } | 43 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/ConstantNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/ConstantNode.java index 980d3eee..acb807ea 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/ConstantNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/ConstantNode.java | |||
@@ -3,25 +3,25 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.misc; | 10 | package tools.refinery.interpreter.rete.misc; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 15 | import tools.refinery.interpreter.rete.network.ReteContainer; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.network.StandardNode; |
17 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 17 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
18 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 18 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
19 | import tools.refinery.viatra.runtime.rete.network.StandardNode; | 19 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
20 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 20 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * Node that always contains a single constant Tuple | 23 | * Node that always contains a single constant Tuple |
24 | * | 24 | * |
25 | * @author Gabor Bergmann | 25 | * @author Gabor Bergmann |
26 | */ | 26 | */ |
27 | public class ConstantNode extends StandardNode { | 27 | public class ConstantNode extends StandardNode { |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/DefaultDeltaMonitor.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/DefaultDeltaMonitor.java index efba3117..ff543936 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/DefaultDeltaMonitor.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/DefaultDeltaMonitor.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.misc; | 10 | package tools.refinery.interpreter.rete.misc; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 12 | import tools.refinery.interpreter.rete.network.Network; |
13 | import tools.refinery.viatra.runtime.rete.network.Network; | 13 | import tools.refinery.interpreter.rete.network.ReteContainer; |
14 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 14 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Default configuration for DeltaMonitor. | 17 | * Default configuration for DeltaMonitor. |
18 | * | 18 | * |
19 | * @author Gabor Bergmann | 19 | * @author Gabor Bergmann |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | public class DefaultDeltaMonitor extends DeltaMonitor<Tuple> { | 22 | public class DefaultDeltaMonitor extends DeltaMonitor<Tuple> { |
23 | 23 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/DeltaMonitor.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/DeltaMonitor.java index 82b6ecda..b32499d4 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/DeltaMonitor.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/DeltaMonitor.java | |||
@@ -3,25 +3,25 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.misc; | 10 | package tools.refinery.interpreter.rete.misc; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.LinkedHashSet; | 13 | import java.util.LinkedHashSet; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.rete.network.ReteContainer; |
16 | import tools.refinery.viatra.runtime.matchers.util.Clearable; | 16 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
17 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 18 | import tools.refinery.interpreter.matchers.util.Clearable; |
19 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 19 | import tools.refinery.interpreter.matchers.util.Direction; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * A monitoring object that connects to the rete network as a receiver to reflect changes since an arbitrary state | 22 | * A monitoring object that connects to the rete network as a receiver to reflect changes since an arbitrary state |
23 | * acknowledged by the client. Match tuples are represented by a type MatchType. | 23 | * acknowledged by the client. Match tuples are represented by a type MatchType. |
24 | * | 24 | * |
25 | * <p> | 25 | * <p> |
26 | * <b>Usage</b>. If a new matching is found, it appears in the matchFoundEvents collection, and disappears when that | 26 | * <b>Usage</b>. If a new matching is found, it appears in the matchFoundEvents collection, and disappears when that |
27 | * particular matching cannot be found anymore. If the event of finding a match has been processed by the client, it can | 27 | * particular matching cannot be found anymore. If the event of finding a match has been processed by the client, it can |
@@ -29,17 +29,17 @@ import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | |||
29 | * matchLostEvents collection, and disappear upon finding the same matching again. "Matching lost" events can also be | 29 | * matchLostEvents collection, and disappear upon finding the same matching again. "Matching lost" events can also be |
30 | * acknowledged by removing a Tuple from the collection. If the matching is found once again, it will return to | 30 | * acknowledged by removing a Tuple from the collection. If the matching is found once again, it will return to |
31 | * matchFoundEvents. | 31 | * matchFoundEvents. |
32 | * | 32 | * |
33 | * <p> | 33 | * <p> |
34 | * <b>Technical notes</b>. Does NOT propagate updates! | 34 | * <b>Technical notes</b>. Does NOT propagate updates! |
35 | * | 35 | * |
36 | * By overriding statelessConvert(), results can be stored to a MatchType. MatchType must provide equals() and | 36 | * By overriding statelessConvert(), results can be stored to a MatchType. MatchType must provide equals() and |
37 | * hashCode() reflecting its contents. The default implementation (DefaultDeltaMonitor) uses Tuple as MatchType. | 37 | * hashCode() reflecting its contents. The default implementation (DefaultDeltaMonitor) uses Tuple as MatchType. |
38 | * | 38 | * |
39 | * By overriding statelessFilter(), some tuples can be filtered. | 39 | * By overriding statelessFilter(), some tuples can be filtered. |
40 | * | 40 | * |
41 | * @author Gabor Bergmann | 41 | * @author Gabor Bergmann |
42 | * | 42 | * |
43 | */ | 43 | */ |
44 | public abstract class DeltaMonitor<MatchType> extends SimpleReceiver implements Clearable { | 44 | public abstract class DeltaMonitor<MatchType> extends SimpleReceiver implements Clearable { |
45 | 45 | ||
@@ -73,7 +73,7 @@ public abstract class DeltaMonitor<MatchType> extends SimpleReceiver implements | |||
73 | 73 | ||
74 | /** | 74 | /** |
75 | * Override this method to provide a lightweight, stateless filter on the tuples | 75 | * Override this method to provide a lightweight, stateless filter on the tuples |
76 | * | 76 | * |
77 | * @param tuple | 77 | * @param tuple |
78 | * the occurrence that is to be filtered | 78 | * the occurrence that is to be filtered |
79 | * @return true if this tuple should be monitored, false if ignored | 79 | * @return true if this tuple should be monitored, false if ignored |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/SimpleReceiver.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/SimpleReceiver.java index dcf9ae78..a6413490 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/misc/SimpleReceiver.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/misc/SimpleReceiver.java | |||
@@ -3,26 +3,26 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.misc; | 9 | package tools.refinery.interpreter.rete.misc; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.rete.network.BaseNode; | 14 | import tools.refinery.interpreter.rete.network.BaseNode; |
15 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 15 | import tools.refinery.interpreter.rete.network.Receiver; |
16 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 16 | import tools.refinery.interpreter.rete.network.ReteContainer; |
17 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 17 | import tools.refinery.interpreter.rete.network.Supplier; |
18 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 18 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
19 | import tools.refinery.viatra.runtime.rete.network.mailbox.timeless.BehaviorChangingMailbox; | 19 | import tools.refinery.interpreter.rete.network.mailbox.timeless.BehaviorChangingMailbox; |
20 | import tools.refinery.viatra.runtime.rete.network.mailbox.timely.TimelyMailbox; | 20 | import tools.refinery.interpreter.rete.network.mailbox.timely.TimelyMailbox; |
21 | import tools.refinery.viatra.runtime.rete.traceability.TraceInfo; | 21 | import tools.refinery.interpreter.rete.traceability.TraceInfo; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * @author Bergmann Gabor | 24 | * @author Bergmann Gabor |
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | public abstract class SimpleReceiver extends BaseNode implements Receiver { | 27 | public abstract class SimpleReceiver extends BaseNode implements Receiver { |
28 | 28 | ||
@@ -31,7 +31,7 @@ public abstract class SimpleReceiver extends BaseNode implements Receiver { | |||
31 | * @since 1.6 | 31 | * @since 1.6 |
32 | */ | 32 | */ |
33 | protected final Mailbox mailbox; | 33 | protected final Mailbox mailbox; |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * @param reteContainer | 36 | * @param reteContainer |
37 | */ | 37 | */ |
@@ -44,7 +44,7 @@ public abstract class SimpleReceiver extends BaseNode implements Receiver { | |||
44 | /** | 44 | /** |
45 | * Instantiates the {@link Mailbox} of this receiver. | 45 | * Instantiates the {@link Mailbox} of this receiver. |
46 | * Subclasses may override this method to provide their own mailbox implementation. | 46 | * Subclasses may override this method to provide their own mailbox implementation. |
47 | * | 47 | * |
48 | * @return the mailbox | 48 | * @return the mailbox |
49 | * @since 2.0 | 49 | * @since 2.0 |
50 | */ | 50 | */ |
@@ -55,12 +55,12 @@ public abstract class SimpleReceiver extends BaseNode implements Receiver { | |||
55 | return new BehaviorChangingMailbox(this, this.reteContainer); | 55 | return new BehaviorChangingMailbox(this, this.reteContainer); |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | @Override | 59 | @Override |
60 | public Mailbox getMailbox() { | 60 | public Mailbox getMailbox() { |
61 | return this.mailbox; | 61 | return this.mailbox; |
62 | } | 62 | } |
63 | 63 | ||
64 | @Override | 64 | @Override |
65 | public void appendParent(Supplier supplier) { | 65 | public void appendParent(Supplier supplier) { |
66 | if (parent == null) | 66 | if (parent == null) |
@@ -90,14 +90,14 @@ public abstract class SimpleReceiver extends BaseNode implements Receiver { | |||
90 | 90 | ||
91 | /** | 91 | /** |
92 | * Disconnects this node from the network. Can be called publicly. | 92 | * Disconnects this node from the network. Can be called publicly. |
93 | * | 93 | * |
94 | * @pre: child nodes, if any, must already be disconnected. | 94 | * @pre: child nodes, if any, must already be disconnected. |
95 | */ | 95 | */ |
96 | public void disconnectFromNetwork() { | 96 | public void disconnectFromNetwork() { |
97 | if (parent != null) | 97 | if (parent != null) |
98 | reteContainer.disconnect(parent, this); | 98 | reteContainer.disconnect(parent, this); |
99 | } | 99 | } |
100 | 100 | ||
101 | @Override | 101 | @Override |
102 | public void assignTraceInfo(TraceInfo traceInfo) { | 102 | public void assignTraceInfo(TraceInfo traceInfo) { |
103 | super.assignTraceInfo(traceInfo); | 103 | super.assignTraceInfo(traceInfo); |
@@ -106,4 +106,4 @@ public abstract class SimpleReceiver extends BaseNode implements Receiver { | |||
106 | parent.acceptPropagatedTraceInfo(traceInfo); | 106 | parent.acceptPropagatedTraceInfo(traceInfo); |
107 | } | 107 | } |
108 | 108 | ||
109 | } \ No newline at end of file | 109 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/BaseNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/BaseNode.java index 2469d6bd..37022db6 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/BaseNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/BaseNode.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network; | 9 | package tools.refinery.interpreter.rete.network; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.HashSet; | 12 | import java.util.HashSet; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | import java.util.TreeSet; | 14 | import java.util.TreeSet; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.rete.traceability.PatternTraceInfo; | 16 | import tools.refinery.interpreter.rete.traceability.PatternTraceInfo; |
17 | import tools.refinery.viatra.runtime.rete.traceability.TraceInfo; | 17 | import tools.refinery.interpreter.rete.traceability.TraceInfo; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Base implementation for a Rete node. | 20 | * Base implementation for a Rete node. |
21 | * | 21 | * |
22 | * @author Bergmann Gabor | 22 | * @author Bergmann Gabor |
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | public abstract class BaseNode implements Node { | 25 | public abstract class BaseNode implements Node { |
26 | 26 | ||
@@ -74,23 +74,23 @@ public abstract class BaseNode implements Node { | |||
74 | public void setTag(Object tag) { | 74 | public void setTag(Object tag) { |
75 | this.tag = tag; | 75 | this.tag = tag; |
76 | } | 76 | } |
77 | 77 | ||
78 | @Override | 78 | @Override |
79 | public Set<TraceInfo> getTraceInfos() { | 79 | public Set<TraceInfo> getTraceInfos() { |
80 | return Collections.unmodifiableSet(traceInfos); | 80 | return Collections.unmodifiableSet(traceInfos); |
81 | } | 81 | } |
82 | 82 | ||
83 | @Override | 83 | @Override |
84 | public void assignTraceInfo(TraceInfo traceInfo) { | 84 | public void assignTraceInfo(TraceInfo traceInfo) { |
85 | traceInfos.add(traceInfo); | 85 | traceInfos.add(traceInfo); |
86 | traceInfo.assignNode(this); | 86 | traceInfo.assignNode(this); |
87 | } | 87 | } |
88 | 88 | ||
89 | @Override | 89 | @Override |
90 | public void acceptPropagatedTraceInfo(TraceInfo traceInfo) { | 90 | public void acceptPropagatedTraceInfo(TraceInfo traceInfo) { |
91 | assignTraceInfo(traceInfo); | 91 | assignTraceInfo(traceInfo); |
92 | } | 92 | } |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Descendants should use this in e.g. logging | 95 | * Descendants should use this in e.g. logging |
96 | */ | 96 | */ |
@@ -105,4 +105,4 @@ public abstract class BaseNode implements Node { | |||
105 | return patternNames.toString(); | 105 | return patternNames.toString(); |
106 | } | 106 | } |
107 | 107 | ||
108 | } \ No newline at end of file | 108 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/ConnectionFactory.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/ConnectionFactory.java index bd4d9bf2..c69757b6 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/ConnectionFactory.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/ConnectionFactory.java | |||
@@ -7,19 +7,19 @@ | |||
7 | * | 7 | * |
8 | * SPDX-License-Identifier: EPL-2.0 | 8 | * SPDX-License-Identifier: EPL-2.0 |
9 | *******************************************************************************/ | 9 | *******************************************************************************/ |
10 | package tools.refinery.viatra.runtime.rete.network; | 10 | package tools.refinery.interpreter.rete.network; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 12 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
13 | import tools.refinery.viatra.runtime.rete.aggregation.IndexerBasedAggregatorNode; | 13 | import tools.refinery.interpreter.rete.aggregation.IndexerBasedAggregatorNode; |
14 | import tools.refinery.viatra.runtime.rete.boundary.InputConnector; | 14 | import tools.refinery.interpreter.rete.boundary.InputConnector; |
15 | import tools.refinery.viatra.runtime.rete.eval.RelationEvaluatorNode; | 15 | import tools.refinery.interpreter.rete.eval.RelationEvaluatorNode; |
16 | import tools.refinery.viatra.runtime.rete.index.DualInputNode; | 16 | import tools.refinery.interpreter.rete.index.DualInputNode; |
17 | import tools.refinery.viatra.runtime.rete.index.Indexer; | 17 | import tools.refinery.interpreter.rete.index.Indexer; |
18 | import tools.refinery.viatra.runtime.rete.index.IterableIndexer; | 18 | import tools.refinery.interpreter.rete.index.IterableIndexer; |
19 | import tools.refinery.viatra.runtime.rete.index.ProjectionIndexer; | 19 | import tools.refinery.interpreter.rete.index.ProjectionIndexer; |
20 | import tools.refinery.viatra.runtime.rete.recipes.*; | 20 | import tools.refinery.interpreter.rete.recipes.*; |
21 | import tools.refinery.viatra.runtime.rete.remote.Address; | 21 | import tools.refinery.interpreter.rete.remote.Address; |
22 | import tools.refinery.viatra.runtime.rete.traceability.RecipeTraceInfo; | 22 | import tools.refinery.interpreter.rete.traceability.RecipeTraceInfo; |
23 | 23 | ||
24 | import java.util.ArrayList; | 24 | import java.util.ArrayList; |
25 | import java.util.Collection; | 25 | import java.util.Collection; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/IGroupable.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/IGroupable.java index c22b06d8..cda84761 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/IGroupable.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/IGroupable.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network; | 9 | package tools.refinery.interpreter.rete.network; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 11 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * @author Gabor Bergmann | 14 | * @author Gabor Bergmann |
@@ -28,4 +28,4 @@ public interface IGroupable { | |||
28 | */ | 28 | */ |
29 | void setCurrentGroup(CommunicationGroup group); | 29 | void setCurrentGroup(CommunicationGroup group); |
30 | 30 | ||
31 | } \ No newline at end of file | 31 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Network.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Network.java index 61030ff2..04fd645f 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Network.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Network.java | |||
@@ -7,17 +7,17 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.network; | 10 | package tools.refinery.interpreter.rete.network; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 12 | import tools.refinery.interpreter.rete.boundary.InputConnector; |
13 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 13 | import tools.refinery.interpreter.rete.recipes.ReteNodeRecipe; |
14 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 14 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
15 | import tools.refinery.viatra.runtime.rete.boundary.InputConnector; | 15 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
16 | import tools.refinery.viatra.runtime.rete.matcher.ReteEngine; | 16 | import tools.refinery.interpreter.matchers.util.Direction; |
17 | import tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe; | 17 | import tools.refinery.interpreter.rete.matcher.ReteEngine; |
18 | import tools.refinery.viatra.runtime.rete.remote.Address; | 18 | import tools.refinery.interpreter.rete.remote.Address; |
19 | import tools.refinery.viatra.runtime.rete.traceability.RecipeTraceInfo; | 19 | import tools.refinery.interpreter.rete.traceability.RecipeTraceInfo; |
20 | import tools.refinery.viatra.runtime.rete.util.Options; | 20 | import tools.refinery.interpreter.rete.util.Options; |
21 | 21 | ||
22 | import java.util.*; | 22 | import java.util.*; |
23 | import java.util.Map.Entry; | 23 | import java.util.Map.Entry; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/NetworkStructureChangeSensitiveNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/NetworkStructureChangeSensitiveNode.java index c6ba34c4..51341424 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/NetworkStructureChangeSensitiveNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/NetworkStructureChangeSensitiveNode.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network; | 9 | package tools.refinery.interpreter.rete.network; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTracker; | 11 | import tools.refinery.interpreter.rete.network.communication.CommunicationTracker; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * {@link Node}s implementing this interface are sensitive to changes in the dependency graph maintained by the | 14 | * {@link Node}s implementing this interface are sensitive to changes in the dependency graph maintained by the |
@@ -16,7 +16,7 @@ import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTra | |||
16 | * affected by changes to the dependency graph. Depending on whether this node is contained in a recursive group or not, | 16 | * affected by changes to the dependency graph. Depending on whether this node is contained in a recursive group or not, |
17 | * it may behave differently, and the {@link NetworkStructureChangeSensitiveNode#networkStructureChanged()} method can | 17 | * it may behave differently, and the {@link NetworkStructureChangeSensitiveNode#networkStructureChanged()} method can |
18 | * be used to perform changes in behavior. | 18 | * be used to perform changes in behavior. |
19 | * | 19 | * |
20 | * @author Tamas Szabo | 20 | * @author Tamas Szabo |
21 | * @since 2.3 | 21 | * @since 2.3 |
22 | */ | 22 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Node.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Node.java index e8ab615a..e7faf374 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Node.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Node.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.network; | 10 | package tools.refinery.interpreter.rete.network; |
11 | 11 | ||
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTracker; | 14 | import tools.refinery.interpreter.rete.network.communication.CommunicationTracker; |
15 | import tools.refinery.viatra.runtime.rete.traceability.TraceInfo; | 15 | import tools.refinery.interpreter.rete.traceability.TraceInfo; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * A node of a rete network, should be uniquely identified by network and nodeId. NodeId can be requested by registering | 18 | * A node of a rete network, should be uniquely identified by network and nodeId. NodeId can be requested by registering |
19 | * at the Network on construction. | 19 | * at the Network on construction. |
20 | * | 20 | * |
21 | * @author Gabor Bergmann | 21 | * @author Gabor Bergmann |
22 | */ | 22 | */ |
23 | public interface Node { | 23 | public interface Node { |
@@ -40,12 +40,12 @@ public interface Node { | |||
40 | * @return the tag of the node | 40 | * @return the tag of the node |
41 | */ | 41 | */ |
42 | Object getTag(); | 42 | Object getTag(); |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * @return unmodifiable view of the list of traceability infos assigned to this node | 45 | * @return unmodifiable view of the list of traceability infos assigned to this node |
46 | */ | 46 | */ |
47 | Set<TraceInfo> getTraceInfos(); | 47 | Set<TraceInfo> getTraceInfos(); |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * assigns new traceability info to this node | 50 | * assigns new traceability info to this node |
51 | */ | 51 | */ |
@@ -54,7 +54,7 @@ public interface Node { | |||
54 | * accepts traceability info propagated to this node | 54 | * accepts traceability info propagated to this node |
55 | */ | 55 | */ |
56 | void acceptPropagatedTraceInfo(TraceInfo traceInfo); | 56 | void acceptPropagatedTraceInfo(TraceInfo traceInfo); |
57 | 57 | ||
58 | default CommunicationTracker getCommunicationTracker() { | 58 | default CommunicationTracker getCommunicationTracker() { |
59 | return getContainer().getCommunicationTracker(); | 59 | return getContainer().getCommunicationTracker(); |
60 | } | 60 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/NodeFactory.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/NodeFactory.java index 3e4ea4e0..301b757d 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/NodeFactory.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/NodeFactory.java | |||
@@ -7,42 +7,42 @@ | |||
7 | * | 7 | * |
8 | * SPDX-License-Identifier: EPL-2.0 | 8 | * SPDX-License-Identifier: EPL-2.0 |
9 | *******************************************************************************/ | 9 | *******************************************************************************/ |
10 | package tools.refinery.viatra.runtime.rete.network; | 10 | package tools.refinery.interpreter.rete.network; |
11 | 11 | ||
12 | import org.apache.log4j.Logger; | 12 | import org.apache.log4j.Logger; |
13 | import org.eclipse.emf.common.util.EMap; | 13 | import org.eclipse.emf.common.util.EMap; |
14 | import tools.refinery.viatra.runtime.rete.itc.alg.representative.RepresentativeElectionAlgorithm; | 14 | import tools.refinery.interpreter.matchers.context.IPosetComparator; |
15 | import tools.refinery.viatra.runtime.rete.itc.alg.representative.StronglyConnectedComponentAlgorithm; | 15 | import tools.refinery.interpreter.matchers.psystem.IExpressionEvaluator; |
16 | import tools.refinery.viatra.runtime.rete.itc.alg.representative.WeaklyConnectedComponentAlgorithm; | 16 | import tools.refinery.interpreter.matchers.psystem.IRelationEvaluator; |
17 | import tools.refinery.viatra.runtime.matchers.context.IPosetComparator; | 17 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.IExpressionEvaluator; | 18 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.IRelationEvaluator; | 19 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 20 | import tools.refinery.interpreter.rete.aggregation.ColumnAggregatorNode; |
21 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 21 | import tools.refinery.interpreter.rete.aggregation.CountNode; |
22 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 22 | import tools.refinery.interpreter.rete.aggregation.IAggregatorNode; |
23 | import tools.refinery.viatra.runtime.rete.aggregation.ColumnAggregatorNode; | 23 | import tools.refinery.interpreter.rete.aggregation.timely.FaithfulParallelTimelyColumnAggregatorNode; |
24 | import tools.refinery.viatra.runtime.rete.aggregation.CountNode; | 24 | import tools.refinery.interpreter.rete.aggregation.timely.FaithfulSequentialTimelyColumnAggregatorNode; |
25 | import tools.refinery.viatra.runtime.rete.aggregation.IAggregatorNode; | 25 | import tools.refinery.interpreter.rete.aggregation.timely.FirstOnlyParallelTimelyColumnAggregatorNode; |
26 | import tools.refinery.viatra.runtime.rete.aggregation.timely.FaithfulParallelTimelyColumnAggregatorNode; | 26 | import tools.refinery.interpreter.rete.aggregation.timely.FirstOnlySequentialTimelyColumnAggregatorNode; |
27 | import tools.refinery.viatra.runtime.rete.aggregation.timely.FaithfulSequentialTimelyColumnAggregatorNode; | 27 | import tools.refinery.interpreter.rete.boundary.ExternalInputEnumeratorNode; |
28 | import tools.refinery.viatra.runtime.rete.aggregation.timely.FirstOnlyParallelTimelyColumnAggregatorNode; | 28 | import tools.refinery.interpreter.rete.boundary.ExternalInputStatelessFilterNode; |
29 | import tools.refinery.viatra.runtime.rete.aggregation.timely.FirstOnlySequentialTimelyColumnAggregatorNode; | 29 | import tools.refinery.interpreter.rete.eval.EvaluatorCore; |
30 | import tools.refinery.viatra.runtime.rete.boundary.ExternalInputEnumeratorNode; | 30 | import tools.refinery.interpreter.rete.eval.MemorylessEvaluatorNode; |
31 | import tools.refinery.viatra.runtime.rete.boundary.ExternalInputStatelessFilterNode; | 31 | import tools.refinery.interpreter.rete.eval.OutputCachingEvaluatorNode; |
32 | import tools.refinery.viatra.runtime.rete.eval.EvaluatorCore; | 32 | import tools.refinery.interpreter.rete.eval.RelationEvaluatorNode; |
33 | import tools.refinery.viatra.runtime.rete.eval.MemorylessEvaluatorNode; | 33 | import tools.refinery.interpreter.rete.index.ExistenceNode; |
34 | import tools.refinery.viatra.runtime.rete.eval.OutputCachingEvaluatorNode; | 34 | import tools.refinery.interpreter.rete.index.Indexer; |
35 | import tools.refinery.viatra.runtime.rete.eval.RelationEvaluatorNode; | 35 | import tools.refinery.interpreter.rete.index.JoinNode; |
36 | import tools.refinery.viatra.runtime.rete.index.ExistenceNode; | 36 | import tools.refinery.interpreter.rete.itc.alg.representative.RepresentativeElectionAlgorithm; |
37 | import tools.refinery.viatra.runtime.rete.index.Indexer; | 37 | import tools.refinery.interpreter.rete.itc.alg.representative.StronglyConnectedComponentAlgorithm; |
38 | import tools.refinery.viatra.runtime.rete.index.JoinNode; | 38 | import tools.refinery.interpreter.rete.itc.alg.representative.WeaklyConnectedComponentAlgorithm; |
39 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration; | 39 | import tools.refinery.interpreter.rete.matcher.TimelyConfiguration; |
40 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration.AggregatorArchitecture; | 40 | import tools.refinery.interpreter.rete.matcher.TimelyConfiguration.AggregatorArchitecture; |
41 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration.TimelineRepresentation; | 41 | import tools.refinery.interpreter.rete.matcher.TimelyConfiguration.TimelineRepresentation; |
42 | import tools.refinery.viatra.runtime.rete.misc.ConstantNode; | 42 | import tools.refinery.interpreter.rete.misc.ConstantNode; |
43 | import tools.refinery.viatra.runtime.rete.recipes.*; | 43 | import tools.refinery.interpreter.rete.recipes.*; |
44 | import tools.refinery.viatra.runtime.rete.single.*; | 44 | import tools.refinery.interpreter.rete.single.*; |
45 | import tools.refinery.viatra.runtime.rete.traceability.TraceInfo; | 45 | import tools.refinery.interpreter.rete.traceability.TraceInfo; |
46 | 46 | ||
47 | import java.util.HashMap; | 47 | import java.util.HashMap; |
48 | import java.util.List; | 48 | import java.util.List; |
@@ -66,7 +66,7 @@ class NodeFactory { | |||
66 | * PRE: parent node must already be created | 66 | * PRE: parent node must already be created |
67 | */ | 67 | */ |
68 | public Indexer createIndexer(ReteContainer reteContainer, IndexerRecipe recipe, Supplier parentNode, | 68 | public Indexer createIndexer(ReteContainer reteContainer, IndexerRecipe recipe, Supplier parentNode, |
69 | TraceInfo... traces) { | 69 | TraceInfo... traces) { |
70 | 70 | ||
71 | if (recipe instanceof ProjectionIndexerRecipe) { | 71 | if (recipe instanceof ProjectionIndexerRecipe) { |
72 | return parentNode.constructIndex(toMask(recipe.getMask()), traces); | 72 | return parentNode.constructIndex(toMask(recipe.getMask()), traces); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/NodeProvisioner.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/NodeProvisioner.java index 9121fc44..0a68f449 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/NodeProvisioner.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/NodeProvisioner.java | |||
@@ -7,29 +7,29 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.network; | 10 | package tools.refinery.interpreter.rete.network; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 12 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
13 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 13 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
14 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 14 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 15 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
16 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 16 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
17 | import tools.refinery.viatra.runtime.rete.boundary.InputConnector; | 17 | import tools.refinery.interpreter.rete.boundary.InputConnector; |
18 | import tools.refinery.viatra.runtime.rete.construction.plancompiler.CompilerHelper; | 18 | import tools.refinery.interpreter.rete.construction.plancompiler.CompilerHelper; |
19 | import tools.refinery.viatra.runtime.rete.index.Indexer; | 19 | import tools.refinery.interpreter.rete.index.Indexer; |
20 | import tools.refinery.viatra.runtime.rete.index.OnetimeIndexer; | 20 | import tools.refinery.interpreter.rete.index.OnetimeIndexer; |
21 | import tools.refinery.viatra.runtime.rete.index.ProjectionIndexer; | 21 | import tools.refinery.interpreter.rete.index.ProjectionIndexer; |
22 | import tools.refinery.viatra.runtime.rete.network.delayed.DelayedConnectCommand; | 22 | import tools.refinery.interpreter.rete.network.delayed.DelayedConnectCommand; |
23 | import tools.refinery.viatra.runtime.rete.recipes.*; | 23 | import tools.refinery.interpreter.rete.recipes.*; |
24 | import tools.refinery.viatra.runtime.rete.recipes.helper.RecipeRecognizer; | 24 | import tools.refinery.interpreter.rete.recipes.helper.RecipeRecognizer; |
25 | import tools.refinery.viatra.runtime.rete.recipes.helper.RecipesHelper; | 25 | import tools.refinery.interpreter.rete.recipes.helper.RecipesHelper; |
26 | import tools.refinery.viatra.runtime.rete.remote.Address; | 26 | import tools.refinery.interpreter.rete.remote.Address; |
27 | import tools.refinery.viatra.runtime.rete.remote.RemoteReceiver; | 27 | import tools.refinery.interpreter.rete.remote.RemoteReceiver; |
28 | import tools.refinery.viatra.runtime.rete.remote.RemoteSupplier; | 28 | import tools.refinery.interpreter.rete.remote.RemoteSupplier; |
29 | import tools.refinery.viatra.runtime.rete.traceability.ActiveNodeConflictTrace; | 29 | import tools.refinery.interpreter.rete.traceability.ActiveNodeConflictTrace; |
30 | import tools.refinery.viatra.runtime.rete.traceability.RecipeTraceInfo; | 30 | import tools.refinery.interpreter.rete.traceability.RecipeTraceInfo; |
31 | import tools.refinery.viatra.runtime.rete.traceability.UserRequestTrace; | 31 | import tools.refinery.interpreter.rete.traceability.UserRequestTrace; |
32 | import tools.refinery.viatra.runtime.rete.util.Options; | 32 | import tools.refinery.interpreter.rete.util.Options; |
33 | 33 | ||
34 | import java.util.Map; | 34 | import java.util.Map; |
35 | import java.util.Set; | 35 | import java.util.Set; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/PosetAwareReceiver.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/PosetAwareReceiver.java index 1eaa18e7..7904eca5 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/PosetAwareReceiver.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/PosetAwareReceiver.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network; | 9 | package tools.refinery.interpreter.rete.network; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.context.IPosetComparator; | 11 | import tools.refinery.interpreter.matchers.context.IPosetComparator; |
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 12 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
13 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 13 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
14 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 14 | import tools.refinery.interpreter.matchers.util.Direction; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * @author Tamas Szabo | 17 | * @author Tamas Szabo |
@@ -20,20 +20,20 @@ import tools.refinery.viatra.runtime.matchers.util.Direction; | |||
20 | public interface PosetAwareReceiver extends Receiver { | 20 | public interface PosetAwareReceiver extends Receiver { |
21 | 21 | ||
22 | public TupleMask getCoreMask(); | 22 | public TupleMask getCoreMask(); |
23 | 23 | ||
24 | public TupleMask getPosetMask(); | 24 | public TupleMask getPosetMask(); |
25 | 25 | ||
26 | public IPosetComparator getPosetComparator(); | 26 | public IPosetComparator getPosetComparator(); |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Updates the receiver with a newly found or lost partial matching also providing information | 29 | * Updates the receiver with a newly found or lost partial matching also providing information |
30 | * whether the update is a monotone change or not. | 30 | * whether the update is a monotone change or not. |
31 | * | 31 | * |
32 | * @param direction the direction of the update | 32 | * @param direction the direction of the update |
33 | * @param update the update tuple | 33 | * @param update the update tuple |
34 | * @param monotone true if the update is monotone, false otherwise | 34 | * @param monotone true if the update is monotone, false otherwise |
35 | * @since 2.4 | 35 | * @since 2.4 |
36 | */ | 36 | */ |
37 | public void updateWithPosetInfo(Direction direction, Tuple update, boolean monotone); | 37 | public void updateWithPosetInfo(Direction direction, Tuple update, boolean monotone); |
38 | 38 | ||
39 | } | 39 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/ProductionNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/ProductionNode.java index 211194c0..2a167078 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/ProductionNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/ProductionNode.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.network; | 10 | package tools.refinery.interpreter.rete.network; |
11 | 11 | ||
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 14 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Interface intended for nodes containing complete matches. | 17 | * Interface intended for nodes containing complete matches. |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Receiver.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Receiver.java index 3dc9aad7..e033ebe5 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Receiver.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Receiver.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.network; | 10 | package tools.refinery.interpreter.rete.network; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.Map.Entry; | 14 | import java.util.Map.Entry; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
17 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 17 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
18 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 19 | import tools.refinery.interpreter.matchers.util.Direction; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * ALL METHODS: FOR INTERNAL USE ONLY; ONLY INVOKE FROM {@link ReteContainer} | 22 | * ALL METHODS: FOR INTERNAL USE ONLY; ONLY INVOKE FROM {@link ReteContainer} |
23 | * | 23 | * |
24 | * @author Gabor Bergmann | 24 | * @author Gabor Bergmann |
25 | * @noimplement This interface is not intended to be implemented by external clients. | 25 | * @noimplement This interface is not intended to be implemented by external clients. |
26 | */ | 26 | */ |
@@ -28,7 +28,7 @@ public interface Receiver extends Node { | |||
28 | 28 | ||
29 | /** | 29 | /** |
30 | * Updates the receiver with a newly found or lost partial matching. | 30 | * Updates the receiver with a newly found or lost partial matching. |
31 | * | 31 | * |
32 | * @since 2.4 | 32 | * @since 2.4 |
33 | */ | 33 | */ |
34 | public void update(final Direction direction, final Tuple updateElement, final Timestamp timestamp); | 34 | public void update(final Direction direction, final Tuple updateElement, final Timestamp timestamp); |
@@ -38,7 +38,7 @@ public interface Receiver extends Node { | |||
38 | * form (t, c) where t is an update tuple and c is the count. The count can also be negative, and it specifies how | 38 | * form (t, c) where t is an update tuple and c is the count. The count can also be negative, and it specifies how |
39 | * many times the tuple t gets deleted or inserted. The default implementation of this method simply calls | 39 | * many times the tuple t gets deleted or inserted. The default implementation of this method simply calls |
40 | * {@link #update(Direction, Tuple, Timestamp)} individually for all updates. | 40 | * {@link #update(Direction, Tuple, Timestamp)} individually for all updates. |
41 | * | 41 | * |
42 | * @since 2.8 | 42 | * @since 2.8 |
43 | */ | 43 | */ |
44 | public default void batchUpdate(final Collection<Map.Entry<Tuple, Integer>> updates, final Timestamp timestamp) { | 44 | public default void batchUpdate(final Collection<Map.Entry<Tuple, Integer>> updates, final Timestamp timestamp) { |
@@ -61,7 +61,7 @@ public interface Receiver extends Node { | |||
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Returns the {@link Mailbox} of this receiver. | 63 | * Returns the {@link Mailbox} of this receiver. |
64 | * | 64 | * |
65 | * @return the mailbox | 65 | * @return the mailbox |
66 | * @since 2.0 | 66 | * @since 2.0 |
67 | */ | 67 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/RederivableNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/RederivableNode.java index cae78d37..6b7ba504 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/RederivableNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/RederivableNode.java | |||
@@ -3,32 +3,32 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network; | 9 | package tools.refinery.interpreter.rete.network; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * A rederivable node can potentially re-derive tuples after the Rete network has finished the delivery of messages. | 12 | * A rederivable node can potentially re-derive tuples after the Rete network has finished the delivery of messages. |
13 | * | 13 | * |
14 | * @author Tamas Szabo | 14 | * @author Tamas Szabo |
15 | * @since 1.6 | 15 | * @since 1.6 |
16 | */ | 16 | */ |
17 | public interface RederivableNode extends Node, IGroupable { | 17 | public interface RederivableNode extends Node, IGroupable { |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * The method is called by the {@link ReteContainer} to re-derive tuples after the normal messages have been | 20 | * The method is called by the {@link ReteContainer} to re-derive tuples after the normal messages have been |
21 | * delivered and consumed. The re-derivation process may trigger the creation and delivery of further messages | 21 | * delivered and consumed. The re-derivation process may trigger the creation and delivery of further messages |
22 | * and further re-derivation rounds. | 22 | * and further re-derivation rounds. |
23 | */ | 23 | */ |
24 | public void rederiveOne(); | 24 | public void rederiveOne(); |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Returns true if this node actually runs in DRed mode (not necessarily). | 27 | * Returns true if this node actually runs in DRed mode (not necessarily). |
28 | * | 28 | * |
29 | * @return true if the node is operating in DRed mode | 29 | * @return true if the node is operating in DRed mode |
30 | * @since 2.0 | 30 | * @since 2.0 |
31 | */ | 31 | */ |
32 | public boolean isInDRedMode(); | 32 | public boolean isInDRedMode(); |
33 | 33 | ||
34 | } | 34 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/ReinitializedNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/ReinitializedNode.java index 09bff29e..959d09fe 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/ReinitializedNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/ReinitializedNode.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.viatra.runtime.rete.network; | 6 | package tools.refinery.interpreter.rete.network; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 8 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
9 | 9 | ||
10 | import java.util.Collection; | 10 | import java.util.Collection; |
11 | 11 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/ReteContainer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/ReteContainer.java index d058417f..b5c91d32 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/ReteContainer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/ReteContainer.java | |||
@@ -8,30 +8,30 @@ | |||
8 | * SPDX-License-Identifier: EPL-2.0 | 8 | * SPDX-License-Identifier: EPL-2.0 |
9 | *******************************************************************************/ | 9 | *******************************************************************************/ |
10 | 10 | ||
11 | package tools.refinery.viatra.runtime.rete.network; | 11 | package tools.refinery.interpreter.rete.network; |
12 | 12 | ||
13 | import org.apache.log4j.Logger; | 13 | import org.apache.log4j.Logger; |
14 | import tools.refinery.viatra.runtime.CancellationToken; | 14 | import tools.refinery.interpreter.rete.boundary.InputConnector; |
15 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 15 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.network.communication.CommunicationTracker; |
17 | import tools.refinery.viatra.runtime.matchers.util.Clearable; | 17 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
18 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 18 | import tools.refinery.interpreter.rete.network.communication.timeless.TimelessCommunicationTracker; |
19 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 19 | import tools.refinery.interpreter.rete.network.communication.timely.TimelyCommunicationTracker; |
20 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 20 | import tools.refinery.interpreter.rete.network.delayed.DelayedCommand; |
21 | import tools.refinery.viatra.runtime.rete.boundary.InputConnector; | 21 | import tools.refinery.interpreter.rete.network.delayed.DelayedConnectCommand; |
22 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration; | 22 | import tools.refinery.interpreter.rete.network.delayed.DelayedDisconnectCommand; |
23 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 23 | import tools.refinery.interpreter.CancellationToken; |
24 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTracker; | 24 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
25 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 25 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
26 | import tools.refinery.viatra.runtime.rete.network.communication.timeless.TimelessCommunicationTracker; | 26 | import tools.refinery.interpreter.matchers.util.Clearable; |
27 | import tools.refinery.viatra.runtime.rete.network.communication.timely.TimelyCommunicationTracker; | 27 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
28 | import tools.refinery.viatra.runtime.rete.network.delayed.DelayedCommand; | 28 | import tools.refinery.interpreter.matchers.util.Direction; |
29 | import tools.refinery.viatra.runtime.rete.network.delayed.DelayedConnectCommand; | 29 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
30 | import tools.refinery.viatra.runtime.rete.network.delayed.DelayedDisconnectCommand; | 30 | import tools.refinery.interpreter.rete.matcher.TimelyConfiguration; |
31 | import tools.refinery.viatra.runtime.rete.remote.Address; | 31 | import tools.refinery.interpreter.rete.remote.Address; |
32 | import tools.refinery.viatra.runtime.rete.single.SingleInputNode; | 32 | import tools.refinery.interpreter.rete.single.SingleInputNode; |
33 | import tools.refinery.viatra.runtime.rete.single.TrimmerNode; | 33 | import tools.refinery.interpreter.rete.single.TrimmerNode; |
34 | import tools.refinery.viatra.runtime.rete.util.Options; | 34 | import tools.refinery.interpreter.rete.util.Options; |
35 | 35 | ||
36 | import java.util.*; | 36 | import java.util.*; |
37 | import java.util.function.Function; | 37 | import java.util.function.Function; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/StandardNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/StandardNode.java index 7dc7c4bc..5a9a2644 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/StandardNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/StandardNode.java | |||
@@ -8,17 +8,17 @@ | |||
8 | * SPDX-License-Identifier: EPL-2.0 | 8 | * SPDX-License-Identifier: EPL-2.0 |
9 | *******************************************************************************/ | 9 | *******************************************************************************/ |
10 | 10 | ||
11 | package tools.refinery.viatra.runtime.rete.network; | 11 | package tools.refinery.interpreter.rete.network; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 13 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
14 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 14 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
15 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 15 | import tools.refinery.interpreter.rete.traceability.TraceInfo; |
16 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 16 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
17 | import tools.refinery.viatra.runtime.rete.index.GenericProjectionIndexer; | 17 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
18 | import tools.refinery.viatra.runtime.rete.index.ProjectionIndexer; | 18 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
19 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 19 | import tools.refinery.interpreter.matchers.util.Direction; |
20 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 20 | import tools.refinery.interpreter.rete.index.GenericProjectionIndexer; |
21 | import tools.refinery.viatra.runtime.rete.traceability.TraceInfo; | 21 | import tools.refinery.interpreter.rete.index.ProjectionIndexer; |
22 | 22 | ||
23 | import java.util.Collection; | 23 | import java.util.Collection; |
24 | import java.util.HashSet; | 24 | import java.util.HashSet; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Supplier.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Supplier.java index 1917a7cf..83d05646 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Supplier.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Supplier.java | |||
@@ -3,56 +3,56 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.network; | 10 | package tools.refinery.interpreter.rete.network; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 17 | import tools.refinery.interpreter.rete.traceability.TraceInfo; |
18 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.rete.index.ProjectionIndexer; | 19 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
20 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 20 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
21 | import tools.refinery.viatra.runtime.rete.single.TrimmerNode; | 21 | import tools.refinery.interpreter.rete.index.ProjectionIndexer; |
22 | import tools.refinery.viatra.runtime.rete.traceability.TraceInfo; | 22 | import tools.refinery.interpreter.rete.single.TrimmerNode; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * @author Gabor Bergmann | 25 | * @author Gabor Bergmann |
26 | * | 26 | * |
27 | * A supplier is an object that can propagate insert or revoke events towards receivers. | 27 | * A supplier is an object that can propagate insert or revoke events towards receivers. |
28 | */ | 28 | */ |
29 | public interface Supplier extends Node { | 29 | public interface Supplier extends Node { |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Pulls the contents of this object in this particular moment into a target collection. | 32 | * Pulls the contents of this object in this particular moment into a target collection. |
33 | * | 33 | * |
34 | * @param flush if true, flushing of messages is allowed during the pull, otherwise flushing is not allowed | 34 | * @param flush if true, flushing of messages is allowed during the pull, otherwise flushing is not allowed |
35 | * @since 2.3 | 35 | * @since 2.3 |
36 | */ | 36 | */ |
37 | public void pullInto(Collection<Tuple> collector, boolean flush); | 37 | public void pullInto(Collection<Tuple> collector, boolean flush); |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * @since 2.4 | 40 | * @since 2.4 |
41 | */ | 41 | */ |
42 | public void pullIntoWithTimeline(final Map<Tuple, Timeline<Timestamp>> collector, final boolean flush); | 42 | public void pullIntoWithTimeline(final Map<Tuple, Timeline<Timestamp>> collector, final boolean flush); |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Returns the contents of this object in this particular moment. | 45 | * Returns the contents of this object in this particular moment. |
46 | * For memoryless nodes, this may involve a costly recomputation of contents. | 46 | * For memoryless nodes, this may involve a costly recomputation of contents. |
47 | * | 47 | * |
48 | * The result is returned as a Set, even when it has multiplicities (at the output of {@link TrimmerNode}). | 48 | * The result is returned as a Set, even when it has multiplicities (at the output of {@link TrimmerNode}). |
49 | * | 49 | * |
50 | * <p> Intended mainly for debug purposes; therefore flushing is performed only if explicitly requested | 50 | * <p> Intended mainly for debug purposes; therefore flushing is performed only if explicitly requested |
51 | * During runtime, flushing may be preferred; see {@link ReteContainer#pullContents(Supplier)} | 51 | * During runtime, flushing may be preferred; see {@link ReteContainer#pullContents(Supplier)} |
52 | * @since 2.3 | 52 | * @since 2.3 |
53 | */ | 53 | */ |
54 | public Set<Tuple> getPulledContents(boolean flush); | 54 | public Set<Tuple> getPulledContents(boolean flush); |
55 | 55 | ||
56 | default public Set<Tuple> getPulledContents() { | 56 | default public Set<Tuple> getPulledContents() { |
57 | return getPulledContents(true); | 57 | return getPulledContents(true); |
58 | } | 58 | } |
@@ -68,8 +68,8 @@ public interface Supplier extends Node { | |||
68 | void removeChild(Receiver receiver); | 68 | void removeChild(Receiver receiver); |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * Instantiates (or reuses, depending on implementation) an index according to the given mask. | 71 | * Instantiates (or reuses, depending on implementation) an index according to the given mask. |
72 | * | 72 | * |
73 | * Intended for internal use; clients should invoke through Library instead to enable reusing. | 73 | * Intended for internal use; clients should invoke through Library instead to enable reusing. |
74 | */ | 74 | */ |
75 | ProjectionIndexer constructIndex(TupleMask mask, TraceInfo... traces); | 75 | ProjectionIndexer constructIndex(TupleMask mask, TraceInfo... traces); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Tunnel.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Tunnel.java index f238f47b..9dcb4b6e 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/Tunnel.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/Tunnel.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.network; | 10 | package tools.refinery.interpreter.rete.network; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * @author Gabor Bergmann | 13 | * @author Gabor Bergmann |
14 | * | 14 | * |
15 | * A Tunnel is an interface into which elments can be instered and from which productions can be extracted. | 15 | * A Tunnel is an interface into which elments can be instered and from which productions can be extracted. |
16 | */ | 16 | */ |
17 | public interface Tunnel extends Supplier, Receiver { | 17 | public interface Tunnel extends Supplier, Receiver { |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/UpdateMessage.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/UpdateMessage.java index 1334a3a9..bd64cc9d 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/UpdateMessage.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/UpdateMessage.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.network; | 10 | package tools.refinery.interpreter.rete.network; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 12 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
13 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 13 | import tools.refinery.interpreter.matchers.util.Direction; |
14 | 14 | ||
15 | class UpdateMessage { | 15 | class UpdateMessage { |
16 | public Receiver receiver; | 16 | public Receiver receiver; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/CommunicationGroup.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/CommunicationGroup.java index 8cedeb11..5d9ee3b4 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/CommunicationGroup.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/CommunicationGroup.java | |||
@@ -3,20 +3,20 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication; | 9 | package tools.refinery.interpreter.rete.network.communication; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.rete.network.Node; | 14 | import tools.refinery.interpreter.rete.network.Node; |
15 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 15 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * A communication group represents a set of nodes in the communication graph that form a strongly connected component. | 18 | * A communication group represents a set of nodes in the communication graph that form a strongly connected component. |
19 | * | 19 | * |
20 | * @author Tamas Szabo | 20 | * @author Tamas Szabo |
21 | * @since 1.6 | 21 | * @since 1.6 |
22 | */ | 22 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/CommunicationTracker.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/CommunicationTracker.java index 9c2fbb9a..2e8eb338 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/CommunicationTracker.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/CommunicationTracker.java | |||
@@ -6,24 +6,24 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication; | 9 | package tools.refinery.interpreter.rete.network.communication; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 11 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
12 | import tools.refinery.viatra.runtime.rete.aggregation.IAggregatorNode; | 12 | import tools.refinery.interpreter.rete.aggregation.IAggregatorNode; |
13 | import tools.refinery.viatra.runtime.rete.boundary.ExternalInputEnumeratorNode; | 13 | import tools.refinery.interpreter.rete.boundary.ExternalInputEnumeratorNode; |
14 | import tools.refinery.viatra.runtime.rete.eval.RelationEvaluatorNode; | 14 | import tools.refinery.interpreter.rete.eval.RelationEvaluatorNode; |
15 | import tools.refinery.viatra.runtime.rete.index.*; | 15 | import tools.refinery.interpreter.rete.index.*; |
16 | import tools.refinery.viatra.runtime.rete.itc.alg.incscc.IncSCCAlg; | 16 | import tools.refinery.interpreter.rete.itc.alg.incscc.IncSCCAlg; |
17 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.topsort.TopologicalSorting; | 17 | import tools.refinery.interpreter.rete.itc.alg.misc.topsort.TopologicalSorting; |
18 | import tools.refinery.viatra.runtime.rete.itc.graphimpl.Graph; | 18 | import tools.refinery.interpreter.rete.itc.graphimpl.Graph; |
19 | import tools.refinery.viatra.runtime.rete.network.*; | 19 | import tools.refinery.interpreter.rete.network.*; |
20 | import tools.refinery.viatra.runtime.rete.network.communication.timely.TimelyIndexerListenerProxy; | 20 | import tools.refinery.interpreter.rete.network.communication.timely.TimelyIndexerListenerProxy; |
21 | import tools.refinery.viatra.runtime.rete.network.communication.timely.TimelyMailboxProxy; | 21 | import tools.refinery.interpreter.rete.network.communication.timely.TimelyMailboxProxy; |
22 | import tools.refinery.viatra.runtime.rete.network.mailbox.FallThroughCapableMailbox; | 22 | import tools.refinery.interpreter.rete.network.mailbox.FallThroughCapableMailbox; |
23 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 23 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
24 | import tools.refinery.viatra.runtime.rete.network.mailbox.timeless.BehaviorChangingMailbox; | 24 | import tools.refinery.interpreter.rete.network.mailbox.timeless.BehaviorChangingMailbox; |
25 | import tools.refinery.viatra.runtime.rete.single.TransitiveClosureNode; | 25 | import tools.refinery.interpreter.rete.single.TransitiveClosureNode; |
26 | import tools.refinery.viatra.runtime.rete.single.TrimmerNode; | 26 | import tools.refinery.interpreter.rete.single.TrimmerNode; |
27 | 27 | ||
28 | import java.util.*; | 28 | import java.util.*; |
29 | 29 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/MessageSelector.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/MessageSelector.java index e1a61693..2e8978b7 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/MessageSelector.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/MessageSelector.java | |||
@@ -3,17 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication; | 9 | package tools.refinery.interpreter.rete.network.communication; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Subclasses of this interface represent meta data of update messages in Rete. | 12 | * Subclasses of this interface represent meta data of update messages in Rete. |
13 | * | 13 | * |
14 | * @author Tamas Szabo | 14 | * @author Tamas Szabo |
15 | * @since 2.3 | 15 | * @since 2.3 |
16 | */ | 16 | */ |
17 | public interface MessageSelector { | 17 | public interface MessageSelector { |
18 | 18 | ||
19 | } | 19 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/NodeComparator.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/NodeComparator.java index 27779352..498191d8 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/NodeComparator.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/NodeComparator.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication; | 9 | package tools.refinery.interpreter.rete.network.communication; |
10 | 10 | ||
11 | import java.util.Comparator; | 11 | import java.util.Comparator; |
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.rete.network.Node; | 14 | import tools.refinery.interpreter.rete.network.Node; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * @since 2.4 | 17 | * @since 2.4 |
@@ -28,5 +28,5 @@ public class NodeComparator implements Comparator<Node> { | |||
28 | public int compare(final Node left, final Node right) { | 28 | public int compare(final Node left, final Node right) { |
29 | return this.nodeMap.get(left) - this.nodeMap.get(right); | 29 | return this.nodeMap.get(left) - this.nodeMap.get(right); |
30 | } | 30 | } |
31 | 31 | ||
32 | } \ No newline at end of file | 32 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/PhasedSelector.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/PhasedSelector.java index 41cd8cd3..1739494a 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/PhasedSelector.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/PhasedSelector.java | |||
@@ -3,32 +3,32 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication; | 9 | package tools.refinery.interpreter.rete.network.communication; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * A default message selector that can be used to associate phases to messages. | 12 | * A default message selector that can be used to associate phases to messages. |
13 | * | 13 | * |
14 | * @author Tamas Szabo | 14 | * @author Tamas Szabo |
15 | * @since 2.3 | 15 | * @since 2.3 |
16 | */ | 16 | */ |
17 | public enum PhasedSelector implements MessageSelector { | 17 | public enum PhasedSelector implements MessageSelector { |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * No special distinguishing feature | 20 | * No special distinguishing feature |
21 | */ | 21 | */ |
22 | DEFAULT, | 22 | DEFAULT, |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Inserts and delete-insert monotone change pairs | 25 | * Inserts and delete-insert monotone change pairs |
26 | */ | 26 | */ |
27 | MONOTONE, | 27 | MONOTONE, |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * Deletes | 30 | * Deletes |
31 | */ | 31 | */ |
32 | ANTI_MONOTONE | 32 | ANTI_MONOTONE |
33 | 33 | ||
34 | } | 34 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/Timestamp.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/Timestamp.java index a50a63a8..dbf4c6ee 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/Timestamp.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/Timestamp.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication; | 9 | package tools.refinery.interpreter.rete.network.communication; |
10 | 10 | ||
11 | import java.util.AbstractMap; | 11 | import java.util.AbstractMap; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 16 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
17 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timelines; | 17 | import tools.refinery.interpreter.matchers.util.timeline.Timelines; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * A timestamp associated with update messages in timely evaluation. | 20 | * A timestamp associated with update messages in timely evaluation. |
21 | * | 21 | * |
22 | * @author Tamas Szabo | 22 | * @author Tamas Szabo |
23 | * @since 2.3 | 23 | * @since 2.3 |
24 | */ | 24 | */ |
@@ -46,7 +46,7 @@ public class Timestamp implements Comparable<Timestamp>, MessageSelector { | |||
46 | return that; | 46 | return that; |
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * @since 2.4 | 51 | * @since 2.4 |
52 | */ | 52 | */ |
@@ -81,11 +81,11 @@ public class Timestamp implements Comparable<Timestamp>, MessageSelector { | |||
81 | public String toString() { | 81 | public String toString() { |
82 | return Integer.toString(this.value); | 82 | return Integer.toString(this.value); |
83 | } | 83 | } |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * A {@link Map} implementation that associates the zero timestamp with every key. There is no suppor for | 86 | * A {@link Map} implementation that associates the zero timestamp with every key. There is no suppor for |
87 | * {@link Map#entrySet()} due to performance reasons. | 87 | * {@link Map#entrySet()} due to performance reasons. |
88 | * | 88 | * |
89 | * @author Tamas Szabo | 89 | * @author Tamas Szabo |
90 | */ | 90 | */ |
91 | public static final class AllZeroMap<T> extends AbstractMap<T, Timeline<Timestamp>> { | 91 | public static final class AllZeroMap<T> extends AbstractMap<T, Timeline<Timestamp>> { |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timeless/RecursiveCommunicationGroup.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/RecursiveCommunicationGroup.java index d8260384..3c0feb7c 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timeless/RecursiveCommunicationGroup.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/RecursiveCommunicationGroup.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication.timeless; | 9 | package tools.refinery.interpreter.rete.network.communication.timeless; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -15,19 +15,19 @@ import java.util.LinkedHashSet; | |||
15 | import java.util.Map; | 15 | import java.util.Map; |
16 | import java.util.Set; | 16 | import java.util.Set; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 18 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
19 | import tools.refinery.viatra.runtime.rete.network.Node; | 19 | import tools.refinery.interpreter.rete.network.Node; |
20 | import tools.refinery.viatra.runtime.rete.network.RederivableNode; | 20 | import tools.refinery.interpreter.rete.network.RederivableNode; |
21 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 21 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
22 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTracker; | 22 | import tools.refinery.interpreter.rete.network.communication.CommunicationTracker; |
23 | import tools.refinery.viatra.runtime.rete.network.communication.MessageSelector; | 23 | import tools.refinery.interpreter.rete.network.communication.MessageSelector; |
24 | import tools.refinery.viatra.runtime.rete.network.communication.PhasedSelector; | 24 | import tools.refinery.interpreter.rete.network.communication.PhasedSelector; |
25 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 25 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * A communication group representing either a single node where the | 28 | * A communication group representing either a single node where the |
29 | * node is a monotonicity aware one or a set of nodes that form an SCC. | 29 | * node is a monotonicity aware one or a set of nodes that form an SCC. |
30 | * | 30 | * |
31 | * @author Tamas Szabo | 31 | * @author Tamas Szabo |
32 | * @since 2.4 | 32 | * @since 2.4 |
33 | */ | 33 | */ |
@@ -54,7 +54,7 @@ public class RecursiveCommunicationGroup extends CommunicationGroup { | |||
54 | @Override | 54 | @Override |
55 | public void deliverMessages() { | 55 | public void deliverMessages() { |
56 | this.currentlyDelivering = true; | 56 | this.currentlyDelivering = true; |
57 | 57 | ||
58 | // ANTI-MONOTONE PHASE | 58 | // ANTI-MONOTONE PHASE |
59 | while (!this.antiMonotoneMailboxes.isEmpty() || !this.defaultMailboxes.isEmpty()) { | 59 | while (!this.antiMonotoneMailboxes.isEmpty() || !this.defaultMailboxes.isEmpty()) { |
60 | while (!this.antiMonotoneMailboxes.isEmpty()) { | 60 | while (!this.antiMonotoneMailboxes.isEmpty()) { |
@@ -89,7 +89,7 @@ public class RecursiveCommunicationGroup extends CommunicationGroup { | |||
89 | mailbox.deliverAll(PhasedSelector.DEFAULT); | 89 | mailbox.deliverAll(PhasedSelector.DEFAULT); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | this.currentlyDelivering = false; | 93 | this.currentlyDelivering = false; |
94 | } | 94 | } |
95 | 95 | ||
@@ -155,10 +155,10 @@ public class RecursiveCommunicationGroup extends CommunicationGroup { | |||
155 | map.put(PhasedSelector.DEFAULT, defaultMailboxes); | 155 | map.put(PhasedSelector.DEFAULT, defaultMailboxes); |
156 | return Collections.unmodifiableMap(map); | 156 | return Collections.unmodifiableMap(map); |
157 | } | 157 | } |
158 | 158 | ||
159 | @Override | 159 | @Override |
160 | public boolean isRecursive() { | 160 | public boolean isRecursive() { |
161 | return true; | 161 | return true; |
162 | } | 162 | } |
163 | 163 | ||
164 | } | 164 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timeless/SingletonCommunicationGroup.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/SingletonCommunicationGroup.java index c51c7dbf..5b50f375 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timeless/SingletonCommunicationGroup.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/SingletonCommunicationGroup.java | |||
@@ -3,31 +3,31 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication.timeless; | 9 | package tools.refinery.interpreter.rete.network.communication.timeless; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.rete.network.Node; | 15 | import tools.refinery.interpreter.rete.network.Node; |
16 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 16 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
17 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTracker; | 17 | import tools.refinery.interpreter.rete.network.communication.CommunicationTracker; |
18 | import tools.refinery.viatra.runtime.rete.network.communication.MessageSelector; | 18 | import tools.refinery.interpreter.rete.network.communication.MessageSelector; |
19 | import tools.refinery.viatra.runtime.rete.network.communication.PhasedSelector; | 19 | import tools.refinery.interpreter.rete.network.communication.PhasedSelector; |
20 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 20 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * A communication group containing only a single node with a single default | 23 | * A communication group containing only a single node with a single default |
24 | * mailbox. | 24 | * mailbox. |
25 | * | 25 | * |
26 | * @author Tamas Szabo | 26 | * @author Tamas Szabo |
27 | * @since 1.6 | 27 | * @since 1.6 |
28 | */ | 28 | */ |
29 | public class SingletonCommunicationGroup extends CommunicationGroup { | 29 | public class SingletonCommunicationGroup extends CommunicationGroup { |
30 | 30 | ||
31 | private Mailbox mailbox; | 31 | private Mailbox mailbox; |
32 | 32 | ||
33 | /** | 33 | /** |
@@ -82,5 +82,5 @@ public class SingletonCommunicationGroup extends CommunicationGroup { | |||
82 | public boolean isRecursive() { | 82 | public boolean isRecursive() { |
83 | return false; | 83 | return false; |
84 | } | 84 | } |
85 | 85 | ||
86 | } | 86 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timeless/TimelessCommunicationTracker.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/TimelessCommunicationTracker.java index 1c18c1cd..77f40fc3 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timeless/TimelessCommunicationTracker.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timeless/TimelessCommunicationTracker.java | |||
@@ -3,32 +3,32 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication.timeless; | 9 | package tools.refinery.interpreter.rete.network.communication.timeless; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.HashSet; | 12 | import java.util.HashSet; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | import java.util.Map.Entry; | 14 | import java.util.Map.Entry; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.rete.index.DualInputNode; | 16 | import tools.refinery.interpreter.rete.index.DualInputNode; |
17 | import tools.refinery.viatra.runtime.rete.index.Indexer; | 17 | import tools.refinery.interpreter.rete.index.Indexer; |
18 | import tools.refinery.viatra.runtime.rete.index.IndexerListener; | 18 | import tools.refinery.interpreter.rete.index.IndexerListener; |
19 | import tools.refinery.viatra.runtime.rete.index.IterableIndexer; | 19 | import tools.refinery.interpreter.rete.index.IterableIndexer; |
20 | import tools.refinery.viatra.runtime.rete.network.Node; | 20 | import tools.refinery.interpreter.rete.network.Node; |
21 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 21 | import tools.refinery.interpreter.rete.network.Receiver; |
22 | import tools.refinery.viatra.runtime.rete.network.RederivableNode; | 22 | import tools.refinery.interpreter.rete.network.RederivableNode; |
23 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 23 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
24 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTracker; | 24 | import tools.refinery.interpreter.rete.network.communication.CommunicationTracker; |
25 | import tools.refinery.viatra.runtime.rete.network.communication.MessageSelector; | 25 | import tools.refinery.interpreter.rete.network.communication.MessageSelector; |
26 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 26 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
27 | import tools.refinery.viatra.runtime.rete.network.mailbox.timeless.BehaviorChangingMailbox; | 27 | import tools.refinery.interpreter.rete.network.mailbox.timeless.BehaviorChangingMailbox; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * Timeless implementation of the communication tracker. | 30 | * Timeless implementation of the communication tracker. |
31 | * | 31 | * |
32 | * @author Tamas Szabo | 32 | * @author Tamas Szabo |
33 | * @since 2.2 | 33 | * @since 2.2 |
34 | */ | 34 | */ |
@@ -107,10 +107,10 @@ public class TimelessCommunicationTracker extends CommunicationTracker { | |||
107 | } | 107 | } |
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
111 | @Override | 111 | @Override |
112 | protected void postProcessGroup(final CommunicationGroup group) { | 112 | protected void postProcessGroup(final CommunicationGroup group) { |
113 | 113 | ||
114 | } | 114 | } |
115 | 115 | ||
116 | /** | 116 | /** |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/ResumableNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/ResumableNode.java index 8097bd91..85b9809d 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/ResumableNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/ResumableNode.java | |||
@@ -3,23 +3,23 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication.timely; | 9 | package tools.refinery.interpreter.rete.network.communication.timely; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.network.IGroupable; | 11 | import tools.refinery.interpreter.rete.network.IGroupable; |
12 | import tools.refinery.viatra.runtime.rete.network.Node; | 12 | import tools.refinery.interpreter.rete.network.Node; |
13 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 13 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * {@link Node}s that implement this interface can resume folding of their states when instructed during timely evaluation. | 16 | * {@link Node}s that implement this interface can resume folding of their states when instructed during timely evaluation. |
17 | * | 17 | * |
18 | * @since 2.3 | 18 | * @since 2.3 |
19 | * @author Tamas Szabo | 19 | * @author Tamas Szabo |
20 | */ | 20 | */ |
21 | public interface ResumableNode extends Node, IGroupable { | 21 | public interface ResumableNode extends Node, IGroupable { |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * When called, the folding of the state shall be resumed at the given timestamp. The resumable is expected to | 24 | * When called, the folding of the state shall be resumed at the given timestamp. The resumable is expected to |
25 | * do a folding step at the given timestamp only. Afterwards, folding shall be interrupted, even if there is more | 25 | * do a folding step at the given timestamp only. Afterwards, folding shall be interrupted, even if there is more |
@@ -32,5 +32,5 @@ public interface ResumableNode extends Node, IGroupable { | |||
32 | * resumable. | 32 | * resumable. |
33 | */ | 33 | */ |
34 | public Timestamp getResumableTimestamp(); | 34 | public Timestamp getResumableTimestamp(); |
35 | 35 | ||
36 | } | 36 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimelyCommunicationGroup.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimelyCommunicationGroup.java index 0394d92c..e9523015 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimelyCommunicationGroup.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimelyCommunicationGroup.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication.timely; | 9 | package tools.refinery.interpreter.rete.network.communication.timely; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -19,19 +19,19 @@ import java.util.TreeMap; | |||
19 | import java.util.TreeSet; | 19 | import java.util.TreeSet; |
20 | 20 | ||
21 | import org.apache.log4j.Logger; | 21 | import org.apache.log4j.Logger; |
22 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 22 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
23 | import tools.refinery.viatra.runtime.rete.network.Node; | 23 | import tools.refinery.interpreter.rete.network.Node; |
24 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 24 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
25 | import tools.refinery.viatra.runtime.rete.network.communication.MessageSelector; | 25 | import tools.refinery.interpreter.rete.network.communication.MessageSelector; |
26 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 26 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
27 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 27 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
28 | import tools.refinery.viatra.runtime.rete.network.mailbox.timely.TimelyMailbox; | 28 | import tools.refinery.interpreter.rete.network.mailbox.timely.TimelyMailbox; |
29 | import tools.refinery.viatra.runtime.rete.util.Options; | 29 | import tools.refinery.interpreter.rete.util.Options; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * A timely communication group implementation. {@link TimelyMailbox}es and {@link LazyFoldingNode}s are ordered in the | 32 | * A timely communication group implementation. {@link TimelyMailbox}es and {@link LazyFoldingNode}s are ordered in the |
33 | * increasing order of timestamps. | 33 | * increasing order of timestamps. |
34 | * | 34 | * |
35 | * @author Tamas Szabo | 35 | * @author Tamas Szabo |
36 | * @since 2.3 | 36 | * @since 2.3 |
37 | */ | 37 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimelyCommunicationTracker.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimelyCommunicationTracker.java index 79179880..a0cdc701 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimelyCommunicationTracker.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimelyCommunicationTracker.java | |||
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication.timely; | 9 | package tools.refinery.interpreter.rete.network.communication.timely; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.List; | 12 | import java.util.List; |
@@ -15,25 +15,25 @@ import java.util.Map.Entry; | |||
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | import java.util.function.Function; | 16 | import java.util.function.Function; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.topsort.TopologicalSorting; | 18 | import tools.refinery.interpreter.rete.itc.alg.misc.topsort.TopologicalSorting; |
19 | import tools.refinery.viatra.runtime.rete.itc.graphimpl.Graph; | 19 | import tools.refinery.interpreter.rete.itc.graphimpl.Graph; |
20 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 20 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
21 | import tools.refinery.viatra.runtime.rete.index.IndexerListener; | 21 | import tools.refinery.interpreter.rete.index.IndexerListener; |
22 | import tools.refinery.viatra.runtime.rete.index.SpecializedProjectionIndexer; | 22 | import tools.refinery.interpreter.rete.index.SpecializedProjectionIndexer; |
23 | import tools.refinery.viatra.runtime.rete.index.SpecializedProjectionIndexer.ListenerSubscription; | 23 | import tools.refinery.interpreter.rete.index.SpecializedProjectionIndexer.ListenerSubscription; |
24 | import tools.refinery.viatra.runtime.rete.index.StandardIndexer; | 24 | import tools.refinery.interpreter.rete.index.StandardIndexer; |
25 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration; | 25 | import tools.refinery.interpreter.rete.matcher.TimelyConfiguration; |
26 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration.TimelineRepresentation; | 26 | import tools.refinery.interpreter.rete.matcher.TimelyConfiguration.TimelineRepresentation; |
27 | import tools.refinery.viatra.runtime.rete.network.NetworkStructureChangeSensitiveNode; | 27 | import tools.refinery.interpreter.rete.network.NetworkStructureChangeSensitiveNode; |
28 | import tools.refinery.viatra.runtime.rete.network.Node; | 28 | import tools.refinery.interpreter.rete.network.Node; |
29 | import tools.refinery.viatra.runtime.rete.network.ProductionNode; | 29 | import tools.refinery.interpreter.rete.network.ProductionNode; |
30 | import tools.refinery.viatra.runtime.rete.network.StandardNode; | 30 | import tools.refinery.interpreter.rete.network.StandardNode; |
31 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 31 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
32 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTracker; | 32 | import tools.refinery.interpreter.rete.network.communication.CommunicationTracker; |
33 | import tools.refinery.viatra.runtime.rete.network.communication.MessageSelector; | 33 | import tools.refinery.interpreter.rete.network.communication.MessageSelector; |
34 | import tools.refinery.viatra.runtime.rete.network.communication.NodeComparator; | 34 | import tools.refinery.interpreter.rete.network.communication.NodeComparator; |
35 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 35 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
36 | import tools.refinery.viatra.runtime.rete.single.DiscriminatorDispatcherNode; | 36 | import tools.refinery.interpreter.rete.single.DiscriminatorDispatcherNode; |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * Timely (DDF) implementation of the {@link CommunicationTracker}. | 39 | * Timely (DDF) implementation of the {@link CommunicationTracker}. |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimelyIndexerListenerProxy.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimelyIndexerListenerProxy.java index e8fbf84e..07916270 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimelyIndexerListenerProxy.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimelyIndexerListenerProxy.java | |||
@@ -3,26 +3,26 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication.timely; | 9 | package tools.refinery.interpreter.rete.network.communication.timely; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 11 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
12 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 12 | import tools.refinery.interpreter.matchers.util.Direction; |
13 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 13 | import tools.refinery.interpreter.matchers.util.Preconditions; |
14 | import tools.refinery.viatra.runtime.rete.index.IndexerListener; | 14 | import tools.refinery.interpreter.rete.index.IndexerListener; |
15 | import tools.refinery.viatra.runtime.rete.network.Node; | 15 | import tools.refinery.interpreter.rete.network.Node; |
16 | import tools.refinery.viatra.runtime.rete.network.ProductionNode; | 16 | import tools.refinery.interpreter.rete.network.ProductionNode; |
17 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 17 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * A timely proxy for another {@link IndexerListener}, which performs some preprocessing | 20 | * A timely proxy for another {@link IndexerListener}, which performs some preprocessing |
21 | * on the differential timestamps before passing it on to the real recipient. | 21 | * on the differential timestamps before passing it on to the real recipient. |
22 | * <p> | 22 | * <p> |
23 | * These proxies are used on edges leading into {@link ProductionNode}s. Because {@link ProductionNode}s | 23 | * These proxies are used on edges leading into {@link ProductionNode}s. Because {@link ProductionNode}s |
24 | * never ask back the indexer for its contents, there is no need to also apply the proxy on that direction. | 24 | * never ask back the indexer for its contents, there is no need to also apply the proxy on that direction. |
25 | * | 25 | * |
26 | * @author Tamas Szabo | 26 | * @author Tamas Szabo |
27 | * @since 2.3 | 27 | * @since 2.3 |
28 | */ | 28 | */ |
@@ -37,7 +37,7 @@ public class TimelyIndexerListenerProxy implements IndexerListener { | |||
37 | this.wrapped = wrapped; | 37 | this.wrapped = wrapped; |
38 | this.preprocessor = preprocessor; | 38 | this.preprocessor = preprocessor; |
39 | } | 39 | } |
40 | 40 | ||
41 | public IndexerListener getWrappedIndexerListener() { | 41 | public IndexerListener getWrappedIndexerListener() { |
42 | return wrapped; | 42 | return wrapped; |
43 | } | 43 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimelyMailboxProxy.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimelyMailboxProxy.java index 550bfbeb..56cec326 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimelyMailboxProxy.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimelyMailboxProxy.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication.timely; | 9 | package tools.refinery.interpreter.rete.network.communication.timely; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 11 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
12 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 12 | import tools.refinery.interpreter.matchers.util.Direction; |
13 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 13 | import tools.refinery.interpreter.matchers.util.Preconditions; |
14 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 14 | import tools.refinery.interpreter.rete.network.Receiver; |
15 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 15 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
16 | import tools.refinery.viatra.runtime.rete.network.communication.MessageSelector; | 16 | import tools.refinery.interpreter.rete.network.communication.MessageSelector; |
17 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 17 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
18 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 18 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * A timely proxy for another {@link Mailbox}, which performs some preprocessing | 21 | * A timely proxy for another {@link Mailbox}, which performs some preprocessing |
22 | * on the differential timestamps before passing it on to the real recipient. | 22 | * on the differential timestamps before passing it on to the real recipient. |
23 | * | 23 | * |
24 | * @author Tamas Szabo | 24 | * @author Tamas Szabo |
25 | * @since 2.3 | 25 | * @since 2.3 |
26 | */ | 26 | */ |
@@ -34,7 +34,7 @@ public class TimelyMailboxProxy implements Mailbox { | |||
34 | this.wrapped = wrapped; | 34 | this.wrapped = wrapped; |
35 | this.preprocessor = preprocessor; | 35 | this.preprocessor = preprocessor; |
36 | } | 36 | } |
37 | 37 | ||
38 | public Mailbox getWrappedMailbox() { | 38 | public Mailbox getWrappedMailbox() { |
39 | return wrapped; | 39 | return wrapped; |
40 | } | 40 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimestampTransformation.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimestampTransformation.java index 8929eb5c..e995f0cb 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/communication/timely/TimestampTransformation.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/communication/timely/TimestampTransformation.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.communication.timely; | 9 | package tools.refinery.interpreter.rete.network.communication.timely; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.network.Node; | 11 | import tools.refinery.interpreter.rete.network.Node; |
12 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 12 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Values of this enum perform different kind of preprocessing on {@link Timestamp}s. | 15 | * Values of this enum perform different kind of preprocessing on {@link Timestamp}s. |
16 | * This is used on edges leading in and out from {@link Node}s in recursive {@link TimelyCommunicationGroup}s. | 16 | * This is used on edges leading in and out from {@link Node}s in recursive {@link TimelyCommunicationGroup}s. |
17 | * | 17 | * |
18 | * @author Tamas Szabo | 18 | * @author Tamas Szabo |
19 | * @since 2.3 | 19 | * @since 2.3 |
20 | */ | 20 | */ |
@@ -25,7 +25,7 @@ public enum TimestampTransformation { | |||
25 | public Timestamp process(final Timestamp timestamp) { | 25 | public Timestamp process(final Timestamp timestamp) { |
26 | return new Timestamp(timestamp.getValue() + 1); | 26 | return new Timestamp(timestamp.getValue() + 1); |
27 | } | 27 | } |
28 | 28 | ||
29 | @Override | 29 | @Override |
30 | public String toString() { | 30 | public String toString() { |
31 | return "INCREMENT"; | 31 | return "INCREMENT"; |
@@ -36,7 +36,7 @@ public enum TimestampTransformation { | |||
36 | public Timestamp process(final Timestamp timestamp) { | 36 | public Timestamp process(final Timestamp timestamp) { |
37 | return Timestamp.ZERO; | 37 | return Timestamp.ZERO; |
38 | } | 38 | } |
39 | 39 | ||
40 | @Override | 40 | @Override |
41 | public String toString() { | 41 | public String toString() { |
42 | return "RESET"; | 42 | return "RESET"; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/delayed/DelayedCommand.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/delayed/DelayedCommand.java index d6312671..eaf35f49 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/delayed/DelayedCommand.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/delayed/DelayedCommand.java | |||
@@ -3,34 +3,34 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.delayed; | 9 | package tools.refinery.interpreter.rete.network.delayed; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | import java.util.Map.Entry; | 13 | import java.util.Map.Entry; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.rete.network.communication.CommunicationTracker; |
16 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 16 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
17 | import tools.refinery.viatra.runtime.matchers.util.Signed; | 17 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
18 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.rete.network.Network; | 19 | import tools.refinery.interpreter.matchers.util.Direction; |
20 | import tools.refinery.viatra.runtime.rete.network.Node; | 20 | import tools.refinery.interpreter.matchers.util.Signed; |
21 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 21 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
22 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 22 | import tools.refinery.interpreter.rete.network.Network; |
23 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 23 | import tools.refinery.interpreter.rete.network.Node; |
24 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTracker; | 24 | import tools.refinery.interpreter.rete.network.Receiver; |
25 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 25 | import tools.refinery.interpreter.rete.network.ReteContainer; |
26 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 26 | import tools.refinery.interpreter.rete.network.Supplier; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Instances of this class are responsible for initializing a {@link Receiver} with the contents of a {@link Supplier}. | 29 | * Instances of this class are responsible for initializing a {@link Receiver} with the contents of a {@link Supplier}. |
30 | * However, due to the dynamic nature of the Rete {@link Network} and to the fact that certain {@link Node}s in the | 30 | * However, due to the dynamic nature of the Rete {@link Network} and to the fact that certain {@link Node}s in the |
31 | * {@link Network} are sensitive to the shape of the {@link Network}, the commands must be delayed until the | 31 | * {@link Network} are sensitive to the shape of the {@link Network}, the commands must be delayed until the |
32 | * construction of the {@link Network} has stabilized. | 32 | * construction of the {@link Network} has stabilized. |
33 | * | 33 | * |
34 | * @author Tamas Szabo | 34 | * @author Tamas Szabo |
35 | * @since 2.3 | 35 | * @since 2.3 |
36 | */ | 36 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/delayed/DelayedConnectCommand.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/delayed/DelayedConnectCommand.java index 1bfdbec6..00077f39 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/delayed/DelayedConnectCommand.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/delayed/DelayedConnectCommand.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.delayed; | 9 | package tools.refinery.interpreter.rete.network.delayed; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 11 | import tools.refinery.interpreter.matchers.util.Direction; |
12 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 12 | import tools.refinery.interpreter.rete.network.Receiver; |
13 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 13 | import tools.refinery.interpreter.rete.network.ReteContainer; |
14 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 14 | import tools.refinery.interpreter.rete.network.Supplier; |
15 | 15 | ||
16 | public class DelayedConnectCommand extends DelayedCommand { | 16 | public class DelayedConnectCommand extends DelayedCommand { |
17 | 17 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/delayed/DelayedDisconnectCommand.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/delayed/DelayedDisconnectCommand.java index 5825a971..4b161388 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/delayed/DelayedDisconnectCommand.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/delayed/DelayedDisconnectCommand.java | |||
@@ -3,25 +3,25 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.delayed; | 9 | package tools.refinery.interpreter.rete.network.delayed; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 11 | import tools.refinery.interpreter.matchers.util.Direction; |
12 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 12 | import tools.refinery.interpreter.rete.network.Receiver; |
13 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 13 | import tools.refinery.interpreter.rete.network.ReteContainer; |
14 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 14 | import tools.refinery.interpreter.rete.network.Supplier; |
15 | 15 | ||
16 | public class DelayedDisconnectCommand extends DelayedCommand { | 16 | public class DelayedDisconnectCommand extends DelayedCommand { |
17 | 17 | ||
18 | protected final boolean wasInSameSCC; | 18 | protected final boolean wasInSameSCC; |
19 | 19 | ||
20 | public DelayedDisconnectCommand(final Supplier supplier, final Receiver receiver, final ReteContainer container, final boolean wasInSameSCC) { | 20 | public DelayedDisconnectCommand(final Supplier supplier, final Receiver receiver, final ReteContainer container, final boolean wasInSameSCC) { |
21 | super(supplier, receiver, Direction.DELETE, container); | 21 | super(supplier, receiver, Direction.DELETE, container); |
22 | this.wasInSameSCC = wasInSameSCC; | 22 | this.wasInSameSCC = wasInSameSCC; |
23 | } | 23 | } |
24 | 24 | ||
25 | @Override | 25 | @Override |
26 | protected boolean isTimestampAware() { | 26 | protected boolean isTimestampAware() { |
27 | return this.wasInSameSCC; | 27 | return this.wasInSameSCC; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/indexer/DefaultMessageIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/indexer/DefaultMessageIndexer.java index da9bc47e..bbc01f1a 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/indexer/DefaultMessageIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/indexer/DefaultMessageIndexer.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.indexer; | 9 | package tools.refinery.interpreter.rete.network.indexer; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 14 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
15 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 15 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * @author Tamas Szabo | 18 | * @author Tamas Szabo |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/indexer/GroupBasedMessageIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/indexer/GroupBasedMessageIndexer.java index 80271252..1bbc863f 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/indexer/GroupBasedMessageIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/indexer/GroupBasedMessageIndexer.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.indexer; | 9 | package tools.refinery.interpreter.rete.network.indexer; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 16 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
17 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 17 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * @author Tamas Szabo | 20 | * @author Tamas Szabo |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/indexer/MessageIndexer.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/indexer/MessageIndexer.java index 271aaa44..c7ef28a1 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/indexer/MessageIndexer.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/indexer/MessageIndexer.java | |||
@@ -3,31 +3,31 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.indexer; | 9 | package tools.refinery.interpreter.rete.network.indexer; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 11 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
12 | import tools.refinery.viatra.runtime.matchers.util.Clearable; | 12 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
13 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 13 | import tools.refinery.interpreter.matchers.util.Clearable; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * A message indexer is used by {@link Mailbox}es to index their contents. | 16 | * A message indexer is used by {@link Mailbox}es to index their contents. |
17 | * | 17 | * |
18 | * @author Tamas Szabo | 18 | * @author Tamas Szabo |
19 | * @since 2.0 | 19 | * @since 2.0 |
20 | */ | 20 | */ |
21 | public interface MessageIndexer extends Clearable { | 21 | public interface MessageIndexer extends Clearable { |
22 | 22 | ||
23 | public void insert(final Tuple update); | 23 | public void insert(final Tuple update); |
24 | 24 | ||
25 | public void delete(final Tuple update); | 25 | public void delete(final Tuple update); |
26 | 26 | ||
27 | public void update(final Tuple update, final int delta); | 27 | public void update(final Tuple update, final int delta); |
28 | 28 | ||
29 | public boolean isEmpty(); | 29 | public boolean isEmpty(); |
30 | 30 | ||
31 | public int getCount(final Tuple update); | 31 | public int getCount(final Tuple update); |
32 | 32 | ||
33 | } | 33 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/AdaptableMailbox.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/AdaptableMailbox.java index 99097f56..4abbe090 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/AdaptableMailbox.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/AdaptableMailbox.java | |||
@@ -3,23 +3,23 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.mailbox; | 9 | package tools.refinery.interpreter.rete.network.mailbox; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTracker; | 11 | import tools.refinery.interpreter.rete.network.communication.CommunicationTracker; |
12 | import tools.refinery.viatra.runtime.rete.network.communication.timely.TimelyMailboxProxy; | 12 | import tools.refinery.interpreter.rete.network.communication.timely.TimelyMailboxProxy; |
13 | import tools.refinery.viatra.runtime.rete.network.mailbox.timeless.BehaviorChangingMailbox; | 13 | import tools.refinery.interpreter.rete.network.mailbox.timeless.BehaviorChangingMailbox; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * An adaptable mailbox can be wrapped by another mailbox to act in behalf of that. The significance of the adaptation | 16 | * An adaptable mailbox can be wrapped by another mailbox to act in behalf of that. The significance of the adaptation |
17 | * is that the adaptee will notify the {@link CommunicationTracker} about updates by promoting the adapter itself. | 17 | * is that the adaptee will notify the {@link CommunicationTracker} about updates by promoting the adapter itself. |
18 | * Adaptable mailboxes are used by the {@link BehaviorChangingMailbox}. | 18 | * Adaptable mailboxes are used by the {@link BehaviorChangingMailbox}. |
19 | * | 19 | * |
20 | * Compare this with {@link TimelyMailboxProxy}. That one also wraps another mailbox in order to | 20 | * Compare this with {@link TimelyMailboxProxy}. That one also wraps another mailbox in order to |
21 | * perform preprocessing on the messages sent to the original recipient. | 21 | * perform preprocessing on the messages sent to the original recipient. |
22 | * | 22 | * |
23 | * @author Tamas Szabo | 23 | * @author Tamas Szabo |
24 | * @since 2.0 | 24 | * @since 2.0 |
25 | */ | 25 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/FallThroughCapableMailbox.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/FallThroughCapableMailbox.java index 8797e254..14c6bc03 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/FallThroughCapableMailbox.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/FallThroughCapableMailbox.java | |||
@@ -3,13 +3,13 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.mailbox; | 9 | package tools.refinery.interpreter.rete.network.mailbox; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 11 | import tools.refinery.interpreter.rete.network.communication.CommunicationTracker; |
12 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTracker; | 12 | import tools.refinery.interpreter.rete.network.Receiver; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * A fall through capable mailbox can directly call the update method of its {@link Receiver} instead of using the | 15 | * A fall through capable mailbox can directly call the update method of its {@link Receiver} instead of using the |
@@ -17,7 +17,7 @@ import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTra | |||
17 | * otherwise it operates in the original behavior. The fall through operation is preferable whenever applicable because | 17 | * otherwise it operates in the original behavior. The fall through operation is preferable whenever applicable because |
18 | * it improves performance. The fall through flag is controlled by the {@link CommunicationTracker} based on the | 18 | * it improves performance. The fall through flag is controlled by the {@link CommunicationTracker} based on the |
19 | * receiver node type and network topology. | 19 | * receiver node type and network topology. |
20 | * | 20 | * |
21 | * @author Tamas Szabo | 21 | * @author Tamas Szabo |
22 | * @since 2.2 | 22 | * @since 2.2 |
23 | */ | 23 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/Mailbox.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/Mailbox.java index 05005974..92da4735 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/Mailbox.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/Mailbox.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.mailbox; | 9 | package tools.refinery.interpreter.rete.network.mailbox; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 11 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
12 | import tools.refinery.viatra.runtime.matchers.util.Clearable; | 12 | import tools.refinery.interpreter.rete.network.communication.MessageSelector; |
13 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 13 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
14 | import tools.refinery.viatra.runtime.rete.network.IGroupable; | 14 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
15 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 15 | import tools.refinery.interpreter.matchers.util.Clearable; |
16 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 16 | import tools.refinery.interpreter.matchers.util.Direction; |
17 | import tools.refinery.viatra.runtime.rete.network.communication.MessageSelector; | 17 | import tools.refinery.interpreter.rete.network.IGroupable; |
18 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 18 | import tools.refinery.interpreter.rete.network.Receiver; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * A mailbox is associated with every {@link Receiver}. Messages can be sent to a {@link Receiver} by posting them into | 21 | * A mailbox is associated with every {@link Receiver}. Messages can be sent to a {@link Receiver} by posting them into |
22 | * the mailbox. Different mailbox implementations may differ in the way how they deliver the posted messages. | 22 | * the mailbox. Different mailbox implementations may differ in the way how they deliver the posted messages. |
23 | * | 23 | * |
24 | * @author Tamas Szabo | 24 | * @author Tamas Szabo |
25 | * @since 2.0 | 25 | * @since 2.0 |
26 | * | 26 | * |
@@ -29,7 +29,7 @@ public interface Mailbox extends Clearable, IGroupable { | |||
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Posts a new message to this mailbox. | 31 | * Posts a new message to this mailbox. |
32 | * | 32 | * |
33 | * @param direction | 33 | * @param direction |
34 | * the direction of the update | 34 | * the direction of the update |
35 | * @param update | 35 | * @param update |
@@ -41,28 +41,28 @@ public interface Mailbox extends Clearable, IGroupable { | |||
41 | /** | 41 | /** |
42 | * Delivers all messages according to the given selector from this mailbox. The selector can also be null. In this case, no | 42 | * Delivers all messages according to the given selector from this mailbox. The selector can also be null. In this case, no |
43 | * special separation is expected between the messages. | 43 | * special separation is expected between the messages. |
44 | * | 44 | * |
45 | * @param selector the message selector | 45 | * @param selector the message selector |
46 | */ | 46 | */ |
47 | public void deliverAll(final MessageSelector selector); | 47 | public void deliverAll(final MessageSelector selector); |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Returns the {@link Receiver} of this mailbox. | 50 | * Returns the {@link Receiver} of this mailbox. |
51 | * | 51 | * |
52 | * @return the receiver | 52 | * @return the receiver |
53 | */ | 53 | */ |
54 | public Receiver getReceiver(); | 54 | public Receiver getReceiver(); |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * Returns the {@link CommunicationGroup} of the receiver of this mailbox. | 57 | * Returns the {@link CommunicationGroup} of the receiver of this mailbox. |
58 | * | 58 | * |
59 | * @return the communication group | 59 | * @return the communication group |
60 | */ | 60 | */ |
61 | public CommunicationGroup getCurrentGroup(); | 61 | public CommunicationGroup getCurrentGroup(); |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Sets the {@link CommunicationGroup} that the receiver of this mailbox is associated with. | 64 | * Sets the {@link CommunicationGroup} that the receiver of this mailbox is associated with. |
65 | * | 65 | * |
66 | * @param group | 66 | * @param group |
67 | * the communication group | 67 | * the communication group |
68 | */ | 68 | */ |
@@ -70,7 +70,7 @@ public interface Mailbox extends Clearable, IGroupable { | |||
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Returns true if this mailbox is empty. | 72 | * Returns true if this mailbox is empty. |
73 | * | 73 | * |
74 | * @return | 74 | * @return |
75 | */ | 75 | */ |
76 | public boolean isEmpty(); | 76 | public boolean isEmpty(); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/MessageIndexerFactory.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/MessageIndexerFactory.java index 2c5255fb..faf517c3 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/MessageIndexerFactory.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/MessageIndexerFactory.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.mailbox; | 9 | package tools.refinery.interpreter.rete.network.mailbox; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.network.indexer.MessageIndexer; | 11 | import tools.refinery.interpreter.rete.network.indexer.MessageIndexer; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * A factory used to create message indexers for {@link Mailbox}es. | 14 | * A factory used to create message indexers for {@link Mailbox}es. |
15 | * | 15 | * |
16 | * @author Tamas Szabo | 16 | * @author Tamas Szabo |
17 | * @since 2.0 | 17 | * @since 2.0 |
18 | */ | 18 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/AbstractUpdateSplittingMailbox.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/AbstractUpdateSplittingMailbox.java index 1e1ada71..31ee2842 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/AbstractUpdateSplittingMailbox.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/AbstractUpdateSplittingMailbox.java | |||
@@ -3,23 +3,23 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.mailbox.timeless; | 9 | package tools.refinery.interpreter.rete.network.mailbox.timeless; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 11 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
12 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 12 | import tools.refinery.interpreter.rete.network.Receiver; |
13 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 13 | import tools.refinery.interpreter.rete.network.ReteContainer; |
14 | import tools.refinery.viatra.runtime.rete.network.indexer.MessageIndexer; | 14 | import tools.refinery.interpreter.rete.network.indexer.MessageIndexer; |
15 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 15 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
16 | import tools.refinery.viatra.runtime.rete.network.mailbox.MessageIndexerFactory; | 16 | import tools.refinery.interpreter.rete.network.mailbox.MessageIndexerFactory; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * An abstract mailbox implementation that is capable of splitting update messages based on some form of monotonicity | 19 | * An abstract mailbox implementation that is capable of splitting update messages based on some form of monotonicity |
20 | * (anti-monotone and monotone). The monotonicity is either defined by the less or equal operator of a poset or, it can | 20 | * (anti-monotone and monotone). The monotonicity is either defined by the less or equal operator of a poset or, it can |
21 | * be the standard subset ordering among sets of tuples. | 21 | * be the standard subset ordering among sets of tuples. |
22 | * | 22 | * |
23 | * @author Tamas Szabo | 23 | * @author Tamas Szabo |
24 | * @since 2.0 | 24 | * @since 2.0 |
25 | * | 25 | * |
@@ -105,5 +105,5 @@ public abstract class AbstractUpdateSplittingMailbox<IndexerType extends Message | |||
105 | public void setCurrentGroup(final CommunicationGroup group) { | 105 | public void setCurrentGroup(final CommunicationGroup group) { |
106 | this.group = group; | 106 | this.group = group; |
107 | } | 107 | } |
108 | 108 | ||
109 | } | 109 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/BehaviorChangingMailbox.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/BehaviorChangingMailbox.java index fe822d7c..86a3f125 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/BehaviorChangingMailbox.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/BehaviorChangingMailbox.java | |||
@@ -3,29 +3,29 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.mailbox.timeless; | 9 | package tools.refinery.interpreter.rete.network.mailbox.timeless; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 11 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
12 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 12 | import tools.refinery.interpreter.rete.network.communication.CommunicationTracker; |
13 | import tools.refinery.viatra.runtime.rete.network.Node; | 13 | import tools.refinery.interpreter.rete.network.communication.MessageSelector; |
14 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 14 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
15 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 15 | import tools.refinery.interpreter.rete.network.communication.timeless.TimelessCommunicationTracker; |
16 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 16 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
17 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTracker; | 17 | import tools.refinery.interpreter.matchers.util.Direction; |
18 | import tools.refinery.viatra.runtime.rete.network.communication.MessageSelector; | 18 | import tools.refinery.interpreter.rete.network.Node; |
19 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 19 | import tools.refinery.interpreter.rete.network.Receiver; |
20 | import tools.refinery.viatra.runtime.rete.network.communication.timeless.TimelessCommunicationTracker; | 20 | import tools.refinery.interpreter.rete.network.ReteContainer; |
21 | import tools.refinery.viatra.runtime.rete.network.mailbox.AdaptableMailbox; | 21 | import tools.refinery.interpreter.rete.network.mailbox.AdaptableMailbox; |
22 | import tools.refinery.viatra.runtime.rete.network.mailbox.FallThroughCapableMailbox; | 22 | import tools.refinery.interpreter.rete.network.mailbox.FallThroughCapableMailbox; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * This mailbox changes its behavior based on the position of its {@link Receiver} in the network topology. | 25 | * This mailbox changes its behavior based on the position of its {@link Receiver} in the network topology. |
26 | * It either behaves as a {@link DefaultMailbox} or as an {@link UpdateSplittingMailbox}. The decision is made by the | 26 | * It either behaves as a {@link DefaultMailbox} or as an {@link UpdateSplittingMailbox}. The decision is made by the |
27 | * {@link CommunicationTracker}, see {@link TimelessCommunicationTracker#postProcessNode(Node)} for more details. | 27 | * {@link CommunicationTracker}, see {@link TimelessCommunicationTracker#postProcessNode(Node)} for more details. |
28 | * | 28 | * |
29 | * @author Tamas Szabo | 29 | * @author Tamas Szabo |
30 | */ | 30 | */ |
31 | public class BehaviorChangingMailbox implements FallThroughCapableMailbox { | 31 | public class BehaviorChangingMailbox implements FallThroughCapableMailbox { |
@@ -93,7 +93,7 @@ public class BehaviorChangingMailbox implements FallThroughCapableMailbox { | |||
93 | public Receiver getReceiver() { | 93 | public Receiver getReceiver() { |
94 | return this.receiver; | 94 | return this.receiver; |
95 | } | 95 | } |
96 | 96 | ||
97 | @Override | 97 | @Override |
98 | public CommunicationGroup getCurrentGroup() { | 98 | public CommunicationGroup getCurrentGroup() { |
99 | return this.group; | 99 | return this.group; |
@@ -108,10 +108,10 @@ public class BehaviorChangingMailbox implements FallThroughCapableMailbox { | |||
108 | public boolean isFallThrough() { | 108 | public boolean isFallThrough() { |
109 | return this.fallThrough; | 109 | return this.fallThrough; |
110 | } | 110 | } |
111 | 111 | ||
112 | @Override | 112 | @Override |
113 | public void setFallThrough(final boolean fallThrough) { | 113 | public void setFallThrough(final boolean fallThrough) { |
114 | this.fallThrough = fallThrough; | 114 | this.fallThrough = fallThrough; |
115 | } | 115 | } |
116 | 116 | ||
117 | } \ No newline at end of file | 117 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/DefaultMailbox.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/DefaultMailbox.java index baf7270f..5bb8386d 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/DefaultMailbox.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/DefaultMailbox.java | |||
@@ -6,21 +6,21 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.mailbox.timeless; | 9 | package tools.refinery.interpreter.rete.network.mailbox.timeless; |
10 | 10 | ||
11 | import java.util.Map; | 11 | import java.util.Map; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 13 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
14 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 14 | import tools.refinery.interpreter.rete.network.communication.MessageSelector; |
15 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 15 | import tools.refinery.interpreter.rete.network.communication.PhasedSelector; |
16 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 16 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
17 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 18 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
19 | import tools.refinery.viatra.runtime.rete.network.communication.MessageSelector; | 19 | import tools.refinery.interpreter.matchers.util.Direction; |
20 | import tools.refinery.viatra.runtime.rete.network.communication.PhasedSelector; | 20 | import tools.refinery.interpreter.rete.network.Receiver; |
21 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 21 | import tools.refinery.interpreter.rete.network.ReteContainer; |
22 | import tools.refinery.viatra.runtime.rete.network.mailbox.AdaptableMailbox; | 22 | import tools.refinery.interpreter.rete.network.mailbox.AdaptableMailbox; |
23 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 23 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * Default mailbox implementation. | 26 | * Default mailbox implementation. |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/PosetAwareMailbox.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/PosetAwareMailbox.java index 50d19882..f83a77cf 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/PosetAwareMailbox.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/PosetAwareMailbox.java | |||
@@ -3,31 +3,31 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.mailbox.timeless; | 9 | package tools.refinery.interpreter.rete.network.mailbox.timeless; |
10 | 10 | ||
11 | import java.util.HashSet; | 11 | import java.util.HashSet; |
12 | import java.util.Map.Entry; | 12 | import java.util.Map.Entry; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.context.IPosetComparator; | 15 | import tools.refinery.interpreter.rete.network.communication.MessageSelector; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.network.communication.PhasedSelector; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 17 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
18 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 18 | import tools.refinery.interpreter.matchers.context.IPosetComparator; |
19 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 19 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
20 | import tools.refinery.viatra.runtime.rete.network.PosetAwareReceiver; | 20 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
21 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 21 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
22 | import tools.refinery.viatra.runtime.rete.network.communication.MessageSelector; | 22 | import tools.refinery.interpreter.matchers.util.Direction; |
23 | import tools.refinery.viatra.runtime.rete.network.communication.PhasedSelector; | 23 | import tools.refinery.interpreter.rete.network.PosetAwareReceiver; |
24 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 24 | import tools.refinery.interpreter.rete.network.ReteContainer; |
25 | import tools.refinery.viatra.runtime.rete.network.indexer.GroupBasedMessageIndexer; | 25 | import tools.refinery.interpreter.rete.network.indexer.GroupBasedMessageIndexer; |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * A monotonicity aware mailbox implementation. The mailbox uses an {@link IPosetComparator} to identify if a pair of | 28 | * A monotonicity aware mailbox implementation. The mailbox uses an {@link IPosetComparator} to identify if a pair of |
29 | * REVOKE - INSERT updates represent a monotone change pair. The mailbox is used by {@link PosetAwareReceiver}s. | 29 | * REVOKE - INSERT updates represent a monotone change pair. The mailbox is used by {@link PosetAwareReceiver}s. |
30 | * | 30 | * |
31 | * @author Tamas Szabo | 31 | * @author Tamas Szabo |
32 | * @since 2.0 | 32 | * @since 2.0 |
33 | */ | 33 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/UpdateSplittingMailbox.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/UpdateSplittingMailbox.java index afa155b2..8e85291f 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timeless/UpdateSplittingMailbox.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timeless/UpdateSplittingMailbox.java | |||
@@ -3,29 +3,29 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.mailbox.timeless; | 9 | package tools.refinery.interpreter.rete.network.mailbox.timeless; |
10 | 10 | ||
11 | import java.util.Map.Entry; | 11 | import java.util.Map.Entry; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 13 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
14 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 14 | import tools.refinery.interpreter.rete.network.communication.MessageSelector; |
15 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 15 | import tools.refinery.interpreter.rete.network.communication.PhasedSelector; |
16 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 16 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
17 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.rete.network.communication.MessageSelector; | 18 | import tools.refinery.interpreter.matchers.util.Direction; |
19 | import tools.refinery.viatra.runtime.rete.network.communication.PhasedSelector; | 19 | import tools.refinery.interpreter.rete.network.Receiver; |
20 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 20 | import tools.refinery.interpreter.rete.network.ReteContainer; |
21 | import tools.refinery.viatra.runtime.rete.network.indexer.DefaultMessageIndexer; | 21 | import tools.refinery.interpreter.rete.network.indexer.DefaultMessageIndexer; |
22 | import tools.refinery.viatra.runtime.rete.network.mailbox.AdaptableMailbox; | 22 | import tools.refinery.interpreter.rete.network.mailbox.AdaptableMailbox; |
23 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 23 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * A mailbox implementation that splits updates messages according to the standard subset ordering into anti-monotonic | 26 | * A mailbox implementation that splits updates messages according to the standard subset ordering into anti-monotonic |
27 | * (deletions) and monotonic (insertions) updates. | 27 | * (deletions) and monotonic (insertions) updates. |
28 | * | 28 | * |
29 | * @author Tamas Szabo | 29 | * @author Tamas Szabo |
30 | * @since 2.0 | 30 | * @since 2.0 |
31 | */ | 31 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timely/TimelyMailbox.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timely/TimelyMailbox.java index bf3b8e14..09f8fb58 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/network/mailbox/timely/TimelyMailbox.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/network/mailbox/timely/TimelyMailbox.java | |||
@@ -3,25 +3,25 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.network.mailbox.timely; | 9 | package tools.refinery.interpreter.rete.network.mailbox.timely; |
10 | 10 | ||
11 | import java.util.Map; | 11 | import java.util.Map; |
12 | import java.util.TreeMap; | 12 | import java.util.TreeMap; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 14 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
15 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 15 | import tools.refinery.interpreter.rete.network.communication.MessageSelector; |
16 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 16 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
17 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration.TimelineRepresentation; | 17 | import tools.refinery.interpreter.rete.network.communication.timely.ResumableNode; |
18 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 19 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
20 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 20 | import tools.refinery.interpreter.matchers.util.Direction; |
21 | import tools.refinery.viatra.runtime.rete.network.communication.MessageSelector; | 21 | import tools.refinery.interpreter.rete.matcher.TimelyConfiguration.TimelineRepresentation; |
22 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 22 | import tools.refinery.interpreter.rete.network.Receiver; |
23 | import tools.refinery.viatra.runtime.rete.network.communication.timely.ResumableNode; | 23 | import tools.refinery.interpreter.rete.network.ReteContainer; |
24 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 24 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
25 | 25 | ||
26 | public class TimelyMailbox implements Mailbox { | 26 | public class TimelyMailbox implements Mailbox { |
27 | 27 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/remote/Address.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/remote/Address.java index 2fed3225..bed5bd6a 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/remote/Address.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/remote/Address.java | |||
@@ -3,20 +3,20 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.remote; | 10 | package tools.refinery.interpreter.rete.remote; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.rete.network.Node; | 12 | import tools.refinery.interpreter.rete.network.Node; |
13 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 13 | import tools.refinery.interpreter.rete.network.ReteContainer; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Remote identifier of a node of type T. | 16 | * Remote identifier of a node of type T. |
17 | * | 17 | * |
18 | * @author Gabor Bergmann | 18 | * @author Gabor Bergmann |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | public class Address<T extends Node> { | 21 | public class Address<T extends Node> { |
22 | ReteContainer container; | 22 | ReteContainer container; |
@@ -35,7 +35,7 @@ public class Address<T extends Node> { | |||
35 | 35 | ||
36 | /** | 36 | /** |
37 | * General constructor. | 37 | * General constructor. |
38 | * | 38 | * |
39 | * @param container | 39 | * @param container |
40 | * @param nodeId | 40 | * @param nodeId |
41 | */ | 41 | */ |
@@ -47,7 +47,7 @@ public class Address<T extends Node> { | |||
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Local-only constructor. (use only for containers in the same VM!) | 49 | * Local-only constructor. (use only for containers in the same VM!) |
50 | * | 50 | * |
51 | * @param node | 51 | * @param node |
52 | * the node to address | 52 | * the node to address |
53 | */ | 53 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/remote/RemoteReceiver.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/remote/RemoteReceiver.java index f7d267af..46bd7551 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/remote/RemoteReceiver.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/remote/RemoteReceiver.java | |||
@@ -3,30 +3,30 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.remote; | 10 | package tools.refinery.interpreter.rete.remote; |
11 | 11 | ||
12 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
13 | import java.util.Collection; | 13 | import java.util.Collection; |
14 | import java.util.List; | 14 | import java.util.List; |
15 | import java.util.Map; | 15 | import java.util.Map; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 17 | import tools.refinery.interpreter.rete.network.Receiver; |
18 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 18 | import tools.refinery.interpreter.rete.network.ReteContainer; |
19 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 19 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
20 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 20 | import tools.refinery.interpreter.rete.single.SingleInputNode; |
21 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
22 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 22 | import tools.refinery.interpreter.matchers.util.Direction; |
23 | import tools.refinery.viatra.runtime.rete.single.SingleInputNode; | 23 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * This node delivers updates to a remote recipient; no updates are propagated further in this network. | 26 | * This node delivers updates to a remote recipient; no updates are propagated further in this network. |
27 | * | 27 | * |
28 | * @author Gabor Bergmann | 28 | * @author Gabor Bergmann |
29 | * | 29 | * |
30 | */ | 30 | */ |
31 | public class RemoteReceiver extends SingleInputNode { | 31 | public class RemoteReceiver extends SingleInputNode { |
32 | 32 | ||
@@ -45,7 +45,7 @@ public class RemoteReceiver extends SingleInputNode { | |||
45 | public void pullInto(Collection<Tuple> collector, boolean flush) { | 45 | public void pullInto(Collection<Tuple> collector, boolean flush) { |
46 | propagatePullInto(collector, flush); | 46 | propagatePullInto(collector, flush); |
47 | } | 47 | } |
48 | 48 | ||
49 | @Override | 49 | @Override |
50 | public void pullIntoWithTimeline(Map<Tuple, Timeline<Timestamp>> collector, boolean flush) { | 50 | public void pullIntoWithTimeline(Map<Tuple, Timeline<Timestamp>> collector, boolean flush) { |
51 | throw new UnsupportedOperationException(); | 51 | throw new UnsupportedOperationException(); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/remote/RemoteSupplier.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/remote/RemoteSupplier.java index cbe4d177..759b1db5 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/remote/RemoteSupplier.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/remote/RemoteSupplier.java | |||
@@ -3,27 +3,27 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.remote; | 10 | package tools.refinery.interpreter.rete.remote; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.rete.network.ReteContainer; |
16 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 16 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
17 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 17 | import tools.refinery.interpreter.rete.single.SingleInputNode; |
18 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 19 | import tools.refinery.interpreter.matchers.util.Direction; |
20 | import tools.refinery.viatra.runtime.rete.single.SingleInputNode; | 20 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * This node receives updates from a remote supplier; no local updates are expected. | 23 | * This node receives updates from a remote supplier; no local updates are expected. |
24 | * | 24 | * |
25 | * @author Gabor Bergmann | 25 | * @author Gabor Bergmann |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | public class RemoteSupplier extends SingleInputNode { | 28 | public class RemoteSupplier extends SingleInputNode { |
29 | 29 | ||
@@ -45,7 +45,7 @@ public class RemoteSupplier extends SingleInputNode { | |||
45 | public void pullIntoWithTimeline(Map<Tuple, Timeline<Timestamp>> collector, boolean flush) { | 45 | public void pullIntoWithTimeline(Map<Tuple, Timeline<Timestamp>> collector, boolean flush) { |
46 | throw new UnsupportedOperationException(); | 46 | throw new UnsupportedOperationException(); |
47 | } | 47 | } |
48 | 48 | ||
49 | @Override | 49 | @Override |
50 | public void update(Direction direction, Tuple updateElement, Timestamp timestamp) { | 50 | public void update(Direction direction, Tuple updateElement, Timestamp timestamp) { |
51 | propagateUpdate(direction, updateElement, timestamp); | 51 | propagateUpdate(direction, updateElement, timestamp); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/AbstractUniquenessEnforcerNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/AbstractUniquenessEnforcerNode.java index e92ce63f..c55a294a 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/AbstractUniquenessEnforcerNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/AbstractUniquenessEnforcerNode.java | |||
@@ -3,34 +3,34 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.single; | 9 | package tools.refinery.interpreter.rete.single; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.List; | 13 | import java.util.List; |
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.network.ReteContainer; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 17 | import tools.refinery.interpreter.rete.network.StandardNode; |
18 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 18 | import tools.refinery.interpreter.rete.network.Supplier; |
19 | import tools.refinery.viatra.runtime.rete.index.ProjectionIndexer; | 19 | import tools.refinery.interpreter.rete.network.Tunnel; |
20 | import tools.refinery.viatra.runtime.rete.index.SpecializedProjectionIndexer.ListenerSubscription; | 20 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
21 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 21 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
22 | import tools.refinery.viatra.runtime.rete.network.StandardNode; | 22 | import tools.refinery.interpreter.rete.traceability.TraceInfo; |
23 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 23 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
24 | import tools.refinery.viatra.runtime.rete.network.Tunnel; | 24 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
25 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 25 | import tools.refinery.interpreter.matchers.util.Direction; |
26 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 26 | import tools.refinery.interpreter.rete.index.ProjectionIndexer; |
27 | import tools.refinery.viatra.runtime.rete.traceability.TraceInfo; | 27 | import tools.refinery.interpreter.rete.index.SpecializedProjectionIndexer.ListenerSubscription; |
28 | import tools.refinery.viatra.runtime.rete.util.Options; | 28 | import tools.refinery.interpreter.rete.util.Options; |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Ensures that no identical copies get to the output. Only one replica of each pattern substitution may traverse this | 31 | * Ensures that no identical copies get to the output. Only one replica of each pattern substitution may traverse this |
32 | * node. There are both timeless and timely implementations. | 32 | * node. There are both timeless and timely implementations. |
33 | * | 33 | * |
34 | * @author Gabor Bergmann | 34 | * @author Gabor Bergmann |
35 | * @author Tamas Szabo | 35 | * @author Tamas Szabo |
36 | * @noinstantiate This class is not intended to be instantiated by clients. | 36 | * @noinstantiate This class is not intended to be instantiated by clients. |
@@ -43,7 +43,7 @@ public abstract class AbstractUniquenessEnforcerNode extends StandardNode implem | |||
43 | protected ProjectionIndexer memoryNullIndexer; | 43 | protected ProjectionIndexer memoryNullIndexer; |
44 | protected ProjectionIndexer memoryIdentityIndexer; | 44 | protected ProjectionIndexer memoryIdentityIndexer; |
45 | protected final int tupleWidth; | 45 | protected final int tupleWidth; |
46 | // MUST BE INSTANTIATED IN THE CONCRETE SUBCLASSES AFTER ALL FIELDS ARE SET | 46 | // MUST BE INSTANTIATED IN THE CONCRETE SUBCLASSES AFTER ALL FIELDS ARE SET |
47 | protected Mailbox mailbox; | 47 | protected Mailbox mailbox; |
48 | protected final TupleMask nullMask; | 48 | protected final TupleMask nullMask; |
49 | protected final TupleMask identityMask; | 49 | protected final TupleMask identityMask; |
@@ -64,7 +64,7 @@ public abstract class AbstractUniquenessEnforcerNode extends StandardNode implem | |||
64 | public Mailbox getMailbox() { | 64 | public Mailbox getMailbox() { |
65 | return this.mailbox; | 65 | return this.mailbox; |
66 | } | 66 | } |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * @since 2.8 | 69 | * @since 2.8 |
70 | */ | 70 | */ |
@@ -135,4 +135,4 @@ public abstract class AbstractUniquenessEnforcerNode extends StandardNode implem | |||
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | } \ No newline at end of file | 138 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/CallbackNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/CallbackNode.java index c68036b5..f4e3ba0d 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/CallbackNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/CallbackNode.java | |||
@@ -3,27 +3,27 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.single; | 9 | package tools.refinery.interpreter.rete.single; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.backend.IUpdateable; | 11 | import tools.refinery.interpreter.rete.network.ReteContainer; |
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 12 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
13 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 13 | import tools.refinery.interpreter.matchers.backend.IUpdateable; |
14 | import tools.refinery.viatra.runtime.rete.misc.SimpleReceiver; | 14 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
15 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 15 | import tools.refinery.interpreter.matchers.util.Direction; |
16 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 16 | import tools.refinery.interpreter.rete.misc.SimpleReceiver; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * @author Bergmann Gabor | 19 | * @author Bergmann Gabor |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | public class CallbackNode extends SimpleReceiver { | 22 | public class CallbackNode extends SimpleReceiver { |
23 | 23 | ||
24 | IUpdateable updateable; | 24 | IUpdateable updateable; |
25 | 25 | ||
26 | public CallbackNode(ReteContainer reteContainer, IUpdateable updateable) | 26 | public CallbackNode(ReteContainer reteContainer, IUpdateable updateable) |
27 | { | 27 | { |
28 | super(reteContainer); | 28 | super(reteContainer); |
29 | this.updateable = updateable; | 29 | this.updateable = updateable; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DefaultProductionNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/DefaultProductionNode.java index eca8bc17..e929b688 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DefaultProductionNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/DefaultProductionNode.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.single; | 10 | package tools.refinery.interpreter.rete.single; |
11 | 11 | ||
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.context.IPosetComparator; | 15 | import tools.refinery.interpreter.rete.network.ProductionNode; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.network.ReteContainer; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 17 | import tools.refinery.interpreter.rete.traceability.TraceInfo; |
18 | import tools.refinery.viatra.runtime.rete.network.ProductionNode; | 18 | import tools.refinery.interpreter.matchers.context.IPosetComparator; |
19 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 19 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
20 | import tools.refinery.viatra.runtime.rete.traceability.CompiledQuery; | 20 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
21 | import tools.refinery.viatra.runtime.rete.traceability.TraceInfo; | 21 | import tools.refinery.interpreter.rete.traceability.CompiledQuery; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * Default implementation of the Production node, based on UniquenessEnforcerNode | 24 | * Default implementation of the Production node, based on UniquenessEnforcerNode |
@@ -34,7 +34,7 @@ public class DefaultProductionNode extends UniquenessEnforcerNode implements Pro | |||
34 | * @since 1.6 | 34 | * @since 1.6 |
35 | */ | 35 | */ |
36 | public DefaultProductionNode(final ReteContainer reteContainer, final Map<String, Integer> posMapping, | 36 | public DefaultProductionNode(final ReteContainer reteContainer, final Map<String, Integer> posMapping, |
37 | final boolean deleteRederiveEvaluation) { | 37 | final boolean deleteRederiveEvaluation) { |
38 | this(reteContainer, posMapping, deleteRederiveEvaluation, null, null, null); | 38 | this(reteContainer, posMapping, deleteRederiveEvaluation, null, null, null); |
39 | } | 39 | } |
40 | 40 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DiscriminatorBucketNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/DiscriminatorBucketNode.java index 803bab20..b08a7330 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DiscriminatorBucketNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/DiscriminatorBucketNode.java | |||
@@ -3,28 +3,28 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.single; | 9 | package tools.refinery.interpreter.rete.single; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 14 | import tools.refinery.interpreter.rete.network.ReteContainer; |
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.rete.network.Supplier; |
16 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 16 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
17 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 17 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
18 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 19 | import tools.refinery.interpreter.matchers.util.Direction; |
20 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 20 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * A bucket holds a filtered set of tuples of its parent {@link DiscriminatorDispatcherNode}. | 23 | * A bucket holds a filtered set of tuples of its parent {@link DiscriminatorDispatcherNode}. |
24 | * Exactly those that have the given bucket key at their discrimination column. | 24 | * Exactly those that have the given bucket key at their discrimination column. |
25 | * | 25 | * |
26 | * <p> During operation, tuple contents and bucket keys have already been wrapped using {@link IQueryRuntimeContext#wrapElement(Object)} | 26 | * <p> During operation, tuple contents and bucket keys have already been wrapped using {@link IQueryRuntimeContext#wrapElement(Object)} |
27 | * | 27 | * |
28 | * @author Gabor Bergmann | 28 | * @author Gabor Bergmann |
29 | * @since 1.5 | 29 | * @since 1.5 |
30 | */ | 30 | */ |
@@ -47,7 +47,7 @@ public class DiscriminatorBucketNode extends SingleInputNode { | |||
47 | getDispatcher().pullIntoFiltered(collector, bucketKey, flush); | 47 | getDispatcher().pullIntoFiltered(collector, bucketKey, flush); |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | @Override | 51 | @Override |
52 | public void pullIntoWithTimeline(final Map<Tuple, Timeline<Timestamp>> collector, final boolean flush) { | 52 | public void pullIntoWithTimeline(final Map<Tuple, Timeline<Timestamp>> collector, final boolean flush) { |
53 | if (parent != null) { | 53 | if (parent != null) { |
@@ -63,23 +63,23 @@ public class DiscriminatorBucketNode extends SingleInputNode { | |||
63 | public Object getBucketKey() { | 63 | public Object getBucketKey() { |
64 | return bucketKey; | 64 | return bucketKey; |
65 | } | 65 | } |
66 | 66 | ||
67 | @Override | 67 | @Override |
68 | public void appendParent(Supplier supplier) { | 68 | public void appendParent(Supplier supplier) { |
69 | if (! (supplier instanceof DiscriminatorDispatcherNode)) | 69 | if (! (supplier instanceof DiscriminatorDispatcherNode)) |
70 | throw new IllegalArgumentException(); | 70 | throw new IllegalArgumentException(); |
71 | super.appendParent(supplier); | 71 | super.appendParent(supplier); |
72 | } | 72 | } |
73 | 73 | ||
74 | public DiscriminatorDispatcherNode getDispatcher() { | 74 | public DiscriminatorDispatcherNode getDispatcher() { |
75 | return (DiscriminatorDispatcherNode) parent; | 75 | return (DiscriminatorDispatcherNode) parent; |
76 | } | 76 | } |
77 | 77 | ||
78 | @Override | 78 | @Override |
79 | protected String toStringCore() { | 79 | protected String toStringCore() { |
80 | return String.format("%s<%s=='%s'>", | 80 | return String.format("%s<%s=='%s'>", |
81 | super.toStringCore(), | 81 | super.toStringCore(), |
82 | (getDispatcher() == null) ? "?" : getDispatcher().getDiscriminationColumnIndex(), | 82 | (getDispatcher() == null) ? "?" : getDispatcher().getDiscriminationColumnIndex(), |
83 | bucketKey); | 83 | bucketKey); |
84 | } | 84 | } |
85 | } | 85 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DiscriminatorDispatcherNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/DiscriminatorDispatcherNode.java index a8e11fcd..65c73787 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DiscriminatorDispatcherNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/DiscriminatorDispatcherNode.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.single; | 9 | package tools.refinery.interpreter.rete.single; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
@@ -14,24 +14,24 @@ import java.util.HashMap; | |||
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | import java.util.Map.Entry; | 15 | import java.util.Map.Entry; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 17 | import tools.refinery.interpreter.rete.network.NetworkStructureChangeSensitiveNode; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 18 | import tools.refinery.interpreter.rete.network.Receiver; |
19 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 19 | import tools.refinery.interpreter.rete.network.ReteContainer; |
20 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 20 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
21 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 21 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
22 | import tools.refinery.viatra.runtime.rete.network.NetworkStructureChangeSensitiveNode; | 22 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
23 | import tools.refinery.viatra.runtime.rete.network.Receiver; | 23 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
24 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 24 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
25 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 25 | import tools.refinery.interpreter.matchers.util.Direction; |
26 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 26 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Node that sends tuples off to different buckets (attached as children of type {@link DiscriminatorBucketNode}), based | 29 | * Node that sends tuples off to different buckets (attached as children of type {@link DiscriminatorBucketNode}), based |
30 | * on the value of a given column. | 30 | * on the value of a given column. |
31 | * | 31 | * |
32 | * <p> | 32 | * <p> |
33 | * Tuple contents and bucket keys have already been wrapped using {@link IQueryRuntimeContext#wrapElement(Object)} | 33 | * Tuple contents and bucket keys have already been wrapped using {@link IQueryRuntimeContext#wrapElement(Object)} |
34 | * | 34 | * |
35 | * @author Gabor Bergmann | 35 | * @author Gabor Bergmann |
36 | * @since 1.5 | 36 | * @since 1.5 |
37 | */ | 37 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/EqualityFilterNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/EqualityFilterNode.java index 014c2016..67d12743 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/EqualityFilterNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/EqualityFilterNode.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.single; | 10 | package tools.refinery.interpreter.rete.single; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 12 | import tools.refinery.interpreter.rete.network.ReteContainer; |
13 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 13 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
14 | 14 | ||
15 | public class EqualityFilterNode extends FilterNode { | 15 | public class EqualityFilterNode extends FilterNode { |
16 | 16 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/FilterNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/FilterNode.java index f66f1715..341df0f2 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/FilterNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/FilterNode.java | |||
@@ -3,28 +3,28 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.single; | 10 | package tools.refinery.interpreter.rete.single; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.Map.Entry; | 14 | import java.util.Map.Entry; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.network.ReteContainer; |
17 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 17 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
18 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 19 | import tools.refinery.interpreter.matchers.util.Direction; |
20 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 20 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * This node implements a simple filter. A stateless abstract check() predicate determines whether a matching is allowed | 23 | * This node implements a simple filter. A stateless abstract check() predicate determines whether a matching is allowed |
24 | * to pass. | 24 | * to pass. |
25 | * | 25 | * |
26 | * @author Gabor Bergmann | 26 | * @author Gabor Bergmann |
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | public abstract class FilterNode extends SingleInputNode { | 29 | public abstract class FilterNode extends SingleInputNode { |
30 | 30 | ||
@@ -34,7 +34,7 @@ public abstract class FilterNode extends SingleInputNode { | |||
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Abstract filtering predicate. Expected to be stateless. | 36 | * Abstract filtering predicate. Expected to be stateless. |
37 | * | 37 | * |
38 | * @param ps | 38 | * @param ps |
39 | * the matching to be checked. | 39 | * the matching to be checked. |
40 | * @return true if and only if the parameter matching is allowed to pass through this node. | 40 | * @return true if and only if the parameter matching is allowed to pass through this node. |
@@ -49,7 +49,7 @@ public abstract class FilterNode extends SingleInputNode { | |||
49 | } | 49 | } |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | @Override | 53 | @Override |
54 | public void pullIntoWithTimeline(Map<Tuple, Timeline<Timestamp>> collector, boolean flush) { | 54 | public void pullIntoWithTimeline(Map<Tuple, Timeline<Timestamp>> collector, boolean flush) { |
55 | for (final Entry<Tuple, Timeline<Timestamp>> entry : this.reteContainer.pullPropagatedContentsWithTimestamp(this, flush).entrySet()) { | 55 | for (final Entry<Tuple, Timeline<Timestamp>> entry : this.reteContainer.pullPropagatedContentsWithTimestamp(this, flush).entrySet()) { |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/InequalityFilterNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/InequalityFilterNode.java index 8dd3e949..4b7b5b78 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/InequalityFilterNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/InequalityFilterNode.java | |||
@@ -3,23 +3,23 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.single; | 10 | package tools.refinery.interpreter.rete.single; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 12 | import tools.refinery.interpreter.rete.network.ReteContainer; |
13 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 13 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
14 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 14 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * This node filters patterns according to equalities and inequalities of elements. The 'subject' element is asserted to | 17 | * This node filters patterns according to equalities and inequalities of elements. The 'subject' element is asserted to |
18 | * be different from the elements given by the inequalityMask. | 18 | * be different from the elements given by the inequalityMask. |
19 | * | 19 | * |
20 | * | 20 | * |
21 | * @author Gabor Bergmann | 21 | * @author Gabor Bergmann |
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | public class InequalityFilterNode extends FilterNode { | 24 | public class InequalityFilterNode extends FilterNode { |
25 | 25 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/RepresentativeElectionNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/RepresentativeElectionNode.java index 95018c4f..75aa32ef 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/RepresentativeElectionNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/RepresentativeElectionNode.java | |||
@@ -6,31 +6,31 @@ | |||
6 | * http://www.eclipse.org/legal/epl-v20.html. | 6 | * http://www.eclipse.org/legal/epl-v20.html. |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.single; | 9 | package tools.refinery.interpreter.rete.single; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.itc.alg.representative.RepresentativeElectionAlgorithm; | 11 | import tools.refinery.interpreter.rete.network.ReinitializedNode; |
12 | import tools.refinery.viatra.runtime.rete.itc.alg.representative.RepresentativeObserver; | 12 | import tools.refinery.interpreter.rete.network.ReteContainer; |
13 | import tools.refinery.viatra.runtime.rete.itc.graphimpl.Graph; | 13 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
14 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 14 | import tools.refinery.interpreter.rete.itc.alg.representative.RepresentativeElectionAlgorithm; |
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 15 | import tools.refinery.interpreter.rete.itc.alg.representative.RepresentativeObserver; |
16 | import tools.refinery.viatra.runtime.matchers.util.Clearable; | 16 | import tools.refinery.interpreter.rete.itc.graphimpl.Graph; |
17 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
19 | import tools.refinery.viatra.runtime.rete.network.ReinitializedNode; | 19 | import tools.refinery.interpreter.matchers.util.Clearable; |
20 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 20 | import tools.refinery.interpreter.matchers.util.Direction; |
21 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 21 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
22 | 22 | ||
23 | import java.util.Collection; | 23 | import java.util.Collection; |
24 | import java.util.Map; | 24 | import java.util.Map; |
25 | 25 | ||
26 | public class RepresentativeElectionNode extends SingleInputNode implements Clearable, RepresentativeObserver, | 26 | public class RepresentativeElectionNode extends SingleInputNode implements Clearable, RepresentativeObserver, |
27 | ReinitializedNode { | 27 | ReinitializedNode { |
28 | private final RepresentativeElectionAlgorithm.Factory algorithmFactory; | 28 | private final RepresentativeElectionAlgorithm.Factory algorithmFactory; |
29 | private Graph<Object> graph; | 29 | private Graph<Object> graph; |
30 | private RepresentativeElectionAlgorithm algorithm; | 30 | private RepresentativeElectionAlgorithm algorithm; |
31 | 31 | ||
32 | public RepresentativeElectionNode(ReteContainer reteContainer, | 32 | public RepresentativeElectionNode(ReteContainer reteContainer, |
33 | RepresentativeElectionAlgorithm.Factory algorithmFactory) { | 33 | RepresentativeElectionAlgorithm.Factory algorithmFactory) { |
34 | super(reteContainer); | 34 | super(reteContainer); |
35 | this.algorithmFactory = algorithmFactory; | 35 | this.algorithmFactory = algorithmFactory; |
36 | graph = new Graph<>(); | 36 | graph = new Graph<>(); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/SingleInputNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/SingleInputNode.java index 99fc45b2..3d44ddaa 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/SingleInputNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/SingleInputNode.java | |||
@@ -3,32 +3,32 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.single; | 10 | package tools.refinery.interpreter.rete.single; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Collections; | 13 | import java.util.Collections; |
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.network.ReteContainer; |
17 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 17 | import tools.refinery.interpreter.rete.network.StandardNode; |
18 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 18 | import tools.refinery.interpreter.rete.network.Supplier; |
19 | import tools.refinery.viatra.runtime.rete.network.StandardNode; | 19 | import tools.refinery.interpreter.rete.network.Tunnel; |
20 | import tools.refinery.viatra.runtime.rete.network.Supplier; | 20 | import tools.refinery.interpreter.rete.network.communication.CommunicationTracker; |
21 | import tools.refinery.viatra.runtime.rete.network.Tunnel; | 21 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
22 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationTracker; | 22 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
23 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 23 | import tools.refinery.interpreter.rete.network.mailbox.timeless.BehaviorChangingMailbox; |
24 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 24 | import tools.refinery.interpreter.rete.network.mailbox.timely.TimelyMailbox; |
25 | import tools.refinery.viatra.runtime.rete.network.mailbox.timeless.BehaviorChangingMailbox; | 25 | import tools.refinery.interpreter.rete.traceability.TraceInfo; |
26 | import tools.refinery.viatra.runtime.rete.network.mailbox.timely.TimelyMailbox; | 26 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
27 | import tools.refinery.viatra.runtime.rete.traceability.TraceInfo; | 27 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * @author Gabor Bergmann | 30 | * @author Gabor Bergmann |
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | public abstract class SingleInputNode extends StandardNode implements Tunnel { | 33 | public abstract class SingleInputNode extends StandardNode implements Tunnel { |
34 | 34 | ||
@@ -37,34 +37,34 @@ public abstract class SingleInputNode extends StandardNode implements Tunnel { | |||
37 | * @since 1.6 | 37 | * @since 1.6 |
38 | */ | 38 | */ |
39 | protected Mailbox mailbox; | 39 | protected Mailbox mailbox; |
40 | 40 | ||
41 | public SingleInputNode(ReteContainer reteContainer) { | 41 | public SingleInputNode(ReteContainer reteContainer) { |
42 | super(reteContainer); | 42 | super(reteContainer); |
43 | mailbox = instantiateMailbox(); | 43 | mailbox = instantiateMailbox(); |
44 | reteContainer.registerClearable(mailbox); | 44 | reteContainer.registerClearable(mailbox); |
45 | parent = null; | 45 | parent = null; |
46 | } | 46 | } |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Instantiates the {@link Mailbox} of this receiver. | 49 | * Instantiates the {@link Mailbox} of this receiver. |
50 | * Subclasses may override this method to provide their own mailbox implementation. | 50 | * Subclasses may override this method to provide their own mailbox implementation. |
51 | * | 51 | * |
52 | * @return the mailbox | 52 | * @return the mailbox |
53 | * @since 2.0 | 53 | * @since 2.0 |
54 | */ | 54 | */ |
55 | protected Mailbox instantiateMailbox() { | 55 | protected Mailbox instantiateMailbox() { |
56 | if (this.reteContainer.isTimelyEvaluation()) { | 56 | if (this.reteContainer.isTimelyEvaluation()) { |
57 | return new TimelyMailbox(this, this.reteContainer); | 57 | return new TimelyMailbox(this, this.reteContainer); |
58 | } else { | 58 | } else { |
59 | return new BehaviorChangingMailbox(this, this.reteContainer); | 59 | return new BehaviorChangingMailbox(this, this.reteContainer); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | @Override | 63 | @Override |
64 | public CommunicationTracker getCommunicationTracker() { | 64 | public CommunicationTracker getCommunicationTracker() { |
65 | return this.reteContainer.getCommunicationTracker(); | 65 | return this.reteContainer.getCommunicationTracker(); |
66 | } | 66 | } |
67 | 67 | ||
68 | @Override | 68 | @Override |
69 | public Mailbox getMailbox() { | 69 | public Mailbox getMailbox() { |
70 | return this.mailbox; | 70 | return this.mailbox; |
@@ -97,7 +97,7 @@ public abstract class SingleInputNode extends StandardNode implements Tunnel { | |||
97 | parent.pullInto(collector, flush); | 97 | parent.pullInto(collector, flush); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | /** | 101 | /** |
102 | * To be called by derived classes and ReteContainer. | 102 | * To be called by derived classes and ReteContainer. |
103 | */ | 103 | */ |
@@ -114,7 +114,7 @@ public abstract class SingleInputNode extends StandardNode implements Tunnel { | |||
114 | else | 114 | else |
115 | return Collections.singleton(parent); | 115 | return Collections.singleton(parent); |
116 | } | 116 | } |
117 | 117 | ||
118 | @Override | 118 | @Override |
119 | public void assignTraceInfo(TraceInfo traceInfo) { | 119 | public void assignTraceInfo(TraceInfo traceInfo) { |
120 | super.assignTraceInfo(traceInfo); | 120 | super.assignTraceInfo(traceInfo); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TimelyProductionNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TimelyProductionNode.java index 82640948..2c71da25 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TimelyProductionNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TimelyProductionNode.java | |||
@@ -3,19 +3,20 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.single; | 9 | package tools.refinery.interpreter.rete.single; |
10 | 10 | ||
11 | import java.util.Iterator; | 11 | import java.util.Iterator; |
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 14 | import tools.refinery.interpreter.rete.network.ProductionNode; |
15 | import tools.refinery.viatra.runtime.rete.network.ProductionNode; | 15 | import tools.refinery.interpreter.rete.network.ReteContainer; |
16 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 16 | import tools.refinery.interpreter.rete.traceability.TraceInfo; |
17 | import tools.refinery.viatra.runtime.rete.traceability.CompiledQuery; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.rete.traceability.TraceInfo; | 18 | import tools.refinery.interpreter.rete.traceability.CompiledQuery; |
19 | |||
19 | /** | 20 | /** |
20 | * Differential dataflow implementation of the Production node, based on {@link TimelyUniquenessEnforcerNode}. | 21 | * Differential dataflow implementation of the Production node, based on {@link TimelyUniquenessEnforcerNode}. |
21 | * | 22 | * |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TimelyUniquenessEnforcerNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TimelyUniquenessEnforcerNode.java index 4c4b4fc0..7a280d8e 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TimelyUniquenessEnforcerNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TimelyUniquenessEnforcerNode.java | |||
@@ -3,36 +3,36 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.single; | 9 | package tools.refinery.interpreter.rete.single; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | import java.util.Map.Entry; | 13 | import java.util.Map.Entry; |
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.matcher.TimelyConfiguration; |
17 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 17 | import tools.refinery.interpreter.rete.network.ReteContainer; |
18 | import tools.refinery.viatra.runtime.matchers.util.Signed; | 18 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
19 | import tools.refinery.viatra.runtime.matchers.util.TimelyMemory; | 19 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
20 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 20 | import tools.refinery.interpreter.rete.network.communication.timely.ResumableNode; |
21 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 21 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
22 | import tools.refinery.viatra.runtime.rete.index.ProjectionIndexer; | 22 | import tools.refinery.interpreter.rete.network.mailbox.timely.TimelyMailbox; |
23 | import tools.refinery.viatra.runtime.rete.index.timely.TimelyMemoryIdentityIndexer; | 23 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
24 | import tools.refinery.viatra.runtime.rete.index.timely.TimelyMemoryNullIndexer; | 24 | import tools.refinery.interpreter.matchers.util.Direction; |
25 | import tools.refinery.viatra.runtime.rete.matcher.TimelyConfiguration.TimelineRepresentation; | 25 | import tools.refinery.interpreter.matchers.util.Signed; |
26 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 26 | import tools.refinery.interpreter.matchers.util.TimelyMemory; |
27 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 27 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
28 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 28 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
29 | import tools.refinery.viatra.runtime.rete.network.communication.timely.ResumableNode; | 29 | import tools.refinery.interpreter.rete.index.ProjectionIndexer; |
30 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 30 | import tools.refinery.interpreter.rete.index.timely.TimelyMemoryIdentityIndexer; |
31 | import tools.refinery.viatra.runtime.rete.network.mailbox.timely.TimelyMailbox; | 31 | import tools.refinery.interpreter.rete.index.timely.TimelyMemoryNullIndexer; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Timely uniqueness enforcer node implementation. | 34 | * Timely uniqueness enforcer node implementation. |
35 | * | 35 | * |
36 | * @author Tamas Szabo | 36 | * @author Tamas Szabo |
37 | * @noinstantiate This class is not intended to be instantiated by clients. | 37 | * @noinstantiate This class is not intended to be instantiated by clients. |
38 | * @noextend This class is not intended to be subclassed by clients. | 38 | * @noextend This class is not intended to be subclassed by clients. |
@@ -49,7 +49,7 @@ public class TimelyUniquenessEnforcerNode extends AbstractUniquenessEnforcerNode | |||
49 | public TimelyUniquenessEnforcerNode(final ReteContainer container, final int tupleWidth) { | 49 | public TimelyUniquenessEnforcerNode(final ReteContainer container, final int tupleWidth) { |
50 | super(container, tupleWidth); | 50 | super(container, tupleWidth); |
51 | this.memory = new TimelyMemory<Timestamp>( | 51 | this.memory = new TimelyMemory<Timestamp>( |
52 | container.getTimelyConfiguration().getTimelineRepresentation() == TimelineRepresentation.FAITHFUL); | 52 | container.getTimelyConfiguration().getTimelineRepresentation() == TimelyConfiguration.TimelineRepresentation.FAITHFUL); |
53 | container.registerClearable(this.memory); | 53 | container.registerClearable(this.memory); |
54 | this.mailbox = instantiateMailbox(); | 54 | this.mailbox = instantiateMailbox(); |
55 | container.registerClearable(this.mailbox); | 55 | container.registerClearable(this.mailbox); |
@@ -158,4 +158,4 @@ public class TimelyUniquenessEnforcerNode extends AbstractUniquenessEnforcerNode | |||
158 | super.networkStructureChanged(); | 158 | super.networkStructureChanged(); |
159 | } | 159 | } |
160 | 160 | ||
161 | } \ No newline at end of file | 161 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TransformerNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TransformerNode.java index 24750656..0cb17f7b 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TransformerNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TransformerNode.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.single; | 10 | package tools.refinery.interpreter.rete.single; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.Map.Entry; | 14 | import java.util.Map.Entry; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.rete.network.ReteContainer; |
17 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 17 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
18 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 19 | import tools.refinery.interpreter.matchers.util.Direction; |
20 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 20 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
21 | 21 | ||
22 | public abstract class TransformerNode extends SingleInputNode { | 22 | public abstract class TransformerNode extends SingleInputNode { |
23 | 23 | ||
@@ -33,7 +33,7 @@ public abstract class TransformerNode extends SingleInputNode { | |||
33 | collector.add(transform(ps)); | 33 | collector.add(transform(ps)); |
34 | } | 34 | } |
35 | } | 35 | } |
36 | 36 | ||
37 | @Override | 37 | @Override |
38 | public void pullIntoWithTimeline(final Map<Tuple, Timeline<Timestamp>> collector, final boolean flush) { | 38 | public void pullIntoWithTimeline(final Map<Tuple, Timeline<Timestamp>> collector, final boolean flush) { |
39 | for (final Entry<Tuple, Timeline<Timestamp>> entry : reteContainer.pullPropagatedContentsWithTimestamp(this, flush).entrySet()) { | 39 | for (final Entry<Tuple, Timeline<Timestamp>> entry : reteContainer.pullPropagatedContentsWithTimestamp(this, flush).entrySet()) { |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TransitiveClosureNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TransitiveClosureNode.java index fdda4ef4..3034933d 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TransitiveClosureNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TransitiveClosureNode.java | |||
@@ -6,22 +6,22 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.single; | 9 | package tools.refinery.interpreter.rete.single; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.itc.alg.incscc.IncSCCAlg; | 11 | import tools.refinery.interpreter.rete.network.NetworkStructureChangeSensitiveNode; |
12 | import tools.refinery.viatra.runtime.rete.itc.alg.misc.Tuple; | 12 | import tools.refinery.interpreter.rete.network.ReinitializedNode; |
13 | import tools.refinery.viatra.runtime.rete.itc.graphimpl.Graph; | 13 | import tools.refinery.interpreter.rete.network.ReteContainer; |
14 | import tools.refinery.viatra.runtime.rete.itc.igraph.ITcDataSource; | 14 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
15 | import tools.refinery.viatra.runtime.rete.itc.igraph.ITcObserver; | 15 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 16 | import tools.refinery.interpreter.rete.itc.alg.incscc.IncSCCAlg; |
17 | import tools.refinery.viatra.runtime.matchers.util.Clearable; | 17 | import tools.refinery.interpreter.rete.itc.alg.misc.Tuple; |
18 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 18 | import tools.refinery.interpreter.rete.itc.graphimpl.Graph; |
19 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 19 | import tools.refinery.interpreter.rete.itc.igraph.ITcDataSource; |
20 | import tools.refinery.viatra.runtime.rete.network.NetworkStructureChangeSensitiveNode; | 20 | import tools.refinery.interpreter.rete.itc.igraph.ITcObserver; |
21 | import tools.refinery.viatra.runtime.rete.network.ReinitializedNode; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
22 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 22 | import tools.refinery.interpreter.matchers.util.Clearable; |
23 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 23 | import tools.refinery.interpreter.matchers.util.Direction; |
24 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 24 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
25 | 25 | ||
26 | import java.util.Collection; | 26 | import java.util.Collection; |
27 | import java.util.Map; | 27 | import java.util.Map; |
@@ -72,10 +72,10 @@ public class TransitiveClosureNode extends SingleInputNode | |||
72 | * the initial collection of tuples | 72 | * the initial collection of tuples |
73 | */ | 73 | */ |
74 | @Override | 74 | @Override |
75 | public void reinitializeWith(Collection<tools.refinery.viatra.runtime.matchers.tuple.Tuple> tuples) { | 75 | public void reinitializeWith(Collection<tools.refinery.interpreter.matchers.tuple.Tuple> tuples) { |
76 | clear(); | 76 | clear(); |
77 | 77 | ||
78 | for (tools.refinery.viatra.runtime.matchers.tuple.Tuple t : tuples) { | 78 | for (tools.refinery.interpreter.matchers.tuple.Tuple t : tuples) { |
79 | graphDataSource.insertNode(t.get(0)); | 79 | graphDataSource.insertNode(t.get(0)); |
80 | graphDataSource.insertNode(t.get(1)); | 80 | graphDataSource.insertNode(t.get(1)); |
81 | graphDataSource.insertEdge(t.get(0), t.get(1)); | 81 | graphDataSource.insertEdge(t.get(0), t.get(1)); |
@@ -84,7 +84,7 @@ public class TransitiveClosureNode extends SingleInputNode | |||
84 | } | 84 | } |
85 | 85 | ||
86 | @Override | 86 | @Override |
87 | public void pullInto(final Collection<tools.refinery.viatra.runtime.matchers.tuple.Tuple> collector, final boolean flush) { | 87 | public void pullInto(final Collection<tools.refinery.interpreter.matchers.tuple.Tuple> collector, final boolean flush) { |
88 | for (final Tuple<Object> tuple : ((IncSCCAlg<Object>) transitiveClosureAlgorithm).getTcRelation()) { | 88 | for (final Tuple<Object> tuple : ((IncSCCAlg<Object>) transitiveClosureAlgorithm).getTcRelation()) { |
89 | collector.add(Tuples.staticArityFlatTupleOf(tuple.getSource(), tuple.getTarget())); | 89 | collector.add(Tuples.staticArityFlatTupleOf(tuple.getSource(), tuple.getTarget())); |
90 | } | 90 | } |
@@ -92,7 +92,7 @@ public class TransitiveClosureNode extends SingleInputNode | |||
92 | 92 | ||
93 | @Override | 93 | @Override |
94 | public void pullIntoWithTimeline( | 94 | public void pullIntoWithTimeline( |
95 | final Map<tools.refinery.viatra.runtime.matchers.tuple.Tuple, Timeline<Timestamp>> collector, | 95 | final Map<tools.refinery.interpreter.matchers.tuple.Tuple, Timeline<Timestamp>> collector, |
96 | final boolean flush) { | 96 | final boolean flush) { |
97 | // use all zero timestamps because this node cannot be used in recursive groups anyway | 97 | // use all zero timestamps because this node cannot be used in recursive groups anyway |
98 | for (final Tuple<Object> tuple : ((IncSCCAlg<Object>) transitiveClosureAlgorithm).getTcRelation()) { | 98 | for (final Tuple<Object> tuple : ((IncSCCAlg<Object>) transitiveClosureAlgorithm).getTcRelation()) { |
@@ -101,7 +101,7 @@ public class TransitiveClosureNode extends SingleInputNode | |||
101 | } | 101 | } |
102 | 102 | ||
103 | @Override | 103 | @Override |
104 | public void update(Direction direction, tools.refinery.viatra.runtime.matchers.tuple.Tuple updateElement, | 104 | public void update(Direction direction, tools.refinery.interpreter.matchers.tuple.Tuple updateElement, |
105 | Timestamp timestamp) { | 105 | Timestamp timestamp) { |
106 | if (updateElement.getSize() == 2) { | 106 | if (updateElement.getSize() == 2) { |
107 | Object source = updateElement.get(0); | 107 | Object source = updateElement.get(0); |
@@ -134,13 +134,13 @@ public class TransitiveClosureNode extends SingleInputNode | |||
134 | 134 | ||
135 | @Override | 135 | @Override |
136 | public void tupleInserted(Object source, Object target) { | 136 | public void tupleInserted(Object source, Object target) { |
137 | tools.refinery.viatra.runtime.matchers.tuple.Tuple tuple = Tuples.staticArityFlatTupleOf(source, target); | 137 | tools.refinery.interpreter.matchers.tuple.Tuple tuple = Tuples.staticArityFlatTupleOf(source, target); |
138 | propagateUpdate(Direction.INSERT, tuple, Timestamp.ZERO); | 138 | propagateUpdate(Direction.INSERT, tuple, Timestamp.ZERO); |
139 | } | 139 | } |
140 | 140 | ||
141 | @Override | 141 | @Override |
142 | public void tupleDeleted(Object source, Object target) { | 142 | public void tupleDeleted(Object source, Object target) { |
143 | tools.refinery.viatra.runtime.matchers.tuple.Tuple tuple = Tuples.staticArityFlatTupleOf(source, target); | 143 | tools.refinery.interpreter.matchers.tuple.Tuple tuple = Tuples.staticArityFlatTupleOf(source, target); |
144 | propagateUpdate(Direction.DELETE, tuple, Timestamp.ZERO); | 144 | propagateUpdate(Direction.DELETE, tuple, Timestamp.ZERO); |
145 | } | 145 | } |
146 | 146 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TransparentNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TransparentNode.java index 6c21a966..fb64ed88 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TransparentNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TransparentNode.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.single; | 10 | package tools.refinery.interpreter.rete.single; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.rete.network.ReteContainer; |
16 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 16 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
17 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 18 | import tools.refinery.interpreter.matchers.util.Direction; |
19 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 19 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Simply propagates everything. Might be used to join or fork. | 22 | * Simply propagates everything. Might be used to join or fork. |
23 | * | 23 | * |
24 | * @author Gabor Bergmann | 24 | * @author Gabor Bergmann |
25 | */ | 25 | */ |
26 | public class TransparentNode extends SingleInputNode { | 26 | public class TransparentNode extends SingleInputNode { |
@@ -44,5 +44,5 @@ public class TransparentNode extends SingleInputNode { | |||
44 | public void pullIntoWithTimeline(final Map<Tuple, Timeline<Timestamp>> collector, final boolean flush) { | 44 | public void pullIntoWithTimeline(final Map<Tuple, Timeline<Timestamp>> collector, final boolean flush) { |
45 | propagatePullIntoWithTimestamp(collector, flush); | 45 | propagatePullIntoWithTimestamp(collector, flush); |
46 | } | 46 | } |
47 | 47 | ||
48 | } | 48 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TrimmerNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TrimmerNode.java index 8a72138c..96e757e3 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/TrimmerNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/TrimmerNode.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.single; | 10 | package tools.refinery.interpreter.rete.single; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 12 | import tools.refinery.interpreter.rete.network.ReteContainer; |
13 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 13 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
14 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 14 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Trims the matchings as specified by a mask. | 17 | * Trims the matchings as specified by a mask. |
18 | * | 18 | * |
19 | * @author Gabor Bergmann | 19 | * @author Gabor Bergmann |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | public class TrimmerNode extends TransformerNode { | 22 | public class TrimmerNode extends TransformerNode { |
23 | 23 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/UniquenessEnforcerNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/UniquenessEnforcerNode.java index 5bfde248..195e3537 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/UniquenessEnforcerNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/UniquenessEnforcerNode.java | |||
@@ -3,35 +3,35 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.single; | 10 | package tools.refinery.interpreter.rete.single; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.context.IPosetComparator; | 16 | import tools.refinery.interpreter.rete.network.PosetAwareReceiver; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 17 | import tools.refinery.interpreter.rete.network.RederivableNode; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 18 | import tools.refinery.interpreter.rete.network.ReteContainer; |
19 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 19 | import tools.refinery.interpreter.rete.network.communication.CommunicationGroup; |
20 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 20 | import tools.refinery.interpreter.rete.network.communication.Timestamp; |
21 | import tools.refinery.viatra.runtime.matchers.util.IMultiset; | 21 | import tools.refinery.interpreter.rete.network.communication.timeless.RecursiveCommunicationGroup; |
22 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 22 | import tools.refinery.interpreter.rete.network.mailbox.Mailbox; |
23 | import tools.refinery.viatra.runtime.rete.index.MemoryIdentityIndexer; | 23 | import tools.refinery.interpreter.rete.network.mailbox.timeless.BehaviorChangingMailbox; |
24 | import tools.refinery.viatra.runtime.rete.index.MemoryNullIndexer; | 24 | import tools.refinery.interpreter.rete.network.mailbox.timeless.PosetAwareMailbox; |
25 | import tools.refinery.viatra.runtime.rete.index.ProjectionIndexer; | 25 | import tools.refinery.interpreter.matchers.context.IPosetComparator; |
26 | import tools.refinery.viatra.runtime.rete.network.PosetAwareReceiver; | 26 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
27 | import tools.refinery.viatra.runtime.rete.network.RederivableNode; | 27 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
28 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 28 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
29 | import tools.refinery.viatra.runtime.rete.network.communication.CommunicationGroup; | 29 | import tools.refinery.interpreter.matchers.util.Direction; |
30 | import tools.refinery.viatra.runtime.rete.network.communication.Timestamp; | 30 | import tools.refinery.interpreter.matchers.util.IMultiset; |
31 | import tools.refinery.viatra.runtime.rete.network.communication.timeless.RecursiveCommunicationGroup; | 31 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
32 | import tools.refinery.viatra.runtime.rete.network.mailbox.Mailbox; | 32 | import tools.refinery.interpreter.rete.index.MemoryIdentityIndexer; |
33 | import tools.refinery.viatra.runtime.rete.network.mailbox.timeless.BehaviorChangingMailbox; | 33 | import tools.refinery.interpreter.rete.index.MemoryNullIndexer; |
34 | import tools.refinery.viatra.runtime.rete.network.mailbox.timeless.PosetAwareMailbox; | 34 | import tools.refinery.interpreter.rete.index.ProjectionIndexer; |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * Timeless uniqueness enforcer node implementation. | 37 | * Timeless uniqueness enforcer node implementation. |
@@ -39,7 +39,7 @@ import tools.refinery.viatra.runtime.rete.network.mailbox.timeless.PosetAwareMai | |||
39 | * The node is capable of operating in the delete and re-derive mode. In this mode, it is also possible to equip the | 39 | * The node is capable of operating in the delete and re-derive mode. In this mode, it is also possible to equip the |
40 | * node with an {@link IPosetComparator} to identify monotone changes; thus, ensuring that a fix-point can be reached | 40 | * node with an {@link IPosetComparator} to identify monotone changes; thus, ensuring that a fix-point can be reached |
41 | * during the evaluation. | 41 | * during the evaluation. |
42 | * | 42 | * |
43 | * @author Gabor Bergmann | 43 | * @author Gabor Bergmann |
44 | * @author Tamas Szabo | 44 | * @author Tamas Szabo |
45 | * @noinstantiate This class is not intended to be instantiated by clients. | 45 | * @noinstantiate This class is not intended to be instantiated by clients. |
@@ -69,19 +69,19 @@ public class UniquenessEnforcerNode extends AbstractUniquenessEnforcerNode | |||
69 | 69 | ||
70 | /** | 70 | /** |
71 | * OPTIONAL ELEMENT - ONLY PRESENT IF MONOTONICITY INFO WAS AVAILABLE | 71 | * OPTIONAL ELEMENT - ONLY PRESENT IF MONOTONICITY INFO WAS AVAILABLE |
72 | * | 72 | * |
73 | * @since 1.6 | 73 | * @since 1.6 |
74 | */ | 74 | */ |
75 | protected final TupleMask coreMask; | 75 | protected final TupleMask coreMask; |
76 | /** | 76 | /** |
77 | * OPTIONAL ELEMENTS - ONLY PRESENT IF MONOTONICITY INFO WAS AVAILABLE | 77 | * OPTIONAL ELEMENTS - ONLY PRESENT IF MONOTONICITY INFO WAS AVAILABLE |
78 | * | 78 | * |
79 | * @since 1.6 | 79 | * @since 1.6 |
80 | */ | 80 | */ |
81 | protected final TupleMask posetMask; | 81 | protected final TupleMask posetMask; |
82 | /** | 82 | /** |
83 | * OPTIONAL ELEMENTS - ONLY PRESENT IF MONOTONICITY INFO WAS AVAILABLE | 83 | * OPTIONAL ELEMENTS - ONLY PRESENT IF MONOTONICITY INFO WAS AVAILABLE |
84 | * | 84 | * |
85 | * @since 1.6 | 85 | * @since 1.6 |
86 | */ | 86 | */ |
87 | protected final IPosetComparator posetComparator; | 87 | protected final IPosetComparator posetComparator; |
@@ -112,14 +112,14 @@ public class UniquenessEnforcerNode extends AbstractUniquenessEnforcerNode | |||
112 | this.mailbox = instantiateMailbox(); | 112 | this.mailbox = instantiateMailbox(); |
113 | reteContainer.registerClearable(this.mailbox); | 113 | reteContainer.registerClearable(this.mailbox); |
114 | } | 114 | } |
115 | 115 | ||
116 | @Override | 116 | @Override |
117 | public void pullInto(final Collection<Tuple> collector, final boolean flush) { | 117 | public void pullInto(final Collection<Tuple> collector, final boolean flush) { |
118 | for (final Tuple tuple : this.memory.distinctValues()) { | 118 | for (final Tuple tuple : this.memory.distinctValues()) { |
119 | collector.add(tuple); | 119 | collector.add(tuple); |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | /** | 123 | /** |
124 | * @since 2.8 | 124 | * @since 2.8 |
125 | */ | 125 | */ |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/ValueBinderFilterNode.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/ValueBinderFilterNode.java index c641bf6e..6a56984c 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/ValueBinderFilterNode.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/single/ValueBinderFilterNode.java | |||
@@ -3,20 +3,20 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.single; | 10 | package tools.refinery.interpreter.rete.single; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 12 | import tools.refinery.interpreter.rete.network.ReteContainer; |
13 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | 13 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * A filter node that keeps only those tuples that contain a certain value at a certain position. | 16 | * A filter node that keeps only those tuples that contain a certain value at a certain position. |
17 | * | 17 | * |
18 | * @author Bergmann Gabor | 18 | * @author Bergmann Gabor |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | public class ValueBinderFilterNode extends FilterNode { | 21 | public class ValueBinderFilterNode extends FilterNode { |
22 | 22 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/ActiveNodeConflictTrace.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/ActiveNodeConflictTrace.java index 2055dfe8..30eac47b 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/ActiveNodeConflictTrace.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/ActiveNodeConflictTrace.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.traceability; | 9 | package tools.refinery.interpreter.rete.traceability; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe; | 11 | import tools.refinery.interpreter.rete.recipes.ReteNodeRecipe; |
12 | 12 | ||
13 | public class ActiveNodeConflictTrace extends RecipeTraceInfo { // TODO implement PatternTraceInfo | 13 | public class ActiveNodeConflictTrace extends RecipeTraceInfo { // TODO implement PatternTraceInfo |
14 | RecipeTraceInfo inactiveRecipeTrace; | 14 | RecipeTraceInfo inactiveRecipeTrace; |
15 | public ActiveNodeConflictTrace(ReteNodeRecipe recipe, | 15 | public ActiveNodeConflictTrace(ReteNodeRecipe recipe, |
16 | RecipeTraceInfo parentRecipeTrace, | 16 | RecipeTraceInfo parentRecipeTrace, |
17 | RecipeTraceInfo inactiveRecipeTrace) { | 17 | RecipeTraceInfo inactiveRecipeTrace) { |
@@ -21,4 +21,4 @@ public class ActiveNodeConflictTrace extends RecipeTraceInfo { // TODO implement | |||
21 | public RecipeTraceInfo getInactiveRecipeTrace() { | 21 | public RecipeTraceInfo getInactiveRecipeTrace() { |
22 | return inactiveRecipeTrace; | 22 | return inactiveRecipeTrace; |
23 | } | 23 | } |
24 | } \ No newline at end of file | 24 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/CompiledQuery.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/CompiledQuery.java index b8c793c5..38665685 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/CompiledQuery.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/CompiledQuery.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.traceability; | 9 | package tools.refinery.interpreter.rete.traceability; |
10 | 10 | ||
11 | import java.util.Map; | 11 | import java.util.Map; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 13 | import tools.refinery.interpreter.matchers.psystem.PBody; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 14 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
15 | import tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe; | 15 | import tools.refinery.interpreter.rete.recipes.ReteNodeRecipe; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * Indicates that recipe expresses the finished match set of a query. | 18 | * Indicates that recipe expresses the finished match set of a query. |
@@ -21,16 +21,16 @@ import tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe; | |||
21 | */ | 21 | */ |
22 | public class CompiledQuery extends RecipeTraceInfo implements | 22 | public class CompiledQuery extends RecipeTraceInfo implements |
23 | PatternTraceInfo { | 23 | PatternTraceInfo { |
24 | 24 | ||
25 | private PQuery query; | 25 | private PQuery query; |
26 | private final Map<PBody, ? extends RecipeTraceInfo> parentRecipeTracesPerBody; | 26 | private final Map<PBody, ? extends RecipeTraceInfo> parentRecipeTracesPerBody; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * @since 1.6 | 29 | * @since 1.6 |
30 | */ | 30 | */ |
31 | public CompiledQuery(ReteNodeRecipe recipe, | 31 | public CompiledQuery(ReteNodeRecipe recipe, |
32 | Map<PBody, ? extends RecipeTraceInfo> parentRecipeTraces, | 32 | Map<PBody, ? extends RecipeTraceInfo> parentRecipeTraces, |
33 | PQuery query) { | 33 | PQuery query) { |
34 | super(recipe, parentRecipeTraces.values()); | 34 | super(recipe, parentRecipeTraces.values()); |
35 | parentRecipeTracesPerBody = parentRecipeTraces; | 35 | parentRecipeTracesPerBody = parentRecipeTraces; |
36 | this.query = query; | 36 | this.query = query; |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/CompiledSubPlan.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/CompiledSubPlan.java index 572e943c..320b9d19 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/CompiledSubPlan.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/CompiledSubPlan.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.traceability; | 9 | package tools.refinery.interpreter.rete.traceability; |
10 | 10 | ||
11 | import java.util.Arrays; | 11 | import java.util.Arrays; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
@@ -15,24 +15,24 @@ import java.util.List; | |||
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | import java.util.stream.Collectors; | 16 | import java.util.stream.Collectors; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 18 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 19 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
20 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 20 | import tools.refinery.interpreter.matchers.util.Preconditions; |
21 | import tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe; | 21 | import tools.refinery.interpreter.rete.recipes.ReteNodeRecipe; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * A trace marker associating a Rete recipe with a query SubPlan. | 24 | * A trace marker associating a Rete recipe with a query SubPlan. |
25 | * | 25 | * |
26 | * <p> The Rete node represented by the recipe is equivalent to the SubPlan. | 26 | * <p> The Rete node represented by the recipe is equivalent to the SubPlan. |
27 | * <p> Invariant: each variable has at most one index associated with it in the tuple, i.e. no duplicates. | 27 | * <p> Invariant: each variable has at most one index associated with it in the tuple, i.e. no duplicates. |
28 | */ | 28 | */ |
29 | public class CompiledSubPlan extends PlanningTrace { | 29 | public class CompiledSubPlan extends PlanningTrace { |
30 | 30 | ||
31 | public CompiledSubPlan(SubPlan subPlan, List<PVariable> variablesTuple, | 31 | public CompiledSubPlan(SubPlan subPlan, List<PVariable> variablesTuple, |
32 | ReteNodeRecipe recipe, | 32 | ReteNodeRecipe recipe, |
33 | Collection<? extends RecipeTraceInfo> parentRecipeTraces) { | 33 | Collection<? extends RecipeTraceInfo> parentRecipeTraces) { |
34 | super(subPlan, variablesTuple, recipe, parentRecipeTraces); | 34 | super(subPlan, variablesTuple, recipe, parentRecipeTraces); |
35 | 35 | ||
36 | // Make sure that each variable occurs only once | 36 | // Make sure that each variable occurs only once |
37 | Set<PVariable> variablesSet = new HashSet<PVariable>(variablesTuple); | 37 | Set<PVariable> variablesSet = new HashSet<PVariable>(variablesTuple); |
38 | Preconditions.checkState(variablesSet.size() == variablesTuple.size(), | 38 | Preconditions.checkState(variablesSet.size() == variablesTuple.size(), |
@@ -41,7 +41,7 @@ public class CompiledSubPlan extends PlanningTrace { | |||
41 | variablesTuple.stream().map(PVariable::getName).collect(Collectors.joining(",")), | 41 | variablesTuple.stream().map(PVariable::getName).collect(Collectors.joining(",")), |
42 | subPlan.toShortString(), recipe)); | 42 | subPlan.toShortString(), recipe)); |
43 | } | 43 | } |
44 | 44 | ||
45 | public CompiledSubPlan(SubPlan subPlan, List<PVariable> variablesTuple, | 45 | public CompiledSubPlan(SubPlan subPlan, List<PVariable> variablesTuple, |
46 | ReteNodeRecipe recipe, | 46 | ReteNodeRecipe recipe, |
47 | RecipeTraceInfo... parentRecipeTraces) { | 47 | RecipeTraceInfo... parentRecipeTraces) { |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/ParameterProjectionTrace.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/ParameterProjectionTrace.java index 8da1e314..d743608a 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/ParameterProjectionTrace.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/ParameterProjectionTrace.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.traceability; | 9 | package tools.refinery.interpreter.rete.traceability; |
10 | 10 | ||
11 | import java.util.Arrays; | 11 | import java.util.Arrays; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 14 | import tools.refinery.interpreter.matchers.psystem.PBody; |
15 | import tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe; | 15 | import tools.refinery.interpreter.rete.recipes.ReteNodeRecipe; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * The recipe projects the finished results of a {@link PBody} onto the list of parameters. | 18 | * The recipe projects the finished results of a {@link PBody} onto the list of parameters. |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/PatternTraceInfo.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/PatternTraceInfo.java index fb7ef062..37a3b9ef 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/PatternTraceInfo.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/PatternTraceInfo.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.traceability; | 9 | package tools.refinery.interpreter.rete.traceability; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * One kind of trace marker that merely establishes the pattern for which the node was built. | 12 | * One kind of trace marker that merely establishes the pattern for which the node was built. |
13 | * @author Bergmann Gabor | 13 | * @author Bergmann Gabor |
14 | */ | 14 | */ |
15 | public interface PatternTraceInfo extends TraceInfo { | 15 | public interface PatternTraceInfo extends TraceInfo { |
16 | String getPatternName(); | 16 | String getPatternName(); |
17 | } \ No newline at end of file | 17 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/PlanningTrace.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/PlanningTrace.java index c1cc3a69..78f3941e 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/PlanningTrace.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/PlanningTrace.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.traceability; | 9 | package tools.refinery.interpreter.rete.traceability; |
10 | 10 | ||
11 | import java.util.Arrays; | 11 | import java.util.Arrays; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
@@ -14,14 +14,14 @@ import java.util.HashMap; | |||
14 | import java.util.List; | 14 | import java.util.List; |
15 | import java.util.Map; | 15 | import java.util.Map; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 17 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 18 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
19 | import tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe; | 19 | import tools.refinery.interpreter.rete.recipes.ReteNodeRecipe; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * A trace marker associating a Rete recipe with a query SubPlan. | 22 | * A trace marker associating a Rete recipe with a query SubPlan. |
23 | * | 23 | * |
24 | * <p> The recipe may be an auxiliary node; | 24 | * <p> The recipe may be an auxiliary node; |
25 | * see {@link CompiledSubPlan} if it represents the entire SubPlan instead. | 25 | * see {@link CompiledSubPlan} if it represents the entire SubPlan instead. |
26 | */ | 26 | */ |
27 | public class PlanningTrace extends RecipeTraceInfo implements PatternTraceInfo { | 27 | public class PlanningTrace extends RecipeTraceInfo implements PatternTraceInfo { |
@@ -30,19 +30,19 @@ public class PlanningTrace extends RecipeTraceInfo implements PatternTraceInfo { | |||
30 | protected List<PVariable> variablesTuple; | 30 | protected List<PVariable> variablesTuple; |
31 | protected Map<PVariable, Integer> posMapping; | 31 | protected Map<PVariable, Integer> posMapping; |
32 | 32 | ||
33 | public PlanningTrace(SubPlan subPlan, List<PVariable> variablesTuple, | 33 | public PlanningTrace(SubPlan subPlan, List<PVariable> variablesTuple, |
34 | ReteNodeRecipe recipe, | 34 | ReteNodeRecipe recipe, |
35 | Collection<? extends RecipeTraceInfo> parentRecipeTraces) { | 35 | Collection<? extends RecipeTraceInfo> parentRecipeTraces) { |
36 | super(recipe, parentRecipeTraces); | 36 | super(recipe, parentRecipeTraces); |
37 | this.subPlan = subPlan; | 37 | this.subPlan = subPlan; |
38 | this.variablesTuple = variablesTuple; | 38 | this.variablesTuple = variablesTuple; |
39 | 39 | ||
40 | this.posMapping = new HashMap<PVariable, Integer>(); | 40 | this.posMapping = new HashMap<PVariable, Integer>(); |
41 | for (int i = 0; i < variablesTuple.size(); ++i) | 41 | for (int i = 0; i < variablesTuple.size(); ++i) |
42 | posMapping.put(variablesTuple.get(i), i); | 42 | posMapping.put(variablesTuple.get(i), i); |
43 | } | 43 | } |
44 | 44 | ||
45 | public PlanningTrace(SubPlan subPlan, List<PVariable> variablesTuple, | 45 | public PlanningTrace(SubPlan subPlan, List<PVariable> variablesTuple, |
46 | ReteNodeRecipe recipe, | 46 | ReteNodeRecipe recipe, |
47 | RecipeTraceInfo... parentRecipeTraces) { | 47 | RecipeTraceInfo... parentRecipeTraces) { |
48 | this(subPlan, variablesTuple, recipe, Arrays.asList(parentRecipeTraces)); | 48 | this(subPlan, variablesTuple, recipe, Arrays.asList(parentRecipeTraces)); |
@@ -68,13 +68,13 @@ public class PlanningTrace extends RecipeTraceInfo implements PatternTraceInfo { | |||
68 | /** | 68 | /** |
69 | * Returns a new clone that reinterprets the same compiled form | 69 | * Returns a new clone that reinterprets the same compiled form |
70 | * as the compiled form of a (potentially different) subPlan. | 70 | * as the compiled form of a (potentially different) subPlan. |
71 | * Useful e.g. if child plan turns out to be a no-op, or when promoting a {@link PlanningTrace} to {@link CompiledSubPlan}. | 71 | * Useful e.g. if child plan turns out to be a no-op, or when promoting a {@link PlanningTrace} to {@link CompiledSubPlan}. |
72 | */ | 72 | */ |
73 | public CompiledSubPlan cloneFor(SubPlan newSubPlan) { | 73 | public CompiledSubPlan cloneFor(SubPlan newSubPlan) { |
74 | return new CompiledSubPlan(newSubPlan, | 74 | return new CompiledSubPlan(newSubPlan, |
75 | getVariablesTuple(), | 75 | getVariablesTuple(), |
76 | getRecipe(), | 76 | getRecipe(), |
77 | getParentRecipeTracesForCloning()); | 77 | getParentRecipeTracesForCloning()); |
78 | } | 78 | } |
79 | 79 | ||
80 | } \ No newline at end of file | 80 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/RecipeTraceInfo.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/RecipeTraceInfo.java index 8f610550..1f9d3d91 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/RecipeTraceInfo.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/RecipeTraceInfo.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.traceability; | 9 | package tools.refinery.interpreter.rete.traceability; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Arrays; | 12 | import java.util.Arrays; |
@@ -14,8 +14,8 @@ import java.util.Collection; | |||
14 | import java.util.Collections; | 14 | import java.util.Collections; |
15 | import java.util.List; | 15 | import java.util.List; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.rete.network.Node; | 17 | import tools.refinery.interpreter.rete.network.Node; |
18 | import tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe; | 18 | import tools.refinery.interpreter.rete.recipes.ReteNodeRecipe; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * A trace marker that indicates the recipe for which the node was built. | 21 | * A trace marker that indicates the recipe for which the node was built. |
@@ -33,24 +33,24 @@ public class RecipeTraceInfo implements TraceInfo { | |||
33 | * @noreference This method is not intended to be referenced by clients. | 33 | * @noreference This method is not intended to be referenced by clients. |
34 | */ | 34 | */ |
35 | public Collection<? extends RecipeTraceInfo> getParentRecipeTracesForCloning() {return parentRecipeTraces;} | 35 | public Collection<? extends RecipeTraceInfo> getParentRecipeTracesForCloning() {return parentRecipeTraces;} |
36 | @Override | 36 | @Override |
37 | public Node getNode() {return node;} | 37 | public Node getNode() {return node;} |
38 | 38 | ||
39 | private Node node; | 39 | private Node node; |
40 | ReteNodeRecipe recipe; | 40 | ReteNodeRecipe recipe; |
41 | ReteNodeRecipe shadowedRecipe; | 41 | ReteNodeRecipe shadowedRecipe; |
42 | Collection<? extends RecipeTraceInfo> parentRecipeTraces; | 42 | Collection<? extends RecipeTraceInfo> parentRecipeTraces; |
43 | 43 | ||
44 | 44 | ||
45 | public RecipeTraceInfo(ReteNodeRecipe recipe, Collection<? extends RecipeTraceInfo> parentRecipeTraces) { | 45 | public RecipeTraceInfo(ReteNodeRecipe recipe, Collection<? extends RecipeTraceInfo> parentRecipeTraces) { |
46 | super(); | 46 | super(); |
47 | this.recipe = recipe; | 47 | this.recipe = recipe; |
48 | this.parentRecipeTraces = parentRecipeTraces; //ParentTraceList.from(parentRecipeTraces); | 48 | this.parentRecipeTraces = parentRecipeTraces; //ParentTraceList.from(parentRecipeTraces); |
49 | } | 49 | } |
50 | public RecipeTraceInfo(ReteNodeRecipe recipe, RecipeTraceInfo... parentRecipeTraces) { | 50 | public RecipeTraceInfo(ReteNodeRecipe recipe, RecipeTraceInfo... parentRecipeTraces) { |
51 | this(recipe, Arrays.asList(parentRecipeTraces)); | 51 | this(recipe, Arrays.asList(parentRecipeTraces)); |
52 | } | 52 | } |
53 | 53 | ||
54 | @Override | 54 | @Override |
55 | public boolean propagateToIndexerParent() {return false;} | 55 | public boolean propagateToIndexerParent() {return false;} |
56 | @Override | 56 | @Override |
@@ -59,9 +59,9 @@ public class RecipeTraceInfo implements TraceInfo { | |||
59 | public boolean propagateFromStandardNodeToSupplierParent() {return false;} | 59 | public boolean propagateFromStandardNodeToSupplierParent() {return false;} |
60 | @Override | 60 | @Override |
61 | public boolean propagateToProductionNodeParentAlso() {return false;} | 61 | public boolean propagateToProductionNodeParentAlso() {return false;} |
62 | @Override | 62 | @Override |
63 | public void assignNode(Node node) {this.node = node;} | 63 | public void assignNode(Node node) {this.node = node;} |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * @param knownRecipe a known recipe that is equivalent to the current recipe | 66 | * @param knownRecipe a known recipe that is equivalent to the current recipe |
67 | */ | 67 | */ |
@@ -69,13 +69,13 @@ public class RecipeTraceInfo implements TraceInfo { | |||
69 | this.shadowedRecipe = this.recipe; | 69 | this.shadowedRecipe = this.recipe; |
70 | this.recipe = knownRecipe; | 70 | this.recipe = knownRecipe; |
71 | } | 71 | } |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * Get original recipe shadowed by an equivalent | 74 | * Get original recipe shadowed by an equivalent |
75 | */ | 75 | */ |
76 | public ReteNodeRecipe getShadowedRecipe() { | 76 | public ReteNodeRecipe getShadowedRecipe() { |
77 | return shadowedRecipe; | 77 | return shadowedRecipe; |
78 | } | 78 | } |
79 | 79 | ||
80 | 80 | ||
81 | } \ No newline at end of file | 81 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/TraceInfo.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/TraceInfo.java index e1d440db..f7ce1933 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/TraceInfo.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/TraceInfo.java | |||
@@ -3,23 +3,23 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.traceability; | 9 | package tools.refinery.interpreter.rete.traceability; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.rete.network.Node; | 11 | import tools.refinery.interpreter.rete.network.Node; |
12 | 12 | ||
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Traces the node back to a purpose for which the node was built, | 15 | * Traces the node back to a purpose for which the node was built, |
16 | * to explain why the node is there and what it means. | 16 | * to explain why the node is there and what it means. |
17 | * @author Bergmann Gabor | 17 | * @author Bergmann Gabor |
18 | */ | 18 | */ |
19 | public interface TraceInfo { | 19 | public interface TraceInfo { |
20 | boolean propagateToIndexerParent(); | 20 | boolean propagateToIndexerParent(); |
21 | boolean propagateFromIndexerToSupplierParent(); | 21 | boolean propagateFromIndexerToSupplierParent(); |
22 | boolean propagateFromStandardNodeToSupplierParent(); | 22 | boolean propagateFromStandardNodeToSupplierParent(); |
23 | boolean propagateToProductionNodeParentAlso(); | 23 | boolean propagateToProductionNodeParentAlso(); |
24 | 24 | ||
25 | void assignNode(Node node); | 25 | void assignNode(Node node); |
@@ -30,4 +30,4 @@ public interface TraceInfo { | |||
30 | // * @return a tuple of correct size representing the semantics of each position. | 30 | // * @return a tuple of correct size representing the semantics of each position. |
31 | // * @post not null | 31 | // * @post not null |
32 | // */ | 32 | // */ |
33 | // Tuple getSemantics(); \ No newline at end of file | 33 | // Tuple getSemantics(); |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/UserRequestTrace.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/UserRequestTrace.java index 11e4db32..2c163430 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/traceability/UserRequestTrace.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/traceability/UserRequestTrace.java | |||
@@ -3,17 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.traceability; | 9 | package tools.refinery.interpreter.rete.traceability; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe; | 13 | import tools.refinery.interpreter.rete.recipes.ReteNodeRecipe; |
14 | 14 | ||
15 | // private class AggregatorReferenceIndexTraceInfo extends RecipeTraceInfo { | 15 | // private class AggregatorReferenceIndexTraceInfo extends RecipeTraceInfo { |
16 | // RecipeTraceInfo aggregatorNodeRecipeTrace; | 16 | // RecipeTraceInfo aggregatorNodeRecipeTrace; |
17 | // public AggregatorReferenceIndexTraceInfo(ProjectionIndexerRecipe recipe, | 17 | // public AggregatorReferenceIndexTraceInfo(ProjectionIndexerRecipe recipe, |
18 | // RecipeTraceInfo parentRecipeTrace, | 18 | // RecipeTraceInfo parentRecipeTrace, |
19 | // RecipeTraceInfo aggregatorNodeRecipeTrace) { | 19 | // RecipeTraceInfo aggregatorNodeRecipeTrace) { |
@@ -26,11 +26,11 @@ import tools.refinery.viatra.runtime.rete.recipes.ReteNodeRecipe; | |||
26 | // } | 26 | // } |
27 | public class UserRequestTrace extends RecipeTraceInfo { | 27 | public class UserRequestTrace extends RecipeTraceInfo { |
28 | public UserRequestTrace(ReteNodeRecipe recipe, | 28 | public UserRequestTrace(ReteNodeRecipe recipe, |
29 | Collection<RecipeTraceInfo> parentRecipeTraces) { | 29 | Collection<RecipeTraceInfo> parentRecipeTraces) { |
30 | super(recipe, parentRecipeTraces); | 30 | super(recipe, parentRecipeTraces); |
31 | } | 31 | } |
32 | public UserRequestTrace(ReteNodeRecipe recipe, | 32 | public UserRequestTrace(ReteNodeRecipe recipe, |
33 | RecipeTraceInfo... parentRecipeTraces) { | 33 | RecipeTraceInfo... parentRecipeTraces) { |
34 | super(recipe, parentRecipeTraces); | 34 | super(recipe, parentRecipeTraces); |
35 | } | 35 | } |
36 | } \ No newline at end of file | 36 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/util/LexicographicComparator.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/util/LexicographicComparator.java index 0efc50af..daf3bf63 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/util/LexicographicComparator.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/util/LexicographicComparator.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.util; | 9 | package tools.refinery.interpreter.rete.util; |
10 | 10 | ||
11 | import java.util.Comparator; | 11 | import java.util.Comparator; |
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
@@ -17,9 +17,9 @@ import java.util.Iterator; | |||
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | public class LexicographicComparator<T> implements Comparator<Iterable<? extends T>> { | 19 | public class LexicographicComparator<T> implements Comparator<Iterable<? extends T>> { |
20 | 20 | ||
21 | final Comparator<T> elementComparator; | 21 | final Comparator<T> elementComparator; |
22 | 22 | ||
23 | public LexicographicComparator(Comparator<T> elementComparator) { | 23 | public LexicographicComparator(Comparator<T> elementComparator) { |
24 | super(); | 24 | super(); |
25 | this.elementComparator = elementComparator; | 25 | this.elementComparator = elementComparator; |
@@ -29,7 +29,7 @@ public class LexicographicComparator<T> implements Comparator<Iterable<? extends | |||
29 | public int compare(Iterable<? extends T> o1, Iterable<? extends T> o2) { | 29 | public int compare(Iterable<? extends T> o1, Iterable<? extends T> o2) { |
30 | Iterator<? extends T> it1 = o1.iterator(); | 30 | Iterator<? extends T> it1 = o1.iterator(); |
31 | Iterator<? extends T> it2 = o2.iterator(); | 31 | Iterator<? extends T> it2 = o2.iterator(); |
32 | 32 | ||
33 | boolean has1, has2, bothHaveNext; | 33 | boolean has1, has2, bothHaveNext; |
34 | do { | 34 | do { |
35 | has1 = it1.hasNext(); | 35 | has1 = it1.hasNext(); |
@@ -39,7 +39,7 @@ public class LexicographicComparator<T> implements Comparator<Iterable<? extends | |||
39 | T element1 = it1.next(); | 39 | T element1 = it1.next(); |
40 | T element2 = it2.next(); | 40 | T element2 = it2.next(); |
41 | int elementComparison = elementComparator.compare(element1, element2); | 41 | int elementComparison = elementComparator.compare(element1, element2); |
42 | if (elementComparison != 0) | 42 | if (elementComparison != 0) |
43 | return elementComparison; | 43 | return elementComparison; |
44 | } | 44 | } |
45 | } while (bothHaveNext); | 45 | } while (bothHaveNext); |
@@ -47,7 +47,7 @@ public class LexicographicComparator<T> implements Comparator<Iterable<? extends | |||
47 | return +1; | 47 | return +1; |
48 | } else if (!has1 && has2) { | 48 | } else if (!has1 && has2) { |
49 | return -1; | 49 | return -1; |
50 | } else /*if (!has1 && !has2)*/ { | 50 | } else /*if (!has1 && !has2)*/ { |
51 | return 0; | 51 | return 0; |
52 | } | 52 | } |
53 | } | 53 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/util/Options.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/util/Options.java index 96cc445f..e372f015 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/util/Options.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/util/Options.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.util; | 10 | package tools.refinery.interpreter.rete.util; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendHintProvider; | 12 | import tools.refinery.interpreter.rete.construction.basiclinear.BasicLinearLayout; |
13 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 13 | import tools.refinery.interpreter.rete.construction.quasitree.QuasiTreeLayout; |
14 | import tools.refinery.viatra.runtime.matchers.planning.IQueryPlannerStrategy; | 14 | import tools.refinery.interpreter.rete.network.communication.timely.TimelyCommunicationGroup; |
15 | import tools.refinery.viatra.runtime.rete.construction.basiclinear.BasicLinearLayout; | 15 | import tools.refinery.interpreter.matchers.backend.IQueryBackendHintProvider; |
16 | import tools.refinery.viatra.runtime.rete.construction.quasitree.QuasiTreeLayout; | 16 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
17 | import tools.refinery.viatra.runtime.rete.network.communication.timely.TimelyCommunicationGroup; | 17 | import tools.refinery.interpreter.matchers.planning.IQueryPlannerStrategy; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Feature switches. | 20 | * Feature switches. |
@@ -54,21 +54,21 @@ public class Options { | |||
54 | // bodies, 1 otherwise | 54 | // bodies, 1 otherwise |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * Enable for internal debugging of Rete communication scheme; | 57 | * Enable for internal debugging of Rete communication scheme; |
58 | * catches cases where the topological sort is violated by a message sent "backwards" | 58 | * catches cases where the topological sort is violated by a message sent "backwards" |
59 | * @since 1.6 | 59 | * @since 1.6 |
60 | */ | 60 | */ |
61 | public static final boolean MONITOR_VIOLATION_OF_RETE_NODEGROUP_TOPOLOGICAL_SORTING = false; | 61 | public static final boolean MONITOR_VIOLATION_OF_RETE_NODEGROUP_TOPOLOGICAL_SORTING = false; |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Enable for internal debugging of message delivery in {@link TimelyCommunicationGroup}s; | 64 | * Enable for internal debugging of message delivery in {@link TimelyCommunicationGroup}s; |
65 | * catches cases when there is a violation of increasing timestamps during message delivery within a group. | 65 | * catches cases when there is a violation of increasing timestamps during message delivery within a group. |
66 | * @since 2.3 | 66 | * @since 2.3 |
67 | */ | 67 | */ |
68 | public static final boolean MONITOR_VIOLATION_OF_DIFFERENTIAL_DATAFLOW_TIMESTAMPS = false; | 68 | public static final boolean MONITOR_VIOLATION_OF_DIFFERENTIAL_DATAFLOW_TIMESTAMPS = false; |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * | 71 | * |
72 | * @author Gabor Bergmann | 72 | * @author Gabor Bergmann |
73 | * @noreference | 73 | * @noreference |
74 | */ | 74 | */ |
@@ -93,19 +93,19 @@ public class Options { | |||
93 | public static final BuilderMethod builderMethod = | 93 | public static final BuilderMethod builderMethod = |
94 | // BuilderMethod.PSYSTEM_BASIC_LINEAR; | 94 | // BuilderMethod.PSYSTEM_BASIC_LINEAR; |
95 | BuilderMethod.PSYSTEM_QUASITREE; | 95 | BuilderMethod.PSYSTEM_QUASITREE; |
96 | 96 | ||
97 | public enum FunctionalDependencyOption { | 97 | public enum FunctionalDependencyOption { |
98 | OFF, | 98 | OFF, |
99 | OPPORTUNISTIC | 99 | OPPORTUNISTIC |
100 | } | 100 | } |
101 | public static final FunctionalDependencyOption functionalDependencyOption = | 101 | public static final FunctionalDependencyOption functionalDependencyOption = |
102 | FunctionalDependencyOption.OPPORTUNISTIC; | 102 | FunctionalDependencyOption.OPPORTUNISTIC; |
103 | 103 | ||
104 | public enum PlanTrimOption { | 104 | public enum PlanTrimOption { |
105 | OFF, | 105 | OFF, |
106 | OPPORTUNISTIC | 106 | OPPORTUNISTIC |
107 | } | 107 | } |
108 | public static final PlanTrimOption planTrimOption = | 108 | public static final PlanTrimOption planTrimOption = |
109 | PlanTrimOption.OPPORTUNISTIC; | 109 | PlanTrimOption.OPPORTUNISTIC; |
110 | 110 | ||
111 | } | 111 | } |
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/util/OrderingCompareAgent.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/util/OrderingCompareAgent.java index 6d0d813a..20fd35dd 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/util/OrderingCompareAgent.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/util/OrderingCompareAgent.java | |||
@@ -7,7 +7,7 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.rete.util; | 10 | package tools.refinery.interpreter.rete.util; |
11 | 11 | ||
12 | import java.util.Comparator; | 12 | import java.util.Comparator; |
13 | 13 | ||
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/util/ReteHintOptions.java b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/util/ReteHintOptions.java index 6e685253..42fcd406 100644 --- a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/util/ReteHintOptions.java +++ b/subprojects/interpreter-rete/src/main/java/tools/refinery/interpreter/rete/util/ReteHintOptions.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.rete.util; | 9 | package tools.refinery.interpreter.rete.util; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 11 | import tools.refinery.interpreter.rete.matcher.DRedReteBackendFactory; |
12 | import tools.refinery.viatra.runtime.matchers.backend.QueryHintOption; | 12 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
13 | import tools.refinery.viatra.runtime.rete.matcher.DRedReteBackendFactory; | 13 | import tools.refinery.interpreter.matchers.backend.QueryHintOption; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Provides key objects (of type {@link QueryHintOption}) for {@link QueryEvaluationHint}s. | 16 | * Provides key objects (of type {@link QueryHintOption}) for {@link QueryEvaluationHint}s. |
@@ -20,39 +20,39 @@ import tools.refinery.viatra.runtime.rete.matcher.DRedReteBackendFactory; | |||
20 | public final class ReteHintOptions { | 20 | public final class ReteHintOptions { |
21 | 21 | ||
22 | private ReteHintOptions() {/*Utility class constructor*/} | 22 | private ReteHintOptions() {/*Utility class constructor*/} |
23 | 23 | ||
24 | public static final QueryHintOption<Boolean> useDiscriminatorDispatchersForConstantFiltering = | 24 | public static final QueryHintOption<Boolean> useDiscriminatorDispatchersForConstantFiltering = |
25 | hintOption("useDiscriminatorDispatchersForConstantFiltering", true); | 25 | hintOption("useDiscriminatorDispatchersForConstantFiltering", true); |
26 | 26 | ||
27 | public static final QueryHintOption<Boolean> prioritizeConstantFiltering = | 27 | public static final QueryHintOption<Boolean> prioritizeConstantFiltering = |
28 | hintOption("prioritizeConstantFiltering", true); | 28 | hintOption("prioritizeConstantFiltering", true); |
29 | 29 | ||
30 | public static final QueryHintOption<Boolean> cacheOutputOfEvaluatorsByDefault = | 30 | public static final QueryHintOption<Boolean> cacheOutputOfEvaluatorsByDefault = |
31 | hintOption("cacheOutputOfEvaluatorsByDefault", true); | 31 | hintOption("cacheOutputOfEvaluatorsByDefault", true); |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * The incremental query evaluator backend can evaluate recursive patterns. | 34 | * The incremental query evaluator backend can evaluate recursive patterns. |
35 | * However, by default, instance models that contain cycles are not supported with recursive queries | 35 | * However, by default, instance models that contain cycles are not supported with recursive queries |
36 | * and can lead to incorrect query results. | 36 | * and can lead to incorrect query results. |
37 | * Enabling Delete And Rederive (DRED) mode guarantees that recursive query evaluation leads to correct results in these cases as well. | 37 | * Enabling Delete And Rederive (DRED) mode guarantees that recursive query evaluation leads to correct results in these cases as well. |
38 | * | 38 | * |
39 | * <p> As DRED may diminish the performance of incremental maintenance, it is not enabled by default. | 39 | * <p> As DRED may diminish the performance of incremental maintenance, it is not enabled by default. |
40 | * @since 1.6 | 40 | * @since 1.6 |
41 | * @deprecated Use {@link DRedReteBackendFactory} instead of setting this option to true. | 41 | * @deprecated Use {@link DRedReteBackendFactory} instead of setting this option to true. |
42 | */ | 42 | */ |
43 | @Deprecated | 43 | @Deprecated |
44 | public static final QueryHintOption<Boolean> deleteRederiveEvaluation = | 44 | public static final QueryHintOption<Boolean> deleteRederiveEvaluation = |
45 | hintOption("deleteRederiveEvaluation", false); | 45 | hintOption("deleteRederiveEvaluation", false); |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * This hint allows the query planner to take advantage of "weakened alternative" suggestions of the meta context. | 48 | * This hint allows the query planner to take advantage of "weakened alternative" suggestions of the meta context. |
49 | * For instance, enumerable unary type constraints may be substituted with a simple type filtering where sufficient. | 49 | * For instance, enumerable unary type constraints may be substituted with a simple type filtering where sufficient. |
50 | * | 50 | * |
51 | * @since 1.6 | 51 | * @since 1.6 |
52 | */ | 52 | */ |
53 | public static final QueryHintOption<Boolean> expandWeakenedAlternativeConstraints = | 53 | public static final QueryHintOption<Boolean> expandWeakenedAlternativeConstraints = |
54 | hintOption("expandWeakenedAlternativeConstraints", true); | 54 | hintOption("expandWeakenedAlternativeConstraints", true); |
55 | 55 | ||
56 | // internal helper for conciseness | 56 | // internal helper for conciseness |
57 | private static <T> QueryHintOption<T> hintOption(String hintKeyLocalName, T defaultValue) { | 57 | private static <T> QueryHintOption<T> hintOption(String hintKeyLocalName, T defaultValue) { |
58 | return new QueryHintOption<>(ReteHintOptions.class, hintKeyLocalName, defaultValue); | 58 | return new QueryHintOption<>(ReteHintOptions.class, hintKeyLocalName, defaultValue); |
diff --git a/subprojects/interpreter/NOTICE.md b/subprojects/interpreter/NOTICE.md new file mode 100644 index 00000000..94c1d803 --- /dev/null +++ b/subprojects/interpreter/NOTICE.md | |||
@@ -0,0 +1,94 @@ | |||
1 | <!-- | ||
2 | Copyright (c) 2018-2019, Zoltan Ujhelyi, IncQuery Labs Ltd. | ||
3 | Copyright (c) 2023 The Refinery Authors <https://refinery.tools/> | ||
4 | |||
5 | SPDX-License-Identifier: EPL-2.0 | ||
6 | --> | ||
7 | |||
8 | This module contains source code from the [Eclipse VIATRA™ project](https://projects.eclipse.org/projects/modeling.viatra), which is available under the terms of the [Eclipse Public License v 2.0](http://www.eclipse.org/legal/epl-v20.html). | ||
9 | |||
10 | Eclipse®, VIATRA™ and ‘Eclipse VIATRA™’ are trademarks of Eclipse Foundation, Inc. | ||
11 | |||
12 | To comply with the [Eclipse Foundation Trademark Usage Policy](https://www.eclipse.org/legal/logo_guidelines.php), we replaced the Eclipse VIATRA™ branding in this repository with the name _Refinery Interpreter_, since the [Eclipse Public License - v 2.0](https://www.eclipse.org/legal/epl-2.0/) does not grant trademark usage rights to derived projects. | ||
13 | _Refinery Interpreter_ is not endorsed or sponsored by Eclipse Foundation, Inc. or any other organizations using the Eclipse VIATRA™ trademark. | ||
14 | |||
15 | We publish our modifications to Eclipse VIATRA™ for use within the Refinery framework under the name _Refinery Interpreter_. When not using _Refinery Interpreter_ directly in the Refinery framework, users are strongly encouraged to rely on [Eclipse VIATRA™](https://eclipse.dev/viatra/) instead. In particular, _Refinery Interpreter_ does not provide any API stability guarantees that are provided by Eclipse VIATRA™. | ||
16 | |||
17 | We reproduce the [accompanying notices of Eclipse VIATRA™](https://github.com/viatra/org.eclipse.viatra/blob/d422bcc626a99c4640c0d13931f393ccea0d2326/NOTICE.md) in full below: | ||
18 | |||
19 | # Notices for Eclipse VIATRA™ | ||
20 | |||
21 | This content is produced and maintained by the Eclipse VIATRA project. | ||
22 | |||
23 | * Project home: https://projects.eclipse.org/projects/modeling.viatra | ||
24 | |||
25 | ## Trademarks | ||
26 | |||
27 | Eclipse VIATRA, and VIATRA are trademarks of the Eclipse Foundation. | ||
28 | |||
29 | ## Copyright | ||
30 | |||
31 | All content is the property of the respective authors or their employers. For | ||
32 | more information regarding authorship of content, please consult the listed | ||
33 | source code repository logs. | ||
34 | |||
35 | ## Declared Project Licenses | ||
36 | |||
37 | This program and the accompanying materials are made available under the terms | ||
38 | of the Eclipse Public License v. 2.0 which is available at | ||
39 | http://www.eclipse.org/legal/epl-v20.html. | ||
40 | |||
41 | SPDX-License-Identifier: EPL-2.0 | ||
42 | |||
43 | ## Source Code | ||
44 | |||
45 | The project maintains the following source code repositories: | ||
46 | |||
47 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra.git | ||
48 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra.modelobfuscator.git | ||
49 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra.examples.git | ||
50 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra2.vpm.git | ||
51 | |||
52 | ## Third-party Content | ||
53 | |||
54 | This project leverages the following third party content. | ||
55 | |||
56 | ANTLR Runtime only: (3.2) | ||
57 | |||
58 | * License: New BSD license | ||
59 | |||
60 | Apache Commons Language Library (2.1) | ||
61 | |||
62 | * License: Apache License, 2.0 | ||
63 | |||
64 | Google Guice / Inject Core API (3.0.0) | ||
65 | |||
66 | * License: Apache License, 2.0 | ||
67 | |||
68 | Google Guice / Inject Core API (3.0.0) | ||
69 | |||
70 | * License: Apache License 2.0 | ||
71 | |||
72 | Guava (10.0.1) | ||
73 | |||
74 | * License: Apache License, 2.0 | ||
75 | |||
76 | Guice (2.0) | ||
77 | |||
78 | * License: Apache License, 2.0 | ||
79 | |||
80 | guice-multibindings (3.0.0) | ||
81 | |||
82 | * License: Apache License, 2.0 | ||
83 | |||
84 | log4j (1.2.15) | ||
85 | |||
86 | * License: Apache License 2.0 | ||
87 | |||
88 | LPG Java Runtime (lpgjavaruntime.jar) (1.1) | ||
89 | |||
90 | * License: Eclipse Public License | ||
91 | |||
92 | mockito (1.9.5) | ||
93 | |||
94 | * License: Apache License, 2.0, New BSD license, MIT license | ||
diff --git a/subprojects/viatra-runtime/about.html b/subprojects/interpreter/about.html index d1d5593a..d1d5593a 100644 --- a/subprojects/viatra-runtime/about.html +++ b/subprojects/interpreter/about.html | |||
diff --git a/subprojects/interpreter/build.gradle.kts b/subprojects/interpreter/build.gradle.kts new file mode 100644 index 00000000..0425cd2a --- /dev/null +++ b/subprojects/interpreter/build.gradle.kts | |||
@@ -0,0 +1,16 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | plugins { | ||
8 | id("tools.refinery.gradle.interpreter-library") | ||
9 | } | ||
10 | |||
11 | dependencies { | ||
12 | implementation(libs.slf4j.log4j) | ||
13 | // Code in this subproject inherits from Eclipse Collection implementation classes, so this can't be `runtimeOnly`. | ||
14 | implementation(libs.eclipseCollections) | ||
15 | implementation(libs.eclipseCollections.api) | ||
16 | } | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/CancellationToken.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/CancellationToken.java index a2ae41e3..9de7700b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/CancellationToken.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/CancellationToken.java | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.viatra.runtime; | 6 | package tools.refinery.interpreter; |
7 | 7 | ||
8 | @FunctionalInterface | 8 | @FunctionalInterface |
9 | public interface CancellationToken { | 9 | public interface CancellationToken { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/AdvancedViatraQueryEngine.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/AdvancedInterpreterEngine.java index 32a3430d..5d0261d2 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/AdvancedViatraQueryEngine.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/AdvancedInterpreterEngine.java | |||
@@ -6,48 +6,49 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api; | 9 | package tools.refinery.interpreter.api; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.api.scope.QueryScope; | 11 | import tools.refinery.interpreter.api.scope.QueryScope; |
12 | import tools.refinery.viatra.runtime.internal.apiimpl.ViatraQueryEngineImpl; | 12 | import tools.refinery.interpreter.internal.apiimpl.InterpreterEngineImpl; |
13 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 13 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
14 | import tools.refinery.viatra.runtime.matchers.backend.*; | 14 | import tools.refinery.interpreter.matchers.backend.*; |
15 | 15 | ||
16 | import java.lang.reflect.InvocationTargetException; | 16 | import java.lang.reflect.InvocationTargetException; |
17 | import java.util.concurrent.Callable; | 17 | import java.util.concurrent.Callable; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Advanced interface to a VIATRA incremental evaluation engine. | 20 | * Advanced interface to a Refinery Interpreter incremental evaluation engine. |
21 | * | 21 | * |
22 | * <p> | 22 | * <p> |
23 | * You can create a new, private, unmanaged {@link AdvancedViatraQueryEngine} instance using | 23 | * You can create a new, private, unmanaged {@link AdvancedInterpreterEngine} instance using |
24 | * {@link #createUnmanagedEngine(QueryScope)}. Additionally, you can access the advanced interface on any | 24 | * {@link #createUnmanagedEngine(QueryScope)}. Additionally, you can access the advanced interface on any |
25 | * {@link ViatraQueryEngine} by {@link AdvancedViatraQueryEngine#from(ViatraQueryEngine)}. | 25 | * {@link InterpreterEngine} by {@link AdvancedInterpreterEngine#from(InterpreterEngine)}. |
26 | * | 26 | * |
27 | * <p> | 27 | * <p> |
28 | * While the default interface {@link ViatraQueryEngine}, is suitable for most users, this advanced interface provides more | 28 | * While the default interface {@link InterpreterEngine}, is suitable for most users, this advanced interface provides more |
29 | * control over the engine. The most important added functionality is the following: | 29 | * control over the engine. The most important added functionality is the following: |
30 | * <ul> | 30 | * <ul> |
31 | * <li>You can have tighter control over the lifecycle of the engine, if you create a private, unmanaged engine | 31 | * <li>You can have tighter control over the lifecycle of the engine, if you create a private, unmanaged engine |
32 | * instance. For instance, a (non-managed) engine can be disposed in order to detach from the EMF model and stop | 32 | * instance. For instance, a (non-managed) engine can be disposed in order to detach from the EMF model and stop |
33 | * listening on update notifications. The indexes built previously in the engine can then be garbage collected, even if | 33 | * listening on update notifications. The indexes built previously in the engine can then be garbage collected, even if |
34 | * the model itself is retained. Total lifecycle control is only available for private, unmanaged engines (created using | 34 | * the model itself is retained. Total lifecycle control is only available for private, unmanaged engines (created using |
35 | * {@link #createUnmanagedEngine(QueryScope)}); a managed engine (obtained via {@link ViatraQueryEngine#on(QueryScope)}) is | 35 | * {@link #createUnmanagedEngine(QueryScope)}); a managed engine (obtained via {@link InterpreterEngine#on(QueryScope)}) is |
36 | * shared among clients and can not be disposed or wiped. | 36 | * shared among clients and can not be disposed or wiped. |
37 | * <li>You can add and remove listeners to receive notification when the model or the match sets change. | 37 | * <li>You can add and remove listeners to receive notification when the model or the match sets change. |
38 | * <li>You can add and remove listeners to receive notification on engine lifecycle events, such as creation of new | 38 | * <li>You can add and remove listeners to receive notification on engine lifecycle events, such as creation of new |
39 | * matchers. For instance, if you explicitly share a private, unmanaged engine between multiple sites, you should | 39 | * matchers. For instance, if you explicitly share a private, unmanaged engine between multiple sites, you should |
40 | * register a callback using {@link #addLifecycleListener(ViatraQueryEngineLifecycleListener)} to learn when another client | 40 | * register a callback using {@link #addLifecycleListener(InterpreterEngineLifecycleListener)} to learn when another client |
41 | * has called the destructive methods {@link #dispose()} or {@link #wipe()}. | 41 | * has called the destructive methods {@link #dispose()} or {@link #wipe()}. |
42 | * </ul> | 42 | * </ul> |
43 | * | 43 | * |
44 | * @author Bergmann Gabor | 44 | * @author Bergmann Gabor |
45 | * @noextend This class is not intended to be subclassed by clients. | 45 | * @noextend This class is not intended to be subclassed by clients. |
46 | */ | 46 | */ |
47 | public abstract class AdvancedViatraQueryEngine extends ViatraQueryEngine { | 47 | public abstract class AdvancedInterpreterEngine extends InterpreterEngine { |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Creates a new unmanaged VIATRA Query engine to evaluate queries over a given scope specified by an {@link QueryScope}. | 50 | * Creates a new unmanaged Refinery Interpreter engine to evaluate queries over a given scope specified by an |
51 | * {@link QueryScope}. | ||
51 | * | 52 | * |
52 | * <p> Repeated invocations will return different instances, so other clients are unable to independently access | 53 | * <p> Repeated invocations will return different instances, so other clients are unable to independently access |
53 | * and influence the returned engine. Note that unmanaged engines do not benefit from some performance improvements | 54 | * and influence the returned engine. Note that unmanaged engines do not benefit from some performance improvements |
@@ -56,7 +57,7 @@ public abstract class AdvancedViatraQueryEngine extends ViatraQueryEngine { | |||
56 | * | 57 | * |
57 | * <p> | 58 | * <p> |
58 | * Client is responsible for the lifecycle of the returned engine, hence the usage of the advanced interface | 59 | * Client is responsible for the lifecycle of the returned engine, hence the usage of the advanced interface |
59 | * {@link AdvancedViatraQueryEngine}. | 60 | * {@link AdvancedInterpreterEngine}. |
60 | * | 61 | * |
61 | * <p> | 62 | * <p> |
62 | * The match set of any patterns will be incrementally refreshed upon updates from this scope. | 63 | * The match set of any patterns will be incrementally refreshed upon updates from this scope. |
@@ -67,12 +68,13 @@ public abstract class AdvancedViatraQueryEngine extends ViatraQueryEngine { | |||
67 | * @return the advanced interface to a newly created unmanaged engine | 68 | * @return the advanced interface to a newly created unmanaged engine |
68 | * @since 0.9 | 69 | * @since 0.9 |
69 | */ | 70 | */ |
70 | public static AdvancedViatraQueryEngine createUnmanagedEngine(QueryScope scope) { | 71 | public static AdvancedInterpreterEngine createUnmanagedEngine(QueryScope scope) { |
71 | return new ViatraQueryEngineImpl(null, scope); | 72 | return new InterpreterEngineImpl(scope); |
72 | } | 73 | } |
73 | 74 | ||
74 | /** | 75 | /** |
75 | * Creates a new unmanaged VIATRA Query engine to evaluate queries over a given scope specified by an {@link QueryScope}. | 76 | * Creates a new unmanaged Refinery Intepreter engine to evaluate queries over a given scope specified by an |
77 | * {@link QueryScope}. | ||
76 | * | 78 | * |
77 | * <p> Repeated invocations will return different instances, so other clients are unable to independently access | 79 | * <p> Repeated invocations will return different instances, so other clients are unable to independently access |
78 | * and influence the returned engine. Note that unmanaged engines do not benefit from some performance improvements | 80 | * and influence the returned engine. Note that unmanaged engines do not benefit from some performance improvements |
@@ -81,7 +83,7 @@ public abstract class AdvancedViatraQueryEngine extends ViatraQueryEngine { | |||
81 | * | 83 | * |
82 | * <p> | 84 | * <p> |
83 | * Client is responsible for the lifecycle of the returned engine, hence the usage of the advanced interface | 85 | * Client is responsible for the lifecycle of the returned engine, hence the usage of the advanced interface |
84 | * {@link AdvancedViatraQueryEngine}. | 86 | * {@link AdvancedInterpreterEngine}. |
85 | * | 87 | * |
86 | * <p> | 88 | * <p> |
87 | * The match set of any patterns will be incrementally refreshed upon updates from this scope. | 89 | * The match set of any patterns will be incrementally refreshed upon updates from this scope. |
@@ -92,59 +94,55 @@ public abstract class AdvancedViatraQueryEngine extends ViatraQueryEngine { | |||
92 | * @return the advanced interface to a newly created unmanaged engine | 94 | * @return the advanced interface to a newly created unmanaged engine |
93 | * @since 1.4 | 95 | * @since 1.4 |
94 | */ | 96 | */ |
95 | public static AdvancedViatraQueryEngine createUnmanagedEngine(QueryScope scope, ViatraQueryEngineOptions options) { | 97 | public static AdvancedInterpreterEngine createUnmanagedEngine(QueryScope scope, InterpreterEngineOptions options) { |
96 | return new ViatraQueryEngineImpl(null, scope, options); | 98 | return new InterpreterEngineImpl(scope, options); |
97 | } | 99 | } |
98 | 100 | ||
99 | /** | 101 | /** |
100 | * Provides access to a given existing engine through the advanced interface. | 102 | * Provides access to a given existing engine through the advanced interface. |
101 | * | 103 | * |
102 | * <p> | ||
103 | * Caveat: if the referenced engine is managed (i.e. created via {@link ViatraQueryEngine#on(QueryScope)}), the advanced | ||
104 | * methods {@link #dispose()} and {@link #wipe()} will not be allowed. | ||
105 | * | ||
106 | * @param engine | 104 | * @param engine |
107 | * the engine to access using the advanced interface | 105 | * the engine to access using the advanced interface |
108 | * @return a reference to the same engine conforming to the advanced interface | 106 | * @return a reference to the same engine conforming to the advanced interface |
109 | */ | 107 | */ |
110 | public static AdvancedViatraQueryEngine from(ViatraQueryEngine engine) { | 108 | public static AdvancedInterpreterEngine from(InterpreterEngine engine) { |
111 | return (AdvancedViatraQueryEngine) engine; | 109 | return (AdvancedInterpreterEngine) engine; |
112 | } | 110 | } |
113 | 111 | ||
114 | /** | 112 | /** |
115 | * Add an engine lifecycle listener to this engine instance. | 113 | * Add an engine lifecycle listener to this engine instance. |
116 | * | 114 | * |
117 | * @param listener | 115 | * @param listener |
118 | * the {@link ViatraQueryEngineLifecycleListener} that should listen to lifecycle events from this engine | 116 | * the {@link InterpreterEngineLifecycleListener} that should listen to lifecycle events from this engine |
119 | */ | 117 | */ |
120 | public abstract void addLifecycleListener(ViatraQueryEngineLifecycleListener listener); | 118 | public abstract void addLifecycleListener(InterpreterEngineLifecycleListener listener); |
121 | 119 | ||
122 | /** | 120 | /** |
123 | * Remove an existing lifecycle listener from this engine instance. | 121 | * Remove an existing lifecycle listener from this engine instance. |
124 | * | 122 | * |
125 | * @param listener | 123 | * @param listener |
126 | * the {@link ViatraQueryEngineLifecycleListener} that should not listen to lifecycle events from this | 124 | * the {@link InterpreterEngineLifecycleListener} that should not listen to lifecycle events from this |
127 | * engine anymore | 125 | * engine anymore |
128 | */ | 126 | */ |
129 | public abstract void removeLifecycleListener(ViatraQueryEngineLifecycleListener listener); | 127 | public abstract void removeLifecycleListener(InterpreterEngineLifecycleListener listener); |
130 | 128 | ||
131 | /** | 129 | /** |
132 | * Add an model update event listener to this engine instance (that fires its callbacks according to its | 130 | * Add an model update event listener to this engine instance (that fires its callbacks according to its |
133 | * notification level). | 131 | * notification level). |
134 | * | 132 | * |
135 | * @param listener | 133 | * @param listener |
136 | * the {@link ViatraQueryModelUpdateListener} that should listen to model update events from this engine. | 134 | * the {@link InterpreterModelUpdateListener} that should listen to model update events from this engine. |
137 | */ | 135 | */ |
138 | public abstract void addModelUpdateListener(ViatraQueryModelUpdateListener listener); | 136 | public abstract void addModelUpdateListener(InterpreterModelUpdateListener listener); |
139 | 137 | ||
140 | /** | 138 | /** |
141 | * Remove an existing model update event listener to this engine instance. | 139 | * Remove an existing model update event listener to this engine instance. |
142 | * | 140 | * |
143 | * @param listener | 141 | * @param listener |
144 | * the {@link ViatraQueryModelUpdateListener} that should not listen to model update events from this engine | 142 | * the {@link InterpreterModelUpdateListener} that should not listen to model update events from this engine |
145 | * anymore | 143 | * anymore |
146 | */ | 144 | */ |
147 | public abstract void removeModelUpdateListener(ViatraQueryModelUpdateListener listener); | 145 | public abstract void removeModelUpdateListener(InterpreterModelUpdateListener listener); |
148 | 146 | ||
149 | /** | 147 | /** |
150 | * Registers low-level callbacks for match appearance and disappearance on this pattern matcher. | 148 | * Registers low-level callbacks for match appearance and disappearance on this pattern matcher. |
@@ -164,25 +162,25 @@ public abstract class AdvancedViatraQueryEngine extends ViatraQueryEngine { | |||
164 | * | 162 | * |
165 | * @param fireNow | 163 | * @param fireNow |
166 | * if true, appearCallback will be immediately invoked on all current matches as a one-time effect. See | 164 | * if true, appearCallback will be immediately invoked on all current matches as a one-time effect. See |
167 | * also {@link ViatraQueryMatcher#forEachMatch(IMatchProcessor)}. | 165 | * also {@link InterpreterMatcher#forEachMatch(IMatchProcessor)}. |
168 | * @param listener | 166 | * @param listener |
169 | * the listener that will be notified of each new match that appears or disappears, starting from now. | 167 | * the listener that will be notified of each new match that appears or disappears, starting from now. |
170 | * @param matcher | 168 | * @param matcher |
171 | * the {@link ViatraQueryMatcher} for which this listener should be active | 169 | * the {@link InterpreterMatcher} for which this listener should be active |
172 | */ | 170 | */ |
173 | public abstract <Match extends IPatternMatch> void addMatchUpdateListener(ViatraQueryMatcher<Match> matcher, | 171 | public abstract <Match extends IPatternMatch> void addMatchUpdateListener(InterpreterMatcher<Match> matcher, |
174 | IMatchUpdateListener<? super Match> listener, boolean fireNow); | 172 | IMatchUpdateListener<? super Match> listener, boolean fireNow); |
175 | 173 | ||
176 | /** | 174 | /** |
177 | * Remove an existing match update event listener to this engine instance. | 175 | * Remove an existing match update event listener to this engine instance. |
178 | * | 176 | * |
179 | * @param matcher | 177 | * @param matcher |
180 | * the {@link ViatraQueryMatcher} for which this listener should not be active anymore | 178 | * the {@link InterpreterMatcher} for which this listener should not be active anymore |
181 | * @param listener | 179 | * @param listener |
182 | * the {@link IMatchUpdateListener} that should not receive the callbacks anymore | 180 | * the {@link IMatchUpdateListener} that should not receive the callbacks anymore |
183 | */ | 181 | */ |
184 | public abstract <Match extends IPatternMatch> void removeMatchUpdateListener(ViatraQueryMatcher<Match> matcher, | 182 | public abstract <Match extends IPatternMatch> void removeMatchUpdateListener(InterpreterMatcher<Match> matcher, |
185 | IMatchUpdateListener<? super Match> listener); | 183 | IMatchUpdateListener<? super Match> listener); |
186 | 184 | ||
187 | 185 | ||
188 | /** | 186 | /** |
@@ -194,13 +192,13 @@ public abstract class AdvancedViatraQueryEngine extends ViatraQueryEngine { | |||
194 | * Otherwise, the query evaluator is free to ignore any hints. | 192 | * Otherwise, the query evaluator is free to ignore any hints. |
195 | * | 193 | * |
196 | * <p> For stateful query backends (Rete), hints may be effective only the first time a matcher is created. | 194 | * <p> For stateful query backends (Rete), hints may be effective only the first time a matcher is created. |
197 | * @param querySpecification a {@link IQuerySpecification} that describes a VIATRA query | 195 | * @param querySpecification a {@link IQuerySpecification} that describes a Refinery Interpreter query |
198 | * @return a pattern matcher corresponding to the specification | 196 | * @return a pattern matcher corresponding to the specification |
199 | * @param optionalEvaluationHints additional / overriding options on query evaluation; passing null means default options associated with the query | 197 | * @param optionalEvaluationHints additional / overriding options on query evaluation; passing null means default options associated with the query |
200 | * @throws ViatraQueryRuntimeException if the matcher could not be initialized | 198 | * @throws InterpreterRuntimeException if the matcher could not be initialized |
201 | * @since 0.9 | 199 | * @since 0.9 |
202 | */ | 200 | */ |
203 | public abstract <Matcher extends ViatraQueryMatcher<? extends IPatternMatch>> Matcher getMatcher( | 201 | public abstract <Matcher extends InterpreterMatcher<? extends IPatternMatch>> Matcher getMatcher( |
204 | IQuerySpecification<Matcher> querySpecification, | 202 | IQuerySpecification<Matcher> querySpecification, |
205 | QueryEvaluationHint optionalEvaluationHints); | 203 | QueryEvaluationHint optionalEvaluationHints); |
206 | 204 | ||
@@ -215,42 +213,21 @@ public abstract class AdvancedViatraQueryEngine extends ViatraQueryEngine { | |||
215 | * This is typically more efficient than traversing the model each time an individual pattern matcher is initialized on demand. | 213 | * This is typically more efficient than traversing the model each time an individual pattern matcher is initialized on demand. |
216 | * The performance benefit only manifests itself if the engine is not in wildcard mode. | 214 | * The performance benefit only manifests itself if the engine is not in wildcard mode. |
217 | * | 215 | * |
218 | * @param queryGroup a {@link IQueryGroup} identifying a set of VIATRA queries | 216 | * @param queryGroup a {@link IQueryGroup} identifying a set of Refinery interpreter queries |
219 | * @param optionalEvaluationHints additional / overriding options on query evaluation; passing null means default options associated with each query | 217 | * @param optionalEvaluationHints additional / overriding options on query evaluation; passing null means default options associated with each query |
220 | * @throws ViatraQueryRuntimeException | 218 | * @throws InterpreterRuntimeException |
221 | * if there was an error in preparing the engine | 219 | * if there was an error in preparing the engine |
222 | * @since 0.9 | 220 | * @since 0.9 |
223 | */ | 221 | */ |
224 | public abstract void prepareGroup(IQueryGroup queryGroup, QueryEvaluationHint optionalEvaluationHints); | 222 | public abstract void prepareGroup(IQueryGroup queryGroup, QueryEvaluationHint optionalEvaluationHints); |
225 | 223 | ||
226 | /** | 224 | /** |
227 | * Indicates whether the engine is managed, i.e. the default engine assigned to the given scope root by | ||
228 | * {@link ViatraQueryEngine#on(QueryScope)}. | ||
229 | * | ||
230 | * <p> | ||
231 | * If the engine is managed, there may be other clients using it, as all calls to | ||
232 | * {@link ViatraQueryEngine#on(QueryScope)} return the same managed engine instance for a given scope root. Therefore the | ||
233 | * destructive methods {@link #wipe()} and {@link #dispose()} are not allowed. | ||
234 | * | ||
235 | * <p> | ||
236 | * On the other hand, if the engine is unmanaged (i.e. a private instance created using | ||
237 | * {@link #createUnmanagedEngine(QueryScope)}), then {@link #wipe()} and {@link #dispose()} can be called. If you | ||
238 | * explicitly share a private, unmanaged engine between multiple sites, register a callback using | ||
239 | * {@link #addLifecycleListener(ViatraQueryEngineLifecycleListener)} to learn when another client has called these | ||
240 | * destructive methods. | ||
241 | * | ||
242 | * @return true if the engine is managed, and therefore potentially shared with other clients querying the same EMF | ||
243 | * model | ||
244 | */ | ||
245 | public abstract boolean isManaged(); | ||
246 | |||
247 | /** | ||
248 | * Indicates whether the engine is in a tainted, inconsistent state due to some internal errors. If true, results | 225 | * Indicates whether the engine is in a tainted, inconsistent state due to some internal errors. If true, results |
249 | * are no longer reliable; engine should be disposed. | 226 | * are no longer reliable; engine should be disposed. |
250 | * | 227 | * |
251 | * <p> | 228 | * <p> |
252 | * The engine is in a tainted state if any of its internal processes report back a fatal error. The | 229 | * The engine is in a tainted state if any of its internal processes report back a fatal error. The |
253 | * {@link ViatraQueryEngineLifecycleListener} interface provides a callback method for entering the tainted state. | 230 | * {@link InterpreterEngineLifecycleListener} interface provides a callback method for entering the tainted state. |
254 | * | 231 | * |
255 | * @return the tainted state | 232 | * @return the tainted state |
256 | */ | 233 | */ |
@@ -268,7 +245,7 @@ public abstract class AdvancedViatraQueryEngine extends ViatraQueryEngine { | |||
268 | * Disallowed if the engine is managed (see {@link #isManaged()}), as there may be other clients using it. | 245 | * Disallowed if the engine is managed (see {@link #isManaged()}), as there may be other clients using it. |
269 | * <p> | 246 | * <p> |
270 | * If you explicitly share a private, unmanaged engine between multiple sites, register a callback using | 247 | * If you explicitly share a private, unmanaged engine between multiple sites, register a callback using |
271 | * {@link #addLifecycleListener(ViatraQueryEngineLifecycleListener)} to learn when another client has called this | 248 | * {@link #addLifecycleListener(InterpreterEngineLifecycleListener)} to learn when another client has called this |
272 | * destructive method. | 249 | * destructive method. |
273 | * | 250 | * |
274 | * @throws UnsupportedOperationException | 251 | * @throws UnsupportedOperationException |
@@ -288,7 +265,7 @@ public abstract class AdvancedViatraQueryEngine extends ViatraQueryEngine { | |||
288 | * Disallowed if the engine is managed (see {@link #isManaged()}), as there may be other clients using it. | 265 | * Disallowed if the engine is managed (see {@link #isManaged()}), as there may be other clients using it. |
289 | * <p> | 266 | * <p> |
290 | * If you explicitly share a private, unmanaged engine between multiple sites, register a callback using | 267 | * If you explicitly share a private, unmanaged engine between multiple sites, register a callback using |
291 | * {@link #addLifecycleListener(ViatraQueryEngineLifecycleListener)} to learn when another client has called this | 268 | * {@link #addLifecycleListener(InterpreterEngineLifecycleListener)} to learn when another client has called this |
292 | * destructive method. | 269 | * destructive method. |
293 | * | 270 | * |
294 | * @throws UnsupportedOperationException | 271 | * @throws UnsupportedOperationException |
@@ -297,28 +274,28 @@ public abstract class AdvancedViatraQueryEngine extends ViatraQueryEngine { | |||
297 | public abstract void dispose(); | 274 | public abstract void dispose(); |
298 | 275 | ||
299 | /** | 276 | /** |
300 | * Provides access to the selected query backend component of the VIATRA Query engine. | 277 | * Provides access to the selected query backend component of the Refinery Interpreter engine. |
301 | * @noreference for internal use only | 278 | * @noreference for internal use only |
302 | * @throws ViatraQueryRuntimeException | 279 | * @throws InterpreterRuntimeException |
303 | */ | 280 | */ |
304 | public abstract IQueryBackend getQueryBackend(IQueryBackendFactory iQueryBackendFactory); | 281 | public abstract IQueryBackend getQueryBackend(IQueryBackendFactory iQueryBackendFactory); |
305 | 282 | ||
306 | /** | 283 | /** |
307 | * Access an existing pattern matcher based on a {@link IQuerySpecification}, and optional hints override. | 284 | * Access an existing pattern matcher based on a {@link IQuerySpecification}, and optional hints override. |
308 | * @param querySpecification a {@link IQuerySpecification} that describes a VIATRA query specification | 285 | * @param querySpecification a {@link IQuerySpecification} that describes a Refinery Interpreter query specification |
309 | * @param optionalOverrideHints a {@link QueryEvaluationHint} that may override the pattern hints (can be null) | 286 | * @param optionalOverrideHints a {@link QueryEvaluationHint} that may override the pattern hints (can be null) |
310 | * @return a pattern matcher corresponding to the specification, <code>null</code> if a matcher does not exist yet. | 287 | * @return a pattern matcher corresponding to the specification, <code>null</code> if a matcher does not exist yet. |
311 | * @since 1.4 | 288 | * @since 1.4 |
312 | */ | 289 | */ |
313 | public abstract <Matcher extends ViatraQueryMatcher<? extends IPatternMatch>> Matcher getExistingMatcher(IQuerySpecification<Matcher> querySpecification, QueryEvaluationHint optionalOverrideHints); | 290 | public abstract <Matcher extends InterpreterMatcher<? extends IPatternMatch>> Matcher getExistingMatcher(IQuerySpecification<Matcher> querySpecification, QueryEvaluationHint optionalOverrideHints); |
314 | 291 | ||
315 | /** | 292 | /** |
316 | * Returns the immutable {@link ViatraQueryEngineOptions} of the engine. | 293 | * Returns the immutable {@link InterpreterEngineOptions} of the engine. |
317 | * | 294 | * |
318 | * @return the engine options | 295 | * @return the engine options |
319 | * @since 1.4 | 296 | * @since 1.4 |
320 | */ | 297 | */ |
321 | public abstract ViatraQueryEngineOptions getEngineOptions(); | 298 | public abstract InterpreterEngineOptions getEngineOptions(); |
322 | 299 | ||
323 | /** | 300 | /** |
324 | * Return the underlying result provider for the given matcher. | 301 | * Return the underlying result provider for the given matcher. |
@@ -327,7 +304,7 @@ public abstract class AdvancedViatraQueryEngine extends ViatraQueryEngine { | |||
327 | * @since 1.4 | 304 | * @since 1.4 |
328 | * @noreference This method is considered internal API | 305 | * @noreference This method is considered internal API |
329 | */ | 306 | */ |
330 | public abstract IQueryResultProvider getResultProviderOfMatcher(ViatraQueryMatcher<? extends IPatternMatch> matcher); | 307 | public abstract IQueryResultProvider getResultProviderOfMatcher(InterpreterMatcher<? extends IPatternMatch> matcher); |
331 | 308 | ||
332 | /** | 309 | /** |
333 | * The given callable will be executed, and all update propagation in stateful query backends | 310 | * The given callable will be executed, and all update propagation in stateful query backends |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/GenericPatternMatch.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/GenericPatternMatch.java index b4de2b70..7d8aa0c2 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/GenericPatternMatch.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/GenericPatternMatch.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.api; | 10 | package tools.refinery.interpreter.api; |
11 | 11 | ||
12 | import java.util.Arrays; | 12 | import java.util.Arrays; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.api.impl.BasePatternMatch; | 14 | import tools.refinery.interpreter.api.impl.BasePatternMatch; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Generic signature object implementation. | 17 | * Generic signature object implementation. |
18 | * | 18 | * |
19 | * See also the generated matcher and signature of the pattern, with pattern-specific API simplifications. | 19 | * See also the generated matcher and signature of the pattern, with pattern-specific API simplifications. |
20 | * | 20 | * |
@@ -101,11 +101,11 @@ public abstract class GenericPatternMatch extends BasePatternMatch { | |||
101 | public GenericQuerySpecification<? extends GenericPatternMatcher> specification() { | 101 | public GenericQuerySpecification<? extends GenericPatternMatcher> specification() { |
102 | return specification; | 102 | return specification; |
103 | } | 103 | } |
104 | 104 | ||
105 | /** | 105 | /** |
106 | * Returns an empty, mutable match. | 106 | * Returns an empty, mutable match. |
107 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | 107 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. |
108 | * | 108 | * |
109 | * @return the empty match | 109 | * @return the empty match |
110 | */ | 110 | */ |
111 | public static GenericPatternMatch newEmptyMatch(GenericQuerySpecification<? extends GenericPatternMatcher> specification) { | 111 | public static GenericPatternMatch newEmptyMatch(GenericQuerySpecification<? extends GenericPatternMatcher> specification) { |
@@ -113,9 +113,9 @@ public abstract class GenericPatternMatch extends BasePatternMatch { | |||
113 | } | 113 | } |
114 | 114 | ||
115 | /** | 115 | /** |
116 | * Returns a mutable (partial) match. | 116 | * Returns a mutable (partial) match. |
117 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | 117 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. |
118 | * | 118 | * |
119 | * @param parameters | 119 | * @param parameters |
120 | * the fixed value of pattern parameters, or null if not bound. | 120 | * the fixed value of pattern parameters, or null if not bound. |
121 | * @return the new, mutable (partial) match object. | 121 | * @return the new, mutable (partial) match object. |
@@ -125,11 +125,11 @@ public abstract class GenericPatternMatch extends BasePatternMatch { | |||
125 | } | 125 | } |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * Returns a new (partial) match. | 128 | * Returns a new (partial) match. |
129 | * This can be used e.g. to call the matcher with a partial match. | 129 | * This can be used e.g. to call the matcher with a partial match. |
130 | * | 130 | * |
131 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch(GenericQuerySpecification)} to obtain a mutable match object. | 131 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch(GenericQuerySpecification)} to obtain a mutable match object. |
132 | * | 132 | * |
133 | * @param parameters | 133 | * @param parameters |
134 | * the fixed value of pattern parameters, or null if not bound. | 134 | * the fixed value of pattern parameters, or null if not bound. |
135 | * @return the (partial) match object. | 135 | * @return the (partial) match object. |
@@ -137,7 +137,7 @@ public abstract class GenericPatternMatch extends BasePatternMatch { | |||
137 | public static GenericPatternMatch newMatch(GenericQuerySpecification<? extends GenericPatternMatcher> specification, Object... parameters) { | 137 | public static GenericPatternMatch newMatch(GenericQuerySpecification<? extends GenericPatternMatcher> specification, Object... parameters) { |
138 | return new Immutable(specification, Arrays.copyOf(parameters, parameters.length)); | 138 | return new Immutable(specification, Arrays.copyOf(parameters, parameters.length)); |
139 | } | 139 | } |
140 | 140 | ||
141 | @Override | 141 | @Override |
142 | public IPatternMatch toImmutable() { | 142 | public IPatternMatch toImmutable() { |
143 | return isMutable() ? newMatch(specification, array) : this; | 143 | return isMutable() ? newMatch(specification, array) : this; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/GenericPatternMatcher.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/GenericPatternMatcher.java index 9a3fbb44..63e09900 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/GenericPatternMatcher.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/GenericPatternMatcher.java | |||
@@ -3,26 +3,27 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.api; | 10 | package tools.refinery.interpreter.api; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.api.impl.BaseMatcher; | 12 | import tools.refinery.interpreter.api.impl.BaseMatcher; |
13 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 13 | import tools.refinery.interpreter.api.scope.QueryScope; |
14 | import tools.refinery.interpreter.matchers.tuple.Tuple; | ||
14 | 15 | ||
15 | /** | 16 | /** |
16 | * This is a generic pattern matcher for any VIATRA pattern, with "interpretative" query execution. | 17 | * This is a generic pattern matcher for any Refinery Interpreter pattern, with "interpretative" query execution. |
17 | * To use the pattern matcher on a given model, obtain a {@link GenericQuerySpecification} first, then | 18 | * To use the pattern matcher on a given model, obtain a {@link GenericQuerySpecification} first, then |
18 | * invoke e.g. {@link GenericQuerySpecification#getMatcher(ViatraQueryEngine)}. | 19 | * invoke e.g. {@link GenericQuerySpecification#getMatcher(InterpreterEngine)}. |
19 | * in conjunction with {@link ViatraQueryEngine#on(tools.refinery.viatra.runtime.api.scope.QueryScope)}. | 20 | * in conjunction with {@link InterpreterEngine#on(QueryScope)}. |
20 | * <p> | 21 | * <p> |
21 | * Whenever available, consider using the pattern-specific generated matcher API instead. | 22 | * Whenever available, consider using the pattern-specific generated matcher API instead. |
22 | * | 23 | * |
23 | * <p> | 24 | * <p> |
24 | * Matches of the pattern will be represented as {@link GenericPatternMatch}. | 25 | * Matches of the pattern will be represented as {@link GenericPatternMatch}. |
25 | * | 26 | * |
26 | * @author Bergmann Gábor | 27 | * @author Bergmann Gábor |
27 | * @see GenericPatternMatch | 28 | * @see GenericPatternMatch |
28 | * @see GenericMatchProcessor | 29 | * @see GenericMatchProcessor |
@@ -30,7 +31,7 @@ import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | |||
30 | * @since 0.9 | 31 | * @since 0.9 |
31 | */ | 32 | */ |
32 | public class GenericPatternMatcher extends BaseMatcher<GenericPatternMatch> { | 33 | public class GenericPatternMatcher extends BaseMatcher<GenericPatternMatch> { |
33 | 34 | ||
34 | /** | 35 | /** |
35 | * @since 1.4 | 36 | * @since 1.4 |
36 | */ | 37 | */ |
@@ -42,7 +43,7 @@ public class GenericPatternMatcher extends BaseMatcher<GenericPatternMatch> { | |||
42 | public GenericPatternMatch arrayToMatch(Object[] parameters) { | 43 | public GenericPatternMatch arrayToMatch(Object[] parameters) { |
43 | return GenericPatternMatch.newMatch(getSpecification(), parameters); | 44 | return GenericPatternMatch.newMatch(getSpecification(), parameters); |
44 | } | 45 | } |
45 | 46 | ||
46 | @Override | 47 | @Override |
47 | public GenericPatternMatch arrayToMatchMutable(Object[] parameters) { | 48 | public GenericPatternMatch arrayToMatchMutable(Object[] parameters) { |
48 | return GenericPatternMatch.newMutableMatch(getSpecification(), parameters); | 49 | return GenericPatternMatch.newMutableMatch(getSpecification(), parameters); |
@@ -52,7 +53,7 @@ public class GenericPatternMatcher extends BaseMatcher<GenericPatternMatch> { | |||
52 | protected GenericPatternMatch tupleToMatch(Tuple t) { | 53 | protected GenericPatternMatch tupleToMatch(Tuple t) { |
53 | return new GenericPatternMatch.Immutable(getSpecification(), /*avoid re-cloning*/t.getElements()); | 54 | return new GenericPatternMatch.Immutable(getSpecification(), /*avoid re-cloning*/t.getElements()); |
54 | } | 55 | } |
55 | 56 | ||
56 | @SuppressWarnings("unchecked") | 57 | @SuppressWarnings("unchecked") |
57 | @Override | 58 | @Override |
58 | public GenericQuerySpecification<? extends GenericPatternMatcher> getSpecification() { | 59 | public GenericQuerySpecification<? extends GenericPatternMatcher> getSpecification() { |
@@ -66,17 +67,17 @@ public class GenericPatternMatcher extends BaseMatcher<GenericPatternMatch> { | |||
66 | static <Matcher extends GenericPatternMatcher> GenericPatternMatcher instantiate(GenericQuerySpecification<Matcher> querySpecification) { | 67 | static <Matcher extends GenericPatternMatcher> GenericPatternMatcher instantiate(GenericQuerySpecification<Matcher> querySpecification) { |
67 | return new GenericPatternMatcher(querySpecification); | 68 | return new GenericPatternMatcher(querySpecification); |
68 | } | 69 | } |
69 | 70 | ||
70 | /** | 71 | /** |
71 | * Internal method for {@link GenericQuerySpecification} | 72 | * Internal method for {@link GenericQuerySpecification} |
72 | * @noreference | 73 | * @noreference |
73 | */ | 74 | */ |
74 | static <Matcher extends GenericPatternMatcher> GenericPatternMatcher instantiate(ViatraQueryEngine engine, GenericQuerySpecification<Matcher> querySpecification) { | 75 | static <Matcher extends GenericPatternMatcher> GenericPatternMatcher instantiate(InterpreterEngine engine, GenericQuerySpecification<Matcher> querySpecification) { |
75 | // check if matcher already exists | 76 | // check if matcher already exists |
76 | GenericPatternMatcher matcher = engine.getExistingMatcher(querySpecification); | 77 | GenericPatternMatcher matcher = engine.getExistingMatcher(querySpecification); |
77 | if (matcher == null) { | 78 | if (matcher == null) { |
78 | matcher = engine.getMatcher(querySpecification); | 79 | matcher = engine.getMatcher(querySpecification); |
79 | } | 80 | } |
80 | return matcher; | 81 | return matcher; |
81 | } | 82 | } |
82 | 83 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/GenericQueryGroup.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/GenericQueryGroup.java index a5661bc9..8be570c5 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/GenericQueryGroup.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/GenericQueryGroup.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api; | 9 | package tools.refinery.interpreter.api; |
10 | 10 | ||
11 | import java.util.Arrays; | 11 | import java.util.Arrays; |
12 | import java.util.HashSet; | 12 | import java.util.HashSet; |
@@ -14,14 +14,14 @@ import java.util.Set; | |||
14 | import java.util.stream.Collectors; | 14 | import java.util.stream.Collectors; |
15 | import java.util.stream.Stream; | 15 | import java.util.stream.Stream; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.api.impl.BaseQueryGroup; | 17 | import tools.refinery.interpreter.api.impl.BaseQueryGroup; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Generic implementation of {@link IQueryGroup}, covering an arbitrarily chosen set of patterns. Use the public | 20 | * Generic implementation of {@link IQueryGroup}, covering an arbitrarily chosen set of patterns. Use the public |
21 | * constructor or static GenericQueryGroup.of(...) methods to instantiate. | 21 | * constructor or static GenericQueryGroup.of(...) methods to instantiate. |
22 | * | 22 | * |
23 | * @author Mark Czotter | 23 | * @author Mark Czotter |
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | public class GenericQueryGroup extends BaseQueryGroup { | 26 | public class GenericQueryGroup extends BaseQueryGroup { |
27 | 27 | ||
@@ -29,7 +29,7 @@ public class GenericQueryGroup extends BaseQueryGroup { | |||
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Creates a GenericQueryGroup object with a set of patterns. | 31 | * Creates a GenericQueryGroup object with a set of patterns. |
32 | * | 32 | * |
33 | * @param patterns | 33 | * @param patterns |
34 | */ | 34 | */ |
35 | public GenericQueryGroup(Set<IQuerySpecification<?>> patterns) { | 35 | public GenericQueryGroup(Set<IQuerySpecification<?>> patterns) { |
@@ -43,16 +43,16 @@ public class GenericQueryGroup extends BaseQueryGroup { | |||
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Creates a generic {@link IQueryGroup} instance from {@link IQuerySpecification} objects. | 45 | * Creates a generic {@link IQueryGroup} instance from {@link IQuerySpecification} objects. |
46 | * | 46 | * |
47 | * @since 2.0 | 47 | * @since 2.0 |
48 | */ | 48 | */ |
49 | public static IQueryGroup of(Stream<IQuerySpecification<?>> querySpecifications) { | 49 | public static IQueryGroup of(Stream<IQuerySpecification<?>> querySpecifications) { |
50 | return new GenericQueryGroup(querySpecifications.collect(Collectors.toSet())); | 50 | return new GenericQueryGroup(querySpecifications.collect(Collectors.toSet())); |
51 | } | 51 | } |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Creates a generic {@link IQueryGroup} instance from {@link IQuerySpecification} objects. | 54 | * Creates a generic {@link IQueryGroup} instance from {@link IQuerySpecification} objects. |
55 | * | 55 | * |
56 | * @param querySpecifications | 56 | * @param querySpecifications |
57 | */ | 57 | */ |
58 | public static IQueryGroup of(Set<IQuerySpecification<?>> querySpecifications) { | 58 | public static IQueryGroup of(Set<IQuerySpecification<?>> querySpecifications) { |
@@ -61,7 +61,7 @@ public class GenericQueryGroup extends BaseQueryGroup { | |||
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Creates a generic {@link IQueryGroup} instance from {@link IQuerySpecification} objects. | 63 | * Creates a generic {@link IQueryGroup} instance from {@link IQuerySpecification} objects. |
64 | * | 64 | * |
65 | * @param querySpecifications | 65 | * @param querySpecifications |
66 | */ | 66 | */ |
67 | public static IQueryGroup of(IQuerySpecification<?>... querySpecifications) { | 67 | public static IQueryGroup of(IQuerySpecification<?>... querySpecifications) { |
@@ -70,7 +70,7 @@ public class GenericQueryGroup extends BaseQueryGroup { | |||
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Creates a generic {@link IQueryGroup} instance from other {@link IQueryGroup} objects (subgroups). | 72 | * Creates a generic {@link IQueryGroup} instance from other {@link IQueryGroup} objects (subgroups). |
73 | * | 73 | * |
74 | */ | 74 | */ |
75 | public static IQueryGroup of(IQueryGroup... subGroups) { | 75 | public static IQueryGroup of(IQueryGroup... subGroups) { |
76 | Set<IQuerySpecification<?>> patterns = new HashSet<IQuerySpecification<?>>(); | 76 | Set<IQuerySpecification<?>> patterns = new HashSet<IQuerySpecification<?>>(); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/GenericQuerySpecification.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/GenericQuerySpecification.java index 5681ac19..47502a8c 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/GenericQuerySpecification.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/GenericQuerySpecification.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api; | 9 | package tools.refinery.interpreter.api; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.api.impl.BaseQuerySpecification; | 11 | import tools.refinery.interpreter.api.impl.BaseQuerySpecification; |
12 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 12 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
13 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 13 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PVisibility; | 14 | import tools.refinery.interpreter.matchers.psystem.queries.PVisibility; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * This is a generic query specification for VIATRA pattern matchers, for "interpretative" query execution. | 17 | * This is a generic query specification for Refinery Interpreter pattern matchers, for "interpretative" query |
18 | * Should be subclassed by query specification implementations specific to query languages. | 18 | * execution. Should be subclassed by query specification implementations specific to query languages. |
19 | * | 19 | * |
20 | * <p> | 20 | * <p> |
21 | * When available, consider using the pattern-specific generated matcher API instead. | 21 | * When available, consider using the pattern-specific generated matcher API instead. |
@@ -23,15 +23,14 @@ import tools.refinery.viatra.runtime.matchers.psystem.queries.PVisibility; | |||
23 | * <p> | 23 | * <p> |
24 | * The created matcher will be of type {@link GenericPatternMatcher}. Matches of the pattern will be represented as | 24 | * The created matcher will be of type {@link GenericPatternMatcher}. Matches of the pattern will be represented as |
25 | * {@link GenericPatternMatch}. | 25 | * {@link GenericPatternMatch}. |
26 | * | 26 | * |
27 | * <p> | 27 | * <p> |
28 | * Note for overriding (if you have your own query language or ): | 28 | * Note for overriding (if you have your own query language or ): |
29 | * Derived classes should use {@link #defaultInstantiate(ViatraQueryEngine)} for implementing | 29 | * Derived classes should use {@link #defaultInstantiate(InterpreterEngine)} for implementing |
30 | * {@link #instantiate(ViatraQueryEngine)} if they use {@link GenericPatternMatcher} proper. | 30 | * {@link #instantiate(InterpreterEngine)} if they use {@link GenericPatternMatcher} proper. |
31 | * | 31 | * |
32 | * @see GenericPatternMatcher | 32 | * @see GenericPatternMatcher |
33 | * @see GenericPatternMatch | 33 | * @see GenericPatternMatch |
34 | * @see GenericMatchProcessor | ||
35 | * @author Bergmann Gábor | 34 | * @author Bergmann Gábor |
36 | * @noinstantiate This class is not intended to be instantiated by end-users. | 35 | * @noinstantiate This class is not intended to be instantiated by end-users. |
37 | * @since 0.9 | 36 | * @since 0.9 |
@@ -57,11 +56,11 @@ public abstract class GenericQuerySpecification<Matcher extends GenericPatternMa | |||
57 | } | 56 | } |
58 | 57 | ||
59 | /** | 58 | /** |
60 | * Derived classes should use this implementation of {@link #instantiate(ViatraQueryEngine)} | 59 | * Derived classes should use this implementation of {@link #instantiate(InterpreterEngine)} |
61 | * if they use {@link GenericPatternMatcher} proper. | 60 | * if they use {@link GenericPatternMatcher} proper. |
62 | * @throws ViatraQueryRuntimeException | 61 | * @throws InterpreterRuntimeException |
63 | */ | 62 | */ |
64 | protected GenericPatternMatcher defaultInstantiate(ViatraQueryEngine engine) { | 63 | protected GenericPatternMatcher defaultInstantiate(InterpreterEngine engine) { |
65 | return GenericPatternMatcher.instantiate(engine, this); | 64 | return GenericPatternMatcher.instantiate(engine, this); |
66 | } | 65 | } |
67 | 66 | ||
@@ -73,4 +72,4 @@ public abstract class GenericQuerySpecification<Matcher extends GenericPatternMa | |||
73 | return getInternalQueryRepresentation().getVisibility(); | 72 | return getInternalQueryRepresentation().getVisibility(); |
74 | } | 73 | } |
75 | 74 | ||
76 | } \ No newline at end of file | 75 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/IMatchUpdateListener.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/IMatchUpdateListener.java index 23c64537..3d71f947 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/IMatchUpdateListener.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/IMatchUpdateListener.java | |||
@@ -3,25 +3,25 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api; | 9 | package tools.refinery.interpreter.api; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * An interface for low-level notifications about match appearance and disappearance. | 12 | * An interface for low-level notifications about match appearance and disappearance. |
13 | * | 13 | * |
14 | * <p> | 14 | * <p> |
15 | * See {@link ViatraQueryMatcher#addCallbackOnMatchUpdate(IMatchUpdateListener, boolean)} for usage. Clients should | 15 | * See {@link InterpreterMatcher#addCallbackOnMatchUpdate(IMatchUpdateListener, boolean)} for usage. Clients should |
16 | * consider using {@link MatchUpdateAdapter} or deriving their implementation from it. | 16 | * consider using {@link MatchUpdateAdapter} or deriving their implementation from it. |
17 | * | 17 | * |
18 | * @author Bergmann Gabor | 18 | * @author Bergmann Gabor |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | public interface IMatchUpdateListener<Match extends IPatternMatch> { | 21 | public interface IMatchUpdateListener<Match extends IPatternMatch> { |
22 | /** | 22 | /** |
23 | * Will be invoked on each new match that appears. | 23 | * Will be invoked on each new match that appears. |
24 | * | 24 | * |
25 | * @param match | 25 | * @param match |
26 | * the match that has just appeared. | 26 | * the match that has just appeared. |
27 | */ | 27 | */ |
@@ -29,7 +29,7 @@ public interface IMatchUpdateListener<Match extends IPatternMatch> { | |||
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Will be invoked on each existing match that disappears. | 31 | * Will be invoked on each existing match that disappears. |
32 | * | 32 | * |
33 | * @param match | 33 | * @param match |
34 | * the match that has just disappeared. | 34 | * the match that has just disappeared. |
35 | */ | 35 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/IPatternMatch.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/IPatternMatch.java index be6467cc..6ea8e0db 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/IPatternMatch.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/IPatternMatch.java | |||
@@ -3,26 +3,26 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.api; | 10 | package tools.refinery.interpreter.api; |
11 | 11 | ||
12 | import java.util.List; | 12 | import java.util.List; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Generic interface for a single match of a pattern. Each instance is a (partial) substitution of pattern parameters, | 15 | * Generic interface for a single match of a pattern. Each instance is a (partial) substitution of pattern parameters, |
16 | * essentially a parameter to value mapping. | 16 | * essentially a parameter to value mapping. |
17 | * | 17 | * |
18 | * <p>Can also represent a partial match; unsubstituted parameters are assigned to null. Pattern matchers must never return | 18 | * <p>Can also represent a partial match; unsubstituted parameters are assigned to null. Pattern matchers must never return |
19 | * a partial match, but they accept partial matches as method parameters. | 19 | * a partial match, but they accept partial matches as method parameters. |
20 | * | 20 | * |
21 | * @author Bergmann Gábor | 21 | * @author Bergmann Gábor |
22 | */ | 22 | */ |
23 | public interface IPatternMatch extends Cloneable /* , Map<String, Object> */{ | 23 | public interface IPatternMatch extends Cloneable /* , Map<String, Object> */{ |
24 | /** @return the pattern for which this is a match. */ | 24 | /** @return the pattern for which this is a match. */ |
25 | public IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>> specification(); | 25 | public IQuerySpecification<? extends InterpreterMatcher<? extends IPatternMatch>> specification(); |
26 | 26 | ||
27 | /** Identifies the name of the pattern for which this is a match. */ | 27 | /** Identifies the name of the pattern for which this is a match. */ |
28 | public String patternName(); | 28 | public String patternName(); |
@@ -38,9 +38,9 @@ public interface IPatternMatch extends Cloneable /* , Map<String, Object> */{ | |||
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Sets the parameter with the given name to the given value. | 40 | * Sets the parameter with the given name to the given value. |
41 | * | 41 | * |
42 | * <p> Works only if match is mutable. See {@link #isMutable()}. | 42 | * <p> Works only if match is mutable. See {@link #isMutable()}. |
43 | * | 43 | * |
44 | * @returns true if successful, false if parameter name is invalid. May also fail and return false if the value type | 44 | * @returns true if successful, false if parameter name is invalid. May also fail and return false if the value type |
45 | * is incompatible. | 45 | * is incompatible. |
46 | * @throws UnsupportedOperationException if match is not mutable. | 46 | * @throws UnsupportedOperationException if match is not mutable. |
@@ -49,9 +49,9 @@ public interface IPatternMatch extends Cloneable /* , Map<String, Object> */{ | |||
49 | 49 | ||
50 | /** | 50 | /** |
51 | * Sets the parameter at the given position to the given value. | 51 | * Sets the parameter at the given position to the given value. |
52 | * | 52 | * |
53 | * <p> Works only if match is mutable. See {@link #isMutable()}. | 53 | * <p> Works only if match is mutable. See {@link #isMutable()}. |
54 | * | 54 | * |
55 | * @returns true if successful, false if position is invalid. May also fail and return false if the value type is | 55 | * @returns true if successful, false if position is invalid. May also fail and return false if the value type is |
56 | * incompatible. | 56 | * incompatible. |
57 | * @throws UnsupportedOperationException if match is not mutable. | 57 | * @throws UnsupportedOperationException if match is not mutable. |
@@ -59,47 +59,47 @@ public interface IPatternMatch extends Cloneable /* , Map<String, Object> */{ | |||
59 | public boolean set(int position, Object newValue); | 59 | public boolean set(int position, Object newValue); |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * Returns whether the match object can be further modified after its creation. Setters work only if the match is mutable. | 62 | * Returns whether the match object can be further modified after its creation. Setters work only if the match is mutable. |
63 | * | 63 | * |
64 | * <p>Matches computed by the pattern matchers are not mutable, so that the match set cannot be modified externally. | 64 | * <p>Matches computed by the pattern matchers are not mutable, so that the match set cannot be modified externally. |
65 | * Partial matches used as matcher input, however, can be mutable; such match objects can be created using {@link ViatraQueryMatcher#newEmptyMatch()}. | 65 | * Partial matches used as matcher input, however, can be mutable; such match objects can be created using {@link InterpreterMatcher#newEmptyMatch()}. |
66 | * | 66 | * |
67 | * @return whether the match can be modified | 67 | * @return whether the match can be modified |
68 | */ | 68 | */ |
69 | public boolean isMutable(); | 69 | public boolean isMutable(); |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Converts the match to an array representation, with each pattern parameter at their respective position. | 72 | * Converts the match to an array representation, with each pattern parameter at their respective position. |
73 | * In case of a partial match, unsubstituted parameters will be represented as null elements in the array. | 73 | * In case of a partial match, unsubstituted parameters will be represented as null elements in the array. |
74 | * | 74 | * |
75 | * @return a newly constructed array containing each parameter substitution of the match in order. | 75 | * @return a newly constructed array containing each parameter substitution of the match in order. |
76 | */ | 76 | */ |
77 | public Object[] toArray(); | 77 | public Object[] toArray(); |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Takes an immutable snapshot of this match. | 80 | * Takes an immutable snapshot of this match. |
81 | * @return the match itself in case of immutable matches, an immutable copy in case of mutable ones. | 81 | * @return the match itself in case of immutable matches, an immutable copy in case of mutable ones. |
82 | */ | 82 | */ |
83 | public IPatternMatch toImmutable(); | 83 | public IPatternMatch toImmutable(); |
84 | 84 | ||
85 | /** Prints the list of parameter-value pairs. */ | 85 | /** Prints the list of parameter-value pairs. */ |
86 | public String prettyPrint(); | 86 | public String prettyPrint(); |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * Checks that this match is compatible with the given other match. | 89 | * Checks that this match is compatible with the given other match. |
90 | * This is used for filtering the match set of a matcher. | 90 | * This is used for filtering the match set of a matcher. |
91 | * | 91 | * |
92 | * <p/> Two non-null matches are compatible if and only if: | 92 | * <p/> Two non-null matches are compatible if and only if: |
93 | * <ul> | 93 | * <ul> |
94 | * <li>They share the same pattern.</li> | 94 | * <li>They share the same pattern.</li> |
95 | * <li>For each parameter, where they are set (non-null) in both matches, | 95 | * <li>For each parameter, where they are set (non-null) in both matches, |
96 | * their values are equal.</li> | 96 | * their values are equal.</li> |
97 | * </li> | 97 | * </li> |
98 | * </ul> | 98 | * </ul> |
99 | * | 99 | * |
100 | * <p/> Furthermore, all matches are considered compatible with | 100 | * <p/> Furthermore, all matches are considered compatible with |
101 | * null matches (e.g. empty filter). | 101 | * null matches (e.g. empty filter). |
102 | * | 102 | * |
103 | * @param other | 103 | * @param other |
104 | * @return true, if this is compatible with other, or other is null | 104 | * @return true, if this is compatible with other, or other is null |
105 | */ | 105 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/IQueryGroup.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/IQueryGroup.java index a783f823..151d0723 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/IQueryGroup.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/IQueryGroup.java | |||
@@ -3,40 +3,40 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api; | 9 | package tools.refinery.interpreter.api; |
10 | 10 | ||
11 | import java.util.Set; | 11 | import java.util.Set; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Generic interface for group of query specifications. | 14 | * Generic interface for group of query specifications. |
15 | * | 15 | * |
16 | * <p>It handles more than one patterns as a group, and provides functionality to initialize the matchers together (which | 16 | * <p>It handles more than one patterns as a group, and provides functionality to initialize the matchers together (which |
17 | * has performance benefits). | 17 | * has performance benefits). |
18 | * | 18 | * |
19 | * @author Mark Czotter | 19 | * @author Mark Czotter |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | public interface IQueryGroup { | 22 | public interface IQueryGroup { |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Initializes matchers for the group of patterns within an {@link ViatraQueryEngine}. If some of the pattern matchers are already | 25 | * Initializes matchers for the group of patterns within an {@link InterpreterEngine}. If some of the pattern matchers are already |
26 | * constructed in the engine, no task is performed for them. | 26 | * constructed in the engine, no task is performed for them. |
27 | * | 27 | * |
28 | * <p> | 28 | * <p> |
29 | * This preparation step has the advantage that it prepares pattern matchers for an arbitrary number of patterns in a | 29 | * This preparation step has the advantage that it prepares pattern matchers for an arbitrary number of patterns in a |
30 | * single-pass traversal of the model. | 30 | * single-pass traversal of the model. |
31 | * This is typically more efficient than traversing the model each time an individual pattern matcher is initialized on demand. | 31 | * This is typically more efficient than traversing the model each time an individual pattern matcher is initialized on demand. |
32 | * The performance benefit only manifests itself if the engine is not in wildcard mode. | 32 | * The performance benefit only manifests itself if the engine is not in wildcard mode. |
33 | * | 33 | * |
34 | * @param engine | 34 | * @param engine |
35 | * the existing VIATRA Query engine in which the matchers will be created. | 35 | * the existing Refinery Interpreter engine in which the matchers will be created. |
36 | * @throws ViatraQueryRuntimeException | 36 | * @throws ViatraQueryRuntimeException |
37 | * if there was an error in preparing the engine | 37 | * if there was an error in preparing the engine |
38 | */ | 38 | */ |
39 | public void prepare(ViatraQueryEngine engine); | 39 | public void prepare(InterpreterEngine engine); |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * Returns the currently assigned {@link IQuerySpecification}s. | 42 | * Returns the currently assigned {@link IQuerySpecification}s. |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/IQuerySpecification.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/IQuerySpecification.java index 326d2202..22861842 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/IQuerySpecification.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/IQuerySpecification.java | |||
@@ -7,36 +7,36 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.api; | 10 | package tools.refinery.interpreter.api; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.api.scope.QueryScope; | 12 | import tools.refinery.interpreter.api.scope.QueryScope; |
13 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 13 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 14 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQueryHeader; | 15 | import tools.refinery.interpreter.matchers.psystem.queries.PQueryHeader; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * API interface for a VIATRA query specification. Each query is associated with a pattern. Methods instantiate a matcher | 18 | * API interface for a Refinery Interpreter query specification. Each query is associated with a pattern. Methods |
19 | * of the pattern with various parameters. | 19 | * instantiate a matcher of the pattern with various parameters. |
20 | * | 20 | * |
21 | * <p> As of 0.9.0, some internal details (mostly relevant for query evaluator backends) have been moved to {@link #getInternalQueryRepresentation()}. | 21 | * <p> As of 0.9.0, some internal details (mostly relevant for query evaluator backends) have been moved to {@link #getInternalQueryRepresentation()}. |
22 | * | 22 | * |
23 | * @author Bergmann Gábor | 23 | * @author Bergmann Gábor |
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | public interface IQuerySpecification<Matcher extends ViatraQueryMatcher<? extends IPatternMatch>> extends PQueryHeader { | 26 | public interface IQuerySpecification<Matcher extends InterpreterMatcher<? extends IPatternMatch>> extends PQueryHeader { |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Initializes the pattern matcher within an existing {@link ViatraQueryEngine}. If the pattern matcher is already | 29 | * Initializes the pattern matcher within an existing {@link InterpreterEngine}. If the pattern matcher is already |
30 | * constructed in the engine, only a lightweight reference is created. | 30 | * constructed in the engine, only a lightweight reference is created. |
31 | * <p> | 31 | * <p> |
32 | * The match set will be incrementally refreshed upon updates. | 32 | * The match set will be incrementally refreshed upon updates. |
33 | * | 33 | * |
34 | * @param engine | 34 | * @param engine |
35 | * the existing VIATRA Query engine in which this matcher will be created. | 35 | * the existing Refinery Interpreter engine in which this matcher will be created. |
36 | * @throws ViatraQueryRuntimeException | 36 | * @throws InterpreterRuntimeException |
37 | * if an error occurs during pattern matcher creation | 37 | * if an error occurs during pattern matcher creation |
38 | */ | 38 | */ |
39 | public Matcher getMatcher(ViatraQueryEngine engine); | 39 | public Matcher getMatcher(InterpreterEngine engine); |
40 | 40 | ||
41 | 41 | ||
42 | /** | 42 | /** |
@@ -76,8 +76,8 @@ public interface IQuerySpecification<Matcher extends ViatraQueryMatcher<? extend | |||
76 | 76 | ||
77 | /** | 77 | /** |
78 | * Creates a new uninitialized matcher, which is not functional until an engine initializes it. Clients | 78 | * Creates a new uninitialized matcher, which is not functional until an engine initializes it. Clients |
79 | * should not call this method, it is used by the {@link ViatraQueryEngine} instance to instantiate matchers. | 79 | * should not call this method, it is used by the {@link InterpreterEngine} instance to instantiate matchers. |
80 | * @throws ViatraQueryRuntimeException | 80 | * @throws InterpreterRuntimeException |
81 | * @noreference This method is not intended to be referenced by clients. | 81 | * @noreference This method is not intended to be referenced by clients. |
82 | * @since 1.4 | 82 | * @since 1.4 |
83 | */ | 83 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngine.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterEngine.java index 0f402b49..e4330783 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngine.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterEngine.java | |||
@@ -8,11 +8,11 @@ | |||
8 | * SPDX-License-Identifier: EPL-2.0 | 8 | * SPDX-License-Identifier: EPL-2.0 |
9 | *******************************************************************************/ | 9 | *******************************************************************************/ |
10 | 10 | ||
11 | package tools.refinery.viatra.runtime.api; | 11 | package tools.refinery.interpreter.api; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.api.scope.IBaseIndex; | 13 | import tools.refinery.interpreter.api.scope.IBaseIndex; |
14 | import tools.refinery.viatra.runtime.api.scope.QueryScope; | 14 | import tools.refinery.interpreter.api.scope.QueryScope; |
15 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 15 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
16 | 16 | ||
17 | import java.util.Set; | 17 | import java.util.Set; |
18 | import java.util.function.Supplier; | 18 | import java.util.function.Supplier; |
@@ -24,7 +24,7 @@ import java.util.stream.Collectors; | |||
24 | * | 24 | * |
25 | * <p> | 25 | * <p> |
26 | * By default, ViatraQueryEngines do not need to be separately disposed; they will be garbage collected along with the model. | 26 | * By default, ViatraQueryEngines do not need to be separately disposed; they will be garbage collected along with the model. |
27 | * Advanced users: see {@link AdvancedViatraQueryEngine} if you want fine control over the lifecycle of an engine. | 27 | * Advanced users: see {@link AdvancedInterpreterEngine} if you want fine control over the lifecycle of an engine. |
28 | * | 28 | * |
29 | * <p> | 29 | * <p> |
30 | * Pattern matchers within this engine may be instantiated in the following ways: | 30 | * Pattern matchers within this engine may be instantiated in the following ways: |
@@ -43,63 +43,17 @@ import java.util.stream.Collectors; | |||
43 | * @author Bergmann Gábor | 43 | * @author Bergmann Gábor |
44 | * @noextend This class is not intended to be subclassed by clients. | 44 | * @noextend This class is not intended to be subclassed by clients. |
45 | */ | 45 | */ |
46 | public abstract class ViatraQueryEngine { | 46 | public abstract class InterpreterEngine { |
47 | |||
48 | |||
49 | /** | ||
50 | * Obtain a (managed) {@link ViatraQueryEngine} to evaluate queries over a given scope specified by an {@link QueryScope}. | ||
51 | * | ||
52 | * <p> For a given matcher scope, the same engine will be returned to any client. | ||
53 | * This facilitates the reuse of internal caches of the engine, greatly improving performance. | ||
54 | * | ||
55 | * <p> The lifecycle of this engine is centrally managed, and will not be disposed as long as the model is retained in memory. | ||
56 | * The engine will be garbage collected along with the model. | ||
57 | * | ||
58 | * <p> | ||
59 | * Advanced users: see {@link AdvancedViatraQueryEngine#createUnmanagedEngine(QueryScope)} to obtain a private, | ||
60 | * unmanaged engine that is not shared with other clients and allows tight control over its lifecycle. | ||
61 | * | ||
62 | * @param scope | ||
63 | * the scope of query evaluation; the definition of the set of model elements that this engine is operates on. | ||
64 | * Provide e.g. a {@link EMFScope} for evaluating queries on an EMF model. | ||
65 | * @return a (managed) {@link ViatraQueryEngine} instance | ||
66 | */ | ||
67 | public static ViatraQueryEngine on(QueryScope scope) { | ||
68 | return ViatraQueryEngineManager.getInstance().getQueryEngine(scope); | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * Obtain a (managed) {@link ViatraQueryEngine} to evaluate queries over a given scope specified by an {@link QueryScope}. | ||
73 | * | ||
74 | * <p> For a given matcher scope, the same engine will be returned to any client. | ||
75 | * This facilitates the reuse of internal caches of the engine, greatly improving performance. | ||
76 | * | ||
77 | * <p> The lifecycle of this engine is centrally managed, and will not be disposed as long as the model is retained in memory. | ||
78 | * The engine will be garbage collected along with the model. | ||
79 | * | ||
80 | * <p> | ||
81 | * Advanced users: see {@link AdvancedViatraQueryEngine#createUnmanagedEngine(QueryScope)} to obtain a private, | ||
82 | * unmanaged engine that is not shared with other clients and allows tight control over its lifecycle. | ||
83 | * | ||
84 | * @param scope | ||
85 | * the scope of query evaluation; the definition of the set of model elements that this engine is operates on. | ||
86 | * Provide e.g. a {@link EMFScope} for evaluating queries on an EMF model. | ||
87 | * @return a (managed) {@link ViatraQueryEngine} instance | ||
88 | * @since 1.4 | ||
89 | */ | ||
90 | public static ViatraQueryEngine on(QueryScope scope, ViatraQueryEngineOptions options) { | ||
91 | return ViatraQueryEngineManager.getInstance().getQueryEngine(scope, options); | ||
92 | } | ||
93 | 47 | ||
94 | /** | 48 | /** |
95 | * Provides access to the internal base index component of the engine, responsible for keeping track of basic | 49 | * Provides access to the internal base index component of the engine, responsible for keeping track of basic |
96 | * contents of the model. | 50 | * contents of the model. |
97 | * | 51 | * |
98 | * <p>If using an {@link EMFScope}, | 52 | * <p>If using an {@link EMFScope}, |
99 | * consider {@link EMFScope#extractUnderlyingEMFIndex(ViatraQueryEngine)} instead to access EMF-specific details. | 53 | * consider {@link EMFScope#extractUnderlyingEMFIndex(InterpreterEngine)} instead to access EMF-specific details. |
100 | * | 54 | * |
101 | * @return the baseIndex the NavigationHelper maintaining the base index | 55 | * @return the baseIndex the NavigationHelper maintaining the base index |
102 | * @throws ViatraQueryRuntimeException | 56 | * @throws InterpreterRuntimeException |
103 | * if the base index could not be constructed | 57 | * if the base index could not be constructed |
104 | */ | 58 | */ |
105 | public abstract IBaseIndex getBaseIndex(); | 59 | public abstract IBaseIndex getBaseIndex(); |
@@ -107,39 +61,39 @@ public abstract class ViatraQueryEngine { | |||
107 | /** | 61 | /** |
108 | * Access a pattern matcher based on a {@link IQuerySpecification}. | 62 | * Access a pattern matcher based on a {@link IQuerySpecification}. |
109 | * Multiple calls will return the same matcher. | 63 | * Multiple calls will return the same matcher. |
110 | * @param querySpecification a {@link IQuerySpecification} that describes a VIATRA query specification | 64 | * @param querySpecification a {@link IQuerySpecification} that describes a Refinery Interpreter query specification |
111 | * @return a pattern matcher corresponding to the specification | 65 | * @return a pattern matcher corresponding to the specification |
112 | * @throws ViatraQueryRuntimeException if the matcher could not be initialized | 66 | * @throws InterpreterRuntimeException if the matcher could not be initialized |
113 | */ | 67 | */ |
114 | public abstract <Matcher extends ViatraQueryMatcher<? extends IPatternMatch>> Matcher getMatcher(IQuerySpecification<Matcher> querySpecification); | 68 | public abstract <Matcher extends InterpreterMatcher<? extends IPatternMatch>> Matcher getMatcher(IQuerySpecification<Matcher> querySpecification); |
115 | 69 | ||
116 | /** | 70 | /** |
117 | * Access a pattern matcher for the graph pattern with the given fully qualified name. | 71 | * Access a pattern matcher for the graph pattern with the given fully qualified name. |
118 | * Will succeed only if a query specification for this fully qualified name has been generated and registered. | 72 | * Will succeed only if a query specification for this fully qualified name has been generated and registered. |
119 | * Multiple calls will return the same matcher unless the registered specification changes. | 73 | * Multiple calls will return the same matcher unless the registered specification changes. |
120 | * | 74 | * |
121 | * @param patternFQN the fully qualified name of a VIATRA query specification | 75 | * @param patternFQN the fully qualified name of a Refinery Interpreter query specification |
122 | * @return a pattern matcher corresponding to the specification | 76 | * @return a pattern matcher corresponding to the specification |
123 | * @throws ViatraQueryRuntimeException if the matcher could not be initialized | 77 | * @throws InterpreterRuntimeException if the matcher could not be initialized |
124 | */ | 78 | */ |
125 | public abstract ViatraQueryMatcher<? extends IPatternMatch> getMatcher(String patternFQN); | 79 | public abstract InterpreterMatcher<? extends IPatternMatch> getMatcher(String patternFQN); |
126 | 80 | ||
127 | /** | 81 | /** |
128 | * Access an existing pattern matcher based on a {@link IQuerySpecification}. | 82 | * Access an existing pattern matcher based on a {@link IQuerySpecification}. |
129 | * @param querySpecification a {@link IQuerySpecification} that describes a VIATRA query specification | 83 | * @param querySpecification a {@link IQuerySpecification} that describes a Refinery Interpreter query specification |
130 | * @return a pattern matcher corresponding to the specification, <code>null</code> if a matcher does not exist yet. | 84 | * @return a pattern matcher corresponding to the specification, <code>null</code> if a matcher does not exist yet. |
131 | */ | 85 | */ |
132 | public abstract <Matcher extends ViatraQueryMatcher<? extends IPatternMatch>> Matcher getExistingMatcher(IQuerySpecification<Matcher> querySpecification); | 86 | public abstract <Matcher extends InterpreterMatcher<? extends IPatternMatch>> Matcher getExistingMatcher(IQuerySpecification<Matcher> querySpecification); |
133 | 87 | ||
134 | 88 | ||
135 | /** | 89 | /** |
136 | * Access a copy of available {@link ViatraQueryMatcher} pattern matchers. | 90 | * Access a copy of available {@link InterpreterMatcher} pattern matchers. |
137 | * @return a copy of the set of currently available pattern matchers registered on this engine instance | 91 | * @return a copy of the set of currently available pattern matchers registered on this engine instance |
138 | */ | 92 | */ |
139 | public abstract Set<? extends ViatraQueryMatcher<? extends IPatternMatch>> getCurrentMatchers(); | 93 | public abstract Set<? extends InterpreterMatcher<? extends IPatternMatch>> getCurrentMatchers(); |
140 | 94 | ||
141 | public Set<IQuerySpecification<? extends ViatraQueryMatcher<? extends IPatternMatch>>> getRegisteredQuerySpecifications() { | 95 | public Set<IQuerySpecification<? extends InterpreterMatcher<? extends IPatternMatch>>> getRegisteredQuerySpecifications() { |
142 | return getCurrentMatchers().stream().map(ViatraQueryMatcher::getSpecification).collect(Collectors.toSet()); | 96 | return getCurrentMatchers().stream().map(InterpreterMatcher::getSpecification).collect(Collectors.toSet()); |
143 | } | 97 | } |
144 | 98 | ||
145 | /** | 99 | /** |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngineInitializationListener.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterEngineInitializationListener.java index 02162a65..f26c1bb3 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngineInitializationListener.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterEngineInitializationListener.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api; | 9 | package tools.refinery.interpreter.api; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Listener interface to get notifications when a new managed engine is initialized. | 12 | * Listener interface to get notifications when a new managed engine is initialized. |
13 | * | 13 | * |
14 | * @author Abel Hegedus | 14 | * @author Abel Hegedus |
15 | * | 15 | * |
16 | */ | 16 | */ |
17 | public interface ViatraQueryEngineInitializationListener { | 17 | public interface InterpreterEngineInitializationListener { |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Called when a managed engine is initialized in the EngineManager. | 20 | * Called when a managed engine is initialized in the EngineManager. |
21 | * | 21 | * |
22 | * @param engine the initialized engine | 22 | * @param engine the initialized engine |
23 | */ | 23 | */ |
24 | void engineInitialized(AdvancedViatraQueryEngine engine); | 24 | void engineInitialized(AdvancedInterpreterEngine engine); |
25 | 25 | ||
26 | } | 26 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngineLifecycleListener.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterEngineLifecycleListener.java index 1c4dc264..c9c16c01 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngineLifecycleListener.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterEngineLifecycleListener.java | |||
@@ -3,48 +3,48 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api; | 9 | package tools.refinery.interpreter.api; |
10 | 10 | ||
11 | 11 | ||
12 | /** | 12 | /** |
13 | * Listener interface for getting notification on changes in an {@link ViatraQueryEngine}. | 13 | * Listener interface for getting notification on changes in an {@link InterpreterEngine}. |
14 | * | 14 | * |
15 | * You can use it to remove any other listeners that you attached to matchers or the engine, | 15 | * You can use it to remove any other listeners that you attached to matchers or the engine, |
16 | * or to handle matchers that are initialized after you started using the engine. | 16 | * or to handle matchers that are initialized after you started using the engine. |
17 | * | 17 | * |
18 | * @author Abel Hegedus | 18 | * @author Abel Hegedus |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | public interface ViatraQueryEngineLifecycleListener { | 21 | public interface InterpreterEngineLifecycleListener { |
22 | 22 | ||
23 | // ------------------------------------------------------------------------------- | 23 | // ------------------------------------------------------------------------------- |
24 | // MATCHERS (methods notifying on changes in the matchers available in the engine) | 24 | // MATCHERS (methods notifying on changes in the matchers available in the engine) |
25 | // ------------------------------------------------------------------------------- | 25 | // ------------------------------------------------------------------------------- |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * Called after a matcher is instantiated in the engine | 28 | * Called after a matcher is instantiated in the engine |
29 | * | 29 | * |
30 | * @param matcher the new matcher | 30 | * @param matcher the new matcher |
31 | */ | 31 | */ |
32 | void matcherInstantiated(ViatraQueryMatcher<? extends IPatternMatch> matcher); | 32 | void matcherInstantiated(InterpreterMatcher<? extends IPatternMatch> matcher); |
33 | 33 | ||
34 | // ------------------------------------------------------------------------- | 34 | // ------------------------------------------------------------------------- |
35 | // HEALTH (methods notifying on changes that affect the health of the engine | 35 | // HEALTH (methods notifying on changes that affect the health of the engine |
36 | // ------------------------------------------------------------------------- | 36 | // ------------------------------------------------------------------------- |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * Called after the engine has become tainted due to a fatal error | 39 | * Called after the engine has become tainted due to a fatal error |
40 | */ | 40 | */ |
41 | void engineBecameTainted(String message, Throwable t); | 41 | void engineBecameTainted(String message, Throwable t); |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * Called after the engine has been wiped | 44 | * Called after the engine has been wiped |
45 | */ | 45 | */ |
46 | void engineWiped(); | 46 | void engineWiped(); |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Called after the engine has been disposed | 49 | * Called after the engine has been disposed |
50 | */ | 50 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngineOptions.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterEngineOptions.java index 15bf1f91..2b0f949b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngineOptions.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterEngineOptions.java | |||
@@ -3,37 +3,37 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api; | 9 | package tools.refinery.interpreter.api; |
10 | |||
10 | 11 | ||
12 | import tools.refinery.interpreter.matchers.backend.IQueryBackendFactory; | ||
13 | import tools.refinery.interpreter.matchers.backend.IQueryBackendFactoryProvider; | ||
14 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; | ||
15 | import tools.refinery.interpreter.matchers.util.Preconditions; | ||
11 | 16 | ||
12 | import java.util.Objects; | 17 | import java.util.Objects; |
13 | import java.util.ServiceLoader; | 18 | import java.util.ServiceLoader; |
14 | 19 | ||
15 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendFactory; | ||
16 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendFactoryProvider; | ||
17 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | ||
19 | |||
20 | /** | 20 | /** |
21 | * This class is intended to provide options to a created {@link ViatraQueryEngine} instance. The {@link #DEFAULT} | 21 | * This class is intended to provide options to a created {@link InterpreterEngine} instance. The {@link #DEFAULT} |
22 | * instance represents the configuration that is selected when no explicit options are provided by the user. To create | 22 | * instance represents the configuration that is selected when no explicit options are provided by the user. To create |
23 | * new configurations, use the static builder methods {@link #defineOptions()} (starts with empty options) or | 23 | * new configurations, use the static builder methods {@link #defineOptions()} (starts with empty options) or |
24 | * {@link #copyOptions(ViatraQueryEngineOptions)} (starts with all options from an existing configuration). | 24 | * {@link #copyOptions(InterpreterEngineOptions)} (starts with all options from an existing configuration). |
25 | * | 25 | * |
26 | * @author Balázs Grill, Zoltan Ujhelyi | 26 | * @author Balázs Grill, Zoltan Ujhelyi |
27 | * @since 1.4 | 27 | * @since 1.4 |
28 | * | 28 | * |
29 | */ | 29 | */ |
30 | public final class ViatraQueryEngineOptions { | 30 | public final class InterpreterEngineOptions { |
31 | 31 | ||
32 | private static boolean areSystemDefaultsCalculated = false; | 32 | private static boolean areSystemDefaultsCalculated = false; |
33 | private static IQueryBackendFactory systemDefaultBackendFactory; | 33 | private static IQueryBackendFactory systemDefaultBackendFactory; |
34 | private static IQueryBackendFactory systemDefaultCachingBackendFactory; | 34 | private static IQueryBackendFactory systemDefaultCachingBackendFactory; |
35 | private static IQueryBackendFactory systemDefaultSearchBackendFactory; | 35 | private static IQueryBackendFactory systemDefaultSearchBackendFactory; |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * @since 2.0 | 38 | * @since 2.0 |
39 | */ | 39 | */ |
@@ -41,11 +41,11 @@ public final class ViatraQueryEngineOptions { | |||
41 | IQueryBackendFactory systemDefaultCachingBackendFactory, | 41 | IQueryBackendFactory systemDefaultCachingBackendFactory, |
42 | IQueryBackendFactory systemDefaultSearchBackendFactory) { | 42 | IQueryBackendFactory systemDefaultSearchBackendFactory) { |
43 | areSystemDefaultsCalculated = true; | 43 | areSystemDefaultsCalculated = true; |
44 | ViatraQueryEngineOptions.systemDefaultBackendFactory = systemDefaultBackendFactory; | 44 | InterpreterEngineOptions.systemDefaultBackendFactory = systemDefaultBackendFactory; |
45 | ViatraQueryEngineOptions.systemDefaultCachingBackendFactory = systemDefaultCachingBackendFactory; | 45 | InterpreterEngineOptions.systemDefaultCachingBackendFactory = systemDefaultCachingBackendFactory; |
46 | ViatraQueryEngineOptions.systemDefaultSearchBackendFactory = systemDefaultSearchBackendFactory; | 46 | InterpreterEngineOptions.systemDefaultSearchBackendFactory = systemDefaultSearchBackendFactory; |
47 | } | 47 | } |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * If {@link #setSystemDefaultBackends(IQueryBackendFactory, IQueryBackendFactory, IQueryBackendFactory)} is not | 50 | * If {@link #setSystemDefaultBackends(IQueryBackendFactory, IQueryBackendFactory, IQueryBackendFactory)} is not |
51 | * called, this method is responsible of finding the corresponding backends on the classpath using Java Service | 51 | * called, this method is responsible of finding the corresponding backends on the classpath using Java Service |
@@ -65,40 +65,40 @@ public final class ViatraQueryEngineOptions { | |||
65 | } | 65 | } |
66 | areSystemDefaultsCalculated = true; | 66 | areSystemDefaultsCalculated = true; |
67 | } | 67 | } |
68 | 68 | ||
69 | private static IQueryBackendFactory getSystemDefaultBackend() { | 69 | private static IQueryBackendFactory getSystemDefaultBackend() { |
70 | if (!areSystemDefaultsCalculated) { | 70 | if (!areSystemDefaultsCalculated) { |
71 | calculateSystemDefaultBackends(); | 71 | calculateSystemDefaultBackends(); |
72 | } | 72 | } |
73 | return Objects.requireNonNull(systemDefaultBackendFactory, "System default backend not found"); | 73 | return Objects.requireNonNull(systemDefaultBackendFactory, "System default backend not found"); |
74 | } | 74 | } |
75 | 75 | ||
76 | private static IQueryBackendFactory getSystemDefaultCachingBackend() { | 76 | private static IQueryBackendFactory getSystemDefaultCachingBackend() { |
77 | if (!areSystemDefaultsCalculated) { | 77 | if (!areSystemDefaultsCalculated) { |
78 | calculateSystemDefaultBackends(); | 78 | calculateSystemDefaultBackends(); |
79 | } | 79 | } |
80 | return Objects.requireNonNull(systemDefaultCachingBackendFactory, "System default caching backend not found"); | 80 | return Objects.requireNonNull(systemDefaultCachingBackendFactory, "System default caching backend not found"); |
81 | } | 81 | } |
82 | 82 | ||
83 | private static IQueryBackendFactory getSystemDefaultSearchBackend() { | 83 | private static IQueryBackendFactory getSystemDefaultSearchBackend() { |
84 | if (!areSystemDefaultsCalculated) { | 84 | if (!areSystemDefaultsCalculated) { |
85 | calculateSystemDefaultBackends(); | 85 | calculateSystemDefaultBackends(); |
86 | } | 86 | } |
87 | return Objects.requireNonNull(systemDefaultSearchBackendFactory, "System default search backend not found"); | 87 | return Objects.requireNonNull(systemDefaultSearchBackendFactory, "System default search backend not found"); |
88 | } | 88 | } |
89 | 89 | ||
90 | private final QueryEvaluationHint engineDefaultHints; | 90 | private final QueryEvaluationHint engineDefaultHints; |
91 | 91 | ||
92 | private final IQueryBackendFactory defaultCachingBackendFactory; | 92 | private final IQueryBackendFactory defaultCachingBackendFactory; |
93 | private final IQueryBackendFactory defaultSearchBackendFactory; | 93 | private final IQueryBackendFactory defaultSearchBackendFactory; |
94 | 94 | ||
95 | /** The default engine options; if options are not defined, this version will be used. */ | 95 | /** The default engine options; if options are not defined, this version will be used. */ |
96 | private static ViatraQueryEngineOptions DEFAULT; | 96 | private static InterpreterEngineOptions DEFAULT; |
97 | 97 | ||
98 | /** | 98 | /** |
99 | * @since 2.0 | 99 | * @since 2.0 |
100 | */ | 100 | */ |
101 | public static final ViatraQueryEngineOptions getDefault() { | 101 | public static final InterpreterEngineOptions getDefault() { |
102 | if (DEFAULT == null) { | 102 | if (DEFAULT == null) { |
103 | DEFAULT = new Builder().build(); | 103 | DEFAULT = new Builder().build(); |
104 | } | 104 | } |
@@ -116,7 +116,7 @@ public final class ViatraQueryEngineOptions { | |||
116 | 116 | ||
117 | } | 117 | } |
118 | 118 | ||
119 | public Builder(ViatraQueryEngineOptions from) { | 119 | public Builder(InterpreterEngineOptions from) { |
120 | this.engineDefaultHints = from.engineDefaultHints; | 120 | this.engineDefaultHints = from.engineDefaultHints; |
121 | this.defaultBackendFactory = engineDefaultHints.getQueryBackendFactory(); | 121 | this.defaultBackendFactory = engineDefaultHints.getQueryBackendFactory(); |
122 | this.defaultCachingBackendFactory = from.defaultCachingBackendFactory; | 122 | this.defaultCachingBackendFactory = from.defaultCachingBackendFactory; |
@@ -149,17 +149,17 @@ public final class ViatraQueryEngineOptions { | |||
149 | this.defaultSearchBackendFactory = defaultSearchBackendFactory; | 149 | this.defaultSearchBackendFactory = defaultSearchBackendFactory; |
150 | return this; | 150 | return this; |
151 | } | 151 | } |
152 | 152 | ||
153 | public Builder withDefaultCachingBackend(IQueryBackendFactory defaultCachingBackendFactory) { | 153 | public Builder withDefaultCachingBackend(IQueryBackendFactory defaultCachingBackendFactory) { |
154 | Preconditions.checkArgument(defaultCachingBackendFactory.isCaching(), "%s is not a caching backend", defaultCachingBackendFactory.getClass()); | 154 | Preconditions.checkArgument(defaultCachingBackendFactory.isCaching(), "%s is not a caching backend", defaultCachingBackendFactory.getClass()); |
155 | this.defaultCachingBackendFactory = defaultCachingBackendFactory; | 155 | this.defaultCachingBackendFactory = defaultCachingBackendFactory; |
156 | return this; | 156 | return this; |
157 | } | 157 | } |
158 | 158 | ||
159 | public ViatraQueryEngineOptions build() { | 159 | public InterpreterEngineOptions build() { |
160 | IQueryBackendFactory defaultFactory = getDefaultBackend(); | 160 | IQueryBackendFactory defaultFactory = getDefaultBackend(); |
161 | QueryEvaluationHint hint = getEngineDefaultHints(defaultFactory); | 161 | QueryEvaluationHint hint = getEngineDefaultHints(defaultFactory); |
162 | return new ViatraQueryEngineOptions(hint, getDefaultCachingBackend(), getDefaultSearchBackend()); | 162 | return new InterpreterEngineOptions(hint, getDefaultCachingBackend(), getDefaultSearchBackend()); |
163 | } | 163 | } |
164 | 164 | ||
165 | private IQueryBackendFactory getDefaultBackend() { | 165 | private IQueryBackendFactory getDefaultBackend() { |
@@ -181,7 +181,7 @@ public final class ViatraQueryEngineOptions { | |||
181 | return getSystemDefaultCachingBackend(); | 181 | return getSystemDefaultCachingBackend(); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | private IQueryBackendFactory getDefaultSearchBackend() { | 185 | private IQueryBackendFactory getDefaultSearchBackend() { |
186 | if (defaultSearchBackendFactory != null) { | 186 | if (defaultSearchBackendFactory != null) { |
187 | return defaultSearchBackendFactory; | 187 | return defaultSearchBackendFactory; |
@@ -211,12 +211,12 @@ public final class ViatraQueryEngineOptions { | |||
211 | /** | 211 | /** |
212 | * Initializes an option builder with settings from an existing configuration. | 212 | * Initializes an option builder with settings from an existing configuration. |
213 | */ | 213 | */ |
214 | public static Builder copyOptions(ViatraQueryEngineOptions options) { | 214 | public static Builder copyOptions(InterpreterEngineOptions options) { |
215 | return new Builder(options); | 215 | return new Builder(options); |
216 | } | 216 | } |
217 | 217 | ||
218 | private ViatraQueryEngineOptions(QueryEvaluationHint engineDefaultHints, | 218 | private InterpreterEngineOptions(QueryEvaluationHint engineDefaultHints, |
219 | IQueryBackendFactory defaultCachingBackendFactory, IQueryBackendFactory defaultSearchBackendFactory) { | 219 | IQueryBackendFactory defaultCachingBackendFactory, IQueryBackendFactory defaultSearchBackendFactory) { |
220 | this.engineDefaultHints = engineDefaultHints; | 220 | this.engineDefaultHints = engineDefaultHints; |
221 | this.defaultCachingBackendFactory = defaultCachingBackendFactory; | 221 | this.defaultCachingBackendFactory = defaultCachingBackendFactory; |
222 | this.defaultSearchBackendFactory = defaultSearchBackendFactory; | 222 | this.defaultSearchBackendFactory = defaultSearchBackendFactory; |
@@ -228,20 +228,20 @@ public final class ViatraQueryEngineOptions { | |||
228 | 228 | ||
229 | /** | 229 | /** |
230 | * Returns the configured default backend | 230 | * Returns the configured default backend |
231 | * | 231 | * |
232 | * @return the defaultBackendFactory | 232 | * @return the defaultBackendFactory |
233 | */ | 233 | */ |
234 | public IQueryBackendFactory getDefaultBackendFactory() { | 234 | public IQueryBackendFactory getDefaultBackendFactory() { |
235 | switch (engineDefaultHints.getQueryBackendRequirementType()) { | 235 | switch (engineDefaultHints.getQueryBackendRequirementType()) { |
236 | case DEFAULT_CACHING: | 236 | case DEFAULT_CACHING: |
237 | return ViatraQueryEngineOptions.getSystemDefaultCachingBackend(); | 237 | return InterpreterEngineOptions.getSystemDefaultCachingBackend(); |
238 | case DEFAULT_SEARCH: | 238 | case DEFAULT_SEARCH: |
239 | return ViatraQueryEngineOptions.getSystemDefaultCachingBackend(); | 239 | return InterpreterEngineOptions.getSystemDefaultCachingBackend(); |
240 | case SPECIFIC: | 240 | case SPECIFIC: |
241 | return engineDefaultHints.getQueryBackendFactory(); | 241 | return engineDefaultHints.getQueryBackendFactory(); |
242 | case UNSPECIFIED: | 242 | case UNSPECIFIED: |
243 | default: | 243 | default: |
244 | return ViatraQueryEngineOptions.getSystemDefaultBackend(); | 244 | return InterpreterEngineOptions.getSystemDefaultBackend(); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | 247 | ||
@@ -252,7 +252,7 @@ public final class ViatraQueryEngineOptions { | |||
252 | public IQueryBackendFactory getDefaultCachingBackendFactory() { | 252 | public IQueryBackendFactory getDefaultCachingBackendFactory() { |
253 | return defaultCachingBackendFactory; | 253 | return defaultCachingBackendFactory; |
254 | } | 254 | } |
255 | 255 | ||
256 | /** | 256 | /** |
257 | * Returns the configured default search-based backend. If the default backend is search-based, it is usually expected, but | 257 | * Returns the configured default search-based backend. If the default backend is search-based, it is usually expected, but |
258 | * not mandatory for the two default backends to be the same. | 258 | * not mandatory for the two default backends to be the same. |
@@ -265,12 +265,12 @@ public final class ViatraQueryEngineOptions { | |||
265 | @Override | 265 | @Override |
266 | public String toString() { | 266 | public String toString() { |
267 | // TODO defaultCachingBackendFactory is ignored | 267 | // TODO defaultCachingBackendFactory is ignored |
268 | if(Objects.equals(engineDefaultHints, DEFAULT.engineDefaultHints)) | 268 | if(Objects.equals(engineDefaultHints, DEFAULT.engineDefaultHints)) |
269 | return "defaults"; | 269 | return "defaults"; |
270 | else | 270 | else |
271 | return engineDefaultHints.toString(); | 271 | return engineDefaultHints.toString(); |
272 | } | 272 | } |
273 | 273 | ||
274 | /** | 274 | /** |
275 | * @since 2.0 | 275 | * @since 2.0 |
276 | */ | 276 | */ |
@@ -280,9 +280,9 @@ public final class ViatraQueryEngineOptions { | |||
280 | } | 280 | } |
281 | 281 | ||
282 | switch (hint.getQueryBackendRequirementType()) { | 282 | switch (hint.getQueryBackendRequirementType()) { |
283 | case DEFAULT_CACHING: | 283 | case DEFAULT_CACHING: |
284 | return getDefaultCachingBackendFactory(); | 284 | return getDefaultCachingBackendFactory(); |
285 | case DEFAULT_SEARCH: | 285 | case DEFAULT_SEARCH: |
286 | return getDefaultSearchBackendFactory(); | 286 | return getDefaultSearchBackendFactory(); |
287 | case SPECIFIC: | 287 | case SPECIFIC: |
288 | return hint.getQueryBackendFactory(); | 288 | return hint.getQueryBackendFactory(); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryMatcher.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterMatcher.java index 1ae0c96f..beeb124c 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryMatcher.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterMatcher.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.api; | 10 | package tools.refinery.interpreter.api; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.List; | 13 | import java.util.List; |
@@ -17,17 +17,17 @@ import java.util.function.Consumer; | |||
17 | import java.util.stream.Stream; | 17 | import java.util.stream.Stream; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Interface for a VIATRA Query matcher associated with a graph pattern. | 20 | * Interface for a Refinery Interpreter matcher associated with a graph pattern. |
21 | * | 21 | * |
22 | * @param <Match> | 22 | * @param <Match> |
23 | * the IPatternMatch type representing a single match of this pattern. | 23 | * the IPatternMatch type representing a single match of this pattern. |
24 | * @author Bergmann Gábor | 24 | * @author Bergmann Gábor |
25 | * @noimplement This interface is not intended to be implemented by clients. Implement BaseMatcher instead. | 25 | * @noimplement This interface is not intended to be implemented by clients. Implement BaseMatcher instead. |
26 | */ | 26 | */ |
27 | public interface ViatraQueryMatcher<Match extends IPatternMatch> { | 27 | public interface InterpreterMatcher<Match extends IPatternMatch> { |
28 | // REFLECTION | 28 | // REFLECTION |
29 | /** The pattern that will be matched. */ | 29 | /** The pattern that will be matched. */ |
30 | IQuerySpecification<? extends ViatraQueryMatcher<Match>> getSpecification(); | 30 | IQuerySpecification<? extends InterpreterMatcher<Match>> getSpecification(); |
31 | 31 | ||
32 | /** Fully qualified name of the pattern. */ | 32 | /** Fully qualified name of the pattern. */ |
33 | String getPatternName(); | 33 | String getPatternName(); |
@@ -41,40 +41,40 @@ public interface ViatraQueryMatcher<Match extends IPatternMatch> { | |||
41 | // ALL MATCHES | 41 | // ALL MATCHES |
42 | /** | 42 | /** |
43 | * Returns the set of all pattern matches. | 43 | * Returns the set of all pattern matches. |
44 | * | 44 | * |
45 | * @return matches represented as a Match object. | 45 | * @return matches represented as a Match object. |
46 | */ | 46 | */ |
47 | Collection<Match> getAllMatches(); | 47 | Collection<Match> getAllMatches(); |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | 50 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. |
51 | * | 51 | * |
52 | * @param partialMatch | 52 | * @param partialMatch |
53 | * a partial match of the pattern where each non-null field binds the corresponding pattern parameter to | 53 | * a partial match of the pattern where each non-null field binds the corresponding pattern parameter to |
54 | * a fixed value. | 54 | * a fixed value. |
55 | * @return matches represented as a Match object. | 55 | * @return matches represented as a Match object. |
56 | */ | 56 | */ |
57 | Collection<Match> getAllMatches(Match partialMatch); | 57 | Collection<Match> getAllMatches(Match partialMatch); |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * Returns a stream of all pattern matches. | 60 | * Returns a stream of all pattern matches. |
61 | * <p> | 61 | * <p> |
62 | * <strong>WARNING</strong> If the result set changes while the stream is evaluated, the set of matches included in | 62 | * <strong>WARNING</strong> If the result set changes while the stream is evaluated, the set of matches included in |
63 | * the stream are unspecified. In such cases, either rely on {@link #getAllMatches()} or collect the results of the | 63 | * the stream are unspecified. In such cases, either rely on {@link #getAllMatches()} or collect the results of the |
64 | * stream in end-user code. | 64 | * stream in end-user code. |
65 | * | 65 | * |
66 | * @return matches represented as a Match object. | 66 | * @return matches represented as a Match object. |
67 | * @since 2.0 | 67 | * @since 2.0 |
68 | */ | 68 | */ |
69 | Stream<Match> streamAllMatches(); | 69 | Stream<Match> streamAllMatches(); |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | 72 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. |
73 | * <p> | 73 | * <p> |
74 | * <strong>WARNING</strong> If the result set changes while the stream is evaluated, the set of matches included in | 74 | * <strong>WARNING</strong> If the result set changes while the stream is evaluated, the set of matches included in |
75 | * the stream are unspecified. In such cases, either rely on {@link #getAllMatches()} or collect the results of the | 75 | * the stream are unspecified. In such cases, either rely on {@link #getAllMatches()} or collect the results of the |
76 | * stream in end-user code. | 76 | * stream in end-user code. |
77 | * | 77 | * |
78 | * @param partialMatch | 78 | * @param partialMatch |
79 | * a partial match of the pattern where each non-null field binds the corresponding pattern parameter to | 79 | * a partial match of the pattern where each non-null field binds the corresponding pattern parameter to |
80 | * a fixed value. | 80 | * a fixed value. |
@@ -82,13 +82,13 @@ public interface ViatraQueryMatcher<Match extends IPatternMatch> { | |||
82 | * @since 2.0 | 82 | * @since 2.0 |
83 | */ | 83 | */ |
84 | Stream<Match> streamAllMatches(Match partialMatch); | 84 | Stream<Match> streamAllMatches(Match partialMatch); |
85 | 85 | ||
86 | // variant(s) with input binding as pattern-specific parameters: not declared in interface | 86 | // variant(s) with input binding as pattern-specific parameters: not declared in interface |
87 | 87 | ||
88 | // SINGLE MATCH | 88 | // SINGLE MATCH |
89 | /** | 89 | /** |
90 | * Returns an arbitrarily chosen pattern match. Neither determinism nor randomness of selection is guaranteed. | 90 | * Returns an arbitrarily chosen pattern match. Neither determinism nor randomness of selection is guaranteed. |
91 | * | 91 | * |
92 | * @return a match represented as a Match object, or an empty Optional if no match is found. | 92 | * @return a match represented as a Match object, or an empty Optional if no match is found. |
93 | * @since 2.0 | 93 | * @since 2.0 |
94 | */ | 94 | */ |
@@ -97,7 +97,7 @@ public interface ViatraQueryMatcher<Match extends IPatternMatch> { | |||
97 | /** | 97 | /** |
98 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | 98 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. |
99 | * Neither determinism nor randomness of selection is guaranteed. | 99 | * Neither determinism nor randomness of selection is guaranteed. |
100 | * | 100 | * |
101 | * @param partialMatch | 101 | * @param partialMatch |
102 | * a partial match of the pattern where each non-null field binds the corresponding pattern parameter to | 102 | * a partial match of the pattern where each non-null field binds the corresponding pattern parameter to |
103 | * a fixed value. | 103 | * a fixed value. |
@@ -111,16 +111,16 @@ public interface ViatraQueryMatcher<Match extends IPatternMatch> { | |||
111 | // MATCH CHECKING | 111 | // MATCH CHECKING |
112 | /** | 112 | /** |
113 | * Indicates whether the query has any kind of matches. | 113 | * Indicates whether the query has any kind of matches. |
114 | * | 114 | * |
115 | * @return true if there exists a valid match of the pattern. | 115 | * @return true if there exists a valid match of the pattern. |
116 | * @since 1.7 | 116 | * @since 1.7 |
117 | */ | 117 | */ |
118 | boolean hasMatch(); | 118 | boolean hasMatch(); |
119 | 119 | ||
120 | /** | 120 | /** |
121 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, under | 121 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, under |
122 | * any possible substitution of the unspecified parameters (if any). | 122 | * any possible substitution of the unspecified parameters (if any). |
123 | * | 123 | * |
124 | * @param partialMatch | 124 | * @param partialMatch |
125 | * a (partial) match of the pattern where each non-null field binds the corresponding pattern parameter | 125 | * a (partial) match of the pattern where each non-null field binds the corresponding pattern parameter |
126 | * to a fixed value. | 126 | * to a fixed value. |
@@ -133,14 +133,14 @@ public interface ViatraQueryMatcher<Match extends IPatternMatch> { | |||
133 | // NUMBER OF MATCHES | 133 | // NUMBER OF MATCHES |
134 | /** | 134 | /** |
135 | * Returns the number of all pattern matches. | 135 | * Returns the number of all pattern matches. |
136 | * | 136 | * |
137 | * @return the number of pattern matches found. | 137 | * @return the number of pattern matches found. |
138 | */ | 138 | */ |
139 | int countMatches(); | 139 | int countMatches(); |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | 142 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. |
143 | * | 143 | * |
144 | * @param partialMatch | 144 | * @param partialMatch |
145 | * a partial match of the pattern where each non-null field binds the corresponding pattern parameter to | 145 | * a partial match of the pattern where each non-null field binds the corresponding pattern parameter to |
146 | * a fixed value. | 146 | * a fixed value. |
@@ -153,7 +153,7 @@ public interface ViatraQueryMatcher<Match extends IPatternMatch> { | |||
153 | // FOR EACH MATCH | 153 | // FOR EACH MATCH |
154 | /** | 154 | /** |
155 | * Executes the given processor on each match of the pattern. | 155 | * Executes the given processor on each match of the pattern. |
156 | * | 156 | * |
157 | * @param processor | 157 | * @param processor |
158 | * the action that will process each pattern match. | 158 | * the action that will process each pattern match. |
159 | * @since 2.0 | 159 | * @since 2.0 |
@@ -163,7 +163,7 @@ public interface ViatraQueryMatcher<Match extends IPatternMatch> { | |||
163 | /** | 163 | /** |
164 | * Executes the given processor on each match of the pattern that conforms to the given fixed values of some | 164 | * Executes the given processor on each match of the pattern that conforms to the given fixed values of some |
165 | * parameters. | 165 | * parameters. |
166 | * | 166 | * |
167 | * @param partialMatch | 167 | * @param partialMatch |
168 | * array where each non-null element binds the corresponding pattern parameter to a fixed value. | 168 | * array where each non-null element binds the corresponding pattern parameter to a fixed value. |
169 | * @param processor | 169 | * @param processor |
@@ -178,7 +178,7 @@ public interface ViatraQueryMatcher<Match extends IPatternMatch> { | |||
178 | /** | 178 | /** |
179 | * Executes the given processor on an arbitrarily chosen match of the pattern. Neither determinism nor randomness of | 179 | * Executes the given processor on an arbitrarily chosen match of the pattern. Neither determinism nor randomness of |
180 | * selection is guaranteed. | 180 | * selection is guaranteed. |
181 | * | 181 | * |
182 | * @param processor | 182 | * @param processor |
183 | * the action that will process the selected match. | 183 | * the action that will process the selected match. |
184 | * @return true if the pattern has at least one match, false if the processor was not invoked | 184 | * @return true if the pattern has at least one match, false if the processor was not invoked |
@@ -189,7 +189,7 @@ public interface ViatraQueryMatcher<Match extends IPatternMatch> { | |||
189 | /** | 189 | /** |
190 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed | 190 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed |
191 | * values of some parameters. Neither determinism nor randomness of selection is guaranteed. | 191 | * values of some parameters. Neither determinism nor randomness of selection is guaranteed. |
192 | * | 192 | * |
193 | * @param partialMatch | 193 | * @param partialMatch |
194 | * array where each non-null element binds the corresponding pattern parameter to a fixed value. | 194 | * array where each non-null element binds the corresponding pattern parameter to a fixed value. |
195 | * @param processor | 195 | * @param processor |
@@ -201,24 +201,24 @@ public interface ViatraQueryMatcher<Match extends IPatternMatch> { | |||
201 | boolean forOneArbitraryMatch(Match partialMatch, Consumer<? super Match> processor); | 201 | boolean forOneArbitraryMatch(Match partialMatch, Consumer<? super Match> processor); |
202 | 202 | ||
203 | // variant(s) with input binding as pattern-specific parameters: not declared in interface | 203 | // variant(s) with input binding as pattern-specific parameters: not declared in interface |
204 | 204 | ||
205 | /** | 205 | /** |
206 | * Returns an empty, mutable Match for the matcher. | 206 | * Returns an empty, mutable Match for the matcher. |
207 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | 207 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. |
208 | * This can be used to call the matcher with a partial match | 208 | * This can be used to call the matcher with a partial match |
209 | * even if the specific class of the matcher or the match is unknown. | 209 | * even if the specific class of the matcher or the match is unknown. |
210 | * | 210 | * |
211 | * @return the empty match | 211 | * @return the empty match |
212 | */ | 212 | */ |
213 | Match newEmptyMatch(); | 213 | Match newEmptyMatch(); |
214 | 214 | ||
215 | /** | 215 | /** |
216 | * Returns a new (partial) Match object for the matcher. | 216 | * Returns a new (partial) Match object for the matcher. |
217 | * This can be used e.g. to call the matcher with a partial | 217 | * This can be used e.g. to call the matcher with a partial |
218 | * match. | 218 | * match. |
219 | * | 219 | * |
220 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | 220 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. |
221 | * | 221 | * |
222 | * @param parameters | 222 | * @param parameters |
223 | * the fixed value of pattern parameters, or null if not bound. | 223 | * the fixed value of pattern parameters, or null if not bound. |
224 | * @return the (partial) match object. | 224 | * @return the (partial) match object. |
@@ -227,7 +227,7 @@ public interface ViatraQueryMatcher<Match extends IPatternMatch> { | |||
227 | 227 | ||
228 | /** | 228 | /** |
229 | * Retrieve the set of values that occur in matches for the given parameterName. | 229 | * Retrieve the set of values that occur in matches for the given parameterName. |
230 | * | 230 | * |
231 | * @param parameterName | 231 | * @param parameterName |
232 | * name of the parameter for which values are returned | 232 | * name of the parameter for which values are returned |
233 | * @return the Set of all values for the given parameter, null if the parameter with the given name does not exists, | 233 | * @return the Set of all values for the given parameter, null if the parameter with the given name does not exists, |
@@ -238,7 +238,7 @@ public interface ViatraQueryMatcher<Match extends IPatternMatch> { | |||
238 | /** | 238 | /** |
239 | * Retrieve the set of values that occur in matches for the given parameterName, that conforms to the given fixed | 239 | * Retrieve the set of values that occur in matches for the given parameterName, that conforms to the given fixed |
240 | * values of some parameters. | 240 | * values of some parameters. |
241 | * | 241 | * |
242 | * @param parameterName | 242 | * @param parameterName |
243 | * name of the parameter for which values are returned | 243 | * name of the parameter for which values are returned |
244 | * @param partialMatch | 244 | * @param partialMatch |
@@ -251,8 +251,8 @@ public interface ViatraQueryMatcher<Match extends IPatternMatch> { | |||
251 | 251 | ||
252 | /** | 252 | /** |
253 | * Returns the engine that the matcher uses. | 253 | * Returns the engine that the matcher uses. |
254 | * | 254 | * |
255 | * @return the engine | 255 | * @return the engine |
256 | */ | 256 | */ |
257 | ViatraQueryEngine getEngine(); | 257 | InterpreterEngine getEngine(); |
258 | } \ No newline at end of file | 258 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryModelUpdateListener.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterModelUpdateListener.java index da8bf87e..796b1828 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryModelUpdateListener.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/InterpreterModelUpdateListener.java | |||
@@ -3,30 +3,30 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api; | 9 | package tools.refinery.interpreter.api; |
10 | 10 | ||
11 | 11 | ||
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Listener interface for model changes affecting different levels of the VIATRA Query architecture. | 14 | * Listener interface for model changes affecting different levels of the Refinery Interpreter architecture. |
15 | * | 15 | * |
16 | * @author Abel Hegedus | 16 | * @author Abel Hegedus |
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | public interface ViatraQueryModelUpdateListener { | 19 | public interface InterpreterModelUpdateListener { |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Possible notification levels for changes | 22 | * Possible notification levels for changes |
23 | * | 23 | * |
24 | * @author Abel Hegedus | 24 | * @author Abel Hegedus |
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | enum ChangeLevel { | 27 | enum ChangeLevel { |
28 | NO_CHANGE, MODEL, INDEX, MATCHSET; | 28 | NO_CHANGE, MODEL, INDEX, MATCHSET; |
29 | 29 | ||
30 | public ChangeLevel changeOccured(ChangeLevel occuredLevel) { | 30 | public ChangeLevel changeOccured(ChangeLevel occuredLevel) { |
31 | if(this.compareTo(occuredLevel) < 0) { | 31 | if(this.compareTo(occuredLevel) < 0) { |
32 | return occuredLevel; | 32 | return occuredLevel; |
@@ -38,18 +38,18 @@ public interface ViatraQueryModelUpdateListener { | |||
38 | /** | 38 | /** |
39 | * Called after each change with also sending the level of change. | 39 | * Called after each change with also sending the level of change. |
40 | * Only called if the change level is at least at the level returned by getLevel(). | 40 | * Only called if the change level is at least at the level returned by getLevel(). |
41 | * | 41 | * |
42 | * @param changeLevel | 42 | * @param changeLevel |
43 | */ | 43 | */ |
44 | void notifyChanged(ChangeLevel changeLevel); | 44 | void notifyChanged(ChangeLevel changeLevel); |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * This may be queried only ONCE (!!!) at the registration of the listener. | 47 | * This may be queried only ONCE (!!!) at the registration of the listener. |
48 | * | 48 | * |
49 | * NOTE: this allows us to only create engine level change providers if there is someone who needs it. | 49 | * NOTE: this allows us to only create engine level change providers if there is someone who needs it. |
50 | * | 50 | * |
51 | * @return the change level where you want notifications | 51 | * @return the change level where you want notifications |
52 | */ | 52 | */ |
53 | ChangeLevel getLevel(); | 53 | ChangeLevel getLevel(); |
54 | 54 | ||
55 | } | 55 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/MatchUpdateAdapter.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/MatchUpdateAdapter.java index 7de6d2c6..7b3a2087 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/MatchUpdateAdapter.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/MatchUpdateAdapter.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api; | 9 | package tools.refinery.interpreter.api; |
10 | 10 | ||
11 | import java.util.function.Consumer; | 11 | import java.util.function.Consumer; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * A default implementation of {@link IMatchUpdateListener} that contains two match processors, one for appearance, one | 14 | * A default implementation of {@link IMatchUpdateListener} that contains two match processors, one for appearance, one |
15 | * for disappearance. Any of the two can be null; in this case, corresponding notifications will be ignored. | 15 | * for disappearance. Any of the two can be null; in this case, corresponding notifications will be ignored. |
16 | * | 16 | * |
17 | * <p> | 17 | * <p> |
18 | * Instantiate using either constructor. | 18 | * Instantiate using either constructor. |
19 | * | 19 | * |
20 | * @author Bergmann Gabor | 20 | * @author Bergmann Gabor |
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | public class MatchUpdateAdapter<Match extends IPatternMatch> implements IMatchUpdateListener<Match> { | 23 | public class MatchUpdateAdapter<Match extends IPatternMatch> implements IMatchUpdateListener<Match> { |
24 | 24 | ||
@@ -27,7 +27,7 @@ public class MatchUpdateAdapter<Match extends IPatternMatch> implements IMatchUp | |||
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Constructs an instance without any match processors registered yet. | 29 | * Constructs an instance without any match processors registered yet. |
30 | * | 30 | * |
31 | * Use {@link #setAppearCallback(Consumer)} and {@link #setDisappearCallback(Consumer)} to specify | 31 | * Use {@link #setAppearCallback(Consumer)} and {@link #setDisappearCallback(Consumer)} to specify |
32 | * optional match processors for match appearance and disappearance, respectively. | 32 | * optional match processors for match appearance and disappearance, respectively. |
33 | */ | 33 | */ |
@@ -37,7 +37,7 @@ public class MatchUpdateAdapter<Match extends IPatternMatch> implements IMatchUp | |||
37 | 37 | ||
38 | /** | 38 | /** |
39 | * Constructs an instance by specifying match processors. | 39 | * Constructs an instance by specifying match processors. |
40 | * | 40 | * |
41 | * @param appearCallback | 41 | * @param appearCallback |
42 | * a match processor that will be invoked on each new match that appears. If null, no callback will be | 42 | * a match processor that will be invoked on each new match that appears. If null, no callback will be |
43 | * executed on match appearance. See {@link Consumer} for details on how to implement. | 43 | * executed on match appearance. See {@link Consumer} for details on how to implement. |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BaseGeneratedPatternGroup.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BaseGeneratedPatternGroup.java index 2e2a823b..be8fc07c 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BaseGeneratedPatternGroup.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BaseGeneratedPatternGroup.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api.impl; | 9 | package tools.refinery.interpreter.api.impl; |
10 | 10 | ||
11 | import java.util.HashSet; | 11 | import java.util.HashSet; |
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.api.IQuerySpecification; | 14 | import tools.refinery.interpreter.api.IQuerySpecification; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * @author Mark Czotter | 17 | * @author Mark Czotter |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | public abstract class BaseGeneratedPatternGroup extends BaseQueryGroup { | 20 | public abstract class BaseGeneratedPatternGroup extends BaseQueryGroup { |
21 | 21 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BaseMatcher.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BaseMatcher.java index ad79aafd..7cf36736 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BaseMatcher.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BaseMatcher.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.api.impl; | 10 | package tools.refinery.interpreter.api.impl; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.List; | 13 | import java.util.List; |
@@ -17,15 +17,15 @@ import java.util.function.Consumer; | |||
17 | import java.util.stream.Collectors; | 17 | import java.util.stream.Collectors; |
18 | import java.util.stream.Stream; | 18 | import java.util.stream.Stream; |
19 | 19 | ||
20 | import tools.refinery.viatra.runtime.api.IPatternMatch; | 20 | import tools.refinery.interpreter.internal.apiimpl.QueryResultWrapper; |
21 | import tools.refinery.viatra.runtime.api.IQuerySpecification; | 21 | import tools.refinery.interpreter.matchers.backend.IMatcherCapability; |
22 | import tools.refinery.viatra.runtime.api.ViatraQueryEngine; | 22 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
23 | import tools.refinery.viatra.runtime.api.ViatraQueryMatcher; | 23 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
24 | import tools.refinery.viatra.runtime.internal.apiimpl.QueryResultWrapper; | 24 | import tools.refinery.interpreter.matchers.util.Preconditions; |
25 | import tools.refinery.viatra.runtime.matchers.backend.IMatcherCapability; | 25 | import tools.refinery.interpreter.api.IPatternMatch; |
26 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 26 | import tools.refinery.interpreter.api.IQuerySpecification; |
27 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 27 | import tools.refinery.interpreter.api.InterpreterEngine; |
28 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 28 | import tools.refinery.interpreter.api.InterpreterMatcher; |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Base implementation of ViatraQueryMatcher. | 31 | * Base implementation of ViatraQueryMatcher. |
@@ -34,11 +34,11 @@ import tools.refinery.viatra.runtime.matchers.util.Preconditions; | |||
34 | * | 34 | * |
35 | * @param <Match> | 35 | * @param <Match> |
36 | */ | 36 | */ |
37 | public abstract class BaseMatcher<Match extends IPatternMatch> extends QueryResultWrapper implements ViatraQueryMatcher<Match> { | 37 | public abstract class BaseMatcher<Match extends IPatternMatch> extends QueryResultWrapper implements InterpreterMatcher<Match> { |
38 | 38 | ||
39 | // FIELDS AND CONSTRUCTOR | 39 | // FIELDS AND CONSTRUCTOR |
40 | 40 | ||
41 | protected ViatraQueryEngine engine; | 41 | protected InterpreterEngine engine; |
42 | protected IQuerySpecification<? extends BaseMatcher<Match>> querySpecification; | 42 | protected IQuerySpecification<? extends BaseMatcher<Match>> querySpecification; |
43 | private IMatcherCapability capabilities; | 43 | private IMatcherCapability capabilities; |
44 | 44 | ||
@@ -49,13 +49,13 @@ public abstract class BaseMatcher<Match extends IPatternMatch> extends QueryResu | |||
49 | this.querySpecification = querySpecification; | 49 | this.querySpecification = querySpecification; |
50 | this.querySpecification.getInternalQueryRepresentation().ensureInitialized(); | 50 | this.querySpecification.getInternalQueryRepresentation().ensureInitialized(); |
51 | } | 51 | } |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * @since 1.4 | 54 | * @since 1.4 |
55 | */ | 55 | */ |
56 | @Override | 56 | @Override |
57 | protected | 57 | protected |
58 | void setBackend(ViatraQueryEngine engine, IQueryResultProvider resultProvider, IMatcherCapability capabilities){ | 58 | void setBackend(InterpreterEngine engine, IQueryResultProvider resultProvider, IMatcherCapability capabilities){ |
59 | this.backend = resultProvider; | 59 | this.backend = resultProvider; |
60 | this.engine = engine; | 60 | this.engine = engine; |
61 | this.capabilities = capabilities; | 61 | this.capabilities = capabilities; |
@@ -101,7 +101,7 @@ public abstract class BaseMatcher<Match extends IPatternMatch> extends QueryResu | |||
101 | public Collection<Match> getAllMatches() { | 101 | public Collection<Match> getAllMatches() { |
102 | return rawStreamAllMatches(emptyArray()).collect(Collectors.toSet()); | 102 | return rawStreamAllMatches(emptyArray()).collect(Collectors.toSet()); |
103 | } | 103 | } |
104 | 104 | ||
105 | @Override | 105 | @Override |
106 | public Stream<Match> streamAllMatches() { | 106 | public Stream<Match> streamAllMatches() { |
107 | return rawStreamAllMatches(emptyArray()); | 107 | return rawStreamAllMatches(emptyArray()); |
@@ -125,7 +125,7 @@ public abstract class BaseMatcher<Match extends IPatternMatch> extends QueryResu | |||
125 | public Collection<Match> getAllMatches(Match partialMatch) { | 125 | public Collection<Match> getAllMatches(Match partialMatch) { |
126 | return rawStreamAllMatches(partialMatch.toArray()).collect(Collectors.toSet()); | 126 | return rawStreamAllMatches(partialMatch.toArray()).collect(Collectors.toSet()); |
127 | } | 127 | } |
128 | 128 | ||
129 | @Override | 129 | @Override |
130 | public Stream<Match> streamAllMatches(Match partialMatch) { | 130 | public Stream<Match> streamAllMatches(Match partialMatch) { |
131 | return rawStreamAllMatches(partialMatch.toArray()); | 131 | return rawStreamAllMatches(partialMatch.toArray()); |
@@ -175,7 +175,7 @@ public abstract class BaseMatcher<Match extends IPatternMatch> extends QueryResu | |||
175 | public boolean hasMatch() { | 175 | public boolean hasMatch() { |
176 | return rawHasMatch(emptyArray()); | 176 | return rawHasMatch(emptyArray()); |
177 | } | 177 | } |
178 | 178 | ||
179 | @Override | 179 | @Override |
180 | public boolean hasMatch(Match partialMatch) { | 180 | public boolean hasMatch(Match partialMatch) { |
181 | return rawHasMatch(partialMatch.toArray()); | 181 | return rawHasMatch(partialMatch.toArray()); |
@@ -286,7 +286,7 @@ public abstract class BaseMatcher<Match extends IPatternMatch> extends QueryResu | |||
286 | public Set<Object> getAllValues(final String parameterName, Match partialMatch) { | 286 | public Set<Object> getAllValues(final String parameterName, Match partialMatch) { |
287 | return rawStreamAllValues(getPositionOfParameter(parameterName), partialMatch.toArray()).collect(Collectors.toSet()); | 287 | return rawStreamAllValues(getPositionOfParameter(parameterName), partialMatch.toArray()).collect(Collectors.toSet()); |
288 | } | 288 | } |
289 | 289 | ||
290 | /** | 290 | /** |
291 | * Retrieve a stream of values that occur in matches for the given parameterName, that conforms to the given fixed | 291 | * Retrieve a stream of values that occur in matches for the given parameterName, that conforms to the given fixed |
292 | * values of some parameters. | 292 | * values of some parameters. |
@@ -325,9 +325,9 @@ public abstract class BaseMatcher<Match extends IPatternMatch> extends QueryResu | |||
325 | protected <T> void rawAccumulateAllValues(final int position, Object[] parameters, final Set<T> accumulator) { | 325 | protected <T> void rawAccumulateAllValues(final int position, Object[] parameters, final Set<T> accumulator) { |
326 | rawForEachMatch(parameters, match -> accumulator.add((T) match.get(position))); | 326 | rawForEachMatch(parameters, match -> accumulator.add((T) match.get(position))); |
327 | } | 327 | } |
328 | 328 | ||
329 | @Override | 329 | @Override |
330 | public ViatraQueryEngine getEngine() { | 330 | public InterpreterEngine getEngine() { |
331 | return engine; | 331 | return engine; |
332 | } | 332 | } |
333 | 333 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BasePatternMatch.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BasePatternMatch.java index 182bb466..0dfaa666 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BasePatternMatch.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BasePatternMatch.java | |||
@@ -7,9 +7,9 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.api.impl; | 10 | package tools.refinery.interpreter.api.impl; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.api.IPatternMatch; | 12 | import tools.refinery.interpreter.api.IPatternMatch; |
13 | 13 | ||
14 | import java.util.Arrays; | 14 | import java.util.Arrays; |
15 | import java.util.Collections; | 15 | import java.util.Collections; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BaseQueryGroup.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BaseQueryGroup.java index b92727e7..c0f619ea 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BaseQueryGroup.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BaseQueryGroup.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api.impl; | 9 | package tools.refinery.interpreter.api.impl; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.api.AdvancedViatraQueryEngine; | 11 | import tools.refinery.interpreter.api.AdvancedInterpreterEngine; |
12 | import tools.refinery.viatra.runtime.api.IQueryGroup; | 12 | import tools.refinery.interpreter.api.IQueryGroup; |
13 | import tools.refinery.viatra.runtime.api.ViatraQueryEngine; | 13 | import tools.refinery.interpreter.api.InterpreterEngine; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Base implementation of {@link IQueryGroup}. | 16 | * Base implementation of {@link IQueryGroup}. |
@@ -21,13 +21,13 @@ import tools.refinery.viatra.runtime.api.ViatraQueryEngine; | |||
21 | public abstract class BaseQueryGroup implements IQueryGroup { | 21 | public abstract class BaseQueryGroup implements IQueryGroup { |
22 | 22 | ||
23 | @Override | 23 | @Override |
24 | public void prepare(ViatraQueryEngine engine) { | 24 | public void prepare(InterpreterEngine engine) { |
25 | prepare(AdvancedViatraQueryEngine.from(engine)); | 25 | prepare(AdvancedInterpreterEngine.from(engine)); |
26 | } | 26 | } |
27 | 27 | ||
28 | protected void prepare(AdvancedViatraQueryEngine engine) { | 28 | protected void prepare(AdvancedInterpreterEngine engine) { |
29 | engine.prepareGroup(this, null /* default options */); | 29 | engine.prepareGroup(this, null /* default options */); |
30 | } | 30 | } |
31 | 31 | ||
32 | 32 | ||
33 | } | 33 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BaseQuerySpecification.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BaseQuerySpecification.java index bee4b93d..411a8c18 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/impl/BaseQuerySpecification.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/impl/BaseQuerySpecification.java | |||
@@ -3,27 +3,26 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.api.impl; | 10 | package tools.refinery.interpreter.api.impl; |
11 | 11 | ||
12 | import java.util.List; | 12 | import java.util.List; |
13 | import java.util.Optional; | 13 | import java.util.Optional; |
14 | import java.util.stream.Collectors; | 14 | import java.util.stream.Collectors; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.api.IPatternMatch; | 16 | import tools.refinery.interpreter.exception.InterpreterException; |
17 | import tools.refinery.viatra.runtime.api.IQuerySpecification; | 17 | import tools.refinery.interpreter.matchers.psystem.annotations.PAnnotation; |
18 | import tools.refinery.viatra.runtime.api.ViatraQueryEngine; | 18 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
19 | import tools.refinery.viatra.runtime.api.ViatraQueryMatcher; | 19 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
20 | import tools.refinery.viatra.runtime.exception.ViatraQueryException; | 20 | import tools.refinery.interpreter.matchers.psystem.queries.PVisibility; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.annotations.PAnnotation; | 21 | import tools.refinery.interpreter.matchers.psystem.queries.QueryInitializationException; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 22 | import tools.refinery.interpreter.api.IPatternMatch; |
23 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 23 | import tools.refinery.interpreter.api.IQuerySpecification; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.queries.QueryInitializationException; | 24 | import tools.refinery.interpreter.api.InterpreterEngine; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery.PQueryStatus; | 25 | import tools.refinery.interpreter.api.InterpreterMatcher; |
26 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PVisibility; | ||
27 | 26 | ||
28 | /** | 27 | /** |
29 | * Base implementation of IQuerySpecification. | 28 | * Base implementation of IQuerySpecification. |
@@ -31,41 +30,41 @@ import tools.refinery.viatra.runtime.matchers.psystem.queries.PVisibility; | |||
31 | * @author Gabor Bergmann | 30 | * @author Gabor Bergmann |
32 | * | 31 | * |
33 | */ | 32 | */ |
34 | public abstract class BaseQuerySpecification<Matcher extends ViatraQueryMatcher<? extends IPatternMatch>> implements | 33 | public abstract class BaseQuerySpecification<Matcher extends InterpreterMatcher<? extends IPatternMatch>> implements |
35 | IQuerySpecification<Matcher> { | 34 | IQuerySpecification<Matcher> { |
36 | 35 | ||
37 | /** | 36 | /** |
38 | * @since 1.6 | 37 | * @since 1.6 |
39 | */ | 38 | */ |
40 | protected static ViatraQueryException processInitializerError(ExceptionInInitializerError err) { | 39 | protected static InterpreterException processInitializerError(ExceptionInInitializerError err) { |
41 | Throwable cause1 = err.getCause(); | 40 | Throwable cause1 = err.getCause(); |
42 | if (cause1 instanceof RuntimeException) { | 41 | if (cause1 instanceof RuntimeException) { |
43 | Throwable cause2 = ((RuntimeException) cause1).getCause(); | 42 | Throwable cause2 = ((RuntimeException) cause1).getCause(); |
44 | if (cause2 instanceof ViatraQueryException) { | 43 | if (cause2 instanceof InterpreterException) { |
45 | return (ViatraQueryException) cause2; | 44 | return (InterpreterException) cause2; |
46 | } else if (cause2 instanceof QueryInitializationException) { | 45 | } else if (cause2 instanceof QueryInitializationException) { |
47 | return new ViatraQueryException((QueryInitializationException) cause2); | 46 | return new InterpreterException((QueryInitializationException) cause2); |
48 | } | 47 | } |
49 | } | 48 | } |
50 | throw err; | 49 | throw err; |
51 | } | 50 | } |
52 | protected final PQuery wrappedPQuery; | 51 | protected final PQuery wrappedPQuery; |
53 | 52 | ||
54 | protected abstract Matcher instantiate(ViatraQueryEngine engine); | 53 | protected abstract Matcher instantiate(InterpreterEngine engine); |
55 | 54 | ||
56 | /** | 55 | /** |
57 | * For backward compatibility of code generated with previous versions of viatra query, this method has a default | 56 | * For backward compatibility of code generated with previous versions of viatra query, this method has a default |
58 | * implementation returning null, indicating that a matcher can only be created using the old method, which ignores | 57 | * implementation returning null, indicating that a matcher can only be created using the old method, which ignores |
59 | * the hints provided by the user. | 58 | * the hints provided by the user. |
60 | * | 59 | * |
61 | * @since 1.4 | 60 | * @since 1.4 |
62 | */ | 61 | */ |
63 | @Override | 62 | @Override |
64 | public Matcher instantiate() { | 63 | public Matcher instantiate() { |
65 | return null; | 64 | return null; |
66 | } | 65 | } |
67 | 66 | ||
68 | 67 | ||
69 | /** | 68 | /** |
70 | * Instantiates query specification for the given internal query representation. | 69 | * Instantiates query specification for the given internal query representation. |
71 | */ | 70 | */ |
@@ -82,15 +81,15 @@ public abstract class BaseQuerySpecification<Matcher extends ViatraQueryMatcher< | |||
82 | } | 81 | } |
83 | 82 | ||
84 | @Override | 83 | @Override |
85 | public Matcher getMatcher(ViatraQueryEngine engine) { | 84 | public Matcher getMatcher(InterpreterEngine engine) { |
86 | ensureInitializedInternal(); | 85 | ensureInitializedInternal(); |
87 | if (wrappedPQuery.getStatus() == PQueryStatus.ERROR) { | 86 | if (wrappedPQuery.getStatus() == PQuery.PQueryStatus.ERROR) { |
88 | String errorMessages = wrappedPQuery.getPProblems().stream() | 87 | String errorMessages = wrappedPQuery.getPProblems().stream() |
89 | .map(input -> (input == null) ? "" : input.getShortMessage()).collect(Collectors.joining("\n")); | 88 | .map(input -> (input == null) ? "" : input.getShortMessage()).collect(Collectors.joining("\n")); |
90 | throw new ViatraQueryException(String.format("Erroneous query specification: %s %n %s", getFullyQualifiedName(), errorMessages), | 89 | throw new InterpreterException(String.format("Erroneous query specification: %s %n %s", getFullyQualifiedName(), errorMessages), |
91 | "Cannot initialize matchers on erroneous query specifications."); | 90 | "Cannot initialize matchers on erroneous query specifications."); |
92 | } else if (!engine.getScope().isCompatibleWithQueryScope(this.getPreferredScopeClass())) { | 91 | } else if (!engine.getScope().isCompatibleWithQueryScope(this.getPreferredScopeClass())) { |
93 | throw new ViatraQueryException( | 92 | throw new InterpreterException( |
94 | String.format( | 93 | String.format( |
95 | "Scope class incompatibility: the query %s is formulated over query scopes of class %s, " | 94 | "Scope class incompatibility: the query %s is formulated over query scopes of class %s, " |
96 | + " thus the query engine formulated over scope %s of class %s cannot evaluate it.", | 95 | + " thus the query engine formulated over scope %s of class %s cannot evaluate it.", |
@@ -104,9 +103,9 @@ public abstract class BaseQuerySpecification<Matcher extends ViatraQueryMatcher< | |||
104 | protected void ensureInitializedInternal() { | 103 | protected void ensureInitializedInternal() { |
105 | wrappedPQuery.ensureInitialized(); | 104 | wrappedPQuery.ensureInitialized(); |
106 | } | 105 | } |
107 | 106 | ||
108 | // // DELEGATIONS | 107 | // // DELEGATIONS |
109 | 108 | ||
110 | @Override | 109 | @Override |
111 | public List<PAnnotation> getAllAnnotations() { | 110 | public List<PAnnotation> getAllAnnotations() { |
112 | return wrappedPQuery.getAllAnnotations(); | 111 | return wrappedPQuery.getAllAnnotations(); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/IBaseIndex.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/IBaseIndex.java index 1795a8ef..949ab2d7 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/IBaseIndex.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/IBaseIndex.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api.scope; | 9 | package tools.refinery.interpreter.api.scope; |
10 | 10 | ||
11 | import java.lang.reflect.InvocationTargetException; | 11 | import java.lang.reflect.InvocationTargetException; |
12 | import java.util.concurrent.Callable; | 12 | import java.util.concurrent.Callable; |
@@ -15,39 +15,39 @@ import java.util.concurrent.Callable; | |||
15 | * Represents the index maintained on the model. | 15 | * Represents the index maintained on the model. |
16 | * @author Bergmann Gabor | 16 | * @author Bergmann Gabor |
17 | * @since 0.9 | 17 | * @since 0.9 |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | public interface IBaseIndex { | 20 | public interface IBaseIndex { |
21 | // TODO lightweightObserver? | 21 | // TODO lightweightObserver? |
22 | // TODO ViatraBaseIndexChangeListener? | 22 | // TODO ViatraBaseIndexChangeListener? |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * The given callback will be executed, and all model traversals and index registrations will be delayed until the | 25 | * The given callback will be executed, and all model traversals and index registrations will be delayed until the |
26 | * execution is done. If there are any outstanding feature, class or datatype registrations, a single coalesced model | 26 | * execution is done. If there are any outstanding feature, class or datatype registrations, a single coalesced model |
27 | * traversal will initialize the caches and deliver the notifications. | 27 | * traversal will initialize the caches and deliver the notifications. |
28 | * | 28 | * |
29 | * @param callable | 29 | * @param callable |
30 | */ | 30 | */ |
31 | public <V> V coalesceTraversals(Callable<V> callable) throws InvocationTargetException; | 31 | public <V> V coalesceTraversals(Callable<V> callable) throws InvocationTargetException; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Adds a coarse-grained listener that will be invoked after the NavigationHelper index or the underlying model is changed. Can be used | 34 | * Adds a coarse-grained listener that will be invoked after the NavigationHelper index or the underlying model is changed. Can be used |
35 | * e.g. to check model contents. Not intended for general use. | 35 | * e.g. to check model contents. Not intended for general use. |
36 | * | 36 | * |
37 | * <p/> See {@link #removeBaseIndexChangeListener(ViatraBaseIndexChangeListener)} | 37 | * <p/> See {@link #removeBaseIndexChangeListener(InterpreterBaseIndexChangeListener)} |
38 | * @param listener | 38 | * @param listener |
39 | */ | 39 | */ |
40 | public void addBaseIndexChangeListener(ViatraBaseIndexChangeListener listener); | 40 | public void addBaseIndexChangeListener(InterpreterBaseIndexChangeListener listener); |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Removes a registered listener. | 43 | * Removes a registered listener. |
44 | * | 44 | * |
45 | * <p/> See {@link #addBaseIndexChangeListener(ViatraBaseIndexChangeListener)} | 45 | * <p/> See {@link #addBaseIndexChangeListener(InterpreterBaseIndexChangeListener)} |
46 | * | 46 | * |
47 | * @param listener | 47 | * @param listener |
48 | */ | 48 | */ |
49 | public void removeBaseIndexChangeListener(ViatraBaseIndexChangeListener listener); | 49 | public void removeBaseIndexChangeListener(InterpreterBaseIndexChangeListener listener); |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * Updates the value of indexed derived features that are not well-behaving. | 52 | * Updates the value of indexed derived features that are not well-behaving. |
53 | */ | 53 | */ |
@@ -70,20 +70,20 @@ public interface IBaseIndex { | |||
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Register a lightweight observer that is notified if any edge starting at the given Object changes. | 72 | * Register a lightweight observer that is notified if any edge starting at the given Object changes. |
73 | * | 73 | * |
74 | * @param observer the listener instance | 74 | * @param observer the listener instance |
75 | * @param observedObject the observed instance object | 75 | * @param observedObject the observed instance object |
76 | * @return false if no observer can be registered for the given instance (e.g. it is a primitive), | 76 | * @return false if no observer can be registered for the given instance (e.g. it is a primitive), |
77 | * or observer was already registered (call has no effect) | 77 | * or observer was already registered (call has no effect) |
78 | */ | 78 | */ |
79 | public boolean addInstanceObserver(IInstanceObserver observer, Object observedObject); | 79 | public boolean addInstanceObserver(IInstanceObserver observer, Object observedObject); |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Unregisters a lightweight observer for the given Object. | 82 | * Unregisters a lightweight observer for the given Object. |
83 | * | 83 | * |
84 | * @param observer the listener instance | 84 | * @param observer the listener instance |
85 | * @param observedObject the observed instance object | 85 | * @param observedObject the observed instance object |
86 | * @return false if no observer can be registered for the given instance (e.g. it is a primitive), | 86 | * @return false if no observer can be registered for the given instance (e.g. it is a primitive), |
87 | * or no observer was registered previously (call has no effect) | 87 | * or no observer was registered previously (call has no effect) |
88 | */ | 88 | */ |
89 | public boolean removeInstanceObserver(IInstanceObserver observer, Object observedObject); | 89 | public boolean removeInstanceObserver(IInstanceObserver observer, Object observedObject); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/IEngineContext.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/IEngineContext.java index 55060853..013a3d1c 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/IEngineContext.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/IEngineContext.java | |||
@@ -3,47 +3,47 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api.scope; | 9 | package tools.refinery.interpreter.api.scope; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 11 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
12 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 12 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * The context of the engine is instantiated by the scope, | 15 | * The context of the engine is instantiated by the scope, |
16 | * and provides information and services regarding the model the towards the engine. | 16 | * and provides information and services regarding the model the towards the engine. |
17 | * | 17 | * |
18 | * @author Bergmann Gabor | 18 | * @author Bergmann Gabor |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | public interface IEngineContext { | 21 | public interface IEngineContext { |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * Returns the base index. | 24 | * Returns the base index. |
25 | * @throws ViatraQueryRuntimeException if the base index cannot be accessed | 25 | * @throws InterpreterRuntimeException if the base index cannot be accessed |
26 | */ | 26 | */ |
27 | IBaseIndex getBaseIndex(); | 27 | IBaseIndex getBaseIndex(); |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * Disposes this context object. Resources in the index may now be freed up. | 30 | * Disposes this context object. Resources in the index may now be freed up. |
31 | * No more methods should be called after this one. | 31 | * No more methods should be called after this one. |
32 | * | 32 | * |
33 | * @throws IllegalStateException if there are any active listeners to the underlying index | 33 | * @throws IllegalStateException if there are any active listeners to the underlying index |
34 | */ | 34 | */ |
35 | void dispose(); | 35 | void dispose(); |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * Provides instance model information for pattern matching. | 38 | * Provides instance model information for pattern matching. |
39 | * | 39 | * |
40 | * <p> Implementors note: must be reentrant. | 40 | * <p> Implementors note: must be reentrant. |
41 | * If called while index loading is already in progress, must return the single runtime context instance that will eventually index the model. | 41 | * If called while index loading is already in progress, must return the single runtime context instance that will eventually index the model. |
42 | * When the runtime query context is invoked in such a case, incomplete indexes are tolerable, but change notifications must be correctly provided as loading commences. | 42 | * When the runtime query context is invoked in such a case, incomplete indexes are tolerable, but change notifications must be correctly provided as loading commences. |
43 | * | 43 | * |
44 | * @return a runtime context for pattern matching | 44 | * @return a runtime context for pattern matching |
45 | * @since 1.2 | 45 | * @since 1.2 |
46 | * @throws ViatraQueryRuntimeException if the runtime context cannot be initialized | 46 | * @throws InterpreterRuntimeException if the runtime context cannot be initialized |
47 | */ | 47 | */ |
48 | public IQueryRuntimeContext getQueryRuntimeContext(); | 48 | public IQueryRuntimeContext getQueryRuntimeContext(); |
49 | } \ No newline at end of file | 49 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/IIndexingErrorListener.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/IIndexingErrorListener.java index f61a5edb..904619b2 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/IIndexingErrorListener.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/IIndexingErrorListener.java | |||
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api.scope; | 9 | package tools.refinery.interpreter.api.scope; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * | 12 | * |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/IInstanceObserver.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/IInstanceObserver.java index 8ef29cbe..18c43aac 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/IInstanceObserver.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/IInstanceObserver.java | |||
@@ -1,21 +1,21 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | * Copyright (c) 2010-2014, Bergmann Gabor, Istvan Rath and Daniel Varro | 2 | * Copyright (c) 2010-2014, Bergmann Gabor, Istvan Rath and Daniel Varro |
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api.scope; | 9 | package tools.refinery.interpreter.api.scope; |
10 | 10 | ||
11 | 11 | ||
12 | /** | 12 | /** |
13 | * Listener interface for lightweight observation of changes in edges leaving from given source instance elements. | 13 | * Listener interface for lightweight observation of changes in edges leaving from given source instance elements. |
14 | * @author Bergmann Gabor | 14 | * @author Bergmann Gabor |
15 | * @since 0.9 | 15 | * @since 0.9 |
16 | * | 16 | * |
17 | */ | 17 | */ |
18 | public interface IInstanceObserver { | 18 | public interface IInstanceObserver { |
19 | void notifyBinaryChanged(Object sourceElement, Object edgeType); | 19 | void notifyBinaryChanged(Object sourceElement, Object edgeType); |
20 | void notifyTernaryChanged(Object sourceElement, Object edgeType); | 20 | void notifyTernaryChanged(Object sourceElement, Object edgeType); |
21 | } | 21 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/ViatraBaseIndexChangeListener.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/InterpreterBaseIndexChangeListener.java index b746e637..97a2166f 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/ViatraBaseIndexChangeListener.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/InterpreterBaseIndexChangeListener.java | |||
@@ -3,32 +3,33 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api.scope; | 9 | package tools.refinery.interpreter.api.scope; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Listener interface for change notifications from the VIATRA Base index. | 12 | * Listener interface for change notifications from the Refinery Base index. |
13 | * | 13 | * |
14 | * @author Abel Hegedus | 14 | * @author Abel Hegedus |
15 | * @since 0.9 | 15 | * @since 0.9 |
16 | * | 16 | * |
17 | */ | 17 | */ |
18 | public interface ViatraBaseIndexChangeListener { | 18 | public interface InterpreterBaseIndexChangeListener { |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * NOTE: it is possible that this method is called only ONCE! Consider returning a constant value that is set in the constructor. | 21 | * NOTE: it is possible that this method is called only ONCE! Consider returning a constant value that is set in the constructor. |
22 | * | 22 | * |
23 | * @return true, if the listener should be notified only after index changes, false if notification is needed after each model change | 23 | * @return true, if the listener should be notified only after index changes, false if notification is needed after each model change |
24 | */ | 24 | */ |
25 | public boolean onlyOnIndexChange(); | 25 | public boolean onlyOnIndexChange(); |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * Called after a model change is handled by the VIATRA Base index and if <code>indexChanged == onlyOnIndexChange()</code>. | 28 | * Called after a model change is handled by the Refinery Interpreter base index and if <code>indexChanged == |
29 | * | 29 | * onlyOnIndexChange()</code>. |
30 | * | ||
30 | * @param indexChanged true, if the model change also affected the contents of the base index | 31 | * @param indexChanged true, if the model change also affected the contents of the base index |
31 | */ | 32 | */ |
32 | public void notifyChanged(boolean indexChanged); | 33 | public void notifyChanged(boolean indexChanged); |
33 | 34 | ||
34 | } | 35 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/QueryScope.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/QueryScope.java index 5456b9ea..81e200d7 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/scope/QueryScope.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/api/scope/QueryScope.java | |||
@@ -3,28 +3,29 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.api.scope; | 9 | package tools.refinery.interpreter.api.scope; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.api.IQuerySpecification; | 11 | import tools.refinery.interpreter.internal.apiimpl.EngineContextFactory; |
12 | import tools.refinery.viatra.runtime.api.ViatraQueryEngine; | 12 | import tools.refinery.interpreter.api.IQuerySpecification; |
13 | import tools.refinery.viatra.runtime.internal.apiimpl.EngineContextFactory; | 13 | import tools.refinery.interpreter.api.InterpreterEngine; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Defines a scope for a VIATRA Query engine, which determines the set of model elements that query evaluation operates on. | 16 | * Defines a scope for a Refinery Interpreter engine, which determines the set of model elements that query evaluation |
17 | * | 17 | * operates on. |
18 | * | ||
18 | * @author Bergmann Gabor | 19 | * @author Bergmann Gabor |
19 | * | 20 | * |
20 | */ | 21 | */ |
21 | public abstract class QueryScope extends EngineContextFactory { | 22 | public abstract class QueryScope extends EngineContextFactory { |
22 | 23 | ||
23 | /** | 24 | /** |
24 | * Determines whether a query engine initialized on this scope can evaluate queries formulated against the given scope type. | 25 | * Determines whether a query engine initialized on this scope can evaluate queries formulated against the given scope type. |
25 | * <p> Every query scope class is compatible with a query engine initialized on a scope of the same class or a subclass. | 26 | * <p> Every query scope class is compatible with a query engine initialized on a scope of the same class or a subclass. |
26 | * @param queryScopeClass the scope class returned by invoking {@link IQuerySpecification#getPreferredScopeClass()} on a query specification | 27 | * @param queryScopeClass the scope class returned by invoking {@link IQuerySpecification#getPreferredScopeClass()} on a query specification |
27 | * @return true if an {@link ViatraQueryEngine} initialized on this scope can consume an {@link IQuerySpecification} | 28 | * @return true if an {@link InterpreterEngine} initialized on this scope can consume an {@link IQuerySpecification} |
28 | */ | 29 | */ |
29 | public boolean isCompatibleWithQueryScope(Class<? extends QueryScope> queryScopeClass) { | 30 | public boolean isCompatibleWithQueryScope(Class<? extends QueryScope> queryScopeClass) { |
30 | return queryScopeClass.isAssignableFrom(this.getClass()); | 31 | return queryScopeClass.isAssignableFrom(this.getClass()); |
diff --git a/subprojects/interpreter/src/main/java/tools/refinery/interpreter/exception/InterpreterException.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/exception/InterpreterException.java new file mode 100644 index 00000000..2100f11e --- /dev/null +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/exception/InterpreterException.java | |||
@@ -0,0 +1,67 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2004-2010 Akos Horvath and Daniel Varro | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | package tools.refinery.interpreter.exception; | ||
10 | |||
11 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; | ||
12 | import tools.refinery.interpreter.matchers.planning.QueryProcessingException; | ||
13 | import tools.refinery.interpreter.matchers.psystem.queries.QueryInitializationException; | ||
14 | |||
15 | import java.io.Serial; | ||
16 | |||
17 | /** | ||
18 | * A general Refinery Interpreter-related problem during the operation of the Refinery Interpreter | ||
19 | * engine, or the loading, manipulation and evaluation of queries. | ||
20 | * | ||
21 | * @author Bergmann Gabor | ||
22 | * @since 0.9 | ||
23 | * | ||
24 | */ | ||
25 | public class InterpreterException extends InterpreterRuntimeException { | ||
26 | |||
27 | @Serial | ||
28 | private static final long serialVersionUID = -74252748358355750L; | ||
29 | |||
30 | /** | ||
31 | * @since 0.9 | ||
32 | */ | ||
33 | public static final String PROCESSING_PROBLEM = "The following error occurred during the processing of a query " + | ||
34 | "(e.g. for the preparation of a Refinery pattern matcher)"; | ||
35 | /** | ||
36 | * @since 0.9 | ||
37 | */ | ||
38 | public static final String QUERY_INIT_PROBLEM = "The following error occurred during the initialization of a " + | ||
39 | "Refinery query specification"; | ||
40 | |||
41 | private final String shortMessage; | ||
42 | |||
43 | public InterpreterException(String s, String shortMessage) { | ||
44 | super(s); | ||
45 | this.shortMessage = shortMessage; | ||
46 | } | ||
47 | |||
48 | public InterpreterException(QueryProcessingException e) { | ||
49 | super(PROCESSING_PROBLEM + ": " + e.getMessage(), e); | ||
50 | this.shortMessage = e.getShortMessage(); | ||
51 | } | ||
52 | |||
53 | public InterpreterException(QueryInitializationException e) { | ||
54 | super(QUERY_INIT_PROBLEM + ": " + e.getMessage(), e); | ||
55 | this.shortMessage = e.getShortMessage(); | ||
56 | } | ||
57 | |||
58 | public InterpreterException(String s, String shortMessage, Throwable e) { | ||
59 | super(s + ": " + e.getMessage(), e); | ||
60 | this.shortMessage = shortMessage; | ||
61 | } | ||
62 | |||
63 | public String getShortMessage() { | ||
64 | return shortMessage; | ||
65 | } | ||
66 | |||
67 | } | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/apiimpl/EngineContextFactory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/apiimpl/EngineContextFactory.java index bed07ebf..9e9172cb 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/apiimpl/EngineContextFactory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/apiimpl/EngineContextFactory.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.internal.apiimpl; | 9 | package tools.refinery.interpreter.internal.apiimpl; |
10 | 10 | ||
11 | import org.apache.log4j.Logger; | 11 | import org.apache.log4j.Logger; |
12 | import tools.refinery.viatra.runtime.api.ViatraQueryEngine; | 12 | import tools.refinery.interpreter.api.InterpreterEngine; |
13 | import tools.refinery.viatra.runtime.api.scope.IEngineContext; | 13 | import tools.refinery.interpreter.api.scope.IEngineContext; |
14 | import tools.refinery.viatra.runtime.api.scope.IIndexingErrorListener; | 14 | import tools.refinery.interpreter.api.scope.IIndexingErrorListener; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Internal interface for a Scope to reveal model contents to the engine. | 17 | * Internal interface for a Scope to reveal model contents to the engine. |
18 | * | 18 | * |
19 | * @author Bergmann Gabor | 19 | * @author Bergmann Gabor |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | public abstract class EngineContextFactory { | 22 | public abstract class EngineContextFactory { |
23 | protected abstract IEngineContext createEngineContext(ViatraQueryEngine engine, IIndexingErrorListener errorListener, Logger logger); | 23 | protected abstract IEngineContext createEngineContext(InterpreterEngine engine, IIndexingErrorListener errorListener, Logger logger); |
24 | } | 24 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/apiimpl/ViatraQueryEngineImpl.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/apiimpl/InterpreterEngineImpl.java index 84ac8f7d..8a2e4c5e 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/apiimpl/ViatraQueryEngineImpl.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/apiimpl/InterpreterEngineImpl.java | |||
@@ -8,34 +8,32 @@ | |||
8 | * SPDX-License-Identifier: EPL-2.0 | 8 | * SPDX-License-Identifier: EPL-2.0 |
9 | *******************************************************************************/ | 9 | *******************************************************************************/ |
10 | 10 | ||
11 | package tools.refinery.viatra.runtime.internal.apiimpl; | 11 | package tools.refinery.interpreter.internal.apiimpl; |
12 | 12 | ||
13 | import org.apache.log4j.Logger; | 13 | import org.apache.log4j.Logger; |
14 | import tools.refinery.viatra.runtime.api.*; | 14 | import tools.refinery.interpreter.api.*; |
15 | import tools.refinery.viatra.runtime.api.impl.BaseMatcher; | 15 | import tools.refinery.interpreter.api.impl.BaseMatcher; |
16 | import tools.refinery.viatra.runtime.api.scope.IBaseIndex; | 16 | import tools.refinery.interpreter.api.scope.IBaseIndex; |
17 | import tools.refinery.viatra.runtime.api.scope.IEngineContext; | 17 | import tools.refinery.interpreter.api.scope.IEngineContext; |
18 | import tools.refinery.viatra.runtime.api.scope.IIndexingErrorListener; | 18 | import tools.refinery.interpreter.api.scope.IIndexingErrorListener; |
19 | import tools.refinery.viatra.runtime.api.scope.QueryScope; | 19 | import tools.refinery.interpreter.api.scope.QueryScope; |
20 | import tools.refinery.viatra.runtime.exception.ViatraQueryException; | 20 | import tools.refinery.interpreter.exception.InterpreterException; |
21 | import tools.refinery.viatra.runtime.internal.engine.LifecycleProvider; | 21 | import tools.refinery.interpreter.internal.engine.LifecycleProvider; |
22 | import tools.refinery.viatra.runtime.internal.engine.ModelUpdateProvider; | 22 | import tools.refinery.interpreter.internal.engine.ModelUpdateProvider; |
23 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 23 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
24 | import tools.refinery.viatra.runtime.matchers.backend.*; | 24 | import tools.refinery.interpreter.matchers.backend.*; |
25 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 25 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
26 | import tools.refinery.viatra.runtime.matchers.context.IQueryCacheContext; | 26 | import tools.refinery.interpreter.matchers.context.IQueryCacheContext; |
27 | import tools.refinery.viatra.runtime.matchers.context.IQueryResultProviderAccess; | 27 | import tools.refinery.interpreter.matchers.context.IQueryResultProviderAccess; |
28 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 28 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
29 | import tools.refinery.viatra.runtime.matchers.planning.QueryProcessingException; | 29 | import tools.refinery.interpreter.matchers.planning.QueryProcessingException; |
30 | import tools.refinery.viatra.runtime.matchers.psystem.analysis.QueryAnalyzer; | 30 | import tools.refinery.interpreter.matchers.psystem.analysis.QueryAnalyzer; |
31 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQueries; | 31 | import tools.refinery.interpreter.matchers.psystem.queries.PQueries; |
32 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 32 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
33 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery.PQueryStatus; | 33 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
34 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 34 | import tools.refinery.interpreter.matchers.util.IMultiLookup; |
35 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | 35 | import tools.refinery.interpreter.matchers.util.Preconditions; |
36 | import tools.refinery.viatra.runtime.matchers.util.IMultiLookup; | 36 | import tools.refinery.interpreter.util.InterpreterLoggingUtil; |
37 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | ||
38 | import tools.refinery.viatra.runtime.util.ViatraQueryLoggingUtil; | ||
39 | 37 | ||
40 | import java.lang.ref.WeakReference; | 38 | import java.lang.ref.WeakReference; |
41 | import java.lang.reflect.InvocationTargetException; | 39 | import java.lang.reflect.InvocationTargetException; |
@@ -44,14 +42,12 @@ import java.util.concurrent.Callable; | |||
44 | import java.util.function.Supplier; | 42 | import java.util.function.Supplier; |
45 | import java.util.stream.Collectors; | 43 | import java.util.stream.Collectors; |
46 | 44 | ||
47 | import static tools.refinery.viatra.runtime.matchers.util.Preconditions.checkArgument; | ||
48 | |||
49 | /** | 45 | /** |
50 | * A VIATRA Query engine back-end (implementation) | 46 | * A Refinery Interpreter engine back-end (implementation) |
51 | * | 47 | * |
52 | * @author Bergmann Gábor | 48 | * @author Bergmann Gábor |
53 | */ | 49 | */ |
54 | public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | 50 | public final class InterpreterEngineImpl extends AdvancedInterpreterEngine |
55 | implements IQueryBackendHintProvider, IQueryCacheContext, IQueryResultProviderAccess { | 51 | implements IQueryBackendHintProvider, IQueryCacheContext, IQueryResultProviderAccess { |
56 | 52 | ||
57 | /** | 53 | /** |
@@ -62,10 +58,7 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
62 | * | 58 | * |
63 | */ | 59 | */ |
64 | private static final String QUERY_ON_DISPOSED_ENGINE_MESSAGE = "Cannot evaluate query on disposed engine!"; | 60 | private static final String QUERY_ON_DISPOSED_ENGINE_MESSAGE = "Cannot evaluate query on disposed engine!"; |
65 | /** | 61 | |
66 | * The engine manager responsible for this engine. Null if this engine is unmanaged. | ||
67 | */ | ||
68 | private final ViatraQueryEngineManager manager; | ||
69 | /** | 62 | /** |
70 | * The model to which the engine is attached. | 63 | * The model to which the engine is attached. |
71 | */ | 64 | */ |
@@ -79,18 +72,18 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
79 | /** | 72 | /** |
80 | * Initialized matchers for each query | 73 | * Initialized matchers for each query |
81 | */ | 74 | */ |
82 | private final IMultiLookup<IQuerySpecification<? extends ViatraQueryMatcher<?>>, ViatraQueryMatcher<?>> matchers = | 75 | private final IMultiLookup<IQuerySpecification<? extends InterpreterMatcher<?>>, InterpreterMatcher<?>> matchers = |
83 | CollectionsFactory.createMultiLookup(Object.class, MemoryType.SETS, Object.class); | 76 | CollectionsFactory.createMultiLookup(Object.class, CollectionsFactory.MemoryType.SETS, Object.class); |
84 | 77 | ||
85 | /** | 78 | /** |
86 | * The RETE and other pattern matcher implementations of the VIATRA Query Engine. | 79 | * The RETE and other pattern matcher implementations of the Refinery Interpreter engine. |
87 | */ | 80 | */ |
88 | private final Map<IQueryBackendFactory, IQueryBackend> queryBackends = Collections.synchronizedMap(new HashMap<>()); | 81 | private final Map<IQueryBackendFactory, IQueryBackend> queryBackends = Collections.synchronizedMap(new HashMap<>()); |
89 | 82 | ||
90 | /** | 83 | /** |
91 | * The current engine default hints | 84 | * The current engine default hints |
92 | */ | 85 | */ |
93 | private final ViatraQueryEngineOptions engineOptions; | 86 | private final InterpreterEngineOptions engineOptions; |
94 | 87 | ||
95 | /** | 88 | /** |
96 | * Common query analysis provided to backends | 89 | * Common query analysis provided to backends |
@@ -108,16 +101,13 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
108 | private boolean disposed = false; | 101 | private boolean disposed = false; |
109 | 102 | ||
110 | /** | 103 | /** |
111 | * @param manager | ||
112 | * null if unmanaged | ||
113 | * @param scope | 104 | * @param scope |
114 | * @param engineDefaultHint | 105 | * @param engineDefaultHint |
115 | * @since 1.4 | 106 | * @since 1.4 |
116 | */ | 107 | */ |
117 | public ViatraQueryEngineImpl(ViatraQueryEngineManager manager, QueryScope scope, | 108 | public InterpreterEngineImpl(QueryScope scope, |
118 | ViatraQueryEngineOptions engineOptions) { | 109 | InterpreterEngineOptions engineOptions) { |
119 | super(); | 110 | super(); |
120 | this.manager = manager; | ||
121 | this.scope = scope; | 111 | this.scope = scope; |
122 | this.lifecycleProvider = new LifecycleProvider(this, getLogger()); | 112 | this.lifecycleProvider = new LifecycleProvider(this, getLogger()); |
123 | this.modelUpdateProvider = new ModelUpdateProvider(this, getLogger()); | 113 | this.modelUpdateProvider = new ModelUpdateProvider(this, getLogger()); |
@@ -126,7 +116,7 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
126 | if (engineOptions != null) { | 116 | if (engineOptions != null) { |
127 | this.engineOptions = engineOptions; | 117 | this.engineOptions = engineOptions; |
128 | } else { | 118 | } else { |
129 | this.engineOptions = ViatraQueryEngineOptions.getDefault(); | 119 | this.engineOptions = InterpreterEngineOptions.getDefault(); |
130 | } | 120 | } |
131 | 121 | ||
132 | } | 122 | } |
@@ -137,8 +127,8 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
137 | * @param scope | 127 | * @param scope |
138 | * @param engineDefaultHint | 128 | * @param engineDefaultHint |
139 | */ | 129 | */ |
140 | public ViatraQueryEngineImpl(ViatraQueryEngineManager manager, QueryScope scope) { | 130 | public InterpreterEngineImpl(QueryScope scope) { |
141 | this(manager, scope, ViatraQueryEngineOptions.getDefault()); | 131 | this(scope, InterpreterEngineOptions.getDefault()); |
142 | } | 132 | } |
143 | 133 | ||
144 | @Override | 134 | @Override |
@@ -192,18 +182,18 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
192 | } | 182 | } |
193 | 183 | ||
194 | @Override | 184 | @Override |
195 | public Set<? extends ViatraQueryMatcher<? extends IPatternMatch>> getCurrentMatchers() { | 185 | public Set<? extends InterpreterMatcher<? extends IPatternMatch>> getCurrentMatchers() { |
196 | return matchers.distinctValuesStream().collect(Collectors.toSet()); | 186 | return matchers.distinctValuesStream().collect(Collectors.toSet()); |
197 | } | 187 | } |
198 | 188 | ||
199 | @Override | 189 | @Override |
200 | public <Matcher extends ViatraQueryMatcher<? extends IPatternMatch>> Matcher getMatcher( | 190 | public <Matcher extends InterpreterMatcher<? extends IPatternMatch>> Matcher getMatcher( |
201 | IQuerySpecification<Matcher> querySpecification) { | 191 | IQuerySpecification<Matcher> querySpecification) { |
202 | return getMatcher(querySpecification, null); | 192 | return getMatcher(querySpecification, null); |
203 | } | 193 | } |
204 | 194 | ||
205 | @Override | 195 | @Override |
206 | public <Matcher extends ViatraQueryMatcher<? extends IPatternMatch>> Matcher getMatcher( | 196 | public <Matcher extends InterpreterMatcher<? extends IPatternMatch>> Matcher getMatcher( |
207 | IQuerySpecification<Matcher> querySpecification, QueryEvaluationHint optionalEvaluationHints) { | 197 | IQuerySpecification<Matcher> querySpecification, QueryEvaluationHint optionalEvaluationHints) { |
208 | return withFlushingChanges(() -> { | 198 | return withFlushingChanges(() -> { |
209 | IMatcherCapability capability = getRequestedCapability(querySpecification, optionalEvaluationHints); | 199 | IMatcherCapability capability = getRequestedCapability(querySpecification, optionalEvaluationHints); |
@@ -222,21 +212,21 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
222 | } | 212 | } |
223 | 213 | ||
224 | @Override | 214 | @Override |
225 | public <Matcher extends ViatraQueryMatcher<? extends IPatternMatch>> Matcher getExistingMatcher( | 215 | public <Matcher extends InterpreterMatcher<? extends IPatternMatch>> Matcher getExistingMatcher( |
226 | IQuerySpecification<Matcher> querySpecification) { | 216 | IQuerySpecification<Matcher> querySpecification) { |
227 | return getExistingMatcher(querySpecification, null); | 217 | return getExistingMatcher(querySpecification, null); |
228 | } | 218 | } |
229 | 219 | ||
230 | @Override | 220 | @Override |
231 | public <Matcher extends ViatraQueryMatcher<? extends IPatternMatch>> Matcher getExistingMatcher( | 221 | public <Matcher extends InterpreterMatcher<? extends IPatternMatch>> Matcher getExistingMatcher( |
232 | IQuerySpecification<Matcher> querySpecification, QueryEvaluationHint optionalOverrideHints) { | 222 | IQuerySpecification<Matcher> querySpecification, QueryEvaluationHint optionalOverrideHints) { |
233 | return doGetExistingMatcher(querySpecification, getRequestedCapability(querySpecification, optionalOverrideHints)); | 223 | return doGetExistingMatcher(querySpecification, getRequestedCapability(querySpecification, optionalOverrideHints)); |
234 | } | 224 | } |
235 | 225 | ||
236 | @SuppressWarnings("unchecked") | 226 | @SuppressWarnings("unchecked") |
237 | private <Matcher extends ViatraQueryMatcher<? extends IPatternMatch>> Matcher doGetExistingMatcher( | 227 | private <Matcher extends InterpreterMatcher<? extends IPatternMatch>> Matcher doGetExistingMatcher( |
238 | IQuerySpecification<Matcher> querySpecification, IMatcherCapability requestedCapability) { | 228 | IQuerySpecification<Matcher> querySpecification, IMatcherCapability requestedCapability) { |
239 | for (ViatraQueryMatcher<?> matcher : matchers.lookupOrEmpty(querySpecification)) { | 229 | for (InterpreterMatcher<?> matcher : matchers.lookupOrEmpty(querySpecification)) { |
240 | BaseMatcher<?> baseMatcher = (BaseMatcher<?>) matcher; | 230 | BaseMatcher<?> baseMatcher = (BaseMatcher<?>) matcher; |
241 | if (baseMatcher.getCapabilities().canBeSubstitute(requestedCapability)) | 231 | if (baseMatcher.getCapabilities().canBeSubstitute(requestedCapability)) |
242 | return (Matcher) matcher; | 232 | return (Matcher) matcher; |
@@ -245,7 +235,7 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
245 | } | 235 | } |
246 | 236 | ||
247 | @Override | 237 | @Override |
248 | public ViatraQueryMatcher<? extends IPatternMatch> getMatcher(String patternFQN) { | 238 | public InterpreterMatcher<? extends IPatternMatch> getMatcher(String patternFQN) { |
249 | throw new UnsupportedOperationException("Query specification registry is not available"); | 239 | throw new UnsupportedOperationException("Query specification registry is not available"); |
250 | } | 240 | } |
251 | 241 | ||
@@ -257,22 +247,22 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
257 | public final Logger getLogger() { | 247 | public final Logger getLogger() { |
258 | if (logger == null) { | 248 | if (logger == null) { |
259 | final int hash = System.identityHashCode(this); | 249 | final int hash = System.identityHashCode(this); |
260 | logger = Logger.getLogger(ViatraQueryLoggingUtil.getLogger(ViatraQueryEngine.class).getName() + "." + hash); | 250 | logger = Logger.getLogger(InterpreterLoggingUtil.getLogger(InterpreterEngine.class).getName() + "." + hash); |
261 | if (logger == null) | 251 | if (logger == null) |
262 | throw new AssertionError( | 252 | throw new AssertionError( |
263 | "Configuration error: unable to create VIATRA Query runtime logger for engine " + hash); | 253 | "Configuration error: unable to create Refinery Interpreter runtime logger for engine " + hash); |
264 | } | 254 | } |
265 | return logger; | 255 | return logger; |
266 | } | 256 | } |
267 | 257 | ||
268 | ///////////////// internal stuff ////////////// | 258 | ///////////////// internal stuff ////////////// |
269 | private void internalRegisterMatcher(IQuerySpecification<?> querySpecification, ViatraQueryMatcher<?> matcher) { | 259 | private void internalRegisterMatcher(IQuerySpecification<?> querySpecification, InterpreterMatcher<?> matcher) { |
270 | matchers.addPair(querySpecification, matcher); | 260 | matchers.addPair(querySpecification, matcher); |
271 | lifecycleProvider.matcherInstantiated(matcher); | 261 | lifecycleProvider.matcherInstantiated(matcher); |
272 | } | 262 | } |
273 | 263 | ||
274 | /** | 264 | /** |
275 | * Provides access to the selected query backend component of the VIATRA Query Engine. | 265 | * Provides access to the selected query backend component of the Refinery Interpreter engine. |
276 | */ | 266 | */ |
277 | @Override | 267 | @Override |
278 | public IQueryBackend getQueryBackend(IQueryBackendFactory iQueryBackendFactory) { | 268 | public IQueryBackend getQueryBackend(IQueryBackendFactory iQueryBackendFactory) { |
@@ -297,7 +287,7 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
297 | 287 | ||
298 | @Override | 288 | @Override |
299 | public IQueryCacheContext getQueryCacheContext() { | 289 | public IQueryCacheContext getQueryCacheContext() { |
300 | return ViatraQueryEngineImpl.this; | 290 | return InterpreterEngineImpl.this; |
301 | } | 291 | } |
302 | 292 | ||
303 | @Override | 293 | @Override |
@@ -307,12 +297,12 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
307 | 297 | ||
308 | @Override | 298 | @Override |
309 | public IQueryBackendHintProvider getHintProvider() { | 299 | public IQueryBackendHintProvider getHintProvider() { |
310 | return ViatraQueryEngineImpl.this; | 300 | return InterpreterEngineImpl.this; |
311 | } | 301 | } |
312 | 302 | ||
313 | @Override | 303 | @Override |
314 | public IQueryResultProviderAccess getResultProviderAccess() { | 304 | public IQueryResultProviderAccess getResultProviderAccess() { |
315 | return ViatraQueryEngineImpl.this; | 305 | return InterpreterEngineImpl.this; |
316 | } | 306 | } |
317 | 307 | ||
318 | @Override | 308 | @Override |
@@ -324,12 +314,12 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
324 | 314 | ||
325 | @Override | 315 | @Override |
326 | public boolean areUpdatesDelayed() { | 316 | public boolean areUpdatesDelayed() { |
327 | return ViatraQueryEngineImpl.this.delayMessageDelivery; | 317 | return InterpreterEngineImpl.this.delayMessageDelivery; |
328 | } | 318 | } |
329 | 319 | ||
330 | @Override | 320 | @Override |
331 | public IMatcherCapability getRequiredMatcherCapability(PQuery query, | 321 | public IMatcherCapability getRequiredMatcherCapability(PQuery query, |
332 | QueryEvaluationHint hint) { | 322 | QueryEvaluationHint hint) { |
333 | return engineOptions.getQueryBackendFactory(hint).calculateRequiredCapability(query, hint); | 323 | return engineOptions.getQueryBackendFactory(hint).calculateRequiredCapability(query, hint); |
334 | } | 324 | } |
335 | 325 | ||
@@ -346,10 +336,6 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
346 | 336 | ||
347 | @Override | 337 | @Override |
348 | public void dispose() { | 338 | public void dispose() { |
349 | if (manager != null) { | ||
350 | throw new UnsupportedOperationException( | ||
351 | String.format("Cannot dispose() managed VIATRA Query Engine. Attempted for scope %s.", scope)); | ||
352 | } | ||
353 | wipe(); | 339 | wipe(); |
354 | 340 | ||
355 | this.disposed = true; | 341 | this.disposed = true; |
@@ -361,22 +347,17 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
361 | engineContext.dispose(); | 347 | engineContext.dispose(); |
362 | } catch (IllegalStateException ex) { | 348 | } catch (IllegalStateException ex) { |
363 | getLogger().warn( | 349 | getLogger().warn( |
364 | "The base index could not be disposed along with the VIATRA Query engine, as there are still active listeners on it."); | 350 | "The base index could not be disposed along with the Refinery Interpreter engine, as there are " + |
351 | "still active listeners on it."); | ||
365 | } | 352 | } |
366 | } | 353 | } |
367 | 354 | ||
368 | @Override | 355 | @Override |
369 | public void wipe() { | 356 | public void wipe() { |
370 | if (manager != null) { | 357 | for (IQueryBackend backend : queryBackends.values()) { |
371 | throw new UnsupportedOperationException( | 358 | backend.dispose(); |
372 | String.format("Cannot wipe() managed VIATRA Query Engine. Attempted for scope %s.", scope)); | 359 | } |
373 | } | 360 | queryBackends.clear(); |
374 | if (queryBackends != null) { | ||
375 | for (IQueryBackend backend : queryBackends.values()) { | ||
376 | backend.dispose(); | ||
377 | } | ||
378 | queryBackends.clear(); | ||
379 | } | ||
380 | matchers.clear(); | 361 | matchers.clear(); |
381 | queryAnalyzer = null; | 362 | queryAnalyzer = null; |
382 | lifecycleProvider.engineWiped(); | 363 | lifecycleProvider.engineWiped(); |
@@ -389,14 +370,14 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
389 | private IIndexingErrorListener taintListener = new SelfTaintListener(this); | 370 | private IIndexingErrorListener taintListener = new SelfTaintListener(this); |
390 | 371 | ||
391 | private static class SelfTaintListener implements IIndexingErrorListener { | 372 | private static class SelfTaintListener implements IIndexingErrorListener { |
392 | WeakReference<ViatraQueryEngineImpl> queryEngineRef; | 373 | WeakReference<InterpreterEngineImpl> queryEngineRef; |
393 | 374 | ||
394 | public SelfTaintListener(ViatraQueryEngineImpl queryEngine) { | 375 | public SelfTaintListener(InterpreterEngineImpl queryEngine) { |
395 | this.queryEngineRef = new WeakReference<ViatraQueryEngineImpl>(queryEngine); | 376 | this.queryEngineRef = new WeakReference<InterpreterEngineImpl>(queryEngine); |
396 | } | 377 | } |
397 | 378 | ||
398 | public void engineBecameTainted(String description, Throwable t) { | 379 | public void engineBecameTainted(String description, Throwable t) { |
399 | final ViatraQueryEngineImpl queryEngine = queryEngineRef.get(); | 380 | final InterpreterEngineImpl queryEngine = queryEngineRef.get(); |
400 | if (queryEngine != null) { | 381 | if (queryEngine != null) { |
401 | queryEngine.tainted = true; | 382 | queryEngine.tainted = true; |
402 | queryEngine.lifecycleProvider.engineBecameTainted(description, t); | 383 | queryEngine.lifecycleProvider.engineBecameTainted(description, t); |
@@ -428,12 +409,6 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
428 | return tainted; | 409 | return tainted; |
429 | } | 410 | } |
430 | 411 | ||
431 | @Override | ||
432 | public boolean isManaged() { | ||
433 | return manager != null; | ||
434 | // return isAdvanced; ??? | ||
435 | } | ||
436 | |||
437 | private <Match extends IPatternMatch> IQueryResultProvider getUnderlyingResultProvider( | 412 | private <Match extends IPatternMatch> IQueryResultProvider getUnderlyingResultProvider( |
438 | final BaseMatcher<Match> matcher) { | 413 | final BaseMatcher<Match> matcher) { |
439 | // IQueryResultProvider resultProvider = reteEngine.accessMatcher(matcher.getSpecification()); | 414 | // IQueryResultProvider resultProvider = reteEngine.accessMatcher(matcher.getSpecification()); |
@@ -441,12 +416,12 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
441 | } | 416 | } |
442 | 417 | ||
443 | @Override | 418 | @Override |
444 | public <Match extends IPatternMatch> void addMatchUpdateListener(final ViatraQueryMatcher<Match> matcher, | 419 | public <Match extends IPatternMatch> void addMatchUpdateListener(final InterpreterMatcher<Match> matcher, |
445 | final IMatchUpdateListener<? super Match> listener, boolean fireNow) { | 420 | final IMatchUpdateListener<? super Match> listener, boolean fireNow) { |
446 | 421 | ||
447 | checkArgument(listener != null, "Cannot add null listener!"); | 422 | Preconditions.checkArgument(listener != null, "Cannot add null listener!"); |
448 | checkArgument(matcher.getEngine() == this, "Cannot register listener for matcher of different engine!"); | 423 | Preconditions.checkArgument(matcher.getEngine() == this, "Cannot register listener for matcher of different engine!"); |
449 | checkArgument(!disposed, "Cannot register listener on matcher of disposed engine!"); | 424 | Preconditions.checkArgument(!disposed, "Cannot register listener on matcher of disposed engine!"); |
450 | 425 | ||
451 | final BaseMatcher<Match> bm = (BaseMatcher<Match>) matcher; | 426 | final BaseMatcher<Match> bm = (BaseMatcher<Match>) matcher; |
452 | 427 | ||
@@ -477,11 +452,11 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
477 | } | 452 | } |
478 | 453 | ||
479 | @Override | 454 | @Override |
480 | public <Match extends IPatternMatch> void removeMatchUpdateListener(ViatraQueryMatcher<Match> matcher, | 455 | public <Match extends IPatternMatch> void removeMatchUpdateListener(InterpreterMatcher<Match> matcher, |
481 | IMatchUpdateListener<? super Match> listener) { | 456 | IMatchUpdateListener<? super Match> listener) { |
482 | checkArgument(listener != null, "Cannot remove null listener!"); | 457 | Preconditions.checkArgument(listener != null, "Cannot remove null listener!"); |
483 | checkArgument(matcher.getEngine() == this, "Cannot remove listener from matcher of different engine!"); | 458 | Preconditions.checkArgument(matcher.getEngine() == this, "Cannot remove listener from matcher of different engine!"); |
484 | checkArgument(!disposed, "Cannot remove listener from matcher of disposed engine!"); | 459 | Preconditions.checkArgument(!disposed, "Cannot remove listener from matcher of disposed engine!"); |
485 | 460 | ||
486 | final BaseMatcher<Match> bm = (BaseMatcher<Match>) matcher; | 461 | final BaseMatcher<Match> bm = (BaseMatcher<Match>) matcher; |
487 | 462 | ||
@@ -496,22 +471,22 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
496 | } | 471 | } |
497 | 472 | ||
498 | @Override | 473 | @Override |
499 | public void addModelUpdateListener(ViatraQueryModelUpdateListener listener) { | 474 | public void addModelUpdateListener(InterpreterModelUpdateListener listener) { |
500 | modelUpdateProvider.addListener(listener); | 475 | modelUpdateProvider.addListener(listener); |
501 | } | 476 | } |
502 | 477 | ||
503 | @Override | 478 | @Override |
504 | public void removeModelUpdateListener(ViatraQueryModelUpdateListener listener) { | 479 | public void removeModelUpdateListener(InterpreterModelUpdateListener listener) { |
505 | modelUpdateProvider.removeListener(listener); | 480 | modelUpdateProvider.removeListener(listener); |
506 | } | 481 | } |
507 | 482 | ||
508 | @Override | 483 | @Override |
509 | public void addLifecycleListener(ViatraQueryEngineLifecycleListener listener) { | 484 | public void addLifecycleListener(InterpreterEngineLifecycleListener listener) { |
510 | lifecycleProvider.addListener(listener); | 485 | lifecycleProvider.addListener(listener); |
511 | } | 486 | } |
512 | 487 | ||
513 | @Override | 488 | @Override |
514 | public void removeLifecycleListener(ViatraQueryEngineLifecycleListener listener) { | 489 | public void removeLifecycleListener(InterpreterEngineLifecycleListener listener) { |
515 | lifecycleProvider.removeListener(listener); | 490 | lifecycleProvider.removeListener(listener); |
516 | } | 491 | } |
517 | 492 | ||
@@ -521,7 +496,7 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
521 | * @param query | 496 | * @param query |
522 | * the pattern for which the result provider should be delivered | 497 | * the pattern for which the result provider should be delivered |
523 | * | 498 | * |
524 | * @throws ViatraQueryRuntimeException | 499 | * @throws InterpreterRuntimeException |
525 | */ | 500 | */ |
526 | public IQueryResultProvider getResultProvider(IQuerySpecification<?> query) { | 501 | public IQueryResultProvider getResultProvider(IQuerySpecification<?> query) { |
527 | Preconditions.checkState(!disposed, QUERY_ON_DISPOSED_ENGINE_MESSAGE); | 502 | Preconditions.checkState(!disposed, QUERY_ON_DISPOSED_ENGINE_MESSAGE); |
@@ -535,7 +510,7 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
535 | * @param query | 510 | * @param query |
536 | * the pattern for which the result provider should be delivered | 511 | * the pattern for which the result provider should be delivered |
537 | * | 512 | * |
538 | * @throws ViatraQueryRuntimeException | 513 | * @throws InterpreterRuntimeException |
539 | */ | 514 | */ |
540 | public IQueryResultProvider getResultProvider(IQuerySpecification<?> query, QueryEvaluationHint hint) { | 515 | public IQueryResultProvider getResultProvider(IQuerySpecification<?> query, QueryEvaluationHint hint) { |
541 | Preconditions.checkState(!disposed, QUERY_ON_DISPOSED_ENGINE_MESSAGE); | 516 | Preconditions.checkState(!disposed, QUERY_ON_DISPOSED_ENGINE_MESSAGE); |
@@ -548,7 +523,7 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
548 | * {@link #getQueryEvaluationHint(IQuerySpecification, QueryEvaluationHint)} before passing a hint to this method to | 523 | * {@link #getQueryEvaluationHint(IQuerySpecification, QueryEvaluationHint)} before passing a hint to this method to |
549 | * make sure engine and query specific hints are correctly applied. | 524 | * make sure engine and query specific hints are correctly applied. |
550 | * | 525 | * |
551 | * @throws ViatraQueryRuntimeException | 526 | * @throws InterpreterRuntimeException |
552 | */ | 527 | */ |
553 | private IQueryResultProvider getResultProviderInternal(IQuerySpecification<?> query, QueryEvaluationHint hint) { | 528 | private IQueryResultProvider getResultProviderInternal(IQuerySpecification<?> query, QueryEvaluationHint hint) { |
554 | return getResultProviderInternal(query.getInternalQueryRepresentation(), hint); | 529 | return getResultProviderInternal(query.getInternalQueryRepresentation(), hint); |
@@ -559,11 +534,11 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
559 | * {@link #getQueryEvaluationHint(IQuerySpecification, QueryEvaluationHint)} before passing a hint to this method to | 534 | * {@link #getQueryEvaluationHint(IQuerySpecification, QueryEvaluationHint)} before passing a hint to this method to |
560 | * make sure engine and query specific hints are correctly applied. | 535 | * make sure engine and query specific hints are correctly applied. |
561 | * | 536 | * |
562 | * @throws ViatraQueryRuntimeException | 537 | * @throws InterpreterRuntimeException |
563 | */ | 538 | */ |
564 | private IQueryResultProvider getResultProviderInternal(PQuery query, QueryEvaluationHint hint) { | 539 | private IQueryResultProvider getResultProviderInternal(PQuery query, QueryEvaluationHint hint) { |
565 | Preconditions.checkArgument(query != null, "Query cannot be null!"); | 540 | Preconditions.checkArgument(query != null, "Query cannot be null!"); |
566 | Preconditions.checkArgument(query.getStatus() != PQueryStatus.ERROR, "Cannot initialize a result provider for the erronoues query `%s`.", query.getSimpleName()); | 541 | Preconditions.checkArgument(query.getStatus() != PQuery.PQueryStatus.ERROR, "Cannot initialize a result provider for the erronoues query `%s`.", query.getSimpleName()); |
567 | final IQueryBackend backend = getQueryBackend(engineOptions.getQueryBackendFactory(getQueryEvaluationHint(query, hint))); | 542 | final IQueryBackend backend = getQueryBackend(engineOptions.getQueryBackendFactory(getQueryEvaluationHint(query, hint))); |
568 | return backend.getResultProvider(query, hint); | 543 | return backend.getResultProvider(query, hint); |
569 | } | 544 | } |
@@ -571,7 +546,7 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
571 | /** | 546 | /** |
572 | * Returns the query backend (influenced by the hint system), even if it is a non-caching backend. | 547 | * Returns the query backend (influenced by the hint system), even if it is a non-caching backend. |
573 | * | 548 | * |
574 | * @throws ViatraQueryRuntimeException | 549 | * @throws InterpreterRuntimeException |
575 | */ | 550 | */ |
576 | private IQueryBackend getQueryBackend(PQuery query) { | 551 | private IQueryBackend getQueryBackend(PQuery query) { |
577 | final IQueryBackendFactory factory = engineOptions.getQueryBackendFactory(getQueryEvaluationHint(query)); | 552 | final IQueryBackendFactory factory = engineOptions.getQueryBackendFactory(getQueryEvaluationHint(query)); |
@@ -581,7 +556,7 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
581 | /** | 556 | /** |
582 | * Returns a caching query backend (influenced by the hint system). | 557 | * Returns a caching query backend (influenced by the hint system). |
583 | * | 558 | * |
584 | * @throws ViatraQueryRuntimeException | 559 | * @throws InterpreterRuntimeException |
585 | */ | 560 | */ |
586 | private IQueryBackend getCachingQueryBackend(PQuery query) { | 561 | private IQueryBackend getCachingQueryBackend(PQuery query) { |
587 | IQueryBackend regularBackend = getQueryBackend(query); | 562 | IQueryBackend regularBackend = getQueryBackend(query); |
@@ -595,7 +570,7 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
595 | public boolean isResultCached(PQuery query) { | 570 | public boolean isResultCached(PQuery query) { |
596 | try { | 571 | try { |
597 | return null != getCachingQueryBackend(query).peekExistingResultProvider(query); | 572 | return null != getCachingQueryBackend(query).peekExistingResultProvider(query); |
598 | } catch (ViatraQueryException iqe) { | 573 | } catch (InterpreterException iqe) { |
599 | getLogger().error(ERROR_ACCESSING_BACKEND, iqe); | 574 | getLogger().error(ERROR_ACCESSING_BACKEND, iqe); |
600 | return false; | 575 | return false; |
601 | } | 576 | } |
@@ -605,7 +580,7 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
605 | public IQueryResultProvider getCachingResultProvider(PQuery query) { | 580 | public IQueryResultProvider getCachingResultProvider(PQuery query) { |
606 | try { | 581 | try { |
607 | return getCachingQueryBackend(query).getResultProvider(query); | 582 | return getCachingQueryBackend(query).getResultProvider(query); |
608 | } catch (ViatraQueryException iqe) { | 583 | } catch (InterpreterException iqe) { |
609 | getLogger().error(ERROR_ACCESSING_BACKEND, iqe); | 584 | getLogger().error(ERROR_ACCESSING_BACKEND, iqe); |
610 | throw iqe; | 585 | throw iqe; |
611 | } | 586 | } |
@@ -649,7 +624,7 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
649 | patterns.forEach(PQuery::ensureInitialized); | 624 | patterns.forEach(PQuery::ensureInitialized); |
650 | 625 | ||
651 | Collection<String> erroneousPatterns = patterns.stream(). | 626 | Collection<String> erroneousPatterns = patterns.stream(). |
652 | filter(PQueries.queryStatusPredicate(PQueryStatus.ERROR)). | 627 | filter(PQueries.queryStatusPredicate(PQuery.PQueryStatus.ERROR)). |
653 | map(PQuery::getFullyQualifiedName). | 628 | map(PQuery::getFullyQualifiedName). |
654 | collect(Collectors.toList()); | 629 | collect(Collectors.toList()); |
655 | Preconditions.checkState(erroneousPatterns.isEmpty(), "Erroneous query(s) found: %s", | 630 | Preconditions.checkState(erroneousPatterns.isEmpty(), "Erroneous query(s) found: %s", |
@@ -670,14 +645,14 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
670 | final Throwable cause = ex.getCause(); | 645 | final Throwable cause = ex.getCause(); |
671 | if (cause instanceof QueryProcessingException) | 646 | if (cause instanceof QueryProcessingException) |
672 | throw (QueryProcessingException) cause; | 647 | throw (QueryProcessingException) cause; |
673 | if (cause instanceof ViatraQueryException) | 648 | if (cause instanceof InterpreterException) |
674 | throw (ViatraQueryException) cause; | 649 | throw (InterpreterException) cause; |
675 | if (cause instanceof RuntimeException) | 650 | if (cause instanceof RuntimeException) |
676 | throw (RuntimeException) cause; | 651 | throw (RuntimeException) cause; |
677 | assert (false); | 652 | assert (false); |
678 | } | 653 | } |
679 | } catch (QueryProcessingException e) { | 654 | } catch (QueryProcessingException e) { |
680 | throw new ViatraQueryException(e); | 655 | throw new InterpreterException(e); |
681 | } | 656 | } |
682 | } | 657 | } |
683 | 658 | ||
@@ -687,12 +662,12 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
687 | } | 662 | } |
688 | 663 | ||
689 | @Override | 664 | @Override |
690 | public ViatraQueryEngineOptions getEngineOptions() { | 665 | public InterpreterEngineOptions getEngineOptions() { |
691 | return engineOptions; | 666 | return engineOptions; |
692 | } | 667 | } |
693 | 668 | ||
694 | @Override | 669 | @Override |
695 | public IQueryResultProvider getResultProviderOfMatcher(ViatraQueryMatcher<? extends IPatternMatch> matcher) { | 670 | public IQueryResultProvider getResultProviderOfMatcher(InterpreterMatcher<? extends IPatternMatch> matcher) { |
696 | return ((QueryResultWrapper) matcher).backend; | 671 | return ((QueryResultWrapper) matcher).backend; |
697 | } | 672 | } |
698 | 673 | ||
@@ -700,7 +675,7 @@ public final class ViatraQueryEngineImpl extends AdvancedViatraQueryEngine | |||
700 | public IQueryResultProvider getResultProvider(PQuery query, QueryEvaluationHint overrideHints) { | 675 | public IQueryResultProvider getResultProvider(PQuery query, QueryEvaluationHint overrideHints) { |
701 | try { | 676 | try { |
702 | return getResultProviderInternal(query, overrideHints); | 677 | return getResultProviderInternal(query, overrideHints); |
703 | } catch (ViatraQueryException e) { | 678 | } catch (InterpreterException e) { |
704 | getLogger().error(ERROR_ACCESSING_BACKEND, e); | 679 | getLogger().error(ERROR_ACCESSING_BACKEND, e); |
705 | throw e; | 680 | throw e; |
706 | } | 681 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/apiimpl/QueryResultWrapper.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/apiimpl/QueryResultWrapper.java index 47f3268d..0f50aee1 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/apiimpl/QueryResultWrapper.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/apiimpl/QueryResultWrapper.java | |||
@@ -3,23 +3,23 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.internal.apiimpl; | 9 | package tools.refinery.interpreter.internal.apiimpl; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.api.ViatraQueryEngine; | 11 | import tools.refinery.interpreter.matchers.backend.IMatcherCapability; |
12 | import tools.refinery.viatra.runtime.matchers.backend.IMatcherCapability; | 12 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
13 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 13 | import tools.refinery.interpreter.api.InterpreterEngine; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Internal class for wrapping a query result providing backend. It's only supported usage is by the | 16 | * Internal class for wrapping a query result providing backend. It's only supported usage is by the |
17 | * {@link ViatraQueryEngineImpl} class. | 17 | * {@link InterpreterEngineImpl} class. |
18 | * </p> | 18 | * </p> |
19 | * | 19 | * |
20 | * <strong>Important note</strong>: this class must not introduce any public method, as it will be visible through | 20 | * <strong>Important note</strong>: this class must not introduce any public method, as it will be visible through |
21 | * BaseMatcher as an API, although this class is not an API itself. | 21 | * BaseMatcher as an API, although this class is not an API itself. |
22 | * | 22 | * |
23 | * @author Bergmann Gabor | 23 | * @author Bergmann Gabor |
24 | * | 24 | * |
25 | */ | 25 | */ |
@@ -27,6 +27,6 @@ public abstract class QueryResultWrapper { | |||
27 | 27 | ||
28 | protected IQueryResultProvider backend; | 28 | protected IQueryResultProvider backend; |
29 | 29 | ||
30 | protected abstract void setBackend(ViatraQueryEngine engine, IQueryResultProvider resultProvider, IMatcherCapability capabilities); | 30 | protected abstract void setBackend(InterpreterEngine engine, IQueryResultProvider resultProvider, IMatcherCapability capabilities); |
31 | 31 | ||
32 | } | 32 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/engine/LifecycleProvider.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/engine/LifecycleProvider.java index 8bbf2a66..2e89e832 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/engine/LifecycleProvider.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/engine/LifecycleProvider.java | |||
@@ -3,37 +3,37 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.internal.engine; | 9 | package tools.refinery.interpreter.internal.engine; |
10 | |||
11 | import java.util.ArrayList; | ||
12 | 10 | ||
13 | import org.apache.log4j.Logger; | 11 | import org.apache.log4j.Logger; |
14 | import tools.refinery.viatra.runtime.api.AdvancedViatraQueryEngine; | 12 | import tools.refinery.interpreter.api.AdvancedInterpreterEngine; |
15 | import tools.refinery.viatra.runtime.api.IPatternMatch; | 13 | import tools.refinery.interpreter.api.IPatternMatch; |
16 | import tools.refinery.viatra.runtime.api.ViatraQueryEngineLifecycleListener; | 14 | import tools.refinery.interpreter.api.InterpreterEngineLifecycleListener; |
17 | import tools.refinery.viatra.runtime.api.ViatraQueryMatcher; | 15 | import tools.refinery.interpreter.api.InterpreterMatcher; |
16 | |||
17 | import java.util.ArrayList; | ||
18 | 18 | ||
19 | public final class LifecycleProvider extends ListenerContainer<ViatraQueryEngineLifecycleListener> implements ViatraQueryEngineLifecycleListener{ | 19 | public final class LifecycleProvider extends ListenerContainer<InterpreterEngineLifecycleListener> implements InterpreterEngineLifecycleListener { |
20 | 20 | ||
21 | private final Logger logger; | 21 | private final Logger logger; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * @param queryEngine | 24 | * @param queryEngine |
25 | */ | 25 | */ |
26 | public LifecycleProvider(AdvancedViatraQueryEngine queryEngine, Logger logger) { | 26 | public LifecycleProvider(AdvancedInterpreterEngine queryEngine, Logger logger) { |
27 | this.logger = logger; | 27 | this.logger = logger; |
28 | } | 28 | } |
29 | 29 | ||
30 | @Override | 30 | @Override |
31 | protected void listenerAdded(ViatraQueryEngineLifecycleListener listener) { | 31 | protected void listenerAdded(InterpreterEngineLifecycleListener listener) { |
32 | logger.debug("Lifecycle listener " + listener + " added to engine."); | 32 | logger.debug("Lifecycle listener " + listener + " added to engine."); |
33 | } | 33 | } |
34 | 34 | ||
35 | @Override | 35 | @Override |
36 | protected void listenerRemoved(ViatraQueryEngineLifecycleListener listener) { | 36 | protected void listenerRemoved(InterpreterEngineLifecycleListener listener) { |
37 | logger.debug("Lifecycle listener " + listener + " removed from engine."); | 37 | logger.debug("Lifecycle listener " + listener + " removed from engine."); |
38 | } | 38 | } |
39 | 39 | ||
@@ -44,23 +44,23 @@ public final class LifecycleProvider extends ListenerContainer<ViatraQueryEngine | |||
44 | // function.apply(listener); | 44 | // function.apply(listener); |
45 | // } catch (Exception ex) { | 45 | // } catch (Exception ex) { |
46 | // logger.error( | 46 | // logger.error( |
47 | // "VIATRA Query encountered an error in delivering notification to listener " | 47 | // "Refinery Interpreter encountered an error in delivering notification to listener " |
48 | // + listener + ".", ex); | 48 | // + listener + ".", ex); |
49 | // } | 49 | // } |
50 | // } | 50 | // } |
51 | // } | 51 | // } |
52 | // } | 52 | // } |
53 | 53 | ||
54 | @Override | 54 | @Override |
55 | public void matcherInstantiated(final ViatraQueryMatcher<? extends IPatternMatch> matcher) { | 55 | public void matcherInstantiated(final InterpreterMatcher<? extends IPatternMatch> matcher) { |
56 | if (!listeners.isEmpty()) { | 56 | if (!listeners.isEmpty()) { |
57 | for (ViatraQueryEngineLifecycleListener listener : new ArrayList<ViatraQueryEngineLifecycleListener>(listeners)) { | 57 | for (InterpreterEngineLifecycleListener listener : new ArrayList<InterpreterEngineLifecycleListener>(listeners)) { |
58 | try { | 58 | try { |
59 | listener.matcherInstantiated(matcher); | 59 | listener.matcherInstantiated(matcher); |
60 | } catch (Exception ex) { | 60 | } catch (Exception ex) { |
61 | logger.error( | 61 | logger.error( |
62 | "VIATRA Query encountered an error in delivering matcher initialization notification to listener " | 62 | "Refinery Interpreter encountered an error in delivering matcher initialization " + |
63 | + listener + ".", ex); | 63 | "notification to listener " + listener + ".", ex); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | } | 66 | } |
@@ -75,13 +75,13 @@ public final class LifecycleProvider extends ListenerContainer<ViatraQueryEngine | |||
75 | @Override | 75 | @Override |
76 | public void engineBecameTainted(String description, Throwable t) { | 76 | public void engineBecameTainted(String description, Throwable t) { |
77 | if (!listeners.isEmpty()) { | 77 | if (!listeners.isEmpty()) { |
78 | for (ViatraQueryEngineLifecycleListener listener : new ArrayList<ViatraQueryEngineLifecycleListener>(listeners)) { | 78 | for (InterpreterEngineLifecycleListener listener : new ArrayList<InterpreterEngineLifecycleListener>(listeners)) { |
79 | try { | 79 | try { |
80 | listener.engineBecameTainted(description, t); | 80 | listener.engineBecameTainted(description, t); |
81 | } catch (Exception ex) { | 81 | } catch (Exception ex) { |
82 | logger.error( | 82 | logger.error( |
83 | "VIATRA Query encountered an error in delivering engine tainted notification to listener " | 83 | "Refinery Interpreter encountered an error in delivering engine tainted notification " + |
84 | + listener + ".", ex); | 84 | "to listener " + listener + ".", ex); |
85 | } | 85 | } |
86 | } | 86 | } |
87 | } | 87 | } |
@@ -96,13 +96,13 @@ public final class LifecycleProvider extends ListenerContainer<ViatraQueryEngine | |||
96 | @Override | 96 | @Override |
97 | public void engineWiped() { | 97 | public void engineWiped() { |
98 | if (!listeners.isEmpty()) { | 98 | if (!listeners.isEmpty()) { |
99 | for (ViatraQueryEngineLifecycleListener listener : new ArrayList<ViatraQueryEngineLifecycleListener>(listeners)) { | 99 | for (InterpreterEngineLifecycleListener listener : new ArrayList<InterpreterEngineLifecycleListener>(listeners)) { |
100 | try { | 100 | try { |
101 | listener.engineWiped(); | 101 | listener.engineWiped(); |
102 | } catch (Exception ex) { | 102 | } catch (Exception ex) { |
103 | logger.error( | 103 | logger.error( |
104 | "VIATRA Query encountered an error in delivering engine wiped notification to listener " | 104 | "Refinery Interpreter encountered an error in delivering engine wiped notification to" + |
105 | + listener + ".", ex); | 105 | " listener " + listener + ".", ex); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | } | 108 | } |
@@ -117,13 +117,13 @@ public final class LifecycleProvider extends ListenerContainer<ViatraQueryEngine | |||
117 | @Override | 117 | @Override |
118 | public void engineDisposed() { | 118 | public void engineDisposed() { |
119 | if (!listeners.isEmpty()) { | 119 | if (!listeners.isEmpty()) { |
120 | for (ViatraQueryEngineLifecycleListener listener : new ArrayList<ViatraQueryEngineLifecycleListener>(listeners)) { | 120 | for (InterpreterEngineLifecycleListener listener : new ArrayList<InterpreterEngineLifecycleListener>(listeners)) { |
121 | try { | 121 | try { |
122 | listener.engineDisposed(); | 122 | listener.engineDisposed(); |
123 | } catch (Exception ex) { | 123 | } catch (Exception ex) { |
124 | logger.error( | 124 | logger.error( |
125 | "VIATRA Query encountered an error in delivering engine disposed notification to listener " | 125 | "Refinery Interpreter encountered an error in delivering engine disposed notification" + |
126 | + listener + ".", ex); | 126 | " to listener " + listener + ".", ex); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | } | 129 | } |
@@ -134,5 +134,5 @@ public final class LifecycleProvider extends ListenerContainer<ViatraQueryEngine | |||
134 | // } | 134 | // } |
135 | // }); | 135 | // }); |
136 | } | 136 | } |
137 | 137 | ||
138 | } \ No newline at end of file | 138 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/engine/ListenerContainer.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/engine/ListenerContainer.java index 34133bed..d168e4f6 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/engine/ListenerContainer.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/engine/ListenerContainer.java | |||
@@ -3,41 +3,43 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.internal.engine; | 9 | package tools.refinery.interpreter.internal.engine; |
10 | 10 | ||
11 | import static tools.refinery.viatra.runtime.matchers.util.Preconditions.checkArgument; | 11 | import tools.refinery.interpreter.matchers.util.Preconditions; |
12 | |||
13 | import static tools.refinery.interpreter.matchers.util.Preconditions.checkArgument; | ||
12 | 14 | ||
13 | import java.util.HashSet; | 15 | import java.util.HashSet; |
14 | import java.util.Set; | 16 | import java.util.Set; |
15 | 17 | ||
16 | public abstract class ListenerContainer<Listener> { | 18 | public abstract class ListenerContainer<Listener> { |
17 | 19 | ||
18 | protected final Set<Listener> listeners; | 20 | protected final Set<Listener> listeners; |
19 | 21 | ||
20 | public ListenerContainer() { | 22 | public ListenerContainer() { |
21 | this.listeners = new HashSet<Listener>(); | 23 | this.listeners = new HashSet<Listener>(); |
22 | } | 24 | } |
23 | 25 | ||
24 | public synchronized void addListener(Listener listener) { | 26 | public synchronized void addListener(Listener listener) { |
25 | checkArgument(listener != null, "Cannot add null listener!"); | 27 | Preconditions.checkArgument(listener != null, "Cannot add null listener!"); |
26 | boolean added = listeners.add(listener); | 28 | boolean added = listeners.add(listener); |
27 | if(added) { | 29 | if(added) { |
28 | listenerAdded(listener); | 30 | listenerAdded(listener); |
29 | } | 31 | } |
30 | } | 32 | } |
31 | 33 | ||
32 | public synchronized void removeListener(Listener listener) { | 34 | public synchronized void removeListener(Listener listener) { |
33 | checkArgument(listener != null, "Cannot remove null listener!"); | 35 | Preconditions.checkArgument(listener != null, "Cannot remove null listener!"); |
34 | boolean removed = listeners.remove(listener); | 36 | boolean removed = listeners.remove(listener); |
35 | if(removed) { | 37 | if(removed) { |
36 | listenerRemoved(listener); | 38 | listenerRemoved(listener); |
37 | } | 39 | } |
38 | } | 40 | } |
39 | 41 | ||
40 | protected abstract void listenerAdded(Listener listener); | 42 | protected abstract void listenerAdded(Listener listener); |
41 | 43 | ||
42 | protected abstract void listenerRemoved(Listener listener); | 44 | protected abstract void listenerRemoved(Listener listener); |
43 | } \ No newline at end of file | 45 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/engine/ModelUpdateProvider.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/engine/ModelUpdateProvider.java index 1f2c27e8..637ee306 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/internal/engine/ModelUpdateProvider.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/internal/engine/ModelUpdateProvider.java | |||
@@ -3,48 +3,38 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.internal.engine; | 9 | package tools.refinery.interpreter.internal.engine; |
10 | |||
11 | import java.util.ArrayList; | ||
12 | import java.util.Collection; | ||
13 | import java.util.Collections; | ||
14 | import java.util.EnumMap; | ||
15 | import java.util.HashSet; | ||
16 | import java.util.Map; | ||
17 | import java.util.Map.Entry; | ||
18 | 10 | ||
19 | import org.apache.log4j.Logger; | 11 | import org.apache.log4j.Logger; |
20 | import tools.refinery.viatra.runtime.api.AdvancedViatraQueryEngine; | 12 | import tools.refinery.interpreter.api.*; |
21 | import tools.refinery.viatra.runtime.api.IMatchUpdateListener; | 13 | import tools.refinery.interpreter.api.InterpreterModelUpdateListener.ChangeLevel; |
22 | import tools.refinery.viatra.runtime.api.IPatternMatch; | 14 | import tools.refinery.interpreter.api.scope.InterpreterBaseIndexChangeListener; |
23 | import tools.refinery.viatra.runtime.api.ViatraQueryEngineLifecycleListener; | 15 | import tools.refinery.interpreter.exception.InterpreterException; |
24 | import tools.refinery.viatra.runtime.api.ViatraQueryMatcher; | 16 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
25 | import tools.refinery.viatra.runtime.api.ViatraQueryModelUpdateListener; | 17 | |
26 | import tools.refinery.viatra.runtime.api.ViatraQueryModelUpdateListener.ChangeLevel; | 18 | import java.util.*; |
27 | import tools.refinery.viatra.runtime.api.scope.ViatraBaseIndexChangeListener; | 19 | import java.util.Map.Entry; |
28 | import tools.refinery.viatra.runtime.exception.ViatraQueryException; | 20 | |
29 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 21 | public final class ModelUpdateProvider extends ListenerContainer<InterpreterModelUpdateListener> { |
30 | 22 | ||
31 | public final class ModelUpdateProvider extends ListenerContainer<ViatraQueryModelUpdateListener> { | 23 | private final AdvancedInterpreterEngine queryEngine; |
32 | |||
33 | private final AdvancedViatraQueryEngine queryEngine; | ||
34 | private ChangeLevel currentChange = ChangeLevel.NO_CHANGE; | 24 | private ChangeLevel currentChange = ChangeLevel.NO_CHANGE; |
35 | private ChangeLevel maxLevel = ChangeLevel.NO_CHANGE; | 25 | private ChangeLevel maxLevel = ChangeLevel.NO_CHANGE; |
36 | private final Map<ChangeLevel, Collection<ViatraQueryModelUpdateListener>> listenerMap; | 26 | private final Map<ChangeLevel, Collection<InterpreterModelUpdateListener>> listenerMap; |
37 | private final Logger logger; | 27 | private final Logger logger; |
38 | 28 | ||
39 | public ModelUpdateProvider(AdvancedViatraQueryEngine queryEngine, Logger logger) { | 29 | public ModelUpdateProvider(AdvancedInterpreterEngine queryEngine, Logger logger) { |
40 | super(); | 30 | super(); |
41 | this.queryEngine = queryEngine; | 31 | this.queryEngine = queryEngine; |
42 | this.logger = logger; | 32 | this.logger = logger; |
43 | listenerMap = new EnumMap<>(ChangeLevel.class); | 33 | listenerMap = new EnumMap<>(ChangeLevel.class); |
44 | } | 34 | } |
45 | 35 | ||
46 | @Override | 36 | @Override |
47 | protected void listenerAdded(ViatraQueryModelUpdateListener listener) { | 37 | protected void listenerAdded(InterpreterModelUpdateListener listener) { |
48 | // check ChangeLevel | 38 | // check ChangeLevel |
49 | // create callback for given level if required | 39 | // create callback for given level if required |
50 | if(listenerMap.isEmpty()) { | 40 | if(listenerMap.isEmpty()) { |
@@ -52,37 +42,37 @@ public final class ModelUpdateProvider extends ListenerContainer<ViatraQueryMode | |||
52 | this.queryEngine.getBaseIndex().addBaseIndexChangeListener(indexListener); | 42 | this.queryEngine.getBaseIndex().addBaseIndexChangeListener(indexListener); |
53 | // add listener to new matchers (use lifecycle listener) | 43 | // add listener to new matchers (use lifecycle listener) |
54 | this.queryEngine.addLifecycleListener(selfListener); | 44 | this.queryEngine.addLifecycleListener(selfListener); |
55 | } catch (ViatraQueryException e) { | 45 | } catch (InterpreterException e) { |
56 | throw new IllegalStateException("Model update listener used on engine without base index", e); | 46 | throw new IllegalStateException("Model update listener used on engine without base index", e); |
57 | } | 47 | } |
58 | } | 48 | } |
59 | 49 | ||
60 | ChangeLevel changeLevel = listener.getLevel(); | 50 | ChangeLevel changeLevel = listener.getLevel(); |
61 | listenerMap.computeIfAbsent(changeLevel, k -> CollectionsFactory.createSet()).add(listener); | 51 | listenerMap.computeIfAbsent(changeLevel, k -> CollectionsFactory.createSet()).add(listener); |
62 | // increase or keep max level of listeners | 52 | // increase or keep max level of listeners |
63 | ChangeLevel oldMaxLevel = maxLevel; | 53 | ChangeLevel oldMaxLevel = maxLevel; |
64 | maxLevel = maxLevel.changeOccured(changeLevel); | 54 | maxLevel = maxLevel.changeOccured(changeLevel); |
65 | if(!maxLevel.equals(oldMaxLevel) && ChangeLevel.MATCHSET.compareTo(oldMaxLevel) > 0 && ChangeLevel.MATCHSET.compareTo(maxLevel) <= 0) { | 55 | if(!maxLevel.equals(oldMaxLevel) && ChangeLevel.MATCHSET.compareTo(oldMaxLevel) > 0 && ChangeLevel.MATCHSET.compareTo(maxLevel) <= 0) { |
66 | // add matchUpdateListener to all matchers | 56 | // add matchUpdateListener to all matchers |
67 | for (ViatraQueryMatcher<?> matcher : this.queryEngine.getCurrentMatchers()) { | 57 | for (InterpreterMatcher<?> matcher : this.queryEngine.getCurrentMatchers()) { |
68 | this.queryEngine.addMatchUpdateListener(matcher, matchSetListener, false); | 58 | this.queryEngine.addMatchUpdateListener(matcher, matchSetListener, false); |
69 | } | 59 | } |
70 | } | 60 | } |
71 | } | 61 | } |
72 | 62 | ||
73 | @Override | 63 | @Override |
74 | protected void listenerRemoved(ViatraQueryModelUpdateListener listener) { | 64 | protected void listenerRemoved(InterpreterModelUpdateListener listener) { |
75 | ChangeLevel changeLevel = listener.getLevel(); | 65 | ChangeLevel changeLevel = listener.getLevel(); |
76 | Collection<ViatraQueryModelUpdateListener> old = listenerMap.getOrDefault(changeLevel, Collections.emptySet()); | 66 | Collection<InterpreterModelUpdateListener> old = listenerMap.getOrDefault(changeLevel, Collections.emptySet()); |
77 | boolean removed = old.remove(listener); | 67 | boolean removed = old.remove(listener); |
78 | if(removed) { | 68 | if(removed) { |
79 | if (old.isEmpty()) listenerMap.remove(changeLevel); | 69 | if (old.isEmpty()) listenerMap.remove(changeLevel); |
80 | } else { | 70 | } else { |
81 | handleUnsuccesfulRemove(listener); | 71 | handleUnsuccesfulRemove(listener); |
82 | } | 72 | } |
83 | 73 | ||
84 | updateMaxLevel(); | 74 | updateMaxLevel(); |
85 | 75 | ||
86 | if(listenerMap.isEmpty()) { | 76 | if(listenerMap.isEmpty()) { |
87 | this.queryEngine.removeLifecycleListener(selfListener); | 77 | this.queryEngine.removeLifecycleListener(selfListener); |
88 | removeBaseIndexChangeListener(); | 78 | removeBaseIndexChangeListener(); |
@@ -92,7 +82,7 @@ public final class ModelUpdateProvider extends ListenerContainer<ViatraQueryMode | |||
92 | private void removeBaseIndexChangeListener() { | 82 | private void removeBaseIndexChangeListener() { |
93 | try { | 83 | try { |
94 | this.queryEngine.getBaseIndex().removeBaseIndexChangeListener(indexListener); | 84 | this.queryEngine.getBaseIndex().removeBaseIndexChangeListener(indexListener); |
95 | } catch (ViatraQueryException e) { | 85 | } catch (InterpreterException e) { |
96 | throw new IllegalStateException("Model update listener used on engine without base index", e); | 86 | throw new IllegalStateException("Model update listener used on engine without base index", e); |
97 | } | 87 | } |
98 | } | 88 | } |
@@ -107,15 +97,15 @@ public final class ModelUpdateProvider extends ListenerContainer<ViatraQueryMode | |||
107 | } | 97 | } |
108 | if(maxLevel.compareTo(ChangeLevel.MATCHSET) < 0) { | 98 | if(maxLevel.compareTo(ChangeLevel.MATCHSET) < 0) { |
109 | // remove listener from matchers | 99 | // remove listener from matchers |
110 | for (ViatraQueryMatcher<?> matcher : this.queryEngine.getCurrentMatchers()) { | 100 | for (InterpreterMatcher<?> matcher : this.queryEngine.getCurrentMatchers()) { |
111 | this.queryEngine.removeMatchUpdateListener(matcher, matchSetListener); | 101 | this.queryEngine.removeMatchUpdateListener(matcher, matchSetListener); |
112 | } | 102 | } |
113 | } | 103 | } |
114 | } | 104 | } |
115 | 105 | ||
116 | private void handleUnsuccesfulRemove(ViatraQueryModelUpdateListener listener) { | 106 | private void handleUnsuccesfulRemove(InterpreterModelUpdateListener listener) { |
117 | for (Entry<ChangeLevel, Collection<ViatraQueryModelUpdateListener>> entry : listenerMap.entrySet()) { | 107 | for (Entry<ChangeLevel, Collection<InterpreterModelUpdateListener>> entry : listenerMap.entrySet()) { |
118 | Collection<ViatraQueryModelUpdateListener> existingListeners = entry.getValue(); | 108 | Collection<InterpreterModelUpdateListener> existingListeners = entry.getValue(); |
119 | // if the listener is contained in some other bucket, remove it from there | 109 | // if the listener is contained in some other bucket, remove it from there |
120 | if(existingListeners.remove(listener)) { | 110 | if(existingListeners.remove(listener)) { |
121 | logger.error("Listener "+listener+" change level changed since initialization!"); | 111 | logger.error("Listener "+listener+" change level changed since initialization!"); |
@@ -127,23 +117,23 @@ public final class ModelUpdateProvider extends ListenerContainer<ViatraQueryMode | |||
127 | } | 117 | } |
128 | 118 | ||
129 | private void notifyListeners() { | 119 | private void notifyListeners() { |
130 | 120 | ||
131 | // any change that occurs after this point should be regarded as a new event | 121 | // any change that occurs after this point should be regarded as a new event |
132 | // FIXME what should happen when a listener creates new notifications? | 122 | // FIXME what should happen when a listener creates new notifications? |
133 | // -> other listeners will get events in different order | 123 | // -> other listeners will get events in different order |
134 | ChangeLevel tempLevel = currentChange; | 124 | ChangeLevel tempLevel = currentChange; |
135 | currentChange = ChangeLevel.NO_CHANGE; | 125 | currentChange = ChangeLevel.NO_CHANGE; |
136 | 126 | ||
137 | if(!listenerMap.isEmpty()) { | 127 | if(!listenerMap.isEmpty()) { |
138 | for (ChangeLevel level : new HashSet<>(listenerMap.keySet())) { | 128 | for (ChangeLevel level : new HashSet<>(listenerMap.keySet())) { |
139 | if(tempLevel.compareTo(level) >= 0) { | 129 | if(tempLevel.compareTo(level) >= 0) { |
140 | for (ViatraQueryModelUpdateListener listener : new ArrayList<>(listenerMap.get(level))) { | 130 | for (InterpreterModelUpdateListener listener : new ArrayList<>(listenerMap.get(level))) { |
141 | try { | 131 | try { |
142 | listener.notifyChanged(tempLevel); | 132 | listener.notifyChanged(tempLevel); |
143 | } catch (Exception ex) { | 133 | } catch (Exception ex) { |
144 | logger.error( | 134 | logger.error( |
145 | "VIATRA Query encountered an error in delivering model update notification to listener " | 135 | "Refinery Interpreter encountered an error in delivering model update " + |
146 | + listener + ".", ex); | 136 | "notification to listener " + listener + ".", ex); |
147 | } | 137 | } |
148 | } | 138 | } |
149 | } | 139 | } |
@@ -151,19 +141,19 @@ public final class ModelUpdateProvider extends ListenerContainer<ViatraQueryMode | |||
151 | } else { | 141 | } else { |
152 | throw new IllegalStateException("Notify listeners must not be called without listeners! Maybe an update callback was not removed correctly."); | 142 | throw new IllegalStateException("Notify listeners must not be called without listeners! Maybe an update callback was not removed correctly."); |
153 | } | 143 | } |
154 | 144 | ||
155 | } | 145 | } |
156 | 146 | ||
157 | // model update "providers": | 147 | // model update "providers": |
158 | // - model: IQBase callback even if not dirty | 148 | // - model: IQBase callback even if not dirty |
159 | // - index: IQBase dirty callback | 149 | // - index: IQBase dirty callback |
160 | private final ViatraBaseIndexChangeListener indexListener = new ViatraBaseIndexChangeListener() { | 150 | private final InterpreterBaseIndexChangeListener indexListener = new InterpreterBaseIndexChangeListener() { |
161 | 151 | ||
162 | @Override | 152 | @Override |
163 | public boolean onlyOnIndexChange() { | 153 | public boolean onlyOnIndexChange() { |
164 | return false; | 154 | return false; |
165 | } | 155 | } |
166 | 156 | ||
167 | @Override | 157 | @Override |
168 | public void notifyChanged(boolean indexChanged) { | 158 | public void notifyChanged(boolean indexChanged) { |
169 | if(indexChanged) { | 159 | if(indexChanged) { |
@@ -173,41 +163,41 @@ public final class ModelUpdateProvider extends ListenerContainer<ViatraQueryMode | |||
173 | } | 163 | } |
174 | notifyListeners(); | 164 | notifyListeners(); |
175 | } | 165 | } |
176 | 166 | ||
177 | }; | 167 | }; |
178 | // - matchset: add the same listener to each matcher and use a dirty flag. needs IQBase callback as well | 168 | // - matchset: add the same listener to each matcher and use a dirty flag. needs IQBase callback as well |
179 | private final IMatchUpdateListener<IPatternMatch> matchSetListener = new IMatchUpdateListener<IPatternMatch>() { | 169 | private final IMatchUpdateListener<IPatternMatch> matchSetListener = new IMatchUpdateListener<IPatternMatch>() { |
180 | 170 | ||
181 | @Override | 171 | @Override |
182 | public void notifyDisappearance(IPatternMatch match) { | 172 | public void notifyDisappearance(IPatternMatch match) { |
183 | currentChange = currentChange.changeOccured(ChangeLevel.MATCHSET); | 173 | currentChange = currentChange.changeOccured(ChangeLevel.MATCHSET); |
184 | } | 174 | } |
185 | 175 | ||
186 | @Override | 176 | @Override |
187 | public void notifyAppearance(IPatternMatch match) { | 177 | public void notifyAppearance(IPatternMatch match) { |
188 | currentChange = currentChange.changeOccured(ChangeLevel.MATCHSET); | 178 | currentChange = currentChange.changeOccured(ChangeLevel.MATCHSET); |
189 | } | 179 | } |
190 | }; | 180 | }; |
191 | 181 | ||
192 | private final ViatraQueryEngineLifecycleListener selfListener = new ViatraQueryEngineLifecycleListener() { | 182 | private final InterpreterEngineLifecycleListener selfListener = new InterpreterEngineLifecycleListener() { |
193 | 183 | ||
194 | @Override | 184 | @Override |
195 | public void matcherInstantiated(ViatraQueryMatcher<? extends IPatternMatch> matcher) { | 185 | public void matcherInstantiated(InterpreterMatcher<? extends IPatternMatch> matcher) { |
196 | if (maxLevel.compareTo(ChangeLevel.MATCHSET) >= 0) { | 186 | if (maxLevel.compareTo(ChangeLevel.MATCHSET) >= 0) { |
197 | ModelUpdateProvider.this.queryEngine.addMatchUpdateListener(matcher, matchSetListener, false); | 187 | ModelUpdateProvider.this.queryEngine.addMatchUpdateListener(matcher, matchSetListener, false); |
198 | } | 188 | } |
199 | } | 189 | } |
200 | 190 | ||
201 | @Override | 191 | @Override |
202 | public void engineWiped() {} | 192 | public void engineWiped() {} |
203 | 193 | ||
204 | @Override | 194 | @Override |
205 | public void engineDisposed() { | 195 | public void engineDisposed() { |
206 | removeBaseIndexChangeListener(); | 196 | removeBaseIndexChangeListener(); |
207 | listenerMap.clear(); | 197 | listenerMap.clear(); |
208 | maxLevel = ChangeLevel.NO_CHANGE; | 198 | maxLevel = ChangeLevel.NO_CHANGE; |
209 | } | 199 | } |
210 | 200 | ||
211 | @Override | 201 | @Override |
212 | public void engineBecameTainted(String description, Throwable t) {} | 202 | public void engineBecameTainted(String description, Throwable t) {} |
213 | }; | 203 | }; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/ViatraQueryRuntimeException.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/InterpreterRuntimeException.java index 83f6f766..3adbd4b6 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/ViatraQueryRuntimeException.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/InterpreterRuntimeException.java | |||
@@ -3,39 +3,42 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers; | 9 | package tools.refinery.interpreter.matchers; |
10 | |||
11 | import java.io.Serial; | ||
10 | 12 | ||
11 | /** | 13 | /** |
12 | * A common base class for all exceptions thrown by various VIATRA Query Runtime APIs. | 14 | * A common base class for all exceptions thrown by various Refinery Interpreter APIs. |
13 | * | 15 | * |
14 | * @author Zoltan Ujhelyi | 16 | * @author Zoltan Ujhelyi |
15 | * @since 2.0 | 17 | * @since 2.0 |
16 | */ | 18 | */ |
17 | public abstract class ViatraQueryRuntimeException extends RuntimeException { | 19 | public abstract class InterpreterRuntimeException extends RuntimeException { |
18 | 20 | ||
19 | private static final long serialVersionUID = -8505253058035069310L; | 21 | @Serial |
22 | private static final long serialVersionUID = -8505253058035069310L; | ||
20 | 23 | ||
21 | public ViatraQueryRuntimeException() { | 24 | public InterpreterRuntimeException() { |
22 | super(); | 25 | super(); |
23 | } | 26 | } |
24 | 27 | ||
25 | public ViatraQueryRuntimeException(String message) { | 28 | public InterpreterRuntimeException(String message) { |
26 | super(message); | 29 | super(message); |
27 | } | 30 | } |
28 | 31 | ||
29 | public ViatraQueryRuntimeException(Throwable cause) { | 32 | public InterpreterRuntimeException(Throwable cause) { |
30 | super(cause); | 33 | super(cause); |
31 | } | 34 | } |
32 | 35 | ||
33 | public ViatraQueryRuntimeException(String message, Throwable cause) { | 36 | public InterpreterRuntimeException(String message, Throwable cause) { |
34 | super(message, cause); | 37 | super(message, cause); |
35 | } | 38 | } |
36 | 39 | ||
37 | public ViatraQueryRuntimeException(String message, Throwable cause, boolean enableSuppression, | 40 | public InterpreterRuntimeException(String message, Throwable cause, boolean enableSuppression, |
38 | boolean writableStackTrace) { | 41 | boolean writableStackTrace) { |
39 | super(message, cause, enableSuppression, writableStackTrace); | 42 | super(message, cause, enableSuppression, writableStackTrace); |
40 | } | 43 | } |
41 | 44 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/AverageAccumulator.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/AverageAccumulator.java index 2c09ede1..86cfac23 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/AverageAccumulator.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/AverageAccumulator.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.aggregators; | 9 | package tools.refinery.interpreter.matchers.aggregators; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * @since 2.0 | 12 | * @since 2.0 |
@@ -20,5 +20,5 @@ class AverageAccumulator<Domain> { | |||
20 | this.value = value; | 20 | this.value = value; |
21 | this.count = count; | 21 | this.count = count; |
22 | } | 22 | } |
23 | 23 | ||
24 | } \ No newline at end of file | 24 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/DoubleAverageOperator.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/DoubleAverageOperator.java index e8a26afd..30a79ff0 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/DoubleAverageOperator.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/DoubleAverageOperator.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.aggregators; | 9 | package tools.refinery.interpreter.matchers.aggregators; |
10 | 10 | ||
11 | import java.util.OptionalDouble; | 11 | import java.util.OptionalDouble; |
12 | import java.util.stream.Stream; | 12 | import java.util.stream.Stream; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 14 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * @author Zoltan Ujhelyi | 17 | * @author Zoltan Ujhelyi |
@@ -20,11 +20,11 @@ import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggr | |||
20 | public class DoubleAverageOperator implements IMultisetAggregationOperator<Double, AverageAccumulator<Double>, Double> { | 20 | public class DoubleAverageOperator implements IMultisetAggregationOperator<Double, AverageAccumulator<Double>, Double> { |
21 | 21 | ||
22 | public static final DoubleAverageOperator INSTANCE = new DoubleAverageOperator(); | 22 | public static final DoubleAverageOperator INSTANCE = new DoubleAverageOperator(); |
23 | 23 | ||
24 | private DoubleAverageOperator() { | 24 | private DoubleAverageOperator() { |
25 | // Singleton, do not call. | 25 | // Singleton, do not call. |
26 | } | 26 | } |
27 | 27 | ||
28 | @Override | 28 | @Override |
29 | public String getShortDescription() { | 29 | public String getShortDescription() { |
30 | return "avg<Integer> incrementally computes the average of java.lang.Integer values"; | 30 | return "avg<Integer> incrementally computes the average of java.lang.Integer values"; |
@@ -70,7 +70,7 @@ public class DoubleAverageOperator implements IMultisetAggregationOperator<Doubl | |||
70 | final OptionalDouble averageOpt = stream.mapToDouble(Double::doubleValue).average(); | 70 | final OptionalDouble averageOpt = stream.mapToDouble(Double::doubleValue).average(); |
71 | return averageOpt.isPresent() ? averageOpt.getAsDouble() : null; | 71 | return averageOpt.isPresent() ? averageOpt.getAsDouble() : null; |
72 | } | 72 | } |
73 | 73 | ||
74 | /** | 74 | /** |
75 | * @since 2.4 | 75 | * @since 2.4 |
76 | */ | 76 | */ |
@@ -78,5 +78,5 @@ public class DoubleAverageOperator implements IMultisetAggregationOperator<Doubl | |||
78 | public AverageAccumulator<Double> clone(AverageAccumulator<Double> original) { | 78 | public AverageAccumulator<Double> clone(AverageAccumulator<Double> original) { |
79 | return new AverageAccumulator<Double>(original.value, original.count); | 79 | return new AverageAccumulator<Double>(original.value, original.count); |
80 | } | 80 | } |
81 | 81 | ||
82 | } \ No newline at end of file | 82 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/DoubleSumOperator.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/DoubleSumOperator.java index 744b0cd1..a15aadd3 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/DoubleSumOperator.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/DoubleSumOperator.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.aggregators; | 9 | package tools.refinery.interpreter.matchers.aggregators; |
10 | 10 | ||
11 | import java.util.stream.Stream; | 11 | import java.util.stream.Stream; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.AbstractMemorylessAggregationOperator; | 13 | import tools.refinery.interpreter.matchers.psystem.aggregations.AbstractMemorylessAggregationOperator; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Incrementally computes the sum of java.lang.Double values | 16 | * Incrementally computes the sum of java.lang.Double values |
@@ -19,7 +19,7 @@ import tools.refinery.viatra.runtime.matchers.psystem.aggregations.AbstractMemor | |||
19 | */ | 19 | */ |
20 | public class DoubleSumOperator extends AbstractMemorylessAggregationOperator<Double, Double> { | 20 | public class DoubleSumOperator extends AbstractMemorylessAggregationOperator<Double, Double> { |
21 | public static final DoubleSumOperator INSTANCE = new DoubleSumOperator(); | 21 | public static final DoubleSumOperator INSTANCE = new DoubleSumOperator(); |
22 | 22 | ||
23 | private DoubleSumOperator() { | 23 | private DoubleSumOperator() { |
24 | // Singleton, do not call. | 24 | // Singleton, do not call. |
25 | } | 25 | } |
@@ -32,7 +32,7 @@ public class DoubleSumOperator extends AbstractMemorylessAggregationOperator<Dou | |||
32 | public String getName() { | 32 | public String getName() { |
33 | return "sum<Double>"; | 33 | return "sum<Double>"; |
34 | } | 34 | } |
35 | 35 | ||
36 | @Override | 36 | @Override |
37 | public Double createNeutral() { | 37 | public Double createNeutral() { |
38 | return 0d; | 38 | return 0d; |
@@ -45,8 +45,8 @@ public class DoubleSumOperator extends AbstractMemorylessAggregationOperator<Dou | |||
45 | 45 | ||
46 | @Override | 46 | @Override |
47 | public Double update(Double oldResult, Double updateValue, boolean isInsertion) { | 47 | public Double update(Double oldResult, Double updateValue, boolean isInsertion) { |
48 | return isInsertion ? | 48 | return isInsertion ? |
49 | oldResult + updateValue : | 49 | oldResult + updateValue : |
50 | oldResult - updateValue; | 50 | oldResult - updateValue; |
51 | } | 51 | } |
52 | 52 | ||
@@ -57,6 +57,6 @@ public class DoubleSumOperator extends AbstractMemorylessAggregationOperator<Dou | |||
57 | public Double aggregateStream(Stream<Double> stream) { | 57 | public Double aggregateStream(Stream<Double> stream) { |
58 | return stream.mapToDouble(Double::doubleValue).sum(); | 58 | return stream.mapToDouble(Double::doubleValue).sum(); |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | } | 62 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/ExtremumOperator.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/ExtremumOperator.java index ee4ceeb8..f5952b72 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/ExtremumOperator.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/ExtremumOperator.java | |||
@@ -3,37 +3,37 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.aggregators; | 9 | package tools.refinery.interpreter.matchers.aggregators; |
10 | 10 | ||
11 | import java.util.Comparator; | 11 | import java.util.Comparator; |
12 | import java.util.SortedMap; | 12 | import java.util.SortedMap; |
13 | import java.util.TreeMap; | 13 | import java.util.TreeMap; |
14 | import java.util.stream.Stream; | 14 | import java.util.stream.Stream; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 16 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Incrementally computes the minimum or maximum of java.lang.Comparable values, using the default comparison | 19 | * Incrementally computes the minimum or maximum of java.lang.Comparable values, using the default comparison |
20 | * | 20 | * |
21 | * @author Gabor Bergmann | 21 | * @author Gabor Bergmann |
22 | * @since 1.4 | 22 | * @since 1.4 |
23 | */ | 23 | */ |
24 | public class ExtremumOperator<T extends Comparable<T>> | 24 | public class ExtremumOperator<T extends Comparable<T>> |
25 | implements IMultisetAggregationOperator<T, SortedMap<T, Integer>, T> { | 25 | implements IMultisetAggregationOperator<T, SortedMap<T, Integer>, T> { |
26 | 26 | ||
27 | public enum Extreme { | 27 | public enum Extreme { |
28 | MIN, MAX; | 28 | MIN, MAX; |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * @since 2.0 | 31 | * @since 2.0 |
32 | */ | 32 | */ |
33 | public <T> T pickFrom(SortedMap<T, Integer> nonEmptyMultiSet) { | 33 | public <T> T pickFrom(SortedMap<T, Integer> nonEmptyMultiSet) { |
34 | switch(this) { | 34 | switch(this) { |
35 | case MIN: | 35 | case MIN: |
36 | return nonEmptyMultiSet.firstKey(); | 36 | return nonEmptyMultiSet.firstKey(); |
37 | case MAX: | 37 | case MAX: |
38 | return nonEmptyMultiSet.lastKey(); | 38 | return nonEmptyMultiSet.lastKey(); |
39 | default: | 39 | default: |
@@ -51,7 +51,7 @@ public class ExtremumOperator<T extends Comparable<T>> | |||
51 | public static <T extends Comparable<T>> ExtremumOperator<T> getMax() { | 51 | public static <T extends Comparable<T>> ExtremumOperator<T> getMax() { |
52 | return MAX_OP; | 52 | return MAX_OP; |
53 | } | 53 | } |
54 | 54 | ||
55 | Extreme extreme; | 55 | Extreme extreme; |
56 | private ExtremumOperator(Extreme extreme) { | 56 | private ExtremumOperator(Extreme extreme) { |
57 | super(); | 57 | super(); |
@@ -94,7 +94,7 @@ public class ExtremumOperator<T extends Comparable<T>> | |||
94 | public SortedMap<T, Integer> update(SortedMap<T, Integer> oldResult, T updateValue, boolean isInsertion) { | 94 | public SortedMap<T, Integer> update(SortedMap<T, Integer> oldResult, T updateValue, boolean isInsertion) { |
95 | oldResult.compute(updateValue, (value, c) -> { | 95 | oldResult.compute(updateValue, (value, c) -> { |
96 | int count = (c == null) ? 0 : c; | 96 | int count = (c == null) ? 0 : c; |
97 | int result = (isInsertion) ? count+1 : count-1; | 97 | int result = (isInsertion) ? count+1 : count-1; |
98 | return (result == 0) ? null : result; | 98 | return (result == 0) ? null : result; |
99 | }); | 99 | }); |
100 | return oldResult; | 100 | return oldResult; |
@@ -105,10 +105,10 @@ public class ExtremumOperator<T extends Comparable<T>> | |||
105 | */ | 105 | */ |
106 | @Override | 106 | @Override |
107 | public T getAggregate(SortedMap<T, Integer> result) { | 107 | public T getAggregate(SortedMap<T, Integer> result) { |
108 | return result.isEmpty() ? null : | 108 | return result.isEmpty() ? null : |
109 | extreme.pickFrom(result); | 109 | extreme.pickFrom(result); |
110 | } | 110 | } |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * @since 2.0 | 113 | * @since 2.0 |
114 | */ | 114 | */ |
@@ -123,7 +123,7 @@ public class ExtremumOperator<T extends Comparable<T>> | |||
123 | return null; | 123 | return null; |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * @since 2.4 | 128 | * @since 2.4 |
129 | */ | 129 | */ |
@@ -131,5 +131,5 @@ public class ExtremumOperator<T extends Comparable<T>> | |||
131 | public SortedMap<T, Integer> clone(SortedMap<T, Integer> original) { | 131 | public SortedMap<T, Integer> clone(SortedMap<T, Integer> original) { |
132 | return new TreeMap<T, Integer>(original); | 132 | return new TreeMap<T, Integer>(original); |
133 | } | 133 | } |
134 | 134 | ||
135 | } | 135 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/IntegerAverageOperator.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/IntegerAverageOperator.java index bf422476..c33fc382 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/IntegerAverageOperator.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/IntegerAverageOperator.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.aggregators; | 9 | package tools.refinery.interpreter.matchers.aggregators; |
10 | 10 | ||
11 | import java.util.OptionalDouble; | 11 | import java.util.OptionalDouble; |
12 | import java.util.stream.Stream; | 12 | import java.util.stream.Stream; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 14 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * @author Zoltan Ujhelyi | 17 | * @author Zoltan Ujhelyi |
@@ -20,11 +20,11 @@ import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggr | |||
20 | public class IntegerAverageOperator implements IMultisetAggregationOperator<Integer, AverageAccumulator<Integer>, Double> { | 20 | public class IntegerAverageOperator implements IMultisetAggregationOperator<Integer, AverageAccumulator<Integer>, Double> { |
21 | 21 | ||
22 | public static final IntegerAverageOperator INSTANCE = new IntegerAverageOperator(); | 22 | public static final IntegerAverageOperator INSTANCE = new IntegerAverageOperator(); |
23 | 23 | ||
24 | private IntegerAverageOperator() { | 24 | private IntegerAverageOperator() { |
25 | // Singleton, do not call. | 25 | // Singleton, do not call. |
26 | } | 26 | } |
27 | 27 | ||
28 | @Override | 28 | @Override |
29 | public String getShortDescription() { | 29 | public String getShortDescription() { |
30 | return "avg<Integer> incrementally computes the average of java.lang.Integer values"; | 30 | return "avg<Integer> incrementally computes the average of java.lang.Integer values"; |
@@ -70,7 +70,7 @@ public class IntegerAverageOperator implements IMultisetAggregationOperator<Inte | |||
70 | final OptionalDouble averageOpt = stream.mapToInt(Integer::intValue).average(); | 70 | final OptionalDouble averageOpt = stream.mapToInt(Integer::intValue).average(); |
71 | return averageOpt.isPresent() ? averageOpt.getAsDouble() : null; | 71 | return averageOpt.isPresent() ? averageOpt.getAsDouble() : null; |
72 | } | 72 | } |
73 | 73 | ||
74 | /** | 74 | /** |
75 | * @since 2.4 | 75 | * @since 2.4 |
76 | */ | 76 | */ |
@@ -78,5 +78,5 @@ public class IntegerAverageOperator implements IMultisetAggregationOperator<Inte | |||
78 | public AverageAccumulator<Integer> clone(AverageAccumulator<Integer> original) { | 78 | public AverageAccumulator<Integer> clone(AverageAccumulator<Integer> original) { |
79 | return new AverageAccumulator<Integer>(original.value, original.count); | 79 | return new AverageAccumulator<Integer>(original.value, original.count); |
80 | } | 80 | } |
81 | 81 | ||
82 | } \ No newline at end of file | 82 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/IntegerSumOperator.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/IntegerSumOperator.java index 18584256..430875bc 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/IntegerSumOperator.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/IntegerSumOperator.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.aggregators; | 9 | package tools.refinery.interpreter.matchers.aggregators; |
10 | 10 | ||
11 | import java.util.stream.Stream; | 11 | import java.util.stream.Stream; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.AbstractMemorylessAggregationOperator; | 13 | import tools.refinery.interpreter.matchers.psystem.aggregations.AbstractMemorylessAggregationOperator; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Incrementally computes the sum of java.lang.Integer values | 16 | * Incrementally computes the sum of java.lang.Integer values |
@@ -19,7 +19,7 @@ import tools.refinery.viatra.runtime.matchers.psystem.aggregations.AbstractMemor | |||
19 | */ | 19 | */ |
20 | public class IntegerSumOperator extends AbstractMemorylessAggregationOperator<Integer, Integer> { | 20 | public class IntegerSumOperator extends AbstractMemorylessAggregationOperator<Integer, Integer> { |
21 | public static final IntegerSumOperator INSTANCE = new IntegerSumOperator(); | 21 | public static final IntegerSumOperator INSTANCE = new IntegerSumOperator(); |
22 | 22 | ||
23 | private IntegerSumOperator() { | 23 | private IntegerSumOperator() { |
24 | // Singleton, do not call. | 24 | // Singleton, do not call. |
25 | } | 25 | } |
@@ -32,7 +32,7 @@ public class IntegerSumOperator extends AbstractMemorylessAggregationOperator<In | |||
32 | public String getName() { | 32 | public String getName() { |
33 | return "sum<Integer>"; | 33 | return "sum<Integer>"; |
34 | } | 34 | } |
35 | 35 | ||
36 | @Override | 36 | @Override |
37 | public Integer createNeutral() { | 37 | public Integer createNeutral() { |
38 | return 0; | 38 | return 0; |
@@ -45,8 +45,8 @@ public class IntegerSumOperator extends AbstractMemorylessAggregationOperator<In | |||
45 | 45 | ||
46 | @Override | 46 | @Override |
47 | public Integer update(Integer oldResult, Integer updateValue, boolean isInsertion) { | 47 | public Integer update(Integer oldResult, Integer updateValue, boolean isInsertion) { |
48 | return isInsertion ? | 48 | return isInsertion ? |
49 | oldResult + updateValue : | 49 | oldResult + updateValue : |
50 | oldResult - updateValue; | 50 | oldResult - updateValue; |
51 | } | 51 | } |
52 | 52 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/LongAverageOperator.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/LongAverageOperator.java index d56c9507..1314adc3 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/LongAverageOperator.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/LongAverageOperator.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.aggregators; | 9 | package tools.refinery.interpreter.matchers.aggregators; |
10 | 10 | ||
11 | import java.util.OptionalDouble; | 11 | import java.util.OptionalDouble; |
12 | import java.util.stream.Stream; | 12 | import java.util.stream.Stream; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 14 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * @author Zoltan Ujhelyi | 17 | * @author Zoltan Ujhelyi |
@@ -20,11 +20,11 @@ import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggr | |||
20 | public class LongAverageOperator implements IMultisetAggregationOperator<Long, AverageAccumulator<Long>, Double> { | 20 | public class LongAverageOperator implements IMultisetAggregationOperator<Long, AverageAccumulator<Long>, Double> { |
21 | 21 | ||
22 | public static final LongAverageOperator INSTANCE = new LongAverageOperator(); | 22 | public static final LongAverageOperator INSTANCE = new LongAverageOperator(); |
23 | 23 | ||
24 | private LongAverageOperator() { | 24 | private LongAverageOperator() { |
25 | // Singleton, do not call. | 25 | // Singleton, do not call. |
26 | } | 26 | } |
27 | 27 | ||
28 | @Override | 28 | @Override |
29 | public String getShortDescription() { | 29 | public String getShortDescription() { |
30 | return "avg<Integer> incrementally computes the average of java.lang.Integer values"; | 30 | return "avg<Integer> incrementally computes the average of java.lang.Integer values"; |
@@ -70,7 +70,7 @@ public class LongAverageOperator implements IMultisetAggregationOperator<Long, A | |||
70 | final OptionalDouble averageOpt = stream.mapToLong(Long::longValue).average(); | 70 | final OptionalDouble averageOpt = stream.mapToLong(Long::longValue).average(); |
71 | return averageOpt.isPresent() ? averageOpt.getAsDouble() : null; | 71 | return averageOpt.isPresent() ? averageOpt.getAsDouble() : null; |
72 | } | 72 | } |
73 | 73 | ||
74 | /** | 74 | /** |
75 | * @since 2.4 | 75 | * @since 2.4 |
76 | */ | 76 | */ |
@@ -78,5 +78,5 @@ public class LongAverageOperator implements IMultisetAggregationOperator<Long, A | |||
78 | public AverageAccumulator<Long> clone(AverageAccumulator<Long> original) { | 78 | public AverageAccumulator<Long> clone(AverageAccumulator<Long> original) { |
79 | return new AverageAccumulator<Long>(original.value, original.count); | 79 | return new AverageAccumulator<Long>(original.value, original.count); |
80 | } | 80 | } |
81 | 81 | ||
82 | } \ No newline at end of file | 82 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/LongSumOperator.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/LongSumOperator.java index 29ded090..2d466314 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/LongSumOperator.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/LongSumOperator.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.aggregators; | 9 | package tools.refinery.interpreter.matchers.aggregators; |
10 | 10 | ||
11 | import java.util.stream.Stream; | 11 | import java.util.stream.Stream; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.AbstractMemorylessAggregationOperator; | 13 | import tools.refinery.interpreter.matchers.psystem.aggregations.AbstractMemorylessAggregationOperator; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Incrementally computes the sum of java.lang.Long values | 16 | * Incrementally computes the sum of java.lang.Long values |
@@ -19,7 +19,7 @@ import tools.refinery.viatra.runtime.matchers.psystem.aggregations.AbstractMemor | |||
19 | */ | 19 | */ |
20 | public class LongSumOperator extends AbstractMemorylessAggregationOperator<Long, Long> { | 20 | public class LongSumOperator extends AbstractMemorylessAggregationOperator<Long, Long> { |
21 | public static final LongSumOperator INSTANCE = new LongSumOperator(); | 21 | public static final LongSumOperator INSTANCE = new LongSumOperator(); |
22 | 22 | ||
23 | private LongSumOperator() { | 23 | private LongSumOperator() { |
24 | // Singleton, do not call. | 24 | // Singleton, do not call. |
25 | } | 25 | } |
@@ -32,7 +32,7 @@ public class LongSumOperator extends AbstractMemorylessAggregationOperator<Long, | |||
32 | public String getName() { | 32 | public String getName() { |
33 | return "sum<Long>"; | 33 | return "sum<Long>"; |
34 | } | 34 | } |
35 | 35 | ||
36 | @Override | 36 | @Override |
37 | public Long createNeutral() { | 37 | public Long createNeutral() { |
38 | return 0L; | 38 | return 0L; |
@@ -45,8 +45,8 @@ public class LongSumOperator extends AbstractMemorylessAggregationOperator<Long, | |||
45 | 45 | ||
46 | @Override | 46 | @Override |
47 | public Long update(Long oldResult, Long updateValue, boolean isInsertion) { | 47 | public Long update(Long oldResult, Long updateValue, boolean isInsertion) { |
48 | return isInsertion ? | 48 | return isInsertion ? |
49 | oldResult + updateValue : | 49 | oldResult + updateValue : |
50 | oldResult - updateValue; | 50 | oldResult - updateValue; |
51 | } | 51 | } |
52 | 52 | ||
@@ -57,5 +57,5 @@ public class LongSumOperator extends AbstractMemorylessAggregationOperator<Long, | |||
57 | public Long aggregateStream(Stream<Long> stream) { | 57 | public Long aggregateStream(Stream<Long> stream) { |
58 | return stream.mapToLong(Long::longValue).sum(); | 58 | return stream.mapToLong(Long::longValue).sum(); |
59 | } | 59 | } |
60 | 60 | ||
61 | } | 61 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/avg.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/avg.java index c25678aa..0d0449d2 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/avg.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/avg.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.aggregators; | 9 | package tools.refinery.interpreter.matchers.aggregators; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.AggregatorType; | 11 | import tools.refinery.interpreter.matchers.psystem.aggregations.AggregatorType; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.BoundAggregator; | 12 | import tools.refinery.interpreter.matchers.psystem.aggregations.BoundAggregator; |
13 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IAggregatorFactory; | 13 | import tools.refinery.interpreter.matchers.psystem.aggregations.IAggregatorFactory; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * This aggregator calculates the average of the values of a selected aggregate parameter of a called pattern. The aggregate | 16 | * This aggregator calculates the average of the values of a selected aggregate parameter of a called pattern. The aggregate |
17 | * parameter is selected with the '#' symbol; the aggregate parameter must not be used outside the aggregator call. The | 17 | * parameter is selected with the '#' symbol; the aggregate parameter must not be used outside the aggregator call. The |
18 | * other parameters of the call might be bound or unbound; bound parameters limit the matches to consider for the | 18 | * other parameters of the call might be bound or unbound; bound parameters limit the matches to consider for the |
19 | * summation. | 19 | * summation. |
20 | * | 20 | * |
21 | * @since 2.0 | 21 | * @since 2.0 |
22 | * | 22 | * |
23 | */ | 23 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/count.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/count.java index 8310a0ce..2cd5e7ed 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/count.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/count.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.aggregators; | 9 | package tools.refinery.interpreter.matchers.aggregators; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.AggregatorType; | 11 | import tools.refinery.interpreter.matchers.psystem.aggregations.AggregatorType; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.BoundAggregator; | 12 | import tools.refinery.interpreter.matchers.psystem.aggregations.BoundAggregator; |
13 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IAggregatorFactory; | 13 | import tools.refinery.interpreter.matchers.psystem.aggregations.IAggregatorFactory; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * An aggregator to count the number of matches a pattern has. The return of the aggregator is an non-negative integer | 16 | * An aggregator to count the number of matches a pattern has. The return of the aggregator is an non-negative integer |
17 | * number. | 17 | * number. |
18 | * | 18 | * |
19 | * @since 1.4 | 19 | * @since 1.4 |
20 | * | 20 | * |
21 | */ | 21 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/max.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/max.java index e0236223..b005bd10 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/max.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/max.java | |||
@@ -3,34 +3,34 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.aggregators; | 9 | package tools.refinery.interpreter.matchers.aggregators; |
10 | 10 | ||
11 | import java.math.BigDecimal; | 11 | import java.math.BigDecimal; |
12 | import java.math.BigInteger; | 12 | import java.math.BigInteger; |
13 | import java.util.Calendar; | 13 | import java.util.Calendar; |
14 | import java.util.Date; | 14 | import java.util.Date; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.AggregatorType; | 16 | import tools.refinery.interpreter.matchers.psystem.aggregations.AggregatorType; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.BoundAggregator; | 17 | import tools.refinery.interpreter.matchers.psystem.aggregations.BoundAggregator; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IAggregatorFactory; | 18 | import tools.refinery.interpreter.matchers.psystem.aggregations.IAggregatorFactory; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * This aggregator calculates the maximum value of a selected aggregate parameter of a called pattern. The aggregate | 21 | * This aggregator calculates the maximum value of a selected aggregate parameter of a called pattern. The aggregate |
22 | * parameter is selected with the '#' symbol; the aggregate parameter must not be used outside the aggregator call. The | 22 | * parameter is selected with the '#' symbol; the aggregate parameter must not be used outside the aggregator call. The |
23 | * other parameters of the call might be bound or unbound; bound parameters limit the matches to consider for the | 23 | * other parameters of the call might be bound or unbound; bound parameters limit the matches to consider for the |
24 | * minimum calculation. | 24 | * minimum calculation. |
25 | * | 25 | * |
26 | * @since 1.4 | 26 | * @since 1.4 |
27 | * @author Gabor Bergmann | 27 | * @author Gabor Bergmann |
28 | */ | 28 | */ |
29 | @AggregatorType( | 29 | @AggregatorType( |
30 | // TODO T extends Comparable? | 30 | // TODO T extends Comparable? |
31 | parameterTypes = {BigDecimal.class, BigInteger.class, Boolean.class, Byte.class, Calendar.class, Character.class, | 31 | parameterTypes = {BigDecimal.class, BigInteger.class, Boolean.class, Byte.class, Calendar.class, Character.class, |
32 | Date.class, Double.class, Enum.class, Float.class, Integer.class, Long.class, Short.class, String.class}, | 32 | Date.class, Double.class, Enum.class, Float.class, Integer.class, Long.class, Short.class, String.class}, |
33 | returnTypes = {BigDecimal.class, BigInteger.class, Boolean.class, Byte.class, Calendar.class, Character.class, | 33 | returnTypes = {BigDecimal.class, BigInteger.class, Boolean.class, Byte.class, Calendar.class, Character.class, |
34 | Date.class, Double.class, Enum.class, Float.class, Integer.class, Long.class, Short.class, String.class}) | 34 | Date.class, Double.class, Enum.class, Float.class, Integer.class, Long.class, Short.class, String.class}) |
35 | public final class max implements IAggregatorFactory { | 35 | public final class max implements IAggregatorFactory { |
36 | 36 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/min.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/min.java index 6408c57b..58d92e92 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/min.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/min.java | |||
@@ -3,37 +3,37 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.aggregators; | 9 | package tools.refinery.interpreter.matchers.aggregators; |
10 | 10 | ||
11 | import java.math.BigDecimal; | 11 | import java.math.BigDecimal; |
12 | import java.math.BigInteger; | 12 | import java.math.BigInteger; |
13 | import java.util.Calendar; | 13 | import java.util.Calendar; |
14 | import java.util.Date; | 14 | import java.util.Date; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.AggregatorType; | 16 | import tools.refinery.interpreter.matchers.psystem.aggregations.AggregatorType; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.BoundAggregator; | 17 | import tools.refinery.interpreter.matchers.psystem.aggregations.BoundAggregator; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IAggregatorFactory; | 18 | import tools.refinery.interpreter.matchers.psystem.aggregations.IAggregatorFactory; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * This aggregator calculates the minimum value of a selected aggregate parameter of a called pattern. The aggregate | 21 | * This aggregator calculates the minimum value of a selected aggregate parameter of a called pattern. The aggregate |
22 | * parameter is selected with the '#' symbol; the aggregate parameter must not be used outside the aggregator call. The | 22 | * parameter is selected with the '#' symbol; the aggregate parameter must not be used outside the aggregator call. The |
23 | * other parameters of the call might be bound or unbound; bound parameters limit the matches to consider for the | 23 | * other parameters of the call might be bound or unbound; bound parameters limit the matches to consider for the |
24 | * minimum calculation. | 24 | * minimum calculation. |
25 | * | 25 | * |
26 | * @since 1.4 | 26 | * @since 1.4 |
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | @AggregatorType( | 29 | @AggregatorType( |
30 | // TODO T extends Comparable? | 30 | // TODO T extends Comparable? |
31 | parameterTypes = {BigDecimal.class, BigInteger.class, Boolean.class, Byte.class, Calendar.class, Character.class, | 31 | parameterTypes = {BigDecimal.class, BigInteger.class, Boolean.class, Byte.class, Calendar.class, Character.class, |
32 | Date.class, Double.class, Enum.class, Float.class, Integer.class, Long.class, Short.class, String.class}, | 32 | Date.class, Double.class, Enum.class, Float.class, Integer.class, Long.class, Short.class, String.class}, |
33 | returnTypes = {BigDecimal.class, BigInteger.class, Boolean.class, Byte.class, Calendar.class, Character.class, | 33 | returnTypes = {BigDecimal.class, BigInteger.class, Boolean.class, Byte.class, Calendar.class, Character.class, |
34 | Date.class, Double.class, Enum.class, Float.class, Integer.class, Long.class, Short.class, String.class}) | 34 | Date.class, Double.class, Enum.class, Float.class, Integer.class, Long.class, Short.class, String.class}) |
35 | public final class min implements IAggregatorFactory { | 35 | public final class min implements IAggregatorFactory { |
36 | 36 | ||
37 | @Override | 37 | @Override |
38 | public BoundAggregator getAggregatorLogic(Class<?> domainClass) { | 38 | public BoundAggregator getAggregatorLogic(Class<?> domainClass) { |
39 | if (Comparable.class.isAssignableFrom(domainClass)) | 39 | if (Comparable.class.isAssignableFrom(domainClass)) |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/sum.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/sum.java index 69ff2e75..e60b21ee 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/aggregators/sum.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/aggregators/sum.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.aggregators; | 9 | package tools.refinery.interpreter.matchers.aggregators; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.AggregatorType; | 11 | import tools.refinery.interpreter.matchers.psystem.aggregations.AggregatorType; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.BoundAggregator; | 12 | import tools.refinery.interpreter.matchers.psystem.aggregations.BoundAggregator; |
13 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IAggregatorFactory; | 13 | import tools.refinery.interpreter.matchers.psystem.aggregations.IAggregatorFactory; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * This aggregator calculates the sum of the values of a selected aggregate parameter of a called pattern. The aggregate | 16 | * This aggregator calculates the sum of the values of a selected aggregate parameter of a called pattern. The aggregate |
17 | * parameter is selected with the '#' symbol; the aggregate parameter must not be used outside the aggregator call. The | 17 | * parameter is selected with the '#' symbol; the aggregate parameter must not be used outside the aggregator call. The |
18 | * other parameters of the call might be bound or unbound; bound parameters limit the matches to consider for the | 18 | * other parameters of the call might be bound or unbound; bound parameters limit the matches to consider for the |
19 | * summation. | 19 | * summation. |
20 | * | 20 | * |
21 | * @since 1.4 | 21 | * @since 1.4 |
22 | * | 22 | * |
23 | */ | 23 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/algorithms/OrderedIterableMerge.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/algorithms/OrderedIterableMerge.java index 1917e909..57aff73d 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/algorithms/OrderedIterableMerge.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/algorithms/OrderedIterableMerge.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.algorithms; | 9 | package tools.refinery.interpreter.matchers.algorithms; |
10 | 10 | ||
11 | import java.util.Comparator; | 11 | import java.util.Comparator; |
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
@@ -18,13 +18,13 @@ import java.util.NoSuchElementException; | |||
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | public class OrderedIterableMerge { | 20 | public class OrderedIterableMerge { |
21 | 21 | ||
22 | private OrderedIterableMerge() { | 22 | private OrderedIterableMerge() { |
23 | // Hidden utility class constructor | 23 | // Hidden utility class constructor |
24 | } | 24 | } |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Lazily merges two iterables, each ordered according to a given comparator. | 27 | * Lazily merges two iterables, each ordered according to a given comparator. |
28 | * Retains order in the result, and also eliminates any duplicates that appear in both arguments. | 28 | * Retains order in the result, and also eliminates any duplicates that appear in both arguments. |
29 | */ | 29 | */ |
30 | public static <T> Iterable<T> mergeUniques(Iterable<T> first, Iterable<T> second, Comparator<T> comparator) { | 30 | public static <T> Iterable<T> mergeUniques(Iterable<T> first, Iterable<T> second, Comparator<T> comparator) { |
@@ -33,29 +33,29 @@ public class OrderedIterableMerge { | |||
33 | Iterator<T> secondIterator = second.iterator(); | 33 | Iterator<T> secondIterator = second.iterator(); |
34 | T firstItem; | 34 | T firstItem; |
35 | T secondItem; | 35 | T secondItem; |
36 | 36 | ||
37 | { | 37 | { |
38 | fetchFirst(); | 38 | fetchFirst(); |
39 | fetchSecond(); | 39 | fetchSecond(); |
40 | } | 40 | } |
41 | 41 | ||
42 | private T fetchFirst() { | 42 | private T fetchFirst() { |
43 | T previous = firstItem; | 43 | T previous = firstItem; |
44 | if (firstIterator.hasNext()) | 44 | if (firstIterator.hasNext()) |
45 | firstItem = firstIterator.next(); | 45 | firstItem = firstIterator.next(); |
46 | else | 46 | else |
47 | firstItem = null; | 47 | firstItem = null; |
48 | return previous; | 48 | return previous; |
49 | } | 49 | } |
50 | private T fetchSecond() { | 50 | private T fetchSecond() { |
51 | T previous = secondItem; | 51 | T previous = secondItem; |
52 | if (secondIterator.hasNext()) | 52 | if (secondIterator.hasNext()) |
53 | secondItem = secondIterator.next(); | 53 | secondItem = secondIterator.next(); |
54 | else | 54 | else |
55 | secondItem = null; | 55 | secondItem = null; |
56 | return previous; | 56 | return previous; |
57 | } | 57 | } |
58 | 58 | ||
59 | @Override | 59 | @Override |
60 | public boolean hasNext() { | 60 | public boolean hasNext() { |
61 | return firstItem != null || secondItem != null; | 61 | return firstItem != null || secondItem != null; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/algorithms/UnionFind.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/algorithms/UnionFind.java index c69f08e5..9d0f5275 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/algorithms/UnionFind.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/algorithms/UnionFind.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.algorithms; | 10 | package tools.refinery.interpreter.matchers.algorithms; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.HashSet; | 13 | import java.util.HashSet; |
@@ -15,14 +15,14 @@ import java.util.Iterator; | |||
15 | import java.util.Map; | 15 | import java.util.Map; |
16 | import java.util.Set; | 16 | import java.util.Set; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 18 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * Union-find data structure implementation. Note that the implementation relies on the correct implementation of the | 21 | * Union-find data structure implementation. Note that the implementation relies on the correct implementation of the |
22 | * equals method of the type parameter's class. | 22 | * equals method of the type parameter's class. |
23 | * | 23 | * |
24 | * @author Tamas Szabo | 24 | * @author Tamas Szabo |
25 | * | 25 | * |
26 | * @param <V> | 26 | * @param <V> |
27 | * the type parameter of the element's stored in the union-find data structure | 27 | * the type parameter of the element's stored in the union-find data structure |
28 | */ | 28 | */ |
@@ -51,7 +51,7 @@ public class UnionFind<V> { | |||
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Creates a new union set from a collection of elements. | 53 | * Creates a new union set from a collection of elements. |
54 | * | 54 | * |
55 | * @param nodes | 55 | * @param nodes |
56 | * the collection of elements | 56 | * the collection of elements |
57 | * @return the root element | 57 | * @return the root element |
@@ -71,7 +71,7 @@ public class UnionFind<V> { | |||
71 | 71 | ||
72 | /** | 72 | /** |
73 | * This method creates a single set containing the given node. | 73 | * This method creates a single set containing the given node. |
74 | * | 74 | * |
75 | * @param node | 75 | * @param node |
76 | * the root node of the set | 76 | * the root node of the set |
77 | * @return the root element | 77 | * @return the root element |
@@ -89,7 +89,7 @@ public class UnionFind<V> { | |||
89 | 89 | ||
90 | /** | 90 | /** |
91 | * Find method with path compression. | 91 | * Find method with path compression. |
92 | * | 92 | * |
93 | * @param node | 93 | * @param node |
94 | * the node to find | 94 | * the node to find |
95 | * @return the root node of the set in which the given node can be found | 95 | * @return the root node of the set in which the given node can be found |
@@ -111,7 +111,7 @@ public class UnionFind<V> { | |||
111 | /** | 111 | /** |
112 | * Union by rank implementation of the two sets which contain x and y; x and/or y can be a single element from the | 112 | * Union by rank implementation of the two sets which contain x and y; x and/or y can be a single element from the |
113 | * universe. | 113 | * universe. |
114 | * | 114 | * |
115 | * @param x | 115 | * @param x |
116 | * set or single element of the universe | 116 | * set or single element of the universe |
117 | * @param y | 117 | * @param y |
@@ -168,7 +168,7 @@ public class UnionFind<V> { | |||
168 | 168 | ||
169 | /** | 169 | /** |
170 | * Delete the set whose root is the given node. | 170 | * Delete the set whose root is the given node. |
171 | * | 171 | * |
172 | * @param root | 172 | * @param root |
173 | * the root node | 173 | * the root node |
174 | */ | 174 | */ |
@@ -192,7 +192,7 @@ public class UnionFind<V> { | |||
192 | return false; | 192 | return false; |
193 | } | 193 | } |
194 | 194 | ||
195 | 195 | ||
196 | /** | 196 | /** |
197 | * Returns the partition in which the given element can be found, or null otherwise. | 197 | * Returns the partition in which the given element can be found, or null otherwise. |
198 | */ | 198 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/algorithms/UnionFindNodeProperty.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/algorithms/UnionFindNodeProperty.java index 82852f9c..7b8ad3f7 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/algorithms/UnionFindNodeProperty.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/algorithms/UnionFindNodeProperty.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.algorithms; | 10 | package tools.refinery.interpreter.matchers.algorithms; |
11 | 11 | ||
12 | public class UnionFindNodeProperty<V> { | 12 | public class UnionFindNodeProperty<V> { |
13 | 13 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/CommonQueryHintOptions.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/CommonQueryHintOptions.java index 317293bf..d7d4412e 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/CommonQueryHintOptions.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/CommonQueryHintOptions.java | |||
@@ -3,13 +3,13 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.backend; | 9 | package tools.refinery.interpreter.matchers.backend; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.IRewriterTraceCollector; | 11 | import tools.refinery.interpreter.matchers.psystem.rewriters.IRewriterTraceCollector; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.NopTraceCollector; | 12 | import tools.refinery.interpreter.matchers.psystem.rewriters.NopTraceCollector; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Query evaluation hints applicable to any engine | 15 | * Query evaluation hints applicable to any engine |
@@ -17,17 +17,17 @@ import tools.refinery.viatra.runtime.matchers.psystem.rewriters.NopTraceCollecto | |||
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | public final class CommonQueryHintOptions { | 19 | public final class CommonQueryHintOptions { |
20 | 20 | ||
21 | private CommonQueryHintOptions() { | 21 | private CommonQueryHintOptions() { |
22 | // Hiding constructor for utility class | 22 | // Hiding constructor for utility class |
23 | } | 23 | } |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * This hint instructs the query backends to record trace information into the given trace collector | 26 | * This hint instructs the query backends to record trace information into the given trace collector |
27 | */ | 27 | */ |
28 | public static final QueryHintOption<IRewriterTraceCollector> normalizationTraceCollector = | 28 | public static final QueryHintOption<IRewriterTraceCollector> normalizationTraceCollector = |
29 | hintOption("normalizationTraceCollector", NopTraceCollector.INSTANCE); | 29 | hintOption("normalizationTraceCollector", NopTraceCollector.INSTANCE); |
30 | 30 | ||
31 | // internal helper for conciseness | 31 | // internal helper for conciseness |
32 | private static <T> QueryHintOption<T> hintOption(String hintKeyLocalName, T defaultValue) { | 32 | private static <T> QueryHintOption<T> hintOption(String hintKeyLocalName, T defaultValue) { |
33 | return new QueryHintOption<>(CommonQueryHintOptions.class, hintKeyLocalName, defaultValue); | 33 | return new QueryHintOption<>(CommonQueryHintOptions.class, hintKeyLocalName, defaultValue); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/ICallDelegationStrategy.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/ICallDelegationStrategy.java index 40853f46..f7f02c75 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/ICallDelegationStrategy.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/ICallDelegationStrategy.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.backend; | 9 | package tools.refinery.interpreter.matchers.backend; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.context.IQueryResultProviderAccess; | 11 | import tools.refinery.interpreter.matchers.context.IQueryResultProviderAccess; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.IQueryReference; | 12 | import tools.refinery.interpreter.matchers.psystem.IQueryReference; |
13 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 13 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Function object that specifies how hints (including backend preferences) shall propagate through pattern calls. | 16 | * Function object that specifies how hints (including backend preferences) shall propagate through pattern calls. |
17 | * | 17 | * |
18 | * <p> A few useful default implementations are included as static fields. | 18 | * <p> A few useful default implementations are included as static fields. |
19 | * | 19 | * |
20 | * <p> As of 2.1, only suppported by the local search backend, and only if the pattern call is not flattened. | 20 | * <p> As of 2.1, only suppported by the local search backend, and only if the pattern call is not flattened. |
21 | * | 21 | * |
22 | * @author Gabor Bergmann | 22 | * @author Gabor Bergmann |
23 | * @since 2.1 | 23 | * @since 2.1 |
24 | */ | 24 | */ |
@@ -27,56 +27,56 @@ public interface ICallDelegationStrategy { | |||
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Specifies how hints (including backend preferences) shall propagate through pattern calls. | 29 | * Specifies how hints (including backend preferences) shall propagate through pattern calls. |
30 | * | 30 | * |
31 | * @param call a {@link PConstraint} in a query that calls another query. | 31 | * @param call a {@link PConstraint} in a query that calls another query. |
32 | * @param callerHint a hint under which the calling pattern is evaluated, | 32 | * @param callerHint a hint under which the calling pattern is evaluated, |
33 | * @param callerBackend the actual backend evaluating the calling pattern. | 33 | * @param callerBackend the actual backend evaluating the calling pattern. |
34 | * @param calleeHintProvider the provider of hints for the called pattern. | 34 | * @param calleeHintProvider the provider of hints for the called pattern. |
35 | * @return the hints, including backend selection, | 35 | * @return the hints, including backend selection, |
36 | * that the backend responsible for the caller pattern must specify when | 36 | * that the backend responsible for the caller pattern must specify when |
37 | * requesting the {@link IQueryResultProvider} for the called pattern via {@link IQueryResultProviderAccess}. | 37 | * requesting the {@link IQueryResultProvider} for the called pattern via {@link IQueryResultProviderAccess}. |
38 | */ | 38 | */ |
39 | public QueryEvaluationHint transformHints(IQueryReference call, | 39 | public QueryEvaluationHint transformHints(IQueryReference call, |
40 | QueryEvaluationHint callerHint, | 40 | QueryEvaluationHint callerHint, |
41 | IQueryBackend callerBackend, | 41 | IQueryBackend callerBackend, |
42 | IQueryBackendHintProvider calleeHintProvider); | 42 | IQueryBackendHintProvider calleeHintProvider); |
43 | 43 | ||
44 | 44 | ||
45 | /** | 45 | /** |
46 | * Options known for callee are used to override caller options, except the backend selection. | 46 | * Options known for callee are used to override caller options, except the backend selection. |
47 | * Always use the same backend for the callee and the caller, regardless what is specified for the callee pattern. | 47 | * Always use the same backend for the callee and the caller, regardless what is specified for the callee pattern. |
48 | * @author Gabor Bergmann | 48 | * @author Gabor Bergmann |
49 | */ | 49 | */ |
50 | public static final ICallDelegationStrategy FULL_BACKEND_ADHESION = (call, callerHint, callerBackend, calleeHintProvider) -> { | 50 | public static final ICallDelegationStrategy FULL_BACKEND_ADHESION = (call, callerHint, callerBackend, calleeHintProvider) -> { |
51 | QueryEvaluationHint calleeHint = | 51 | QueryEvaluationHint calleeHint = |
52 | calleeHintProvider.getQueryEvaluationHint(call.getReferredQuery()); | 52 | calleeHintProvider.getQueryEvaluationHint(call.getReferredQuery()); |
53 | QueryEvaluationHint result = | 53 | QueryEvaluationHint result = |
54 | callerHint == null ? calleeHint : callerHint.overrideBy(calleeHint); | 54 | callerHint == null ? calleeHint : callerHint.overrideBy(calleeHint); |
55 | 55 | ||
56 | QueryEvaluationHint backendAdhesion = new QueryEvaluationHint( | 56 | QueryEvaluationHint backendAdhesion = new QueryEvaluationHint( |
57 | null /* settings-ignorant */, callerBackend.getFactory()); | 57 | null /* settings-ignorant */, callerBackend.getFactory()); |
58 | result = result.overrideBy(backendAdhesion); | 58 | result = result.overrideBy(backendAdhesion); |
59 | return result; | 59 | return result; |
60 | }; | 60 | }; |
61 | /** | 61 | /** |
62 | * Options known for callee are used to override caller options, including the backend selection. | 62 | * Options known for callee are used to override caller options, including the backend selection. |
63 | * If callee does not specify a backend requirement, the backend of the caller is kept. | 63 | * If callee does not specify a backend requirement, the backend of the caller is kept. |
64 | * @author Gabor Bergmann | 64 | * @author Gabor Bergmann |
65 | */ | 65 | */ |
66 | public static final ICallDelegationStrategy PARTIAL_BACKEND_ADHESION = (call, callerHint, callerBackend, calleeHintProvider) -> { | 66 | public static final ICallDelegationStrategy PARTIAL_BACKEND_ADHESION = (call, callerHint, callerBackend, calleeHintProvider) -> { |
67 | QueryEvaluationHint backendAdhesion = new QueryEvaluationHint( | 67 | QueryEvaluationHint backendAdhesion = new QueryEvaluationHint( |
68 | null /* settings-ignorant */, callerBackend.getFactory()); | 68 | null /* settings-ignorant */, callerBackend.getFactory()); |
69 | 69 | ||
70 | QueryEvaluationHint result = | 70 | QueryEvaluationHint result = |
71 | callerHint == null ? backendAdhesion : callerHint.overrideBy(backendAdhesion); | 71 | callerHint == null ? backendAdhesion : callerHint.overrideBy(backendAdhesion); |
72 | 72 | ||
73 | QueryEvaluationHint calleeHint = calleeHintProvider.getQueryEvaluationHint(call.getReferredQuery()); | 73 | QueryEvaluationHint calleeHint = calleeHintProvider.getQueryEvaluationHint(call.getReferredQuery()); |
74 | result = result.overrideBy(calleeHint); | 74 | result = result.overrideBy(calleeHint); |
75 | 75 | ||
76 | return result; | 76 | return result; |
77 | }; | 77 | }; |
78 | /** | 78 | /** |
79 | * Options known for callee are used to override caller options, including the backend selection. | 79 | * Options known for callee are used to override caller options, including the backend selection. |
80 | * Always use the backend specified for the callee (or the default if none), regardless of the backend of the caller. | 80 | * Always use the backend specified for the callee (or the default if none), regardless of the backend of the caller. |
81 | * @author Gabor Bergmann | 81 | * @author Gabor Bergmann |
82 | */ | 82 | */ |
@@ -84,6 +84,6 @@ public interface ICallDelegationStrategy { | |||
84 | QueryEvaluationHint calleeHint = calleeHintProvider.getQueryEvaluationHint(call.getReferredQuery()); | 84 | QueryEvaluationHint calleeHint = calleeHintProvider.getQueryEvaluationHint(call.getReferredQuery()); |
85 | return callerHint == null ? calleeHint : callerHint.overrideBy(calleeHint); | 85 | return callerHint == null ? calleeHint : callerHint.overrideBy(calleeHint); |
86 | }; | 86 | }; |
87 | 87 | ||
88 | 88 | ||
89 | } | 89 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IMatcherCapability.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IMatcherCapability.java index 104b68a8..ba2f4b42 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IMatcherCapability.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IMatcherCapability.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.backend; | 9 | package tools.refinery.interpreter.matchers.backend; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Implementations of this interface can be used to decide whether a matcher created by an arbitrary backend can | 12 | * Implementations of this interface can be used to decide whether a matcher created by an arbitrary backend can |
13 | * potentially be used as a substitute for another matcher. | 13 | * potentially be used as a substitute for another matcher. |
14 | * | 14 | * |
15 | * @author Grill Balázs | 15 | * @author Grill Balázs |
16 | * @since 1.4 | 16 | * @since 1.4 |
17 | * | 17 | * |
@@ -22,5 +22,5 @@ public interface IMatcherCapability { | |||
22 | * Returns true if matchers of this capability can be used as a substitute for a matcher implementing the given capability | 22 | * Returns true if matchers of this capability can be used as a substitute for a matcher implementing the given capability |
23 | */ | 23 | */ |
24 | public boolean canBeSubstitute(IMatcherCapability capability); | 24 | public boolean canBeSubstitute(IMatcherCapability capability); |
25 | 25 | ||
26 | } | 26 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryBackend.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryBackend.java index c85f10a4..c98378a1 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryBackend.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryBackend.java | |||
@@ -3,44 +3,45 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.backend; | 9 | package tools.refinery.interpreter.matchers.backend; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 11 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 12 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Internal interface for a VIATRA query specification. Each query is associated with a pattern. Methods instantiate a matcher | 15 | * Internal interface for a Refienry Interpreter query specification. Each query is associated with a pattern. Methods |
16 | * of the pattern with various parameters. | 16 | * instantiate a matcher of the pattern with various parameters. |
17 | * | 17 | * |
18 | * @author Bergmann Gábor | 18 | * @author Bergmann Gábor |
19 | * @since 0.9 | 19 | * @since 0.9 |
20 | * @noextend This interface is not intended to be extended by users of the VIATRA framework, and should only be used by the query engine | 20 | * @noextend This interface is not intended to be extended by users of the Refinery Interpreter framework, and should |
21 | * only be used by the query engine | ||
21 | */ | 22 | */ |
22 | public interface IQueryBackend { | 23 | public interface IQueryBackend { |
23 | 24 | ||
24 | /** | 25 | /** |
25 | * @return true iff this backend is incremental, i.e. it caches the results of queries for quick retrieval, | 26 | * @return true iff this backend is incremental, i.e. it caches the results of queries for quick retrieval, |
26 | * and can provide update notifications on result set changes. | 27 | * and can provide update notifications on result set changes. |
27 | */ | 28 | */ |
28 | public boolean isCaching(); | 29 | public boolean isCaching(); |
29 | 30 | ||
30 | /** | 31 | /** |
31 | * Returns a result provider for a given query. Repeated calls may return the same instance. | 32 | * Returns a result provider for a given query. Repeated calls may return the same instance. |
32 | * @throws ViatraQueryRuntimeException | 33 | * @throws InterpreterRuntimeException |
33 | */ | 34 | */ |
34 | public IQueryResultProvider getResultProvider(PQuery query); | 35 | public IQueryResultProvider getResultProvider(PQuery query); |
35 | 36 | ||
36 | /** | 37 | /** |
37 | * Returns a result provider for a given query. Repeated calls may return the same instance. | 38 | * Returns a result provider for a given query. Repeated calls may return the same instance. |
38 | * @param optional hints that may override engine and query defaults (as provided by {@link IQueryBackendHintProvider}). Can be null. | 39 | * @param optional hints that may override engine and query defaults (as provided by {@link IQueryBackendHintProvider}). Can be null. |
39 | * @throws ViatraQueryRuntimeException | 40 | * @throws InterpreterRuntimeException |
40 | * @since 1.4 | 41 | * @since 1.4 |
41 | */ | 42 | */ |
42 | public IQueryResultProvider getResultProvider(PQuery query, QueryEvaluationHint hints); | 43 | public IQueryResultProvider getResultProvider(PQuery query, QueryEvaluationHint hints); |
43 | 44 | ||
44 | /** | 45 | /** |
45 | * Returns an existing result provider for a given query, if it was previously constructed, returns null otherwise. | 46 | * Returns an existing result provider for a given query, if it was previously constructed, returns null otherwise. |
46 | * Will not construct and initialize new result providers. | 47 | * Will not construct and initialize new result providers. |
@@ -48,17 +49,17 @@ public interface IQueryBackend { | |||
48 | public IQueryResultProvider peekExistingResultProvider(PQuery query); | 49 | public IQueryResultProvider peekExistingResultProvider(PQuery query); |
49 | 50 | ||
50 | /** | 51 | /** |
51 | * Propagates all pending updates in this query backend. The implementation of this method is optional, and it | 52 | * Propagates all pending updates in this query backend. The implementation of this method is optional, and it |
52 | * can be ignored entirely if the backend does not delay updates. | 53 | * can be ignored entirely if the backend does not delay updates. |
53 | * @since 1.6 | 54 | * @since 1.6 |
54 | */ | 55 | */ |
55 | public void flushUpdates(); | 56 | public void flushUpdates(); |
56 | 57 | ||
57 | /** | 58 | /** |
58 | * Disposes the query backend. | 59 | * Disposes the query backend. |
59 | */ | 60 | */ |
60 | public abstract void dispose(); | 61 | public abstract void dispose(); |
61 | 62 | ||
62 | /** | 63 | /** |
63 | * @return the factory that created this backend, if this functionality is supported | 64 | * @return the factory that created this backend, if this functionality is supported |
64 | * @since 2.1 | 65 | * @since 2.1 |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryBackendFactory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryBackendFactory.java index e264ab3f..dc82b9ce 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryBackendFactory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryBackendFactory.java | |||
@@ -3,35 +3,36 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.backend; | 9 | package tools.refinery.interpreter.matchers.backend; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 11 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 12 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * A Query Backend Factory identifies a query evaluator implementation, and can create an evaluator instance (an {@link IQueryBackend}) tied to a specific VIATRA Query engine upon request. | 15 | * A Query Backend Factory identifies a query evaluator implementation, and can create an evaluator instance (an |
16 | * | 16 | * {@link IQueryBackend}) tied to a specific Refinery Interpreter engine upon request. |
17 | * <p> The factory is used as a lookup key for the backend instance, | 17 | * |
18 | * therefore implementors should either be singletons, or implement equals() / hashCode() accordingly. | 18 | * <p> The factory is used as a lookup key for the backend instance, |
19 | * | 19 | * therefore implementors should either be singletons, or implement equals() / hashCode() accordingly. |
20 | * | ||
20 | * @author Bergmann Gabor | 21 | * @author Bergmann Gabor |
21 | * | 22 | * |
22 | */ | 23 | */ |
23 | public interface IQueryBackendFactory { | 24 | public interface IQueryBackendFactory { |
24 | 25 | ||
25 | /** | 26 | /** |
26 | * Creates a new {@link IQueryBackend} instance tied to the given context elements. | 27 | * Creates a new {@link IQueryBackend} instance tied to the given context elements. |
27 | * | 28 | * |
28 | * @return an instance of the class returned by {@link #getBackendClass()} that operates in the given context. | 29 | * @return an instance of the class returned by {@link #getBackendClass()} that operates in the given context. |
29 | * @since 1.5 | 30 | * @since 1.5 |
30 | */ | 31 | */ |
31 | public IQueryBackend | 32 | public IQueryBackend |
32 | create(IQueryBackendContext context); | 33 | create(IQueryBackendContext context); |
33 | 34 | ||
34 | 35 | ||
35 | /** | 36 | /** |
36 | * The backend instances created by this factory are guaranteed to conform to the returned class. | 37 | * The backend instances created by this factory are guaranteed to conform to the returned class. |
37 | */ | 38 | */ |
@@ -39,11 +40,11 @@ public interface IQueryBackendFactory { | |||
39 | 40 | ||
40 | /** | 41 | /** |
41 | * Calculate the required capabilities, which are needed to execute the given pattern | 42 | * Calculate the required capabilities, which are needed to execute the given pattern |
42 | * | 43 | * |
43 | * @since 1.4 | 44 | * @since 1.4 |
44 | */ | 45 | */ |
45 | public IMatcherCapability calculateRequiredCapability(PQuery query, QueryEvaluationHint hint); | 46 | public IMatcherCapability calculateRequiredCapability(PQuery query, QueryEvaluationHint hint); |
46 | 47 | ||
47 | /** | 48 | /** |
48 | * Returns whether the current backend is caching | 49 | * Returns whether the current backend is caching |
49 | * @since 2.0 | 50 | * @since 2.0 |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryBackendFactoryProvider.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryBackendFactoryProvider.java index 8787814e..c868fe5a 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryBackendFactoryProvider.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryBackendFactoryProvider.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.backend; | 9 | package tools.refinery.interpreter.matchers.backend; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * A provider interface for {@link IQueryBackendFactory} instances. | 12 | * A provider interface for {@link IQueryBackendFactory} instances. |
@@ -18,7 +18,7 @@ public interface IQueryBackendFactoryProvider { | |||
18 | * Returns a query backend factory instance. The method should return the same instance in case of repeated calls. | 18 | * Returns a query backend factory instance. The method should return the same instance in case of repeated calls. |
19 | */ | 19 | */ |
20 | IQueryBackendFactory getFactory(); | 20 | IQueryBackendFactory getFactory(); |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * Returns whether the given query backend should be considered as system default. If multiple backends are | 23 | * Returns whether the given query backend should be considered as system default. If multiple backends are |
24 | * registered as system default, it is undefined which one will be chosen. | 24 | * registered as system default, it is undefined which one will be chosen. |
@@ -26,7 +26,7 @@ public interface IQueryBackendFactoryProvider { | |||
26 | default boolean isSystemDefaultEngine() { | 26 | default boolean isSystemDefaultEngine() { |
27 | return false; | 27 | return false; |
28 | } | 28 | } |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Returns whether the given query backend should be considered as system default search backend. If multiple | 31 | * Returns whether the given query backend should be considered as system default search backend. If multiple |
32 | * backends are registered as system default, it is undefined which one will be chosen. | 32 | * backends are registered as system default, it is undefined which one will be chosen. |
@@ -34,8 +34,8 @@ public interface IQueryBackendFactoryProvider { | |||
34 | default boolean isSystemDefaultSearchBackend() { | 34 | default boolean isSystemDefaultSearchBackend() { |
35 | return false; | 35 | return false; |
36 | } | 36 | } |
37 | 37 | ||
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Returns whether the given query backend should be considered as system default caching backend. If multiple | 40 | * Returns whether the given query backend should be considered as system default caching backend. If multiple |
41 | * backends are registered as system default, it is undefined which one will be chosen. | 41 | * backends are registered as system default, it is undefined which one will be chosen. |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryBackendHintProvider.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryBackendHintProvider.java index 9bb76349..992024a2 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryBackendHintProvider.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryBackendHintProvider.java | |||
@@ -3,30 +3,30 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.backend; | 9 | package tools.refinery.interpreter.matchers.backend; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 11 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Provides query evaluation hints consisting of the Engine default hints and | 14 | * Provides query evaluation hints consisting of the Engine default hints and |
15 | * the hints provided by the pattern itself. | 15 | * the hints provided by the pattern itself. |
16 | * | 16 | * |
17 | * @author Bergmann Gabor | 17 | * @author Bergmann Gabor |
18 | * @since 0.9 | 18 | * @since 0.9 |
19 | * @noimplement This interface is not intended to be implemented by clients, except in the tools.refinery.viatra.runtime plugin. | 19 | * @noimplement This interface is not intended to be implemented by clients, except in the tools.refinery.viatra.runtime plugin. |
20 | */ | 20 | */ |
21 | public interface IQueryBackendHintProvider { | 21 | public interface IQueryBackendHintProvider { |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * Suggests query evaluation hints regarding a query. The returned hints reflects the default hints of the | 24 | * Suggests query evaluation hints regarding a query. The returned hints reflects the default hints of the |
25 | * query engine merged with the hints provided by the pattern itself. These can be overridden via specific | 25 | * query engine merged with the hints provided by the pattern itself. These can be overridden via specific |
26 | * advanced API of the engine. | 26 | * advanced API of the engine. |
27 | * | 27 | * |
28 | * @since 1.4 | 28 | * @since 1.4 |
29 | */ | 29 | */ |
30 | QueryEvaluationHint getQueryEvaluationHint(PQuery query); | 30 | QueryEvaluationHint getQueryEvaluationHint(PQuery query); |
31 | 31 | ||
32 | } | 32 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryResultProvider.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryResultProvider.java index cd7d050f..9183bc70 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IQueryResultProvider.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IQueryResultProvider.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.backend; | 9 | package tools.refinery.interpreter.matchers.backend; |
10 | 10 | ||
11 | import java.util.Optional; | 11 | import java.util.Optional; |
12 | import java.util.stream.Stream; | 12 | import java.util.stream.Stream; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.planning.helpers.StatisticsHelper; | 14 | import tools.refinery.interpreter.matchers.planning.helpers.StatisticsHelper; |
15 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 15 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 17 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
18 | import tools.refinery.viatra.runtime.matchers.util.Accuracy; | 18 | import tools.refinery.interpreter.matchers.util.Accuracy; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * An internal interface of the query backend that provides results of a given query. | 21 | * An internal interface of the query backend that provides results of a given query. |
22 | * @author Bergmann Gabor | 22 | * @author Bergmann Gabor |
23 | * @noimplement This interface is not intended to be implemented by clients. | 23 | * @noimplement This interface is not intended to be implemented by clients. |
24 | */ | 24 | */ |
@@ -33,7 +33,7 @@ public interface IQueryResultProvider { | |||
33 | * @since 2.0 | 33 | * @since 2.0 |
34 | */ | 34 | */ |
35 | public boolean hasMatch(Object[] parameters); | 35 | public boolean hasMatch(Object[] parameters); |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * Decides whether there are any matches of the pattern that conform to the given fixed values of some parameters. | 38 | * Decides whether there are any matches of the pattern that conform to the given fixed values of some parameters. |
39 | * | 39 | * |
@@ -47,7 +47,7 @@ public interface IQueryResultProvider { | |||
47 | * @since 2.0 | 47 | * @since 2.0 |
48 | */ | 48 | */ |
49 | public boolean hasMatch(TupleMask parameterSeedMask, ITuple projectedParameterSeed); | 49 | public boolean hasMatch(TupleMask parameterSeedMask, ITuple projectedParameterSeed); |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | 52 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. |
53 | * | 53 | * |
@@ -57,7 +57,7 @@ public interface IQueryResultProvider { | |||
57 | * @return the number of pattern matches found. | 57 | * @return the number of pattern matches found. |
58 | */ | 58 | */ |
59 | public int countMatches(Object[] parameters); | 59 | public int countMatches(Object[] parameters); |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | 62 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. |
63 | * | 63 | * |
@@ -72,44 +72,44 @@ public interface IQueryResultProvider { | |||
72 | * @since 1.7 | 72 | * @since 1.7 |
73 | */ | 73 | */ |
74 | public int countMatches(TupleMask parameterSeedMask, ITuple projectedParameterSeed); | 74 | public int countMatches(TupleMask parameterSeedMask, ITuple projectedParameterSeed); |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Gives an estimate of the number of different groups the matches are projected into by the given mask | 77 | * Gives an estimate of the number of different groups the matches are projected into by the given mask |
78 | * (e.g. for an identity mask, this means the full match set size). The estimate must meet the required accuracy. | 78 | * (e.g. for an identity mask, this means the full match set size). The estimate must meet the required accuracy. |
79 | * | 79 | * |
80 | * <p> If there is insufficient information to provide an answer up to the required precision, {@link Optional#empty()} may be returned. | 80 | * <p> If there is insufficient information to provide an answer up to the required precision, {@link Optional#empty()} may be returned. |
81 | * In other words, query backends may deny an answer, or do their best to give an estimate without actually determining the match set of the query. | 81 | * In other words, query backends may deny an answer, or do their best to give an estimate without actually determining the match set of the query. |
82 | * However, caching backends are expected to simply return the indexed (projection) size, initialized on-demand if necessary. | 82 | * However, caching backends are expected to simply return the indexed (projection) size, initialized on-demand if necessary. |
83 | * | 83 | * |
84 | * <p> PRE: {@link TupleMask#isNonrepeating()} must hold for the group mask. | 84 | * <p> PRE: {@link TupleMask#isNonrepeating()} must hold for the group mask. |
85 | * | 85 | * |
86 | * @return if available, an estimate of the cardinality of the projection of the match set, with the desired accuracy. | 86 | * @return if available, an estimate of the cardinality of the projection of the match set, with the desired accuracy. |
87 | * | 87 | * |
88 | * @since 2.1 | 88 | * @since 2.1 |
89 | */ | 89 | */ |
90 | public Optional<Long> estimateCardinality(TupleMask groupMask, Accuracy requiredAccuracy); | 90 | public Optional<Long> estimateCardinality(TupleMask groupMask, Accuracy requiredAccuracy); |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * Gives an estimate of the average size of different groups the matches are projected into by the given mask | 93 | * Gives an estimate of the average size of different groups the matches are projected into by the given mask |
94 | * (e.g. for an identity mask, this means 1, while for an empty mask, the result is match set size). | 94 | * (e.g. for an identity mask, this means 1, while for an empty mask, the result is match set size). |
95 | * The estimate must meet the required accuracy. | 95 | * The estimate must meet the required accuracy. |
96 | * | 96 | * |
97 | * <p> If there is insufficient information to provide an answer up to the required precision, {@link Optional#empty()} may be returned. | 97 | * <p> If there is insufficient information to provide an answer up to the required precision, {@link Optional#empty()} may be returned. |
98 | * In other words, query backends may deny an answer, or do their best to give an estimate without actually determining the match set of the query. | 98 | * In other words, query backends may deny an answer, or do their best to give an estimate without actually determining the match set of the query. |
99 | * However, caching backends are expected to simply return the exact value from the index, initialized on-demand if necessary. | 99 | * However, caching backends are expected to simply return the exact value from the index, initialized on-demand if necessary. |
100 | * | 100 | * |
101 | * <p> For an empty match set, zero is acceptable as an exact answer. | 101 | * <p> For an empty match set, zero is acceptable as an exact answer. |
102 | * | 102 | * |
103 | * <p> PRE: {@link TupleMask#isNonrepeating()} must hold for the group mask. | 103 | * <p> PRE: {@link TupleMask#isNonrepeating()} must hold for the group mask. |
104 | * | 104 | * |
105 | * @return if available, an estimate of the average size of each projection group of the match set, with the desired accuracy. | 105 | * @return if available, an estimate of the average size of each projection group of the match set, with the desired accuracy. |
106 | * | 106 | * |
107 | * @since 2.1 | 107 | * @since 2.1 |
108 | */ | 108 | */ |
109 | public default Optional<Double> estimateAverageBucketSize(TupleMask groupMask, Accuracy requiredAccuracy) { | 109 | public default Optional<Double> estimateAverageBucketSize(TupleMask groupMask, Accuracy requiredAccuracy) { |
110 | return StatisticsHelper.estimateAverageBucketSize(groupMask, requiredAccuracy, this::estimateCardinality); | 110 | return StatisticsHelper.estimateAverageBucketSize(groupMask, requiredAccuracy, this::estimateCardinality); |
111 | } | 111 | } |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | 114 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. |
115 | * Neither determinism nor randomness of selection is guaranteed. | 115 | * Neither determinism nor randomness of selection is guaranteed. |
@@ -121,11 +121,11 @@ public interface IQueryResultProvider { | |||
121 | * @since 2.0 | 121 | * @since 2.0 |
122 | */ | 122 | */ |
123 | public Optional<Tuple> getOneArbitraryMatch(Object[] parameters); | 123 | public Optional<Tuple> getOneArbitraryMatch(Object[] parameters); |
124 | 124 | ||
125 | /** | 125 | /** |
126 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | 126 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. |
127 | * Neither determinism nor randomness of selection is guaranteed. | 127 | * Neither determinism nor randomness of selection is guaranteed. |
128 | * | 128 | * |
129 | * @param parameterSeedMask | 129 | * @param parameterSeedMask |
130 | * a mask that extracts those parameters of the query (from the entire parameter list) that should be | 130 | * a mask that extracts those parameters of the query (from the entire parameter list) that should be |
131 | * bound to a fixed value | 131 | * bound to a fixed value |
@@ -136,8 +136,8 @@ public interface IQueryResultProvider { | |||
136 | * @return a match represented in the internal {@link Tuple} representation. | 136 | * @return a match represented in the internal {@link Tuple} representation. |
137 | * @since 2.0 | 137 | * @since 2.0 |
138 | */ | 138 | */ |
139 | public Optional<Tuple> getOneArbitraryMatch(TupleMask parameterSeedMask, ITuple parameters); | 139 | public Optional<Tuple> getOneArbitraryMatch(TupleMask parameterSeedMask, ITuple parameters); |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | 142 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. |
143 | * | 143 | * |
@@ -148,7 +148,7 @@ public interface IQueryResultProvider { | |||
148 | * @since 2.0 | 148 | * @since 2.0 |
149 | */ | 149 | */ |
150 | public Stream<Tuple> getAllMatches(Object[] parameters); | 150 | public Stream<Tuple> getAllMatches(Object[] parameters); |
151 | 151 | ||
152 | /** | 152 | /** |
153 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | 153 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. |
154 | * | 154 | * |
@@ -162,39 +162,39 @@ public interface IQueryResultProvider { | |||
162 | * @return matches represented in the internal {@link Tuple} representation. | 162 | * @return matches represented in the internal {@link Tuple} representation. |
163 | * @since 2.0 | 163 | * @since 2.0 |
164 | */ | 164 | */ |
165 | public Stream<Tuple> getAllMatches(TupleMask parameterSeedMask, ITuple parameters); | 165 | public Stream<Tuple> getAllMatches(TupleMask parameterSeedMask, ITuple parameters); |
166 | 166 | ||
167 | /** | 167 | /** |
168 | * The underlying query evaluator backend. | 168 | * The underlying query evaluator backend. |
169 | */ | 169 | */ |
170 | public IQueryBackend getQueryBackend(); | 170 | public IQueryBackend getQueryBackend(); |
171 | 171 | ||
172 | /** | 172 | /** |
173 | * Internal method that registers low-level callbacks for match appearance and disappearance. | 173 | * Internal method that registers low-level callbacks for match appearance and disappearance. |
174 | * | 174 | * |
175 | * <p> | 175 | * <p> |
176 | * <b>Caution: </b> This is a low-level callback that is invoked when the pattern matcher is not necessarily in a | 176 | * <b>Caution: </b> This is a low-level callback that is invoked when the pattern matcher is not necessarily in a |
177 | * consistent state yet. Importantly, no model modification permitted during the callback. | 177 | * consistent state yet. Importantly, no model modification permitted during the callback. |
178 | * | 178 | * |
179 | * <p> | 179 | * <p> |
180 | * The callback can be unregistered via invoking {@link #removeUpdateListener(Object)} with the same tag. | 180 | * The callback can be unregistered via invoking {@link #removeUpdateListener(Object)} with the same tag. |
181 | * | 181 | * |
182 | * @param listener | 182 | * @param listener |
183 | * the listener that will be notified of each new match that appears or disappears, starting from now. | 183 | * the listener that will be notified of each new match that appears or disappears, starting from now. |
184 | * @param listenerTag | 184 | * @param listenerTag |
185 | * a tag by which to identify the listener for later removal by {@link #removeUpdateListener(Object)}. | 185 | * a tag by which to identify the listener for later removal by {@link #removeUpdateListener(Object)}. |
186 | * @param fireNow | 186 | * @param fireNow |
187 | * if true, the insertion update allback will be immediately invoked on all current matches as a one-time effect. | 187 | * if true, the insertion update allback will be immediately invoked on all current matches as a one-time effect. |
188 | * | 188 | * |
189 | * @throws UnsupportedOperationException if this is a non-incremental backend | 189 | * @throws UnsupportedOperationException if this is a non-incremental backend |
190 | * (i.e. {@link IQueryBackend#isCaching()} on {@link #getQueryBackend()} returns false) | 190 | * (i.e. {@link IQueryBackend#isCaching()} on {@link #getQueryBackend()} returns false) |
191 | */ | 191 | */ |
192 | public void addUpdateListener(final IUpdateable listener, final Object listenerTag, boolean fireNow); | 192 | public void addUpdateListener(final IUpdateable listener, final Object listenerTag, boolean fireNow); |
193 | 193 | ||
194 | /** | 194 | /** |
195 | * Removes an existing listener previously registered with the given tag. | 195 | * Removes an existing listener previously registered with the given tag. |
196 | * | 196 | * |
197 | * @throws UnsupportedOperationException if this is a non-incremental backend | 197 | * @throws UnsupportedOperationException if this is a non-incremental backend |
198 | * (i.e. {@link IQueryBackend#isCaching()} on {@link #getQueryBackend()} returns false) | 198 | * (i.e. {@link IQueryBackend#isCaching()} on {@link #getQueryBackend()} returns false) |
199 | */ | 199 | */ |
200 | public void removeUpdateListener(final Object listenerTag); | 200 | public void removeUpdateListener(final Object listenerTag); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IUpdateable.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IUpdateable.java index baf7144a..e46f4e32 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/IUpdateable.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/IUpdateable.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.backend; | 9 | package tools.refinery.interpreter.matchers.backend; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 11 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Internal interface for the query backend to singal an update to a query result. | 14 | * Internal interface for the query backend to singal an update to a query result. |
@@ -17,7 +17,7 @@ import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | |||
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | public interface IUpdateable { | 19 | public interface IUpdateable { |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * This callback method must be free of exceptions, even {@link RuntimeException}s (though not {@link Error}s). | 22 | * This callback method must be free of exceptions, even {@link RuntimeException}s (though not {@link Error}s). |
23 | * @param updateElement the tuple that is changed | 23 | * @param updateElement the tuple that is changed |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/QueryEvaluationHint.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/QueryEvaluationHint.java index eab92128..188aaf62 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/QueryEvaluationHint.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/QueryEvaluationHint.java | |||
@@ -3,33 +3,30 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.backend; | 9 | package tools.refinery.interpreter.matchers.backend; |
10 | 10 | ||
11 | import java.util.AbstractMap; | 11 | import tools.refinery.interpreter.matchers.util.Preconditions; |
12 | import java.util.Collections; | ||
13 | import java.util.HashMap; | ||
14 | import java.util.Map; | ||
15 | import java.util.Objects; | ||
16 | import java.util.stream.Collectors; | ||
17 | 12 | ||
18 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 13 | import java.util.*; |
14 | import java.util.stream.Collectors; | ||
19 | 15 | ||
20 | /** | 16 | /** |
21 | * Provides VIATRA Query with additional hints on how a query should be evaluated. The same hint can be provided to multiple queries. | 17 | * Provides Refinery Interpreter with additional hints on how a query should be evaluated. The same hint can be provided |
22 | * | 18 | * to multiple queries. |
19 | * | ||
23 | * <p> This class is immutable. Overriding options will create a new instance. | 20 | * <p> This class is immutable. Overriding options will create a new instance. |
24 | * | 21 | * |
25 | * <p> | 22 | * <p> |
26 | * Here be dragons: for advanced users only. | 23 | * Here be dragons: for advanced users only. |
27 | * | 24 | * |
28 | * @author Bergmann Gabor | 25 | * @author Bergmann Gabor |
29 | * | 26 | * |
30 | */ | 27 | */ |
31 | public class QueryEvaluationHint { | 28 | public class QueryEvaluationHint { |
32 | 29 | ||
33 | /** | 30 | /** |
34 | * @since 2.0 | 31 | * @since 2.0 |
35 | * | 32 | * |
@@ -52,18 +49,18 @@ public class QueryEvaluationHint { | |||
52 | */ | 49 | */ |
53 | SPECIFIC | 50 | SPECIFIC |
54 | } | 51 | } |
55 | 52 | ||
56 | final IQueryBackendFactory queryBackendFactory; | 53 | final IQueryBackendFactory queryBackendFactory; |
57 | final Map<QueryHintOption<?>, Object> backendHintSettings; | 54 | final Map<QueryHintOption<?>, Object> backendHintSettings; |
58 | final BackendRequirement requirement; | 55 | final BackendRequirement requirement; |
59 | 56 | ||
60 | /** | 57 | /** |
61 | * Specifies the suggested query backend requirements, and value settings for additional backend-specific options. | 58 | * Specifies the suggested query backend requirements, and value settings for additional backend-specific options. |
62 | * | 59 | * |
63 | * <p> | 60 | * <p> |
64 | * The backend requirement type must not be {@link BackendRequirement#SPECIFIC} - for that case, use the constructor | 61 | * The backend requirement type must not be {@link BackendRequirement#SPECIFIC} - for that case, use the constructor |
65 | * {@link #QueryEvaluationHint(Map, IQueryBackendFactory)}. | 62 | * {@link #QueryEvaluationHint(Map, IQueryBackendFactory)}. |
66 | * | 63 | * |
67 | * @param backendHintSettings | 64 | * @param backendHintSettings |
68 | * if non-null, each entry in the map overrides backend-specific options regarding query evaluation | 65 | * if non-null, each entry in the map overrides backend-specific options regarding query evaluation |
69 | * (null-valued map entries permitted to erase hints); passing null means default options associated with | 66 | * (null-valued map entries permitted to erase hints); passing null means default options associated with |
@@ -77,17 +74,17 @@ public class QueryEvaluationHint { | |||
77 | Preconditions.checkArgument(backendRequirementType != null, "Specific requirement needs to be set"); | 74 | Preconditions.checkArgument(backendRequirementType != null, "Specific requirement needs to be set"); |
78 | Preconditions.checkArgument(backendRequirementType != BackendRequirement.SPECIFIC, "Specific backend requirement needs providing a corresponding backend type"); | 75 | Preconditions.checkArgument(backendRequirementType != BackendRequirement.SPECIFIC, "Specific backend requirement needs providing a corresponding backend type"); |
79 | this.queryBackendFactory = null; | 76 | this.queryBackendFactory = null; |
80 | this.requirement = backendRequirementType; | 77 | this.requirement = backendRequirementType; |
81 | this.backendHintSettings = (backendHintSettings == null) | 78 | this.backendHintSettings = (backendHintSettings == null) |
82 | ? Collections.<QueryHintOption<?>, Object> emptyMap() | 79 | ? Collections.<QueryHintOption<?>, Object> emptyMap() |
83 | : new HashMap<>(backendHintSettings); | 80 | : new HashMap<>(backendHintSettings); |
84 | } | 81 | } |
85 | 82 | ||
86 | /** | 83 | /** |
87 | * Specifies the suggested query backend, and value settings for additional backend-specific options. The first | 84 | * Specifies the suggested query backend, and value settings for additional backend-specific options. The first |
88 | * parameter can be null; if the second parameter is null, it is expected that the other constructor is called | 85 | * parameter can be null; if the second parameter is null, it is expected that the other constructor is called |
89 | * instead with a {@link BackendRequirement#UNSPECIFIED} parameter. | 86 | * instead with a {@link BackendRequirement#UNSPECIFIED} parameter. |
90 | * | 87 | * |
91 | * @param backendHintSettings | 88 | * @param backendHintSettings |
92 | * if non-null, each entry in the map overrides backend-specific options regarding query evaluation | 89 | * if non-null, each entry in the map overrides backend-specific options regarding query evaluation |
93 | * (null-valued map entries permitted to erase hints); passing null means default options associated with | 90 | * (null-valued map entries permitted to erase hints); passing null means default options associated with |
@@ -98,16 +95,16 @@ public class QueryEvaluationHint { | |||
98 | * @since 1.5 | 95 | * @since 1.5 |
99 | */ | 96 | */ |
100 | public QueryEvaluationHint( | 97 | public QueryEvaluationHint( |
101 | Map<QueryHintOption<?>, Object> backendHintSettings, | 98 | Map<QueryHintOption<?>, Object> backendHintSettings, |
102 | IQueryBackendFactory queryBackendFactory) { | 99 | IQueryBackendFactory queryBackendFactory) { |
103 | super(); | 100 | super(); |
104 | this.queryBackendFactory = queryBackendFactory; | 101 | this.queryBackendFactory = queryBackendFactory; |
105 | this.requirement = (queryBackendFactory == null) ? BackendRequirement.UNSPECIFIED : BackendRequirement.SPECIFIC; | 102 | this.requirement = (queryBackendFactory == null) ? BackendRequirement.UNSPECIFIED : BackendRequirement.SPECIFIC; |
106 | this.backendHintSettings = (backendHintSettings == null) | 103 | this.backendHintSettings = (backendHintSettings == null) |
107 | ? Collections.<QueryHintOption<?>, Object> emptyMap() | 104 | ? Collections.<QueryHintOption<?>, Object> emptyMap() |
108 | : new HashMap<>(backendHintSettings); | 105 | : new HashMap<>(backendHintSettings); |
109 | } | 106 | } |
110 | 107 | ||
111 | /** | 108 | /** |
112 | * Returns the backend requirement described by this hint. If a specific backend is required, that can be queried by {@link #getQueryBackendFactory()}. | 109 | * Returns the backend requirement described by this hint. If a specific backend is required, that can be queried by {@link #getQueryBackendFactory()}. |
113 | * @since 2.0 | 110 | * @since 2.0 |
@@ -115,10 +112,10 @@ public class QueryEvaluationHint { | |||
115 | public BackendRequirement getQueryBackendRequirementType() { | 112 | public BackendRequirement getQueryBackendRequirementType() { |
116 | return requirement; | 113 | return requirement; |
117 | } | 114 | } |
118 | 115 | ||
119 | /** | 116 | /** |
120 | * A suggestion for choosing the query evaluator algorithm. | 117 | * A suggestion for choosing the query evaluator algorithm. |
121 | * | 118 | * |
122 | * <p> | 119 | * <p> |
123 | * Returns null iff {@link #getQueryBackendRequirementType()} does not return {@link BackendRequirement#SPECIFIC}; | 120 | * Returns null iff {@link #getQueryBackendRequirementType()} does not return {@link BackendRequirement#SPECIFIC}; |
124 | * in such cases a corresponding default backend is selected inside the engine | 121 | * in such cases a corresponding default backend is selected inside the engine |
@@ -126,13 +123,13 @@ public class QueryEvaluationHint { | |||
126 | public IQueryBackendFactory getQueryBackendFactory() { | 123 | public IQueryBackendFactory getQueryBackendFactory() { |
127 | return queryBackendFactory; | 124 | return queryBackendFactory; |
128 | } | 125 | } |
129 | 126 | ||
130 | /** | 127 | /** |
131 | * Each entry in the immutable map overrides backend-specific options regarding query evaluation. | 128 | * Each entry in the immutable map overrides backend-specific options regarding query evaluation. |
132 | * | 129 | * |
133 | * <p>The map is non-null, even if empty. | 130 | * <p>The map is non-null, even if empty. |
134 | * Null-valued map entries are also permitted to erase hints via {@link #overrideBy(QueryEvaluationHint)}. | 131 | * Null-valued map entries are also permitted to erase hints via {@link #overrideBy(QueryEvaluationHint)}. |
135 | * | 132 | * |
136 | * @since 1.5 | 133 | * @since 1.5 |
137 | */ | 134 | */ |
138 | public Map<QueryHintOption<?>, Object> getBackendHintSettings() { | 135 | public Map<QueryHintOption<?>, Object> getBackendHintSettings() { |
@@ -142,13 +139,13 @@ public class QueryEvaluationHint { | |||
142 | 139 | ||
143 | /** | 140 | /** |
144 | * Override values in this hint and return a consolidated instance. | 141 | * Override values in this hint and return a consolidated instance. |
145 | * | 142 | * |
146 | * @since 1.4 | 143 | * @since 1.4 |
147 | */ | 144 | */ |
148 | public QueryEvaluationHint overrideBy(QueryEvaluationHint overridingHint){ | 145 | public QueryEvaluationHint overrideBy(QueryEvaluationHint overridingHint){ |
149 | if (overridingHint == null) | 146 | if (overridingHint == null) |
150 | return this; | 147 | return this; |
151 | 148 | ||
152 | BackendRequirement overriddenRequirement = this.getQueryBackendRequirementType(); | 149 | BackendRequirement overriddenRequirement = this.getQueryBackendRequirementType(); |
153 | if (overridingHint.getQueryBackendRequirementType() != BackendRequirement.UNSPECIFIED) { | 150 | if (overridingHint.getQueryBackendRequirementType() != BackendRequirement.UNSPECIFIED) { |
154 | overriddenRequirement = overridingHint.getQueryBackendRequirementType(); | 151 | overriddenRequirement = overridingHint.getQueryBackendRequirementType(); |
@@ -167,7 +164,7 @@ public class QueryEvaluationHint { | |||
167 | return new QueryEvaluationHint(hints, overriddenRequirement); | 164 | return new QueryEvaluationHint(hints, overriddenRequirement); |
168 | } | 165 | } |
169 | } | 166 | } |
170 | 167 | ||
171 | /** | 168 | /** |
172 | * Returns whether the given hint option is overridden. | 169 | * Returns whether the given hint option is overridden. |
173 | * @since 1.5 | 170 | * @since 1.5 |
@@ -175,7 +172,7 @@ public class QueryEvaluationHint { | |||
175 | public boolean isOptionOverridden(QueryHintOption<?> option) { | 172 | public boolean isOptionOverridden(QueryHintOption<?> option) { |
176 | return getBackendHintSettings().containsKey(option); | 173 | return getBackendHintSettings().containsKey(option); |
177 | } | 174 | } |
178 | 175 | ||
179 | /** | 176 | /** |
180 | * Returns the value of the given hint option from the given hint collection, or null if not defined. | 177 | * Returns the value of the given hint option from the given hint collection, or null if not defined. |
181 | * @since 1.5 | 178 | * @since 1.5 |
@@ -184,7 +181,7 @@ public class QueryEvaluationHint { | |||
184 | public <HintValue> HintValue getValueOrNull(QueryHintOption<HintValue> option) { | 181 | public <HintValue> HintValue getValueOrNull(QueryHintOption<HintValue> option) { |
185 | return (HintValue) getBackendHintSettings().get(option); | 182 | return (HintValue) getBackendHintSettings().get(option); |
186 | } | 183 | } |
187 | 184 | ||
188 | /** | 185 | /** |
189 | * Returns the value of the given hint option from the given hint collection, or the default value if not defined. | 186 | * Returns the value of the given hint option from the given hint collection, or the default value if not defined. |
190 | * Intended to be called by backends to find out the definitive value that should be considered. | 187 | * Intended to be called by backends to find out the definitive value that should be considered. |
@@ -193,7 +190,7 @@ public class QueryEvaluationHint { | |||
193 | public <HintValue> HintValue getValueOrDefault(QueryHintOption<HintValue> option) { | 190 | public <HintValue> HintValue getValueOrDefault(QueryHintOption<HintValue> option) { |
194 | return option.getValueOrDefault(this); | 191 | return option.getValueOrDefault(this); |
195 | } | 192 | } |
196 | 193 | ||
197 | @Override | 194 | @Override |
198 | public int hashCode() { | 195 | public int hashCode() { |
199 | return Objects.hash(backendHintSettings, queryBackendFactory, requirement); | 196 | return Objects.hash(backendHintSettings, queryBackendFactory, requirement); |
@@ -219,7 +216,7 @@ public class QueryEvaluationHint { | |||
219 | @Override | 216 | @Override |
220 | public String toString() { | 217 | public String toString() { |
221 | StringBuilder sb = new StringBuilder(); | 218 | StringBuilder sb = new StringBuilder(); |
222 | 219 | ||
223 | if (getQueryBackendFactory() != null) | 220 | if (getQueryBackendFactory() != null) |
224 | sb.append("backend: ").append(getQueryBackendFactory().getBackendClass().getSimpleName()); | 221 | sb.append("backend: ").append(getQueryBackendFactory().getBackendClass().getSimpleName()); |
225 | if (! backendHintSettings.isEmpty()) { | 222 | if (! backendHintSettings.isEmpty()) { |
@@ -228,13 +225,13 @@ public class QueryEvaluationHint { | |||
228 | sb.append(backendHintSettings.toString()); | 225 | sb.append(backendHintSettings.toString()); |
229 | } else { | 226 | } else { |
230 | // we have to iterate on the contents | 227 | // we have to iterate on the contents |
231 | 228 | ||
232 | String joinedHintMap = backendHintSettings.entrySet().stream() | 229 | String joinedHintMap = backendHintSettings.entrySet().stream() |
233 | .map(setting -> setting.getKey() + "=" + setting.getValue()).collect(Collectors.joining(", ")); | 230 | .map(setting -> setting.getKey() + "=" + setting.getValue()).collect(Collectors.joining(", ")); |
234 | sb.append('{').append(joinedHintMap).append('}'); | 231 | sb.append('{').append(joinedHintMap).append('}'); |
235 | } | 232 | } |
236 | } | 233 | } |
237 | 234 | ||
238 | final String result = sb.toString(); | 235 | final String result = sb.toString(); |
239 | return result.isEmpty() ? "defaults" : result; | 236 | return result.isEmpty() ? "defaults" : result; |
240 | } | 237 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/QueryHintOption.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/QueryHintOption.java index 2c6bb4de..516fa9a9 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/QueryHintOption.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/QueryHintOption.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.backend; | 9 | package tools.refinery.interpreter.matchers.backend; |
10 | 10 | ||
11 | import java.util.Map; | 11 | import java.util.Map; |
12 | import java.util.Objects; | 12 | import java.util.Objects; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Each instance of this class corresponds to a given hint option. | 15 | * Each instance of this class corresponds to a given hint option. |
16 | * | 16 | * |
17 | * It is recommended to expose options to clients (and query backends) as public static fields. | 17 | * It is recommended to expose options to clients (and query backends) as public static fields. |
18 | * | 18 | * |
19 | * @author Gabor Bergmann | 19 | * @author Gabor Bergmann |
20 | * @since 1.5 | 20 | * @since 1.5 |
21 | */ | 21 | */ |
@@ -31,10 +31,10 @@ public class QueryHintOption<HintValue> { | |||
31 | this.optionQualifiedName = optionQualifiedName; | 31 | this.optionQualifiedName = optionQualifiedName; |
32 | this.defaultValue = defaultValue; | 32 | this.defaultValue = defaultValue; |
33 | } | 33 | } |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * This is the recommended constructor for hint options defined as static fields within an enclosing class. | 36 | * This is the recommended constructor for hint options defined as static fields within an enclosing class. |
37 | * Combines the qualified name of the hint from the (qualified) name of the enclosing class and a local name (unique within that class). | 37 | * Combines the qualified name of the hint from the (qualified) name of the enclosing class and a local name (unique within that class). |
38 | */ | 38 | */ |
39 | public <T extends HintValue> QueryHintOption(Class<?> optionNamespace, String optionLocalName, T defaultValue) { | 39 | public <T extends HintValue> QueryHintOption(Class<?> optionNamespace, String optionLocalName, T defaultValue) { |
40 | this(String.format("%s@%s", optionLocalName, optionNamespace.getName()), defaultValue); | 40 | this(String.format("%s@%s", optionLocalName, optionNamespace.getName()), defaultValue); |
@@ -68,30 +68,30 @@ public class QueryHintOption<HintValue> { | |||
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | /** | 72 | /** |
73 | * Returns the value of this hint option from the given hint collection, or null if not defined. | 73 | * Returns the value of this hint option from the given hint collection, or null if not defined. |
74 | */ | 74 | */ |
75 | public HintValue getValueOrNull(QueryEvaluationHint hints) { | 75 | public HintValue getValueOrNull(QueryEvaluationHint hints) { |
76 | return hints.getValueOrNull(this); | 76 | return hints.getValueOrNull(this); |
77 | } | 77 | } |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Returns whether this hint option is defined in the given hint collection. | 80 | * Returns whether this hint option is defined in the given hint collection. |
81 | */ | 81 | */ |
82 | public boolean isOverriddenIn(QueryEvaluationHint hints) { | 82 | public boolean isOverriddenIn(QueryEvaluationHint hints) { |
83 | return hints.isOptionOverridden(this); | 83 | return hints.isOptionOverridden(this); |
84 | } | 84 | } |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Puts a value of this hint option into an option-to-value map. | 87 | * Puts a value of this hint option into an option-to-value map. |
88 | * | 88 | * |
89 | * <p> This method is offered in lieu of a builder API. | 89 | * <p> This method is offered in lieu of a builder API. |
90 | * Use this method on any number of hint options in order to populate an option-value map. | 90 | * Use this method on any number of hint options in order to populate an option-value map. |
91 | * Then instantiate the immutable {@link QueryEvaluationHint} using the map. | 91 | * Then instantiate the immutable {@link QueryEvaluationHint} using the map. |
92 | * | 92 | * |
93 | * @see #insertValueIfNondefault(Map, Object) | 93 | * @see #insertValueIfNondefault(Map, Object) |
94 | * @return the hint value that was previously present in the map under this hint option, carrying over the semantics of {@link Map#put(Object, Object)}. | 94 | * @return the hint value that was previously present in the map under this hint option, carrying over the semantics of {@link Map#put(Object, Object)}. |
95 | */ | 95 | */ |
96 | @SuppressWarnings("unchecked") | 96 | @SuppressWarnings("unchecked") |
97 | public HintValue insertOverridingValue(Map<QueryHintOption<?>, Object> hints, HintValue overridingValue) { | 97 | public HintValue insertOverridingValue(Map<QueryHintOption<?>, Object> hints, HintValue overridingValue) { |
@@ -101,11 +101,11 @@ public class QueryHintOption<HintValue> { | |||
101 | /** | 101 | /** |
102 | * Puts a value of this hint option into an option-to-value map, if the given value differs from the default value of the option. | 102 | * Puts a value of this hint option into an option-to-value map, if the given value differs from the default value of the option. |
103 | * If the default value is provided instead, then the map is not updated. | 103 | * If the default value is provided instead, then the map is not updated. |
104 | * | 104 | * |
105 | * <p> This method is offered in lieu of a builder API. | 105 | * <p> This method is offered in lieu of a builder API. |
106 | * Use this method on any number of hint options in order to populate an option-value map. | 106 | * Use this method on any number of hint options in order to populate an option-value map. |
107 | * Then instantiate the immutable {@link QueryEvaluationHint} using the map. | 107 | * Then instantiate the immutable {@link QueryEvaluationHint} using the map. |
108 | * | 108 | * |
109 | * @see #insertOverridingValue(Map, Object) | 109 | * @see #insertOverridingValue(Map, Object) |
110 | * @since 2.0 | 110 | * @since 2.0 |
111 | */ | 111 | */ |
@@ -113,10 +113,10 @@ public class QueryHintOption<HintValue> { | |||
113 | if (!Objects.equals(defaultValue, overridingValue)) | 113 | if (!Objects.equals(defaultValue, overridingValue)) |
114 | hints.put(this, overridingValue); | 114 | hints.put(this, overridingValue); |
115 | } | 115 | } |
116 | 116 | ||
117 | @Override | 117 | @Override |
118 | public String toString() { | 118 | public String toString() { |
119 | return optionQualifiedName; | 119 | return optionQualifiedName; |
120 | } | 120 | } |
121 | 121 | ||
122 | } | 122 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/ResultProviderRequestor.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/ResultProviderRequestor.java index 6ec6d53e..5fe57d5b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/backend/ResultProviderRequestor.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/backend/ResultProviderRequestor.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.backend; | 9 | package tools.refinery.interpreter.matchers.backend; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.context.IQueryResultProviderAccess; | 11 | import tools.refinery.interpreter.matchers.context.IQueryResultProviderAccess; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.IQueryReference; | 12 | import tools.refinery.interpreter.matchers.psystem.IQueryReference; |
13 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 13 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Uniform way of requesting result providers for pattern calls within queries. | 16 | * Uniform way of requesting result providers for pattern calls within queries. |
17 | * Intended users are query backends, for calling other backends to deliver results of dependee queries. | 17 | * Intended users are query backends, for calling other backends to deliver results of dependee queries. |
18 | * | 18 | * |
19 | * @author Gabor Bergmann | 19 | * @author Gabor Bergmann |
20 | * @since 2.1 | 20 | * @since 2.1 |
21 | */ | 21 | */ |
@@ -26,14 +26,14 @@ public class ResultProviderRequestor { | |||
26 | ICallDelegationStrategy delegationStrategy; | 26 | ICallDelegationStrategy delegationStrategy; |
27 | QueryEvaluationHint callerHint; | 27 | QueryEvaluationHint callerHint; |
28 | QueryEvaluationHint universalOverride; | 28 | QueryEvaluationHint universalOverride; |
29 | 29 | ||
30 | 30 | ||
31 | /** | 31 | /** |
32 | * @param callerBackend the actual backend evaluating the calling pattern. | 32 | * @param callerBackend the actual backend evaluating the calling pattern. |
33 | * @param resultProviderAccess | 33 | * @param resultProviderAccess |
34 | * @param hintProvider | 34 | * @param hintProvider |
35 | * @param delegationStrategy | 35 | * @param delegationStrategy |
36 | * @param callerHint a hint under which the calling pattern is evaluated, | 36 | * @param callerHint a hint under which the calling pattern is evaluated, |
37 | * @param universalOverride if non-null, overrides the hint with extra options <i>after</i> the {@link ICallDelegationStrategy} | 37 | * @param universalOverride if non-null, overrides the hint with extra options <i>after</i> the {@link ICallDelegationStrategy} |
38 | */ | 38 | */ |
39 | public ResultProviderRequestor(IQueryBackend callerBackend, IQueryResultProviderAccess resultProviderAccess, | 39 | public ResultProviderRequestor(IQueryBackend callerBackend, IQueryResultProviderAccess resultProviderAccess, |
@@ -52,22 +52,22 @@ public class ResultProviderRequestor { | |||
52 | 52 | ||
53 | 53 | ||
54 | /** | 54 | /** |
55 | * | 55 | * |
56 | * @param call a {@link PConstraint} in a query that calls another query. | 56 | * @param call a {@link PConstraint} in a query that calls another query. |
57 | * @param spotOverride if non-null, overrides the hint with extra options <i>after</i> the {@link ICallDelegationStrategy} | 57 | * @param spotOverride if non-null, overrides the hint with extra options <i>after</i> the {@link ICallDelegationStrategy} |
58 | * and the universal override specified in the constructor | 58 | * and the universal override specified in the constructor |
59 | * @return the obtained result provider | 59 | * @return the obtained result provider |
60 | */ | 60 | */ |
61 | public IQueryResultProvider requestResultProvider(IQueryReference call, QueryEvaluationHint spotOverride) { | 61 | public IQueryResultProvider requestResultProvider(IQueryReference call, QueryEvaluationHint spotOverride) { |
62 | QueryEvaluationHint hints = | 62 | QueryEvaluationHint hints = |
63 | delegationStrategy.transformHints(call, callerHint, callerBackend, hintProvider); | 63 | delegationStrategy.transformHints(call, callerHint, callerBackend, hintProvider); |
64 | 64 | ||
65 | if (universalOverride != null) | 65 | if (universalOverride != null) |
66 | hints = hints.overrideBy(universalOverride); | 66 | hints = hints.overrideBy(universalOverride); |
67 | 67 | ||
68 | if (spotOverride != null) | 68 | if (spotOverride != null) |
69 | hints = hints.overrideBy(spotOverride); | 69 | hints = hints.overrideBy(spotOverride); |
70 | 70 | ||
71 | return resultProviderAccess.getResultProvider(call.getReferredQuery(), hints); | 71 | return resultProviderAccess.getResultProvider(call.getReferredQuery(), hints); |
72 | } | 72 | } |
73 | 73 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/AbstractQueryMetaContext.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/AbstractQueryMetaContext.java index 99611758..14ca52c1 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/AbstractQueryMetaContext.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/AbstractQueryMetaContext.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.context; | 9 | package tools.refinery.interpreter.matchers.context; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -17,13 +17,13 @@ import java.util.Set; | |||
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Common abstract class for implementers of {@link IQueryMetaContext} | 19 | * Common abstract class for implementers of {@link IQueryMetaContext} |
20 | * | 20 | * |
21 | * @author Grill Balázs | 21 | * @author Grill Balázs |
22 | * @since 1.3 | 22 | * @since 1.3 |
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | public abstract class AbstractQueryMetaContext implements IQueryMetaContext { | 25 | public abstract class AbstractQueryMetaContext implements IQueryMetaContext { |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * @since 2.0 | 28 | * @since 2.0 |
29 | */ | 29 | */ |
@@ -39,7 +39,7 @@ public abstract class AbstractQueryMetaContext implements IQueryMetaContext { | |||
39 | public boolean canLeadOutOfScope(IInputKey key) { | 39 | public boolean canLeadOutOfScope(IInputKey key) { |
40 | return key.getArity() > 1; | 40 | return key.getArity() > 1; |
41 | } | 41 | } |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * @since 1.6 | 44 | * @since 1.6 |
45 | */ | 45 | */ |
@@ -47,14 +47,14 @@ public abstract class AbstractQueryMetaContext implements IQueryMetaContext { | |||
47 | public Comparator<IInputKey> getSuggestedEliminationOrdering() { | 47 | public Comparator<IInputKey> getSuggestedEliminationOrdering() { |
48 | return (o1, o2) -> 0; | 48 | return (o1, o2) -> 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * @since 1.6 | 52 | * @since 1.6 |
53 | */ | 53 | */ |
54 | @Override | 54 | @Override |
55 | public Collection<InputKeyImplication> getWeakenedAlternatives(IInputKey implyingKey) { | 55 | public Collection<InputKeyImplication> getWeakenedAlternatives(IInputKey implyingKey) { |
56 | return Collections.emptySet(); | 56 | return Collections.emptySet(); |
57 | } | 57 | } |
58 | 58 | ||
59 | @Override | 59 | @Override |
60 | public boolean isPosetKey(IInputKey key) { | 60 | public boolean isPosetKey(IInputKey key) { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/AbstractQueryRuntimeContext.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/AbstractQueryRuntimeContext.java index c797eff9..fa6b5a26 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/AbstractQueryRuntimeContext.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/AbstractQueryRuntimeContext.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.context; | 9 | package tools.refinery.interpreter.matchers.context; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * This class is intended to be extended by implementors. The main purpose of this abstract implementation to protect | 12 | * This class is intended to be extended by implementors. The main purpose of this abstract implementation to protect |
13 | * implementors from future changes in the interface. | 13 | * implementors from future changes in the interface. |
14 | * | 14 | * |
15 | * @author Grill Balázs | 15 | * @author Grill Balázs |
16 | * @since 1.4 | 16 | * @since 1.4 |
17 | * | 17 | * |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IInputKey.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IInputKey.java index 4dbcca88..dd6680cb 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IInputKey.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IInputKey.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.context; | 9 | package tools.refinery.interpreter.matchers.context; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * An input key identifies an input (extensional) relation, such as the instance set of a given node or edge type, or the direct containment relation. | 12 | * An input key identifies an input (extensional) relation, such as the instance set of a given node or edge type, or the direct containment relation. |
13 | * | 13 | * |
14 | * <p> The input key, at the very minimum, is associated with an arity (number of columns), a user-friendly name, and a string identifier (for distributive purposes). | 14 | * <p> The input key, at the very minimum, is associated with an arity (number of columns), a user-friendly name, and a string identifier (for distributive purposes). |
15 | * | 15 | * |
16 | * <p> The input key itself must be an immutable data object that properly overrides equals() and hashCode(). | 16 | * <p> The input key itself must be an immutable data object that properly overrides equals() and hashCode(). |
17 | * It must be instantiable without using the query context object, so that query specifications may construct the appropriate PQueries. | 17 | * It must be instantiable without using the query context object, so that query specifications may construct the appropriate PQueries. |
18 | * | 18 | * |
19 | * @author Bergmann Gabor | 19 | * @author Bergmann Gabor |
20 | * | 20 | * |
21 | */ | 21 | */ |
@@ -29,17 +29,17 @@ public interface IInputKey { | |||
29 | * An internal string identifier that can be used to uniquely identify to input key (relevant for distributed applications). | 29 | * An internal string identifier that can be used to uniquely identify to input key (relevant for distributed applications). |
30 | */ | 30 | */ |
31 | public String getStringID(); | 31 | public String getStringID(); |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * The width of tuples in this relation. | 34 | * The width of tuples in this relation. |
35 | */ | 35 | */ |
36 | public int getArity(); | 36 | public int getArity(); |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * Returns true iff instance tuples of the key can be enumerated. | 39 | * Returns true iff instance tuples of the key can be enumerated. |
40 | * <p> If false, the runtime can only test tuple membership in the extensional relation identified by the key, but not enumerate member tuples in general. | 40 | * <p> If false, the runtime can only test tuple membership in the extensional relation identified by the key, but not enumerate member tuples in general. |
41 | */ | 41 | */ |
42 | boolean isEnumerable(); | 42 | boolean isEnumerable(); |
43 | 43 | ||
44 | 44 | ||
45 | } | 45 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IPosetComparator.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IPosetComparator.java index e2d5bcee..137e6338 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IPosetComparator.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IPosetComparator.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.context; | 9 | package tools.refinery.interpreter.matchers.context; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 11 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Implementations of this interface aid the query engine with the ordering of poset elements. This information is | 14 | * Implementations of this interface aid the query engine with the ordering of poset elements. This information is |
15 | * particularly important in the delete and re-derive evaluation mode because they let the engine identify monotone | 15 | * particularly important in the delete and re-derive evaluation mode because they let the engine identify monotone |
16 | * change pairs. | 16 | * change pairs. |
17 | * | 17 | * |
18 | * @author Tamas Szabo | 18 | * @author Tamas Szabo |
19 | * @since 1.6 | 19 | * @since 1.6 |
20 | */ | 20 | */ |
@@ -22,8 +22,8 @@ public interface IPosetComparator { | |||
22 | 22 | ||
23 | /** | 23 | /** |
24 | * Returns true if the 'left' tuple of poset elements is smaller or equal than the 'right' tuple of poset elements according to | 24 | * Returns true if the 'left' tuple of poset elements is smaller or equal than the 'right' tuple of poset elements according to |
25 | * the partial order that this poset comparator employs. | 25 | * the partial order that this poset comparator employs. |
26 | * | 26 | * |
27 | * @param left | 27 | * @param left |
28 | * the left tuple of poset elements | 28 | * the left tuple of poset elements |
29 | * @param right | 29 | * @param right |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryBackendContext.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryBackendContext.java index 04f00aaa..a2f60f0d 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryBackendContext.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryBackendContext.java | |||
@@ -3,17 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.context; | 9 | package tools.refinery.interpreter.matchers.context; |
10 | 10 | ||
11 | import org.apache.log4j.Logger; | 11 | import org.apache.log4j.Logger; |
12 | import tools.refinery.viatra.runtime.matchers.backend.IMatcherCapability; | 12 | import tools.refinery.interpreter.matchers.psystem.analysis.QueryAnalyzer; |
13 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendHintProvider; | 13 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
14 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 14 | import tools.refinery.interpreter.matchers.backend.IMatcherCapability; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.analysis.QueryAnalyzer; | 15 | import tools.refinery.interpreter.matchers.backend.IQueryBackendHintProvider; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 16 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * This interface is a collector which holds every API that is provided by the engine to control | 19 | * This interface is a collector which holds every API that is provided by the engine to control |
@@ -25,25 +25,25 @@ import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | |||
25 | public interface IQueryBackendContext { | 25 | public interface IQueryBackendContext { |
26 | 26 | ||
27 | Logger getLogger(); | 27 | Logger getLogger(); |
28 | 28 | ||
29 | IQueryRuntimeContext getRuntimeContext(); | 29 | IQueryRuntimeContext getRuntimeContext(); |
30 | 30 | ||
31 | IQueryCacheContext getQueryCacheContext(); | 31 | IQueryCacheContext getQueryCacheContext(); |
32 | 32 | ||
33 | IQueryBackendHintProvider getHintProvider(); | 33 | IQueryBackendHintProvider getHintProvider(); |
34 | 34 | ||
35 | IQueryResultProviderAccess getResultProviderAccess(); | 35 | IQueryResultProviderAccess getResultProviderAccess(); |
36 | 36 | ||
37 | QueryAnalyzer getQueryAnalyzer(); | 37 | QueryAnalyzer getQueryAnalyzer(); |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * @since 2.0 | 40 | * @since 2.0 |
41 | */ | 41 | */ |
42 | IMatcherCapability getRequiredMatcherCapability(PQuery query, QueryEvaluationHint overrideHints); | 42 | IMatcherCapability getRequiredMatcherCapability(PQuery query, QueryEvaluationHint overrideHints); |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * @since 1.6 | 45 | * @since 1.6 |
46 | */ | 46 | */ |
47 | boolean areUpdatesDelayed(); | 47 | boolean areUpdatesDelayed(); |
48 | 48 | ||
49 | } | 49 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryCacheContext.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryCacheContext.java index 617207f6..af525fae 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryCacheContext.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryCacheContext.java | |||
@@ -3,37 +3,37 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.context; | 9 | package tools.refinery.interpreter.matchers.context; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 11 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
12 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackend; | 12 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
13 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 13 | import tools.refinery.interpreter.matchers.backend.IQueryBackend; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 14 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Provides information on already cached queries to query evaluator backends at runtime. | 17 | * Provides information on already cached queries to query evaluator backends at runtime. |
18 | * | 18 | * |
19 | * @author Bergmann Gabor | 19 | * @author Bergmann Gabor |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | public interface IQueryCacheContext { | 22 | public interface IQueryCacheContext { |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Checks if there already is a caching result provider for the given query. | 25 | * Checks if there already is a caching result provider for the given query. |
26 | * <p> Returns false if called while the caching result provider of the given query is being constructed in the first place. | 26 | * <p> Returns false if called while the caching result provider of the given query is being constructed in the first place. |
27 | */ | 27 | */ |
28 | public boolean isResultCached(PQuery query); | 28 | public boolean isResultCached(PQuery query); |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * Returns a caching result provider for the given query; it must be constructed if it does not exist yet. | 31 | * Returns a caching result provider for the given query; it must be constructed if it does not exist yet. |
32 | * <p> <b>Caution:</b> behavior undefined if called while the caching result provider of the given query is being constructed. | 32 | * <p> <b>Caution:</b> behavior undefined if called while the caching result provider of the given query is being constructed. |
33 | * Beware of infinite loops. | 33 | * Beware of infinite loops. |
34 | * <p> <b>Postcondition:</b> {@link IQueryBackend#isCaching()} returns true for the {@link #getQueryBackend()} of the returned provider | 34 | * <p> <b>Postcondition:</b> {@link IQueryBackend#isCaching()} returns true for the {@link #getQueryBackend()} of the returned provider |
35 | * | 35 | * |
36 | * @throws ViatraQueryRuntimeException | 36 | * @throws InterpreterRuntimeException |
37 | */ | 37 | */ |
38 | public IQueryResultProvider getCachingResultProvider(PQuery query); | 38 | public IQueryResultProvider getCachingResultProvider(PQuery query); |
39 | } | 39 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryMetaContext.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryMetaContext.java index 4c22a3cb..36e5ae95 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryMetaContext.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryMetaContext.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.context; | 9 | package tools.refinery.interpreter.matchers.context; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Comparator; | 12 | import java.util.Comparator; |
@@ -15,25 +15,25 @@ import java.util.Set; | |||
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Provides metamodel information (relationship of input keys) to query evaluator backends at runtime and at query planning time. | 17 | * Provides metamodel information (relationship of input keys) to query evaluator backends at runtime and at query planning time. |
18 | * | 18 | * |
19 | * @noimplement Implementors should extend {@link AbstractQueryMetaContext} instead of directly implementing this interface. | 19 | * @noimplement Implementors should extend {@link AbstractQueryMetaContext} instead of directly implementing this interface. |
20 | * @author Bergmann Gabor | 20 | * @author Bergmann Gabor |
21 | */ | 21 | */ |
22 | public interface IQueryMetaContext { | 22 | public interface IQueryMetaContext { |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Returns true iff instance tuples of the given key can be enumerated. | 25 | * Returns true iff instance tuples of the given key can be enumerated. |
26 | * <p> If false, the runtime can only test tuple membership in the extensional relation identified by the key, but not enumerate member tuples in general. | 26 | * <p> If false, the runtime can only test tuple membership in the extensional relation identified by the key, but not enumerate member tuples in general. |
27 | * <p> Equivalent to {@link IInputKey#isEnumerable()}. | 27 | * <p> Equivalent to {@link IInputKey#isEnumerable()}. |
28 | */ | 28 | */ |
29 | boolean isEnumerable(IInputKey key); | 29 | boolean isEnumerable(IInputKey key); |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Returns true iff the set of instance tuples of the given key is immutable. | 32 | * Returns true iff the set of instance tuples of the given key is immutable. |
33 | * <p> If false, the runtime provides notifications upon change. | 33 | * <p> If false, the runtime provides notifications upon change. |
34 | */ | 34 | */ |
35 | boolean isStateless(IInputKey key); | 35 | boolean isStateless(IInputKey key); |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * Returns a set of implications (weakened alternatives), | 38 | * Returns a set of implications (weakened alternatives), |
39 | * with a suggestion for the query planner that satisfying them first may help in satisfying the implying key. | 39 | * with a suggestion for the query planner that satisfying them first may help in satisfying the implying key. |
@@ -42,57 +42,57 @@ public interface IQueryMetaContext { | |||
42 | * @since 1.6 | 42 | * @since 1.6 |
43 | */ | 43 | */ |
44 | Collection<InputKeyImplication> getWeakenedAlternatives(IInputKey implyingKey); | 44 | Collection<InputKeyImplication> getWeakenedAlternatives(IInputKey implyingKey); |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Returns known direct implications, e.g. edge supertypes, edge opposites, node type constraints, etc. | 47 | * Returns known direct implications, e.g. edge supertypes, edge opposites, node type constraints, etc. |
48 | * <p> Note that for the obvious reasons, enumerable keys can only be implied by enumerable keys. | 48 | * <p> Note that for the obvious reasons, enumerable keys can only be implied by enumerable keys. |
49 | */ | 49 | */ |
50 | Collection<InputKeyImplication> getImplications(IInputKey implyingKey); | 50 | Collection<InputKeyImplication> getImplications(IInputKey implyingKey); |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Returns known "double dispatch" implications, where the given implying key implies other input keys under certain additional conditions (themselves input keys). | 53 | * Returns known "double dispatch" implications, where the given implying key implies other input keys under certain additional conditions (themselves input keys). |
54 | * For example, a "type x, unscoped" input key may imply the "type x, in scope" input key under the condition of the input key "x is in scope" | 54 | * For example, a "type x, unscoped" input key may imply the "type x, in scope" input key under the condition of the input key "x is in scope" |
55 | * | 55 | * |
56 | * <p> Note that for the obvious reasons, enumerable keys can only be implied by enumerable keys (either as the implying key or as the additional condition). | 56 | * <p> Note that for the obvious reasons, enumerable keys can only be implied by enumerable keys (either as the implying key or as the additional condition). |
57 | * <p> Note that symmetry is not required, i.e. the additional conditions do not have to list the same conditional implication. | 57 | * <p> Note that symmetry is not required, i.e. the additional conditions do not have to list the same conditional implication. |
58 | * @return multi-map, where the keys are additional conditions and the values are input key implications jointly implied by the condition and the given implying key. | 58 | * @return multi-map, where the keys are additional conditions and the values are input key implications jointly implied by the condition and the given implying key. |
59 | * @since 2.0 | 59 | * @since 2.0 |
60 | */ | 60 | */ |
61 | Map<InputKeyImplication, Set<InputKeyImplication>> getConditionalImplications(IInputKey implyingKey); | 61 | Map<InputKeyImplication, Set<InputKeyImplication>> getConditionalImplications(IInputKey implyingKey); |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Returns functional dependencies of the input key expressed in terms of column indices. | 64 | * Returns functional dependencies of the input key expressed in terms of column indices. |
65 | * | 65 | * |
66 | * <p> Each entry of the map is a functional dependency rule, where the entry key specifies source columns and the entry value specifies target columns. | 66 | * <p> Each entry of the map is a functional dependency rule, where the entry key specifies source columns and the entry value specifies target columns. |
67 | */ | 67 | */ |
68 | Map<Set<Integer>, Set<Integer>> getFunctionalDependencies(IInputKey key); | 68 | Map<Set<Integer>, Set<Integer>> getFunctionalDependencies(IInputKey key); |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * For query normalizing, this is the order suggested for trying to eliminate input keys. | 71 | * For query normalizing, this is the order suggested for trying to eliminate input keys. |
72 | * @since 1.6 | 72 | * @since 1.6 |
73 | */ | 73 | */ |
74 | Comparator<IInputKey> getSuggestedEliminationOrdering(); | 74 | Comparator<IInputKey> getSuggestedEliminationOrdering(); |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Tells whether the given {@link IInputKey} is an edge and may lead out of scope. | 77 | * Tells whether the given {@link IInputKey} is an edge and may lead out of scope. |
78 | * | 78 | * |
79 | * @since 1.6 | 79 | * @since 1.6 |
80 | */ | 80 | */ |
81 | boolean canLeadOutOfScope(IInputKey key); | 81 | boolean canLeadOutOfScope(IInputKey key); |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Returns true if the given {@link IInputKey} represents a poset type. | 84 | * Returns true if the given {@link IInputKey} represents a poset type. |
85 | * @since 1.6 | 85 | * @since 1.6 |
86 | */ | 86 | */ |
87 | boolean isPosetKey(IInputKey key); | 87 | boolean isPosetKey(IInputKey key); |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * Returns an {@link IPosetComparator} for the given set of {@link IInputKey}s. | 90 | * Returns an {@link IPosetComparator} for the given set of {@link IInputKey}s. |
91 | * | 91 | * |
92 | * @param keys an iterable collection of input keys | 92 | * @param keys an iterable collection of input keys |
93 | * @return the poset comparator | 93 | * @return the poset comparator |
94 | * @since 1.6 | 94 | * @since 1.6 |
95 | */ | 95 | */ |
96 | IPosetComparator getPosetComparator(Iterable<IInputKey> keys); | 96 | IPosetComparator getPosetComparator(Iterable<IInputKey> keys); |
97 | 97 | ||
98 | } | 98 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryResultProviderAccess.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryResultProviderAccess.java index 7fecd01a..e4970cef 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryResultProviderAccess.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryResultProviderAccess.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.context; | 9 | package tools.refinery.interpreter.matchers.context; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 11 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
12 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 12 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
13 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 13 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * This interface exposes API to request {@link IQueryResultProvider} for {@link PQuery} instances. | 16 | * This interface exposes API to request {@link IQueryResultProvider} for {@link PQuery} instances. |
17 | * | 17 | * |
18 | * @author Grill Balázs | 18 | * @author Grill Balázs |
19 | * @since 1.5 | 19 | * @since 1.5 |
20 | * @noimplement This interface is not intended to be implemented by clients. | 20 | * @noimplement This interface is not intended to be implemented by clients. |
@@ -24,8 +24,8 @@ public interface IQueryResultProviderAccess { | |||
24 | /** | 24 | /** |
25 | * Get a result provider for the given {@link PQuery}, which conforms the capabilities requested by the | 25 | * Get a result provider for the given {@link PQuery}, which conforms the capabilities requested by the |
26 | * given {@link QueryEvaluationHint} object. | 26 | * given {@link QueryEvaluationHint} object. |
27 | * @throws ViatraQueryRuntimeException | 27 | * @throws ViatraQueryRuntimeException |
28 | */ | 28 | */ |
29 | public IQueryResultProvider getResultProvider(PQuery query, QueryEvaluationHint overrideHints); | 29 | public IQueryResultProvider getResultProvider(PQuery query, QueryEvaluationHint overrideHints); |
30 | 30 | ||
31 | } | 31 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryRuntimeContext.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryRuntimeContext.java index 61359c1b..1a3b300a 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryRuntimeContext.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryRuntimeContext.java | |||
@@ -7,14 +7,14 @@ | |||
7 | * | 7 | * |
8 | * SPDX-License-Identifier: EPL-2.0 | 8 | * SPDX-License-Identifier: EPL-2.0 |
9 | *******************************************************************************/ | 9 | *******************************************************************************/ |
10 | package tools.refinery.viatra.runtime.matchers.context; | 10 | package tools.refinery.interpreter.matchers.context; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.CancellationToken; | 12 | import tools.refinery.interpreter.matchers.planning.helpers.StatisticsHelper; |
13 | import tools.refinery.viatra.runtime.matchers.planning.helpers.StatisticsHelper; | 13 | import tools.refinery.interpreter.CancellationToken; |
14 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 14 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 16 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
17 | import tools.refinery.viatra.runtime.matchers.util.Accuracy; | 17 | import tools.refinery.interpreter.matchers.util.Accuracy; |
18 | 18 | ||
19 | import java.lang.reflect.InvocationTargetException; | 19 | import java.lang.reflect.InvocationTargetException; |
20 | import java.util.Optional; | 20 | import java.util.Optional; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryRuntimeContextListener.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryRuntimeContextListener.java index 7be27d56..87b07099 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IQueryRuntimeContextListener.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IQueryRuntimeContextListener.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.context; | 9 | package tools.refinery.interpreter.matchers.context; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 11 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Listens for changes in the runtime context. | 14 | * Listens for changes in the runtime context. |
@@ -16,7 +16,7 @@ import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | |||
16 | * | 16 | * |
17 | */ | 17 | */ |
18 | public interface IQueryRuntimeContextListener { | 18 | public interface IQueryRuntimeContextListener { |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * The given tuple was inserted into or removed from the input relation indicated by the given key. | 21 | * The given tuple was inserted into or removed from the input relation indicated by the given key. |
22 | * @param key the key identifying the input relation that was updated | 22 | * @param key the key identifying the input relation that was updated |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IndexingService.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IndexingService.java index 8210765d..08183746 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/IndexingService.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/IndexingService.java | |||
@@ -3,14 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.context; | 9 | package tools.refinery.interpreter.matchers.context; |
10 | |||
11 | import tools.refinery.interpreter.matchers.tuple.Tuple; | ||
10 | 12 | ||
11 | /** | 13 | /** |
12 | * These are the different services which can be provided by an {@link IQueryRuntimeContext} implementation. | 14 | * These are the different services which can be provided by an {@link IQueryRuntimeContext} implementation. |
13 | * | 15 | * |
14 | * @author Grill Balázs | 16 | * @author Grill Balázs |
15 | * @since 1.4 | 17 | * @since 1.4 |
16 | * | 18 | * |
@@ -18,19 +20,19 @@ package tools.refinery.viatra.runtime.matchers.context; | |||
18 | public enum IndexingService { | 20 | public enum IndexingService { |
19 | 21 | ||
20 | /** | 22 | /** |
21 | * Cardinality information is available. Makes possible to calculate | 23 | * Cardinality information is available. Makes possible to calculate |
22 | * unseeded calls of {@link IQueryRuntimeContext#countTuples(IInputKey, tools.refinery.viatra.runtime.matchers.tuple.Tuple)} | 24 | * unseeded calls of {@link IQueryRuntimeContext#countTuples(IInputKey, Tuple)} |
23 | */ | 25 | */ |
24 | STATISTICS, | 26 | STATISTICS, |
25 | 27 | ||
26 | /** | 28 | /** |
27 | * The indexer can provide notifications about changes in the model. | 29 | * The indexer can provide notifications about changes in the model. |
28 | */ | 30 | */ |
29 | NOTIFICATIONS, | 31 | NOTIFICATIONS, |
30 | 32 | ||
31 | /** | 33 | /** |
32 | * Enables enumeration of instances and reverse-navigation. | 34 | * Enables enumeration of instances and reverse-navigation. |
33 | */ | 35 | */ |
34 | INSTANCES | 36 | INSTANCES |
35 | 37 | ||
36 | } | 38 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/InputKeyImplication.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/InputKeyImplication.java index 2a403810..b98a8d2f 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/InputKeyImplication.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/InputKeyImplication.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.context; | 9 | package tools.refinery.interpreter.matchers.context; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -14,12 +14,12 @@ import java.util.List; | |||
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Data object representing the implication of an input key, in use cases including edge supertypes, edge opposites, node type constraints, etc. | 16 | * Data object representing the implication of an input key, in use cases including edge supertypes, edge opposites, node type constraints, etc. |
17 | * | 17 | * |
18 | * <p> Each instance tuple of the <i>implying input key</i> (if given) implies the presence of an instance tuple of the <i>implied input key</i> consisting of elements of the original tuple at given positions. | 18 | * <p> Each instance tuple of the <i>implying input key</i> (if given) implies the presence of an instance tuple of the <i>implied input key</i> consisting of elements of the original tuple at given positions. |
19 | * When the input key is null, it is not an input constraint but some other source that implies input keys. | 19 | * When the input key is null, it is not an input constraint but some other source that implies input keys. |
20 | * | 20 | * |
21 | * <p> The implication is an immutable data object. | 21 | * <p> The implication is an immutable data object. |
22 | * | 22 | * |
23 | * @author Bergmann Gabor | 23 | * @author Bergmann Gabor |
24 | * | 24 | * |
25 | */ | 25 | */ |
@@ -29,7 +29,7 @@ public final class InputKeyImplication { | |||
29 | private List<Integer> impliedIndices; | 29 | private List<Integer> impliedIndices; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Optional. Instance tuples of this input key imply an instance tuple of another key. | 32 | * Optional. Instance tuples of this input key imply an instance tuple of another key. |
33 | * Sometimes it is not an input key that implies other input keys, so this attribute can be null. | 33 | * Sometimes it is not an input key that implies other input keys, so this attribute can be null. |
34 | */ | 34 | */ |
35 | public IInputKey getImplyingKey() { | 35 | public IInputKey getImplyingKey() { |
@@ -59,7 +59,7 @@ public final class InputKeyImplication { | |||
59 | this.impliedKey = impliedKey; | 59 | this.impliedKey = impliedKey; |
60 | this.impliedIndices = Collections.unmodifiableList(new ArrayList<>(implyingIndices)); | 60 | this.impliedIndices = Collections.unmodifiableList(new ArrayList<>(implyingIndices)); |
61 | } | 61 | } |
62 | 62 | ||
63 | @Override | 63 | @Override |
64 | public int hashCode() { | 64 | public int hashCode() { |
65 | final int prime = 31; | 65 | final int prime = 31; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/common/BaseInputKeyWrapper.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/common/BaseInputKeyWrapper.java index f9b05e5b..127a8631 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/common/BaseInputKeyWrapper.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/common/BaseInputKeyWrapper.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.context.common; | 9 | package tools.refinery.interpreter.matchers.context.common; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 11 | import tools.refinery.interpreter.matchers.context.IInputKey; |
12 | 12 | ||
13 | 13 | ||
14 | /** | 14 | /** |
15 | * An input key that is identified by a single wrapped object and the class of the wrapper. | 15 | * An input key that is identified by a single wrapped object and the class of the wrapper. |
16 | * @author Bergmann Gabor | 16 | * @author Bergmann Gabor |
17 | * | 17 | * |
18 | */ | 18 | */ |
@@ -27,8 +27,8 @@ public abstract class BaseInputKeyWrapper<Wrapped> implements IInputKey { | |||
27 | public Wrapped getWrappedKey() { | 27 | public Wrapped getWrappedKey() { |
28 | return wrappedKey; | 28 | return wrappedKey; |
29 | } | 29 | } |
30 | 30 | ||
31 | 31 | ||
32 | @Override | 32 | @Override |
33 | public int hashCode() { | 33 | public int hashCode() { |
34 | return ((wrappedKey == null) ? 0 : wrappedKey.hashCode()); | 34 | return ((wrappedKey == null) ? 0 : wrappedKey.hashCode()); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/common/JavaTransitiveInstancesKey.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/common/JavaTransitiveInstancesKey.java index 400a6ab9..fc1accbd 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/common/JavaTransitiveInstancesKey.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/common/JavaTransitiveInstancesKey.java | |||
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.context.common; | 9 | package tools.refinery.interpreter.matchers.context.common; |
10 | 10 | ||
11 | 11 | ||
12 | 12 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/surrogate/SurrogateQueryRegistry.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/surrogate/SurrogateQueryRegistry.java index bb24ec8c..83eba8c9 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/context/surrogate/SurrogateQueryRegistry.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/context/surrogate/SurrogateQueryRegistry.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.context.surrogate; | 9 | package tools.refinery.interpreter.matchers.context.surrogate; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.HashMap; | 12 | import java.util.HashMap; |
@@ -15,21 +15,21 @@ import java.util.Map; | |||
15 | import java.util.NoSuchElementException; | 15 | import java.util.NoSuchElementException; |
16 | import java.util.Set; | 16 | import java.util.Set; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 18 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 19 | import tools.refinery.interpreter.matchers.context.IInputKey; |
20 | import tools.refinery.viatra.runtime.matchers.util.IProvider; | 20 | import tools.refinery.interpreter.matchers.util.IProvider; |
21 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 21 | import tools.refinery.interpreter.matchers.util.Preconditions; |
22 | import tools.refinery.viatra.runtime.matchers.util.SingletonInstanceProvider; | 22 | import tools.refinery.interpreter.matchers.util.SingletonInstanceProvider; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * @author Abel Hegedus | 25 | * @author Abel Hegedus |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | public class SurrogateQueryRegistry { | 28 | public class SurrogateQueryRegistry { |
29 | 29 | ||
30 | private Map<IInputKey, IProvider<PQuery>> registeredSurrogateQueryMap = new HashMap<>(); | 30 | private Map<IInputKey, IProvider<PQuery>> registeredSurrogateQueryMap = new HashMap<>(); |
31 | private Map<IInputKey, IProvider<PQuery>> dynamicSurrogateQueryMap = new HashMap<>(); | 31 | private Map<IInputKey, IProvider<PQuery>> dynamicSurrogateQueryMap = new HashMap<>(); |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Hidden constructor | 34 | * Hidden constructor |
35 | */ | 35 | */ |
@@ -37,17 +37,17 @@ public class SurrogateQueryRegistry { | |||
37 | } | 37 | } |
38 | 38 | ||
39 | private static final SurrogateQueryRegistry INSTANCE = new SurrogateQueryRegistry(); | 39 | private static final SurrogateQueryRegistry INSTANCE = new SurrogateQueryRegistry(); |
40 | 40 | ||
41 | public static SurrogateQueryRegistry instance() { | 41 | public static SurrogateQueryRegistry instance() { |
42 | return INSTANCE; | 42 | return INSTANCE; |
43 | } | 43 | } |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * | 46 | * |
47 | * @param feature | 47 | * @param feature |
48 | * @param surrogateQuery | 48 | * @param surrogateQuery |
49 | * @return the previous surrogate query associated with feature, or null if there was no such query FQN registered | 49 | * @return the previous surrogate query associated with feature, or null if there was no such query FQN registered |
50 | * @throws IllegalArgumentException if feature or surrogateQuery is null | 50 | * @throws IllegalArgumentException if feature or surrogateQuery is null |
51 | */ | 51 | */ |
52 | public IProvider<PQuery> registerSurrogateQueryForFeature(IInputKey feature, PQuery surrogateQuery) { | 52 | public IProvider<PQuery> registerSurrogateQueryForFeature(IInputKey feature, PQuery surrogateQuery) { |
53 | Preconditions.checkArgument(surrogateQuery != null, "Surrogate query must not be null!"); | 53 | Preconditions.checkArgument(surrogateQuery != null, "Surrogate query must not be null!"); |
@@ -55,7 +55,7 @@ public class SurrogateQueryRegistry { | |||
55 | } | 55 | } |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * | 58 | * |
59 | * @param feature | 59 | * @param feature |
60 | * @param surrogateQuery | 60 | * @param surrogateQuery |
61 | * @return the previous surrogate query associated with feature, or null | 61 | * @return the previous surrogate query associated with feature, or null |
@@ -68,12 +68,12 @@ public class SurrogateQueryRegistry { | |||
68 | Preconditions.checkArgument(surrogateQueryProvider != null, "Surrogate query must not be null!"); | 68 | Preconditions.checkArgument(surrogateQueryProvider != null, "Surrogate query must not be null!"); |
69 | return registeredSurrogateQueryMap.put(feature, surrogateQueryProvider); | 69 | return registeredSurrogateQueryMap.put(feature, surrogateQueryProvider); |
70 | } | 70 | } |
71 | 71 | ||
72 | public IProvider<PQuery> addDynamicSurrogateQueryForFeature(IInputKey feature, PQuery surrogateQuery) { | 72 | public IProvider<PQuery> addDynamicSurrogateQueryForFeature(IInputKey feature, PQuery surrogateQuery) { |
73 | Preconditions.checkArgument(surrogateQuery != null, "Surrogate query FQN must not be null!"); | 73 | Preconditions.checkArgument(surrogateQuery != null, "Surrogate query FQN must not be null!"); |
74 | return addDynamicSurrogateQueryForFeature(feature, new SingletonInstanceProvider<PQuery>(surrogateQuery)); | 74 | return addDynamicSurrogateQueryForFeature(feature, new SingletonInstanceProvider<PQuery>(surrogateQuery)); |
75 | } | 75 | } |
76 | 76 | ||
77 | public IProvider<PQuery> addDynamicSurrogateQueryForFeature(IInputKey feature, IProvider<PQuery> surrogateQuery) { | 77 | public IProvider<PQuery> addDynamicSurrogateQueryForFeature(IInputKey feature, IProvider<PQuery> surrogateQuery) { |
78 | Preconditions.checkArgument(feature != null, "Feature must not be null!"); | 78 | Preconditions.checkArgument(feature != null, "Feature must not be null!"); |
79 | Preconditions.checkArgument(surrogateQuery != null, "Surrogate query FQN must not be null!"); | 79 | Preconditions.checkArgument(surrogateQuery != null, "Surrogate query FQN must not be null!"); |
@@ -84,9 +84,9 @@ public class SurrogateQueryRegistry { | |||
84 | Preconditions.checkArgument(feature != null, "Feature must not be null!"); | 84 | Preconditions.checkArgument(feature != null, "Feature must not be null!"); |
85 | return dynamicSurrogateQueryMap.remove(feature); | 85 | return dynamicSurrogateQueryMap.remove(feature); |
86 | } | 86 | } |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * | 89 | * |
90 | * @param feature that may have surrogate query defined, null not allowed | 90 | * @param feature that may have surrogate query defined, null not allowed |
91 | * @return true if the feature has a surrogate query defined | 91 | * @return true if the feature has a surrogate query defined |
92 | * @throws IllegalArgumentException if feature is null | 92 | * @throws IllegalArgumentException if feature is null |
@@ -99,9 +99,9 @@ public class SurrogateQueryRegistry { | |||
99 | } | 99 | } |
100 | return surrogateExists; | 100 | return surrogateExists; |
101 | } | 101 | } |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * | 104 | * |
105 | * @param feature for which the surrogate query FQN should be returned | 105 | * @param feature for which the surrogate query FQN should be returned |
106 | * @return the surrogate query FQN defined for the feature | 106 | * @return the surrogate query FQN defined for the feature |
107 | * @throws IllegalArgumentException if feature is null | 107 | * @throws IllegalArgumentException if feature is null |
@@ -126,22 +126,22 @@ public class SurrogateQueryRegistry { | |||
126 | public Set<IInputKey> getRegisteredSurrogateQueries() { | 126 | public Set<IInputKey> getRegisteredSurrogateQueries() { |
127 | return Collections.unmodifiableSet(getRegisteredSurrogateQueriesInternal()); | 127 | return Collections.unmodifiableSet(getRegisteredSurrogateQueriesInternal()); |
128 | } | 128 | } |
129 | 129 | ||
130 | private Set<IInputKey> getRegisteredSurrogateQueriesInternal() { | 130 | private Set<IInputKey> getRegisteredSurrogateQueriesInternal() { |
131 | return registeredSurrogateQueryMap.keySet(); | 131 | return registeredSurrogateQueryMap.keySet(); |
132 | } | 132 | } |
133 | 133 | ||
134 | /** | 134 | /** |
135 | * @return an unmodifiable set of features with dynamically added surrogate queries | 135 | * @return an unmodifiable set of features with dynamically added surrogate queries |
136 | */ | 136 | */ |
137 | public Set<IInputKey> getDynamicSurrogateQueries() { | 137 | public Set<IInputKey> getDynamicSurrogateQueries() { |
138 | return Collections.unmodifiableSet(getDynamicSurrogateQueriesInternal()); | 138 | return Collections.unmodifiableSet(getDynamicSurrogateQueriesInternal()); |
139 | } | 139 | } |
140 | 140 | ||
141 | private Set<IInputKey> getDynamicSurrogateQueriesInternal() { | 141 | private Set<IInputKey> getDynamicSurrogateQueriesInternal() { |
142 | return dynamicSurrogateQueryMap.keySet(); | 142 | return dynamicSurrogateQueryMap.keySet(); |
143 | } | 143 | } |
144 | 144 | ||
145 | /** | 145 | /** |
146 | * @return an unmodifiable set that contains all features with surrogate queries. | 146 | * @return an unmodifiable set that contains all features with surrogate queries. |
147 | */ | 147 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/AbstractTrivialMaskedMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/AbstractTrivialMaskedMemory.java index 66587f77..94572c06 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/AbstractTrivialMaskedMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/AbstractTrivialMaskedMemory.java | |||
@@ -3,25 +3,25 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.memories; | 9 | package tools.refinery.interpreter.matchers.memories; |
10 | 10 | ||
11 | import java.util.Iterator; | 11 | import java.util.Iterator; |
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 14 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 16 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
17 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 17 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
18 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | 18 | import tools.refinery.interpreter.matchers.util.CollectionsFactory.MemoryType; |
19 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 19 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
20 | import tools.refinery.viatra.runtime.matchers.util.IMemory; | 20 | import tools.refinery.interpreter.matchers.util.IMemory; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * Common parts of nullary and identity specializations. | 23 | * Common parts of nullary and identity specializations. |
24 | * | 24 | * |
25 | * @noextend This class is not intended to be subclassed by clients. | 25 | * @noextend This class is not intended to be subclassed by clients. |
26 | * @author Gabor Bergmann | 26 | * @author Gabor Bergmann |
27 | * @since 2.0 | 27 | * @since 2.0 |
@@ -34,7 +34,7 @@ abstract class AbstractTrivialMaskedMemory<Timestamp extends Comparable<Timestam | |||
34 | super(mask, owner); | 34 | super(mask, owner); |
35 | tuples = CollectionsFactory.createMemory(Object.class, bucketType); | 35 | tuples = CollectionsFactory.createMemory(Object.class, bucketType); |
36 | } | 36 | } |
37 | 37 | ||
38 | @Override | 38 | @Override |
39 | public Map<Tuple, Timeline<Timestamp>> getWithTimeline(ITuple signature) { | 39 | public Map<Tuple, Timeline<Timestamp>> getWithTimeline(ITuple signature) { |
40 | throw new UnsupportedOperationException("Timeless memories do not support timestamp-based lookup!"); | 40 | throw new UnsupportedOperationException("Timeless memories do not support timestamp-based lookup!"); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/DefaultMaskedTupleMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/DefaultMaskedTupleMemory.java index 92081409..22c4140a 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/DefaultMaskedTupleMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/DefaultMaskedTupleMemory.java | |||
@@ -3,38 +3,38 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.memories; | 10 | package tools.refinery.interpreter.matchers.memories; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Iterator; | 13 | import java.util.Iterator; |
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 16 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 18 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
19 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 19 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
20 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | 20 | import tools.refinery.interpreter.matchers.util.CollectionsFactory.MemoryType; |
21 | import tools.refinery.viatra.runtime.matchers.util.IMemoryView; | 21 | import tools.refinery.interpreter.matchers.util.IMemoryView; |
22 | import tools.refinery.viatra.runtime.matchers.util.IMultiLookup; | 22 | import tools.refinery.interpreter.matchers.util.IMultiLookup; |
23 | import tools.refinery.viatra.runtime.matchers.util.IMultiLookup.ChangeGranularity; | 23 | import tools.refinery.interpreter.matchers.util.IMultiLookup.ChangeGranularity; |
24 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 24 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * @author Gabor Bergmann | 27 | * @author Gabor Bergmann |
28 | * | 28 | * |
29 | * Default implementation that covers all cases. | 29 | * Default implementation that covers all cases. |
30 | * | 30 | * |
31 | * @since 2.0 | 31 | * @since 2.0 |
32 | */ | 32 | */ |
33 | public final class DefaultMaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | 33 | public final class DefaultMaskedTupleMemory<Timestamp extends Comparable<Timestamp>> |
34 | extends MaskedTupleMemory<Timestamp> { | 34 | extends MaskedTupleMemory<Timestamp> { |
35 | /** | 35 | /** |
36 | * Maps a signature tuple to the bucket of tuples with the given signature. | 36 | * Maps a signature tuple to the bucket of tuples with the given signature. |
37 | * | 37 | * |
38 | * @since 2.0 | 38 | * @since 2.0 |
39 | */ | 39 | */ |
40 | protected IMultiLookup<Tuple, Tuple> signatureToTuples; | 40 | protected IMultiLookup<Tuple, Tuple> signatureToTuples; |
@@ -83,7 +83,7 @@ public final class DefaultMaskedTupleMemory<Timestamp extends Comparable<Timesta | |||
83 | throw raiseDuplicateDeletion(tuple); | 83 | throw raiseDuplicateDeletion(tuple); |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | @Override | 87 | @Override |
88 | public Map<Tuple, Timeline<Timestamp>> getWithTimeline(ITuple signature) { | 88 | public Map<Tuple, Timeline<Timestamp>> getWithTimeline(ITuple signature) { |
89 | throw new UnsupportedOperationException("Timeless memories do not support timestamp-based lookup!"); | 89 | throw new UnsupportedOperationException("Timeless memories do not support timestamp-based lookup!"); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/IdentityMaskedTupleMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/IdentityMaskedTupleMemory.java index dc59daf5..bd693eeb 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/IdentityMaskedTupleMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/IdentityMaskedTupleMemory.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.memories; | 9 | package tools.refinery.interpreter.matchers.memories; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 14 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
15 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 15 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 16 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
17 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | 17 | import tools.refinery.interpreter.matchers.util.CollectionsFactory.MemoryType; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Specialized for identity mask; tuples are stored as a simple set/multiset memory. | 20 | * Specialized for identity mask; tuples are stored as a simple set/multiset memory. |
21 | * | 21 | * |
22 | * @author Gabor Bergmann | 22 | * @author Gabor Bergmann |
23 | * @since 2.0 | 23 | * @since 2.0 |
24 | */ | 24 | */ |
@@ -49,7 +49,7 @@ public final class IdentityMaskedTupleMemory<Timestamp extends Comparable<Timest | |||
49 | @Override | 49 | @Override |
50 | public Collection<Tuple> get(ITuple signature) { | 50 | public Collection<Tuple> get(ITuple signature) { |
51 | Tuple contained = tuples.theContainedVersionOfUnsafe(signature); | 51 | Tuple contained = tuples.theContainedVersionOfUnsafe(signature); |
52 | return contained != null ? | 52 | return contained != null ? |
53 | Collections.singleton(contained) : | 53 | Collections.singleton(contained) : |
54 | null; | 54 | null; |
55 | } | 55 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/MaskedTupleMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/MaskedTupleMemory.java index 62377624..9c179451 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/MaskedTupleMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/MaskedTupleMemory.java | |||
@@ -3,28 +3,28 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.memories; | 9 | package tools.refinery.interpreter.matchers.memories; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.Iterator; | 13 | import java.util.Iterator; |
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.memories.timely.TimelyDefaultMaskedTupleMemory; | 16 | import tools.refinery.interpreter.matchers.memories.timely.TimelyDefaultMaskedTupleMemory; |
17 | import tools.refinery.viatra.runtime.matchers.memories.timely.TimelyIdentityMaskedTupleMemory; | 17 | import tools.refinery.interpreter.matchers.memories.timely.TimelyIdentityMaskedTupleMemory; |
18 | import tools.refinery.viatra.runtime.matchers.memories.timely.TimelyNullaryMaskedTupleMemory; | 18 | import tools.refinery.interpreter.matchers.memories.timely.TimelyNullaryMaskedTupleMemory; |
19 | import tools.refinery.viatra.runtime.matchers.memories.timely.TimelyUnaryMaskedTupleMemory; | 19 | import tools.refinery.interpreter.matchers.memories.timely.TimelyUnaryMaskedTupleMemory; |
20 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 20 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
21 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
22 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 22 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
23 | import tools.refinery.viatra.runtime.matchers.util.Clearable; | 23 | import tools.refinery.interpreter.matchers.util.Clearable; |
24 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | 24 | import tools.refinery.interpreter.matchers.util.CollectionsFactory.MemoryType; |
25 | import tools.refinery.viatra.runtime.matchers.util.resumable.MaskedResumable; | 25 | import tools.refinery.interpreter.matchers.util.resumable.MaskedResumable; |
26 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 26 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
27 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 27 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * Indexes a collection of tuples by their signature (i.e. footprint, projection) obtained according to a mask. May | 30 | * Indexes a collection of tuples by their signature (i.e. footprint, projection) obtained according to a mask. May |
@@ -32,7 +32,7 @@ import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | |||
32 | * <p> | 32 | * <p> |
33 | * There are timeless and timely versions of the different memories. Timely versions associate {@link Timeline}s with | 33 | * There are timeless and timely versions of the different memories. Timely versions associate {@link Timeline}s with |
34 | * the stored tuples. | 34 | * the stored tuples. |
35 | * | 35 | * |
36 | * @noextend This class is not intended to be subclassed by clients. | 36 | * @noextend This class is not intended to be subclassed by clients. |
37 | * @author Gabor Bergmann | 37 | * @author Gabor Bergmann |
38 | * @author Tamas Szabo | 38 | * @author Tamas Szabo |
@@ -54,7 +54,7 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
54 | * the created memory should be timely or not. <br> | 54 | * the created memory should be timely or not. <br> |
55 | * <br> | 55 | * <br> |
56 | * Timely means that tuples are associated with a timeline. | 56 | * Timely means that tuples are associated with a timeline. |
57 | * | 57 | * |
58 | * @since 2.3 | 58 | * @since 2.3 |
59 | */ | 59 | */ |
60 | public static <T extends Comparable<T>> MaskedTupleMemory<T> create(final TupleMask mask, | 60 | public static <T extends Comparable<T>> MaskedTupleMemory<T> create(final TupleMask mask, |
@@ -72,7 +72,7 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
72 | * Lazyness can only be used together with timely memories. It means that the maintenance of the timelines is lazy, | 72 | * Lazyness can only be used together with timely memories. It means that the maintenance of the timelines is lazy, |
73 | * that is, the memory only updates its internal data structures at the timestamp affected by an update, and can be | 73 | * that is, the memory only updates its internal data structures at the timestamp affected by an update, and can be |
74 | * instructed later to resume the maintenance at higher timestamps, as well. | 74 | * instructed later to resume the maintenance at higher timestamps, as well. |
75 | * | 75 | * |
76 | * @since 2.4 | 76 | * @since 2.4 |
77 | */ | 77 | */ |
78 | public static <T extends Comparable<T>> MaskedTupleMemory<T> create(final TupleMask mask, | 78 | public static <T extends Comparable<T>> MaskedTupleMemory<T> create(final TupleMask mask, |
@@ -124,7 +124,7 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
124 | /** | 124 | /** |
125 | * Initializes the contents of this memory based on the contents of another memory. The default value is associated | 125 | * Initializes the contents of this memory based on the contents of another memory. The default value is associated |
126 | * with each tuple in the timely memories. | 126 | * with each tuple in the timely memories. |
127 | * | 127 | * |
128 | * @since 2.3 | 128 | * @since 2.3 |
129 | */ | 129 | */ |
130 | public void initializeWith(final MaskedTupleMemory<Timestamp> other, final Timestamp defaultValue) { | 130 | public void initializeWith(final MaskedTupleMemory<Timestamp> other, final Timestamp defaultValue) { |
@@ -142,7 +142,7 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
142 | 142 | ||
143 | /** | 143 | /** |
144 | * Returns true of this memory is timely, false otherwise. | 144 | * Returns true of this memory is timely, false otherwise. |
145 | * | 145 | * |
146 | * @since 2.3 | 146 | * @since 2.3 |
147 | */ | 147 | */ |
148 | public boolean isTimely() { | 148 | public boolean isTimely() { |
@@ -156,14 +156,14 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
156 | 156 | ||
157 | /** | 157 | /** |
158 | * The object "owning" this memory. May be null. | 158 | * The object "owning" this memory. May be null. |
159 | * | 159 | * |
160 | * @since 1.7 | 160 | * @since 1.7 |
161 | */ | 161 | */ |
162 | protected final Object owner; | 162 | protected final Object owner; |
163 | 163 | ||
164 | /** | 164 | /** |
165 | * The node owning this memory. May be null. | 165 | * The node owning this memory. May be null. |
166 | * | 166 | * |
167 | * @since 2.0 | 167 | * @since 2.0 |
168 | */ | 168 | */ |
169 | public Object getOwner() { | 169 | public Object getOwner() { |
@@ -172,7 +172,7 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
172 | 172 | ||
173 | /** | 173 | /** |
174 | * The mask according to which tuples are projected and indexed. | 174 | * The mask according to which tuples are projected and indexed. |
175 | * | 175 | * |
176 | * @since 2.0 | 176 | * @since 2.0 |
177 | */ | 177 | */ |
178 | public TupleMask getMask() { | 178 | public TupleMask getMask() { |
@@ -187,7 +187,7 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
187 | /** | 187 | /** |
188 | * @return the total number of distinct tuples stored. Multiple copies of the same tuple, if allowed, are counted as | 188 | * @return the total number of distinct tuples stored. Multiple copies of the same tuple, if allowed, are counted as |
189 | * one. | 189 | * one. |
190 | * | 190 | * |
191 | * <p> | 191 | * <p> |
192 | * This is currently not cached but computed on demand. It is therefore not efficient, and shall only be | 192 | * This is currently not cached but computed on demand. It is therefore not efficient, and shall only be |
193 | * used for debug / profiling purposes. | 193 | * used for debug / profiling purposes. |
@@ -201,21 +201,21 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
201 | 201 | ||
202 | /** | 202 | /** |
203 | * Retrieves a read-only view of exactly those signatures for which at least one tuple is stored | 203 | * Retrieves a read-only view of exactly those signatures for which at least one tuple is stored |
204 | * | 204 | * |
205 | * @since 2.0 | 205 | * @since 2.0 |
206 | */ | 206 | */ |
207 | public abstract Iterable<Tuple> getSignatures(); | 207 | public abstract Iterable<Tuple> getSignatures(); |
208 | 208 | ||
209 | /** | 209 | /** |
210 | * Retrieves tuples that have the specified signature | 210 | * Retrieves tuples that have the specified signature |
211 | * | 211 | * |
212 | * @return collection of tuples found, null if none | 212 | * @return collection of tuples found, null if none |
213 | */ | 213 | */ |
214 | public abstract Collection<Tuple> get(final ITuple signature); | 214 | public abstract Collection<Tuple> get(final ITuple signature); |
215 | 215 | ||
216 | /** | 216 | /** |
217 | * Retrieves the tuples and their associated timelines that have the specified signature. | 217 | * Retrieves the tuples and their associated timelines that have the specified signature. |
218 | * | 218 | * |
219 | * @return the mappings from tuples to timelines, null if there is no mapping for the signature | 219 | * @return the mappings from tuples to timelines, null if there is no mapping for the signature |
220 | * @since 2.4 | 220 | * @since 2.4 |
221 | */ | 221 | */ |
@@ -223,7 +223,7 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
223 | 223 | ||
224 | /** | 224 | /** |
225 | * Retrieves tuples that have the specified signature. | 225 | * Retrieves tuples that have the specified signature. |
226 | * | 226 | * |
227 | * @return collection of tuples found, never null | 227 | * @return collection of tuples found, never null |
228 | * @since 2.1 | 228 | * @since 2.1 |
229 | */ | 229 | */ |
@@ -234,7 +234,7 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
234 | 234 | ||
235 | /** | 235 | /** |
236 | * Retrieves tuples with their associated timelines that have the specified signature. | 236 | * Retrieves tuples with their associated timelines that have the specified signature. |
237 | * | 237 | * |
238 | * @return map of tuples and timelines found, never null | 238 | * @return map of tuples and timelines found, never null |
239 | * @since 2.4 | 239 | * @since 2.4 |
240 | */ | 240 | */ |
@@ -245,12 +245,12 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
245 | 245 | ||
246 | /** | 246 | /** |
247 | * Removes a tuple occurrence from the memory with the given signature. | 247 | * Removes a tuple occurrence from the memory with the given signature. |
248 | * | 248 | * |
249 | * @param tuple | 249 | * @param tuple |
250 | * the tuple to be removed from the memory | 250 | * the tuple to be removed from the memory |
251 | * @param signature | 251 | * @param signature |
252 | * precomputed footprint of the tuple according to the mask | 252 | * precomputed footprint of the tuple according to the mask |
253 | * | 253 | * |
254 | * @return true if this was the the last occurrence of the signature (according to the mask) | 254 | * @return true if this was the the last occurrence of the signature (according to the mask) |
255 | */ | 255 | */ |
256 | public boolean remove(final Tuple tuple, final Tuple signature) { | 256 | public boolean remove(final Tuple tuple, final Tuple signature) { |
@@ -259,16 +259,16 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
259 | 259 | ||
260 | /** | 260 | /** |
261 | * Removes a tuple occurrence from the memory with the given signature and timestamp. | 261 | * Removes a tuple occurrence from the memory with the given signature and timestamp. |
262 | * | 262 | * |
263 | * @param tuple | 263 | * @param tuple |
264 | * the tuple to be removed from the memory | 264 | * the tuple to be removed from the memory |
265 | * @param signature | 265 | * @param signature |
266 | * precomputed footprint of the tuple according to the mask | 266 | * precomputed footprint of the tuple according to the mask |
267 | * @param timestamp | 267 | * @param timestamp |
268 | * the timestamp associated with the tuple | 268 | * the timestamp associated with the tuple |
269 | * | 269 | * |
270 | * @return A {@link Diff} describing how the timeline of the given tuple changed. | 270 | * @return A {@link Diff} describing how the timeline of the given tuple changed. |
271 | * | 271 | * |
272 | * @since 2.4 | 272 | * @since 2.4 |
273 | */ | 273 | */ |
274 | public Diff<Timestamp> removeWithTimestamp(final Tuple tuple, final Tuple signature, final Timestamp timestamp) { | 274 | public Diff<Timestamp> removeWithTimestamp(final Tuple tuple, final Tuple signature, final Timestamp timestamp) { |
@@ -277,10 +277,10 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
277 | 277 | ||
278 | /** | 278 | /** |
279 | * Removes a tuple occurrence from the memory. | 279 | * Removes a tuple occurrence from the memory. |
280 | * | 280 | * |
281 | * @param tuple | 281 | * @param tuple |
282 | * the tuple to be removed from the memory | 282 | * the tuple to be removed from the memory |
283 | * | 283 | * |
284 | * @return true if this was the the last occurrence of the signature (according to the mask) | 284 | * @return true if this was the the last occurrence of the signature (according to the mask) |
285 | */ | 285 | */ |
286 | public boolean remove(final Tuple tuple) { | 286 | public boolean remove(final Tuple tuple) { |
@@ -289,14 +289,14 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
289 | 289 | ||
290 | /** | 290 | /** |
291 | * Removes a tuple occurrence from the memory with the given timestamp. | 291 | * Removes a tuple occurrence from the memory with the given timestamp. |
292 | * | 292 | * |
293 | * @param tuple | 293 | * @param tuple |
294 | * the tuple to be removed from the memory | 294 | * the tuple to be removed from the memory |
295 | * @param timestamp | 295 | * @param timestamp |
296 | * the timestamp associated with the tuple | 296 | * the timestamp associated with the tuple |
297 | * | 297 | * |
298 | * @return A {@link Diff} describing how the timeline of the given tuple changed. | 298 | * @return A {@link Diff} describing how the timeline of the given tuple changed. |
299 | * | 299 | * |
300 | * @since 2.4 | 300 | * @since 2.4 |
301 | */ | 301 | */ |
302 | public Diff<Timestamp> removeWithTimestamp(final Tuple tuple, final Timestamp timestamp) { | 302 | public Diff<Timestamp> removeWithTimestamp(final Tuple tuple, final Timestamp timestamp) { |
@@ -305,12 +305,12 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
305 | 305 | ||
306 | /** | 306 | /** |
307 | * Adds a tuple occurrence to the memory with the given signature. | 307 | * Adds a tuple occurrence to the memory with the given signature. |
308 | * | 308 | * |
309 | * @param tuple | 309 | * @param tuple |
310 | * the tuple to be added to the memory | 310 | * the tuple to be added to the memory |
311 | * @param signature | 311 | * @param signature |
312 | * precomputed footprint of the tuple according to the mask | 312 | * precomputed footprint of the tuple according to the mask |
313 | * | 313 | * |
314 | * @return true if new signature encountered (according to the mask) | 314 | * @return true if new signature encountered (according to the mask) |
315 | */ | 315 | */ |
316 | public boolean add(final Tuple tuple, final Tuple signature) { | 316 | public boolean add(final Tuple tuple, final Tuple signature) { |
@@ -319,16 +319,16 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
319 | 319 | ||
320 | /** | 320 | /** |
321 | * Adds a tuple occurrence to the memory with the given signature and timestamp. | 321 | * Adds a tuple occurrence to the memory with the given signature and timestamp. |
322 | * | 322 | * |
323 | * @param tuple | 323 | * @param tuple |
324 | * the tuple to be added to the memory | 324 | * the tuple to be added to the memory |
325 | * @param signature | 325 | * @param signature |
326 | * precomputed footprint of the tuple according to the mask | 326 | * precomputed footprint of the tuple according to the mask |
327 | * @param timestamp | 327 | * @param timestamp |
328 | * the timestamp associated with the tuple | 328 | * the timestamp associated with the tuple |
329 | * | 329 | * |
330 | * @return A {@link Diff} describing how the timeline of the given tuple changed. | 330 | * @return A {@link Diff} describing how the timeline of the given tuple changed. |
331 | * | 331 | * |
332 | * @since 2.4 | 332 | * @since 2.4 |
333 | */ | 333 | */ |
334 | public Diff<Timestamp> addWithTimestamp(final Tuple tuple, final Tuple signature, final Timestamp timestamp) { | 334 | public Diff<Timestamp> addWithTimestamp(final Tuple tuple, final Tuple signature, final Timestamp timestamp) { |
@@ -337,10 +337,10 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
337 | 337 | ||
338 | /** | 338 | /** |
339 | * Adds a tuple occurrence to the memory. | 339 | * Adds a tuple occurrence to the memory. |
340 | * | 340 | * |
341 | * @param tuple | 341 | * @param tuple |
342 | * the tuple to be added to the memory | 342 | * the tuple to be added to the memory |
343 | * | 343 | * |
344 | * @return true if new signature encountered (according to the mask) | 344 | * @return true if new signature encountered (according to the mask) |
345 | */ | 345 | */ |
346 | public boolean add(final Tuple tuple) { | 346 | public boolean add(final Tuple tuple) { |
@@ -349,14 +349,14 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
349 | 349 | ||
350 | /** | 350 | /** |
351 | * Adds a tuple occurrence to the memory with the given timestamp. | 351 | * Adds a tuple occurrence to the memory with the given timestamp. |
352 | * | 352 | * |
353 | * @param tuple | 353 | * @param tuple |
354 | * the tuple to be added to the memory | 354 | * the tuple to be added to the memory |
355 | * @param timestamp | 355 | * @param timestamp |
356 | * the timestamp associated with the tuple | 356 | * the timestamp associated with the tuple |
357 | * | 357 | * |
358 | * @return A {@link Diff} describing how the timeline of the given tuple changed. | 358 | * @return A {@link Diff} describing how the timeline of the given tuple changed. |
359 | * | 359 | * |
360 | * @since 2.4 | 360 | * @since 2.4 |
361 | */ | 361 | */ |
362 | public Diff<Timestamp> addWithTimestamp(final Tuple tuple, final Timestamp timestamp) { | 362 | public Diff<Timestamp> addWithTimestamp(final Tuple tuple, final Timestamp timestamp) { |
@@ -382,4 +382,4 @@ public abstract class MaskedTupleMemory<Timestamp extends Comparable<Timestamp>> | |||
382 | return getClass().getSimpleName() + "<" + mask + ">@" + owner; | 382 | return getClass().getSimpleName() + "<" + mask + ">@" + owner; |
383 | } | 383 | } |
384 | 384 | ||
385 | } \ No newline at end of file | 385 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/NullaryMaskedTupleMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/NullaryMaskedTupleMemory.java index 7fa9e053..7ed52358 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/NullaryMaskedTupleMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/NullaryMaskedTupleMemory.java | |||
@@ -3,32 +3,32 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.memories; | 9 | package tools.refinery.interpreter.matchers.memories; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 15 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 17 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
19 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | 19 | import tools.refinery.interpreter.matchers.util.CollectionsFactory.MemoryType; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Specialized for nullary mask; tuples are stored as a simple set/multiset memory. | 22 | * Specialized for nullary mask; tuples are stored as a simple set/multiset memory. |
23 | * | 23 | * |
24 | * @author Gabor Bergmann | 24 | * @author Gabor Bergmann |
25 | * @since 2.0 | 25 | * @since 2.0 |
26 | */ | 26 | */ |
27 | public final class NullaryMaskedTupleMemory<Timestamp extends Comparable<Timestamp>> extends AbstractTrivialMaskedMemory<Timestamp> { | 27 | public final class NullaryMaskedTupleMemory<Timestamp extends Comparable<Timestamp>> extends AbstractTrivialMaskedMemory<Timestamp> { |
28 | 28 | ||
29 | protected static final Set<Tuple> UNIT_RELATION = | 29 | protected static final Set<Tuple> UNIT_RELATION = |
30 | Collections.singleton(Tuples.staticArityFlatTupleOf()); | 30 | Collections.singleton(Tuples.staticArityFlatTupleOf()); |
31 | protected static final Set<Tuple> EMPTY_RELATION = | 31 | protected static final Set<Tuple> EMPTY_RELATION = |
32 | Collections.emptySet(); | 32 | Collections.emptySet(); |
33 | /** | 33 | /** |
34 | * @param mask | 34 | * @param mask |
@@ -55,7 +55,7 @@ public final class NullaryMaskedTupleMemory<Timestamp extends Comparable<Timesta | |||
55 | @Override | 55 | @Override |
56 | public Collection<Tuple> get(ITuple signature) { | 56 | public Collection<Tuple> get(ITuple signature) { |
57 | if (0 == signature.getSize()) | 57 | if (0 == signature.getSize()) |
58 | return tuples.distinctValues(); | 58 | return tuples.distinctValues(); |
59 | else return null; | 59 | else return null; |
60 | } | 60 | } |
61 | 61 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/UnaryMaskedTupleMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/UnaryMaskedTupleMemory.java index f34cc9e3..ccef3a7b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/UnaryMaskedTupleMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/UnaryMaskedTupleMemory.java | |||
@@ -3,29 +3,29 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.memories; | 9 | package tools.refinery.interpreter.matchers.memories; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 15 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 17 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
19 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 19 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
20 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | 20 | import tools.refinery.interpreter.matchers.util.CollectionsFactory.MemoryType; |
21 | import tools.refinery.viatra.runtime.matchers.util.IMemoryView; | 21 | import tools.refinery.interpreter.matchers.util.IMemoryView; |
22 | import tools.refinery.viatra.runtime.matchers.util.IMultiLookup; | 22 | import tools.refinery.interpreter.matchers.util.IMultiLookup; |
23 | import tools.refinery.viatra.runtime.matchers.util.IMultiLookup.ChangeGranularity; | 23 | import tools.refinery.interpreter.matchers.util.IMultiLookup.ChangeGranularity; |
24 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 24 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Specialized for unary mask; tuples are indexed by a single column as opposed to a projection (signature) tuple. | 27 | * Specialized for unary mask; tuples are indexed by a single column as opposed to a projection (signature) tuple. |
28 | * | 28 | * |
29 | * @author Gabor Bergmann | 29 | * @author Gabor Bergmann |
30 | * @since 2.0 | 30 | * @since 2.0 |
31 | */ | 31 | */ |
@@ -44,12 +44,12 @@ public final class UnaryMaskedTupleMemory<Timestamp extends Comparable<Timestamp | |||
44 | public UnaryMaskedTupleMemory(TupleMask mask, MemoryType bucketType, Object owner) { | 44 | public UnaryMaskedTupleMemory(TupleMask mask, MemoryType bucketType, Object owner) { |
45 | super(mask, owner); | 45 | super(mask, owner); |
46 | if (1 != mask.getSize()) throw new IllegalArgumentException(mask.toString()); | 46 | if (1 != mask.getSize()) throw new IllegalArgumentException(mask.toString()); |
47 | 47 | ||
48 | columnToTuples = CollectionsFactory.<Object, Tuple>createMultiLookup( | 48 | columnToTuples = CollectionsFactory.<Object, Tuple>createMultiLookup( |
49 | Object.class, bucketType, Object.class); | 49 | Object.class, bucketType, Object.class); |
50 | keyPosition = mask.indices[0]; | 50 | keyPosition = mask.indices[0]; |
51 | } | 51 | } |
52 | 52 | ||
53 | @Override | 53 | @Override |
54 | public void clear() { | 54 | public void clear() { |
55 | columnToTuples.clear(); | 55 | columnToTuples.clear(); |
@@ -98,7 +98,7 @@ public final class UnaryMaskedTupleMemory<Timestamp extends Comparable<Timestamp | |||
98 | IMemoryView<Tuple> bucket = columnToTuples.lookup(key); | 98 | IMemoryView<Tuple> bucket = columnToTuples.lookup(key); |
99 | return bucket == null ? null : bucket.distinctValues(); | 99 | return bucket == null ? null : bucket.distinctValues(); |
100 | } | 100 | } |
101 | 101 | ||
102 | @Override | 102 | @Override |
103 | public Map<Tuple, Timeline<Timestamp>> getWithTimeline(ITuple signature) { | 103 | public Map<Tuple, Timeline<Timestamp>> getWithTimeline(ITuple signature) { |
104 | throw new UnsupportedOperationException("Timeless memories do not support timestamp-based lookup!"); | 104 | throw new UnsupportedOperationException("Timeless memories do not support timestamp-based lookup!"); |
@@ -123,7 +123,7 @@ public final class UnaryMaskedTupleMemory<Timestamp extends Comparable<Timestamp | |||
123 | public boolean add(Tuple tuple) { | 123 | public boolean add(Tuple tuple) { |
124 | return addInternal(tuple, tuple.get(keyPosition)); | 124 | return addInternal(tuple, tuple.get(keyPosition)); |
125 | } | 125 | } |
126 | 126 | ||
127 | protected boolean addInternal(Tuple tuple, Object key) { | 127 | protected boolean addInternal(Tuple tuple, Object key) { |
128 | try { | 128 | try { |
129 | return columnToTuples.addPair(key, tuple) == ChangeGranularity.KEY; | 129 | return columnToTuples.addPair(key, tuple) == ChangeGranularity.KEY; |
@@ -131,7 +131,7 @@ public final class UnaryMaskedTupleMemory<Timestamp extends Comparable<Timestamp | |||
131 | throw raiseDuplicateInsertion(tuple); | 131 | throw raiseDuplicateInsertion(tuple); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
135 | protected boolean removeInternal(Tuple tuple, Object key) { | 135 | protected boolean removeInternal(Tuple tuple, Object key) { |
136 | try { | 136 | try { |
137 | return columnToTuples.removePair(key, tuple) == ChangeGranularity.KEY; | 137 | return columnToTuples.removePair(key, tuple) == ChangeGranularity.KEY; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/AbstractTimelyMaskedMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/AbstractTimelyMaskedMemory.java index 45ce3a4e..9a1312cd 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/AbstractTimelyMaskedMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/AbstractTimelyMaskedMemory.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.memories.timely; | 9 | package tools.refinery.interpreter.matchers.memories.timely; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
@@ -16,19 +16,19 @@ import java.util.Objects; | |||
16 | import java.util.Set; | 16 | import java.util.Set; |
17 | import java.util.TreeMap; | 17 | import java.util.TreeMap; |
18 | 18 | ||
19 | import tools.refinery.viatra.runtime.matchers.memories.MaskedTupleMemory; | 19 | import tools.refinery.interpreter.matchers.memories.MaskedTupleMemory; |
20 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 20 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
21 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 21 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
22 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 22 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
23 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 23 | import tools.refinery.interpreter.matchers.util.Direction; |
24 | import tools.refinery.viatra.runtime.matchers.util.Signed; | 24 | import tools.refinery.interpreter.matchers.util.Signed; |
25 | import tools.refinery.viatra.runtime.matchers.util.TimelyMemory; | 25 | import tools.refinery.interpreter.matchers.util.TimelyMemory; |
26 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 26 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
27 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 27 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * Common parts of timely default and timely unary implementations. | 30 | * Common parts of timely default and timely unary implementations. |
31 | * | 31 | * |
32 | * @noextend This class is not intended to be subclassed by clients. | 32 | * @noextend This class is not intended to be subclassed by clients. |
33 | * @author Tamas Szabo | 33 | * @author Tamas Szabo |
34 | * @since 2.3 | 34 | * @since 2.3 |
@@ -125,16 +125,16 @@ abstract class AbstractTimelyMaskedMemory<Timestamp extends Comparable<Timestamp | |||
125 | protected Diff<Timestamp> removeInternal(final KeyType key, final Tuple tuple, final Timestamp timestamp) { | 125 | protected Diff<Timestamp> removeInternal(final KeyType key, final Tuple tuple, final Timestamp timestamp) { |
126 | Timestamp oldResumableTimestamp = null; | 126 | Timestamp oldResumableTimestamp = null; |
127 | Timestamp newResumableTimestamp = null; | 127 | Timestamp newResumableTimestamp = null; |
128 | 128 | ||
129 | final TimelyMemory<Timestamp> keyMemory = this.memoryMap.get(key); | 129 | final TimelyMemory<Timestamp> keyMemory = this.memoryMap.get(key); |
130 | if (keyMemory == null) { | 130 | if (keyMemory == null) { |
131 | throw raiseDuplicateDeletion(tuple); | 131 | throw raiseDuplicateDeletion(tuple); |
132 | } | 132 | } |
133 | 133 | ||
134 | if (this.isLazy) { | 134 | if (this.isLazy) { |
135 | oldResumableTimestamp = keyMemory.getResumableTimestamp(); | 135 | oldResumableTimestamp = keyMemory.getResumableTimestamp(); |
136 | } | 136 | } |
137 | 137 | ||
138 | Diff<Timestamp> diff = null; | 138 | Diff<Timestamp> diff = null; |
139 | try { | 139 | try { |
140 | diff = keyMemory.remove(tuple, timestamp); | 140 | diff = keyMemory.remove(tuple, timestamp); |
@@ -144,42 +144,42 @@ abstract class AbstractTimelyMaskedMemory<Timestamp extends Comparable<Timestamp | |||
144 | if (keyMemory.isEmpty()) { | 144 | if (keyMemory.isEmpty()) { |
145 | this.memoryMap.remove(key); | 145 | this.memoryMap.remove(key); |
146 | } | 146 | } |
147 | 147 | ||
148 | if (this.isLazy) { | 148 | if (this.isLazy) { |
149 | newResumableTimestamp = keyMemory.getResumableTimestamp(); | 149 | newResumableTimestamp = keyMemory.getResumableTimestamp(); |
150 | if (!Objects.equals(oldResumableTimestamp, newResumableTimestamp)) { | 150 | if (!Objects.equals(oldResumableTimestamp, newResumableTimestamp)) { |
151 | unregisterFoldingState(oldResumableTimestamp, key); | 151 | unregisterFoldingState(oldResumableTimestamp, key); |
152 | registerFoldingState(newResumableTimestamp, key); | 152 | registerFoldingState(newResumableTimestamp, key); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | return diff; | 156 | return diff; |
157 | } | 157 | } |
158 | 158 | ||
159 | protected Diff<Timestamp> addInternal(final KeyType key, final Tuple tuple, final Timestamp timestamp) { | 159 | protected Diff<Timestamp> addInternal(final KeyType key, final Tuple tuple, final Timestamp timestamp) { |
160 | Timestamp oldResumableTimestamp = null; | 160 | Timestamp oldResumableTimestamp = null; |
161 | Timestamp newResumableTimestamp = null; | 161 | Timestamp newResumableTimestamp = null; |
162 | 162 | ||
163 | final TimelyMemory<Timestamp> keyMemory = this.memoryMap.computeIfAbsent(key, | 163 | final TimelyMemory<Timestamp> keyMemory = this.memoryMap.computeIfAbsent(key, |
164 | k -> new TimelyMemory<Timestamp>(this.isLazy)); | 164 | k -> new TimelyMemory<Timestamp>(this.isLazy)); |
165 | 165 | ||
166 | if (this.isLazy) { | 166 | if (this.isLazy) { |
167 | oldResumableTimestamp = keyMemory.getResumableTimestamp(); | 167 | oldResumableTimestamp = keyMemory.getResumableTimestamp(); |
168 | } | 168 | } |
169 | 169 | ||
170 | final Diff<Timestamp> diff = keyMemory.put(tuple, timestamp); | 170 | final Diff<Timestamp> diff = keyMemory.put(tuple, timestamp); |
171 | 171 | ||
172 | if (this.isLazy) { | 172 | if (this.isLazy) { |
173 | newResumableTimestamp = keyMemory.getResumableTimestamp(); | 173 | newResumableTimestamp = keyMemory.getResumableTimestamp(); |
174 | if (!Objects.equals(oldResumableTimestamp, newResumableTimestamp)) { | 174 | if (!Objects.equals(oldResumableTimestamp, newResumableTimestamp)) { |
175 | unregisterFoldingState(oldResumableTimestamp, key); | 175 | unregisterFoldingState(oldResumableTimestamp, key); |
176 | registerFoldingState(newResumableTimestamp, key); | 176 | registerFoldingState(newResumableTimestamp, key); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
180 | return diff; | 180 | return diff; |
181 | } | 181 | } |
182 | 182 | ||
183 | @Override | 183 | @Override |
184 | public Diff<Timestamp> removeWithTimestamp(final Tuple tuple, final Timestamp timestamp) { | 184 | public Diff<Timestamp> removeWithTimestamp(final Tuple tuple, final Timestamp timestamp) { |
185 | return removeWithTimestamp(tuple, null, timestamp); | 185 | return removeWithTimestamp(tuple, null, timestamp); |
@@ -194,7 +194,7 @@ abstract class AbstractTimelyMaskedMemory<Timestamp extends Comparable<Timestamp | |||
194 | public boolean isTimely() { | 194 | public boolean isTimely() { |
195 | return true; | 195 | return true; |
196 | } | 196 | } |
197 | 197 | ||
198 | protected void registerFoldingState(final Timestamp timestamp, final KeyType key) { | 198 | protected void registerFoldingState(final Timestamp timestamp, final KeyType key) { |
199 | if (timestamp != null) { | 199 | if (timestamp != null) { |
200 | this.foldingStates.compute(timestamp, (k, v) -> { | 200 | this.foldingStates.compute(timestamp, (k, v) -> { |
@@ -206,7 +206,7 @@ abstract class AbstractTimelyMaskedMemory<Timestamp extends Comparable<Timestamp | |||
206 | }); | 206 | }); |
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
210 | protected void unregisterFoldingState(final Timestamp timestamp, final KeyType key) { | 210 | protected void unregisterFoldingState(final Timestamp timestamp, final KeyType key) { |
211 | if (timestamp != null) { | 211 | if (timestamp != null) { |
212 | this.foldingStates.compute(timestamp, (k, v) -> { | 212 | this.foldingStates.compute(timestamp, (k, v) -> { |
@@ -215,7 +215,7 @@ abstract class AbstractTimelyMaskedMemory<Timestamp extends Comparable<Timestamp | |||
215 | }); | 215 | }); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | @Override | 219 | @Override |
220 | public Timestamp getResumableTimestamp() { | 220 | public Timestamp getResumableTimestamp() { |
221 | if (this.foldingStates == null || this.foldingStates.isEmpty()) { | 221 | if (this.foldingStates == null || this.foldingStates.isEmpty()) { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/AbstractTimelyTrivialMaskedMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/AbstractTimelyTrivialMaskedMemory.java index ca06685a..a3d66d0d 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/AbstractTimelyTrivialMaskedMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/AbstractTimelyTrivialMaskedMemory.java | |||
@@ -3,28 +3,28 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.memories.timely; | 9 | package tools.refinery.interpreter.matchers.memories.timely; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.Map.Entry; | 14 | import java.util.Map.Entry; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.memories.MaskedTupleMemory; | 16 | import tools.refinery.interpreter.matchers.memories.MaskedTupleMemory; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 18 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
19 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 19 | import tools.refinery.interpreter.matchers.util.Direction; |
20 | import tools.refinery.viatra.runtime.matchers.util.Signed; | 20 | import tools.refinery.interpreter.matchers.util.Signed; |
21 | import tools.refinery.viatra.runtime.matchers.util.TimelyMemory; | 21 | import tools.refinery.interpreter.matchers.util.TimelyMemory; |
22 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 22 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
23 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 23 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * Common parts of timely nullary and timely identity implementations. | 26 | * Common parts of timely nullary and timely identity implementations. |
27 | * | 27 | * |
28 | * @noextend This class is not intended to be subclassed by clients. | 28 | * @noextend This class is not intended to be subclassed by clients. |
29 | * @author Tamas Szabo | 29 | * @author Tamas Szabo |
30 | * @since 2.3 | 30 | * @since 2.3 |
@@ -37,7 +37,7 @@ abstract class AbstractTimelyTrivialMaskedMemory<Timestamp extends Comparable<Ti | |||
37 | super(mask, owner); | 37 | super(mask, owner); |
38 | this.memory = new TimelyMemory<Timestamp>(isLazy); | 38 | this.memory = new TimelyMemory<Timestamp>(isLazy); |
39 | } | 39 | } |
40 | 40 | ||
41 | @Override | 41 | @Override |
42 | public void initializeWith(final MaskedTupleMemory<Timestamp> other, final Timestamp defaultValue) { | 42 | public void initializeWith(final MaskedTupleMemory<Timestamp> other, final Timestamp defaultValue) { |
43 | final Iterable<Tuple> signatures = other.getSignatures(); | 43 | final Iterable<Tuple> signatures = other.getSignatures(); |
@@ -49,17 +49,17 @@ abstract class AbstractTimelyTrivialMaskedMemory<Timestamp extends Comparable<Ti | |||
49 | if (signed.getDirection() == Direction.DELETE) { | 49 | if (signed.getDirection() == Direction.DELETE) { |
50 | this.removeWithTimestamp(entry.getKey(), signed.getPayload()); | 50 | this.removeWithTimestamp(entry.getKey(), signed.getPayload()); |
51 | } else { | 51 | } else { |
52 | this.addWithTimestamp(entry.getKey(), signed.getPayload()); | 52 | this.addWithTimestamp(entry.getKey(), signed.getPayload()); |
53 | } | 53 | } |
54 | } | 54 | } |
55 | } | 55 | } |
56 | } else { | 56 | } else { |
57 | final Collection<Tuple> tuples = other.get(signature); | 57 | final Collection<Tuple> tuples = other.get(signature); |
58 | for (final Tuple tuple : tuples) { | 58 | for (final Tuple tuple : tuples) { |
59 | this.removeWithTimestamp(tuple, defaultValue); | 59 | this.removeWithTimestamp(tuple, defaultValue); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | @Override | 65 | @Override |
@@ -76,7 +76,7 @@ abstract class AbstractTimelyTrivialMaskedMemory<Timestamp extends Comparable<Ti | |||
76 | public Iterator<Tuple> iterator() { | 76 | public Iterator<Tuple> iterator() { |
77 | return this.memory.keySet().iterator(); | 77 | return this.memory.keySet().iterator(); |
78 | } | 78 | } |
79 | 79 | ||
80 | @Override | 80 | @Override |
81 | public Diff<Timestamp> removeWithTimestamp(final Tuple tuple, final Timestamp timestamp) { | 81 | public Diff<Timestamp> removeWithTimestamp(final Tuple tuple, final Timestamp timestamp) { |
82 | return removeWithTimestamp(tuple, null, timestamp); | 82 | return removeWithTimestamp(tuple, null, timestamp); |
@@ -86,12 +86,12 @@ abstract class AbstractTimelyTrivialMaskedMemory<Timestamp extends Comparable<Ti | |||
86 | public Diff<Timestamp> addWithTimestamp(final Tuple tuple, final Timestamp timestamp) { | 86 | public Diff<Timestamp> addWithTimestamp(final Tuple tuple, final Timestamp timestamp) { |
87 | return addWithTimestamp(tuple, null, timestamp); | 87 | return addWithTimestamp(tuple, null, timestamp); |
88 | } | 88 | } |
89 | 89 | ||
90 | @Override | 90 | @Override |
91 | public boolean isTimely() { | 91 | public boolean isTimely() { |
92 | return true; | 92 | return true; |
93 | } | 93 | } |
94 | 94 | ||
95 | @Override | 95 | @Override |
96 | public Timestamp getResumableTimestamp() { | 96 | public Timestamp getResumableTimestamp() { |
97 | return this.memory.getResumableTimestamp(); | 97 | return this.memory.getResumableTimestamp(); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/TimelyDefaultMaskedTupleMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/TimelyDefaultMaskedTupleMemory.java index 623d7399..23cf572b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/TimelyDefaultMaskedTupleMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/TimelyDefaultMaskedTupleMemory.java | |||
@@ -3,28 +3,28 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.memories.timely; | 10 | package tools.refinery.interpreter.matchers.memories.timely; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.Collections; | 13 | import java.util.Collections; |
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 17 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 19 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
20 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 20 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
21 | import tools.refinery.viatra.runtime.matchers.util.TimelyMemory; | 21 | import tools.refinery.interpreter.matchers.util.TimelyMemory; |
22 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 22 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
23 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 23 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * Default timely implementation that covers all cases. | 26 | * Default timely implementation that covers all cases. |
27 | * | 27 | * |
28 | * @author Tamas Szabo | 28 | * @author Tamas Szabo |
29 | * @since 2.3 | 29 | * @since 2.3 |
30 | */ | 30 | */ |
@@ -63,12 +63,12 @@ public final class TimelyDefaultMaskedTupleMemory<Timestamp extends Comparable<T | |||
63 | public Map<Tuple, Timeline<Timestamp>> getWithTimeline(final ITuple signature) { | 63 | public Map<Tuple, Timeline<Timestamp>> getWithTimeline(final ITuple signature) { |
64 | return getWithTimestampInternal(signature.toImmutable()); | 64 | return getWithTimestampInternal(signature.toImmutable()); |
65 | } | 65 | } |
66 | 66 | ||
67 | @Override | 67 | @Override |
68 | public boolean isPresentAtInfinity(final ITuple signature) { | 68 | public boolean isPresentAtInfinity(final ITuple signature) { |
69 | return isPresentAtInfinityInteral(signature.toImmutable()); | 69 | return isPresentAtInfinityInteral(signature.toImmutable()); |
70 | } | 70 | } |
71 | 71 | ||
72 | @Override | 72 | @Override |
73 | public Set<Tuple> getResumableSignatures() { | 73 | public Set<Tuple> getResumableSignatures() { |
74 | if (this.foldingStates == null || this.foldingStates.isEmpty()) { | 74 | if (this.foldingStates == null || this.foldingStates.isEmpty()) { |
@@ -77,7 +77,7 @@ public final class TimelyDefaultMaskedTupleMemory<Timestamp extends Comparable<T | |||
77 | return this.foldingStates.firstEntry().getValue(); | 77 | return this.foldingStates.firstEntry().getValue(); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | @Override | 81 | @Override |
82 | public Map<Tuple, Map<Tuple, Diff<Timestamp>>> resumeAt(final Timestamp timestamp) { | 82 | public Map<Tuple, Map<Tuple, Diff<Timestamp>>> resumeAt(final Timestamp timestamp) { |
83 | final Map<Tuple, Map<Tuple, Diff<Timestamp>>> result = CollectionsFactory.createMap(); | 83 | final Map<Tuple, Map<Tuple, Diff<Timestamp>>> result = CollectionsFactory.createMap(); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/TimelyIdentityMaskedTupleMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/TimelyIdentityMaskedTupleMemory.java index 568f274d..1ab01447 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/TimelyIdentityMaskedTupleMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/TimelyIdentityMaskedTupleMemory.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.memories.timely; | 9 | package tools.refinery.interpreter.matchers.memories.timely; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -14,16 +14,16 @@ import java.util.Map; | |||
14 | import java.util.Map.Entry; | 14 | import java.util.Map.Entry; |
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 17 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 19 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
20 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 20 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
21 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 21 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
22 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 22 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Timely specialization for identity mask. | 25 | * Timely specialization for identity mask. |
26 | * | 26 | * |
27 | * @author Tamas Szabo | 27 | * @author Tamas Szabo |
28 | * @since 2.3 | 28 | * @since 2.3 |
29 | */ | 29 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/TimelyNullaryMaskedTupleMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/TimelyNullaryMaskedTupleMemory.java index 75987a89..2c3103db 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/TimelyNullaryMaskedTupleMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/TimelyNullaryMaskedTupleMemory.java | |||
@@ -3,26 +3,26 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.memories.timely; | 9 | package tools.refinery.interpreter.matchers.memories.timely; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 16 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 18 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 19 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
20 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 20 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
21 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 21 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * Timely specialization for nullary mask. | 24 | * Timely specialization for nullary mask. |
25 | * | 25 | * |
26 | * @author Tamas Szabo | 26 | * @author Tamas Szabo |
27 | * @since 2.3 | 27 | * @since 2.3 |
28 | */ | 28 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/TimelyUnaryMaskedTupleMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/TimelyUnaryMaskedTupleMemory.java index 178193af..8a129122 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/memories/timely/TimelyUnaryMaskedTupleMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/memories/timely/TimelyUnaryMaskedTupleMemory.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.memories.timely; | 9 | package tools.refinery.interpreter.matchers.memories.timely; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -14,18 +14,18 @@ import java.util.Iterator; | |||
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 17 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 19 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
20 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 20 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
21 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 21 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
22 | import tools.refinery.viatra.runtime.matchers.util.TimelyMemory; | 22 | import tools.refinery.interpreter.matchers.util.TimelyMemory; |
23 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 23 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
24 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 24 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Timely specialization for unary mask. | 27 | * Timely specialization for unary mask. |
28 | * | 28 | * |
29 | * @author Tamas Szabo | 29 | * @author Tamas Szabo |
30 | * @since 2.3 | 30 | * @since 2.3 |
31 | */ | 31 | */ |
@@ -119,7 +119,7 @@ public final class TimelyUnaryMaskedTupleMemory<Timestamp extends Comparable<Tim | |||
119 | } else if (resumableTimestamp.compareTo(timestamp) != 0) { | 119 | } else if (resumableTimestamp.compareTo(timestamp) != 0) { |
120 | throw new IllegalStateException("Expected to continue folding at " + resumableTimestamp + "!"); | 120 | throw new IllegalStateException("Expected to continue folding at " + resumableTimestamp + "!"); |
121 | } | 121 | } |
122 | 122 | ||
123 | final Set<Object> signatures = this.foldingStates.remove(timestamp); | 123 | final Set<Object> signatures = this.foldingStates.remove(timestamp); |
124 | for (final Object signature : signatures) { | 124 | for (final Object signature : signatures) { |
125 | final TimelyMemory<Timestamp> memory = this.memoryMap.get(signature); | 125 | final TimelyMemory<Timestamp> memory = this.memoryMap.get(signature); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/IOperationCompiler.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/IOperationCompiler.java index c9f4b305..e2301d77 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/IOperationCompiler.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/IOperationCompiler.java | |||
@@ -3,27 +3,27 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.planning; | 10 | package tools.refinery.interpreter.matchers.planning; |
11 | 11 | ||
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 14 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.IExpressionEvaluator; | 15 | import tools.refinery.interpreter.matchers.psystem.IExpressionEvaluator; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 16 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 18 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * | 21 | * |
22 | * An implicit common parameter is the "effort" PatternDescription. This | 22 | * An implicit common parameter is the "effort" PatternDescription. This |
23 | * indicates that the build request is part of an effort to build the matcher of | 23 | * indicates that the build request is part of an effort to build the matcher of |
24 | * the given pattern; it it important to record this during code generation so | 24 | * the given pattern; it it important to record this during code generation so |
25 | * that the generated code can be separated according to patterns. | 25 | * that the generated code can be separated according to patterns. |
26 | * | 26 | * |
27 | * @param <Collector> | 27 | * @param <Collector> |
28 | * the handle of a receiver-like RETE ending to which plans can be | 28 | * the handle of a receiver-like RETE ending to which plans can be |
29 | * connected | 29 | * connected |
@@ -33,19 +33,19 @@ import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | |||
33 | public interface IOperationCompiler<Collector> { | 33 | public interface IOperationCompiler<Collector> { |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * @throws ViatraQueryRuntimeException | 36 | * @throws InterpreterRuntimeException |
37 | */ | 37 | */ |
38 | public Collector patternCollector(PQuery pattern); | 38 | public Collector patternCollector(PQuery pattern); |
39 | 39 | ||
40 | public void buildConnection(SubPlan parentPlan, Collector collector); | 40 | public void buildConnection(SubPlan parentPlan, Collector collector); |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * @since 0.9 | 43 | * @since 0.9 |
44 | */ | 44 | */ |
45 | public void patternFinished(PQuery pattern, Collector collector); | 45 | public void patternFinished(PQuery pattern, Collector collector); |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * @throws ViatraQueryRuntimeException | 48 | * @throws InterpreterRuntimeException |
49 | */ | 49 | */ |
50 | public SubPlan patternCallPlan(Tuple nodes, PQuery supplierKey); | 50 | public SubPlan patternCallPlan(Tuple nodes, PQuery supplierKey); |
51 | 51 | ||
@@ -91,7 +91,7 @@ public interface IOperationCompiler<Collector> { | |||
91 | SubPlan parentPlan); | 91 | SubPlan parentPlan); |
92 | public SubPlan buildFunctionEvaluator(IExpressionEvaluator evaluator, Map<String, Integer> tupleNameMap, | 92 | public SubPlan buildFunctionEvaluator(IExpressionEvaluator evaluator, Map<String, Integer> tupleNameMap, |
93 | SubPlan parentPlan, Object computedResultCalibrationElement); | 93 | SubPlan parentPlan, Object computedResultCalibrationElement); |
94 | 94 | ||
95 | /** | 95 | /** |
96 | * @return an operation compiler that potentially acts on a separate container | 96 | * @return an operation compiler that potentially acts on a separate container |
97 | */ | 97 | */ |
@@ -105,4 +105,4 @@ public interface IOperationCompiler<Collector> { | |||
105 | 105 | ||
106 | public void reinitialize(); | 106 | public void reinitialize(); |
107 | 107 | ||
108 | } \ No newline at end of file | 108 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/IQueryPlannerStrategy.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/IQueryPlannerStrategy.java index 6ce9d91b..c9da01e3 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/IQueryPlannerStrategy.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/IQueryPlannerStrategy.java | |||
@@ -3,27 +3,27 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.planning; | 10 | package tools.refinery.interpreter.matchers.planning; |
11 | 11 | ||
12 | import org.apache.log4j.Logger; | 12 | import org.apache.log4j.Logger; |
13 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 13 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
14 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 14 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 15 | import tools.refinery.interpreter.matchers.psystem.PBody; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * An algorithm that builds a query plan based on a PSystem representation of a body of constraints. This interface is | 18 | * An algorithm that builds a query plan based on a PSystem representation of a body of constraints. This interface is |
19 | * for internal use of the various query backends. | 19 | * for internal use of the various query backends. |
20 | * | 20 | * |
21 | * @author Gabor Bergmann | 21 | * @author Gabor Bergmann |
22 | */ | 22 | */ |
23 | public interface IQueryPlannerStrategy { | 23 | public interface IQueryPlannerStrategy { |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * @throws ViatraQueryRuntimeException | 26 | * @throws InterpreterRuntimeException |
27 | */ | 27 | */ |
28 | public SubPlan plan(PBody pSystem, Logger logger, IQueryMetaContext context); | 28 | public SubPlan plan(PBody pSystem, Logger logger, IQueryMetaContext context); |
29 | } | 29 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/QueryProcessingException.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/QueryProcessingException.java index 501ddf73..3efa32a2 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/QueryProcessingException.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/QueryProcessingException.java | |||
@@ -3,37 +3,37 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.planning; | 9 | package tools.refinery.interpreter.matchers.planning; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 11 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * @author Zoltan Ujhelyi | 14 | * @author Zoltan Ujhelyi |
15 | * @since 0.9 | 15 | * @since 0.9 |
16 | */ | 16 | */ |
17 | public class QueryProcessingException extends ViatraQueryRuntimeException { | 17 | public class QueryProcessingException extends InterpreterRuntimeException { |
18 | 18 | ||
19 | private static final long serialVersionUID = -8272290113656867086L; | 19 | private static final long serialVersionUID = -8272290113656867086L; |
20 | /** | 20 | /** |
21 | * Binding the '{n}' (n = 1..N) strings to contextual conditions in 'context' | 21 | * Binding the '{n}' (n = 1..N) strings to contextual conditions in 'context' |
22 | * | 22 | * |
23 | * @param context | 23 | * @param context |
24 | * : array of context-sensitive Strings | 24 | * : array of context-sensitive Strings |
25 | */ | 25 | */ |
26 | protected static String bind(String message, String[] context) { | 26 | protected static String bind(String message, String[] context) { |
27 | if (context == null) | 27 | if (context == null) |
28 | return message; | 28 | return message; |
29 | 29 | ||
30 | String internal = message; | 30 | String internal = message; |
31 | for (int i = 0; i < context.length; i++) { | 31 | for (int i = 0; i < context.length; i++) { |
32 | internal = internal.replace("{" + (i + 1) + "}", context[i] != null ? context[i] : "<<null>>"); | 32 | internal = internal.replace("{" + (i + 1) + "}", context[i] != null ? context[i] : "<<null>>"); |
33 | } | 33 | } |
34 | return internal; | 34 | return internal; |
35 | } | 35 | } |
36 | 36 | ||
37 | private Object patternDescription; | 37 | private Object patternDescription; |
38 | private String shortMessage; | 38 | private String shortMessage; |
39 | 39 | ||
@@ -51,7 +51,7 @@ public class QueryProcessingException extends ViatraQueryRuntimeException { | |||
51 | super(message); | 51 | super(message); |
52 | initializeFields(message, patternDescription); | 52 | initializeFields(message, patternDescription); |
53 | } | 53 | } |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * @param message | 56 | * @param message |
57 | * The template of the exception message | 57 | * The template of the exception message |
@@ -80,7 +80,7 @@ public class QueryProcessingException extends ViatraQueryRuntimeException { | |||
80 | super(bind(message, context), cause); | 80 | super(bind(message, context), cause); |
81 | initializeFields(shortMessage, patternDescription); | 81 | initializeFields(shortMessage, patternDescription); |
82 | } | 82 | } |
83 | 83 | ||
84 | public Object getPatternDescription() { | 84 | public Object getPatternDescription() { |
85 | return patternDescription; | 85 | return patternDescription; |
86 | } | 86 | } |
@@ -94,9 +94,9 @@ public class QueryProcessingException extends ViatraQueryRuntimeException { | |||
94 | this.shortMessage = shortMessage; | 94 | this.shortMessage = shortMessage; |
95 | } | 95 | } |
96 | 96 | ||
97 | 97 | ||
98 | public void setPatternDescription(Object patternDescription) { | 98 | public void setPatternDescription(Object patternDescription) { |
99 | this.patternDescription = patternDescription; | 99 | this.patternDescription = patternDescription; |
100 | } | 100 | } |
101 | 101 | ||
102 | } \ No newline at end of file | 102 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/SubPlan.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/SubPlan.java index 1998df9d..46e6efe3 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/SubPlan.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/SubPlan.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.planning; | 10 | package tools.refinery.interpreter.matchers.planning; |
11 | 11 | ||
12 | import java.util.Arrays; | 12 | import java.util.Arrays; |
13 | import java.util.HashSet; | 13 | import java.util.HashSet; |
@@ -16,49 +16,49 @@ import java.util.Set; | |||
16 | import java.util.WeakHashMap; | 16 | import java.util.WeakHashMap; |
17 | import java.util.stream.Collectors; | 17 | import java.util.stream.Collectors; |
18 | 18 | ||
19 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 19 | import tools.refinery.interpreter.matchers.planning.helpers.TypeHelper; |
20 | import tools.refinery.viatra.runtime.matchers.planning.helpers.TypeHelper; | 20 | import tools.refinery.interpreter.matchers.planning.operations.POperation; |
21 | import tools.refinery.viatra.runtime.matchers.planning.operations.POperation; | 21 | import tools.refinery.interpreter.matchers.planning.operations.PProject; |
22 | import tools.refinery.viatra.runtime.matchers.planning.operations.PProject; | 22 | import tools.refinery.interpreter.matchers.planning.operations.PStart; |
23 | import tools.refinery.viatra.runtime.matchers.planning.operations.PStart; | 23 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 24 | import tools.refinery.interpreter.matchers.psystem.PBody; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 25 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
26 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 26 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
27 | import tools.refinery.viatra.runtime.matchers.psystem.TypeJudgement; | 27 | import tools.refinery.interpreter.matchers.psystem.TypeJudgement; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * A plan representing a subset of (or possibly all the) constraints evaluated. A SubPlan instance is responsible for | 30 | * A plan representing a subset of (or possibly all the) constraints evaluated. A SubPlan instance is responsible for |
31 | * representing a state of the plan; but after it is initialized it is expected be immutable | 31 | * representing a state of the plan; but after it is initialized it is expected be immutable |
32 | * (exception: inferred constraints, see {@link #inferConstraint(PConstraint)}). | 32 | * (exception: inferred constraints, see {@link #inferConstraint(PConstraint)}). |
33 | * | 33 | * |
34 | * <p> A SubPlan is constructed by applying a {@link POperation} on zero or more parent SubPlans. | 34 | * <p> A SubPlan is constructed by applying a {@link POperation} on zero or more parent SubPlans. |
35 | * Important maintained information: <ul> | 35 | * Important maintained information: <ul> |
36 | * <li>set of <b>variables</b> whose values are known when the runtime evaluation is at this stage, | 36 | * <li>set of <b>variables</b> whose values are known when the runtime evaluation is at this stage, |
37 | * <li>set of <b>constraints</b> that are known to hold true at this point. | 37 | * <li>set of <b>constraints</b> that are known to hold true at this point. |
38 | * </ul> | 38 | * </ul> |
39 | * | 39 | * |
40 | * <p> Recommended to instantiate via a {@link SubPlanFactory} or subclasses, | 40 | * <p> Recommended to instantiate via a {@link SubPlanFactory} or subclasses, |
41 | * so that query planners can subclass SubPlan if needed. | 41 | * so that query planners can subclass SubPlan if needed. |
42 | * | 42 | * |
43 | * @author Gabor Bergmann | 43 | * @author Gabor Bergmann |
44 | * | 44 | * |
45 | */ | 45 | */ |
46 | public class SubPlan { | 46 | public class SubPlan { |
47 | private PBody body; | 47 | private PBody body; |
48 | private List<? extends SubPlan> parentPlans; | 48 | private List<? extends SubPlan> parentPlans; |
49 | private POperation operation; | 49 | private POperation operation; |
50 | 50 | ||
51 | private final Set<PVariable> visibleVariables; | 51 | private final Set<PVariable> visibleVariables; |
52 | private final Set<PVariable> allVariables; | 52 | private final Set<PVariable> allVariables; |
53 | private final Set<PVariable> introducedVariables; // delta compared to first parent | 53 | private final Set<PVariable> introducedVariables; // delta compared to first parent |
54 | private Set<PConstraint> allConstraints; | 54 | private Set<PConstraint> allConstraints; |
55 | private Set<PConstraint> deltaConstraints; // delta compared to all parents | 55 | private Set<PConstraint> deltaConstraints; // delta compared to all parents |
56 | private Set<PConstraint> externallyInferredConstraints; // inferred in addition to direct consequences of the operation and parents | 56 | private Set<PConstraint> externallyInferredConstraints; // inferred in addition to direct consequences of the operation and parents |
57 | 57 | ||
58 | |||
59 | |||
60 | |||
58 | 61 | ||
59 | |||
60 | |||
61 | |||
62 | /** | 62 | /** |
63 | * A SubPlan is constructed by applying a {@link POperation} on zero or more parent SubPlans. | 63 | * A SubPlan is constructed by applying a {@link POperation} on zero or more parent SubPlans. |
64 | */ | 64 | */ |
@@ -73,10 +73,10 @@ public class SubPlan { | |||
73 | this.body = body; | 73 | this.body = body; |
74 | this.parentPlans = parentPlans; | 74 | this.parentPlans = parentPlans; |
75 | this.operation = operation; | 75 | this.operation = operation; |
76 | 76 | ||
77 | this.externallyInferredConstraints = new HashSet<PConstraint>(); | 77 | this.externallyInferredConstraints = new HashSet<PConstraint>(); |
78 | this.deltaConstraints = new HashSet<PConstraint>(operation.getDeltaConstraints()); | 78 | this.deltaConstraints = new HashSet<PConstraint>(operation.getDeltaConstraints()); |
79 | 79 | ||
80 | this.allVariables = new HashSet<PVariable>(); | 80 | this.allVariables = new HashSet<PVariable>(); |
81 | for (PConstraint constraint: deltaConstraints) { | 81 | for (PConstraint constraint: deltaConstraints) { |
82 | this.allVariables.addAll(constraint.getDeducedVariables()); | 82 | this.allVariables.addAll(constraint.getDeducedVariables()); |
@@ -85,13 +85,13 @@ public class SubPlan { | |||
85 | for (SubPlan parentPlan: parentPlans) { | 85 | for (SubPlan parentPlan: parentPlans) { |
86 | this.allConstraints.addAll(parentPlan.getAllEnforcedConstraints()); | 86 | this.allConstraints.addAll(parentPlan.getAllEnforcedConstraints()); |
87 | this.allVariables.addAll(parentPlan.getAllDeducedVariables()); | 87 | this.allVariables.addAll(parentPlan.getAllDeducedVariables()); |
88 | } | 88 | } |
89 | 89 | ||
90 | // TODO this is ugly a bit | 90 | // TODO this is ugly a bit |
91 | if (operation instanceof PStart) { | 91 | if (operation instanceof PStart) { |
92 | this.visibleVariables = new HashSet<PVariable>(((PStart) operation).getAPrioriVariables()); | 92 | this.visibleVariables = new HashSet<PVariable>(((PStart) operation).getAPrioriVariables()); |
93 | this.allVariables.addAll(visibleVariables); | 93 | this.allVariables.addAll(visibleVariables); |
94 | } else if (operation instanceof PProject) { | 94 | } else if (operation instanceof PProject) { |
95 | this.visibleVariables = new HashSet<PVariable>(((PProject) operation).getToVariables()); | 95 | this.visibleVariables = new HashSet<PVariable>(((PProject) operation).getToVariables()); |
96 | } else { | 96 | } else { |
97 | this.visibleVariables = new HashSet<PVariable>(); | 97 | this.visibleVariables = new HashSet<PVariable>(); |
@@ -99,27 +99,27 @@ public class SubPlan { | |||
99 | this.visibleVariables.addAll(parentPlan.getVisibleVariables()); | 99 | this.visibleVariables.addAll(parentPlan.getVisibleVariables()); |
100 | for (PConstraint constraint: deltaConstraints) | 100 | for (PConstraint constraint: deltaConstraints) |
101 | this.visibleVariables.addAll(constraint.getDeducedVariables()); | 101 | this.visibleVariables.addAll(constraint.getDeducedVariables()); |
102 | } | 102 | } |
103 | 103 | ||
104 | this.introducedVariables = new HashSet<PVariable>(this.visibleVariables); | 104 | this.introducedVariables = new HashSet<PVariable>(this.visibleVariables); |
105 | if (!parentPlans.isEmpty()) | 105 | if (!parentPlans.isEmpty()) |
106 | introducedVariables.removeAll(parentPlans.get(0).getVisibleVariables()); | 106 | introducedVariables.removeAll(parentPlans.get(0).getVisibleVariables()); |
107 | 107 | ||
108 | operation.checkConsistency(this); | 108 | operation.checkConsistency(this); |
109 | } | 109 | } |
110 | 110 | ||
111 | 111 | ||
112 | @Override | 112 | @Override |
113 | public String toString() { | 113 | public String toString() { |
114 | return toLongString(); | 114 | return toLongString(); |
115 | } | 115 | } |
116 | public String toShortString() { | 116 | public String toShortString() { |
117 | return String.format("Plan{%s}:%s", | 117 | return String.format("Plan{%s}:%s", |
118 | visibleVariables.stream().map(PVariable::getName).collect(Collectors.joining(",")), | 118 | visibleVariables.stream().map(PVariable::getName).collect(Collectors.joining(",")), |
119 | operation.getShortName()); | 119 | operation.getShortName()); |
120 | } | 120 | } |
121 | public String toLongString() { | 121 | public String toLongString() { |
122 | return String.format("%s<%s>", | 122 | return String.format("%s<%s>", |
123 | toShortString(), | 123 | toShortString(), |
124 | parentPlans.stream().map(Object::toString).collect(Collectors.joining("; "))); | 124 | parentPlans.stream().map(Object::toString).collect(Collectors.joining("; "))); |
125 | } | 125 | } |
@@ -141,11 +141,11 @@ public class SubPlan { | |||
141 | } | 141 | } |
142 | 142 | ||
143 | /** | 143 | /** |
144 | * Indicate that a given constraint was found to be automatically satisfied at this point | 144 | * Indicate that a given constraint was found to be automatically satisfied at this point |
145 | * without additional operations. | 145 | * without additional operations. |
146 | * (results are also included in {@link SubPlan#getDeltaEnforcedConstraints()}) | 146 | * (results are also included in {@link SubPlan#getDeltaEnforcedConstraints()}) |
147 | * | 147 | * |
148 | * <p>Warning: not propagated automatically to child plans, | 148 | * <p>Warning: not propagated automatically to child plans, |
149 | * so best to invoke before constructing further SubPlans. </p> | 149 | * so best to invoke before constructing further SubPlans. </p> |
150 | */ | 150 | */ |
151 | public void inferConstraint(PConstraint constraint) { | 151 | public void inferConstraint(PConstraint constraint) { |
@@ -153,22 +153,22 @@ public class SubPlan { | |||
153 | deltaConstraints.add(constraint); | 153 | deltaConstraints.add(constraint); |
154 | allConstraints.add(constraint); | 154 | allConstraints.add(constraint); |
155 | } | 155 | } |
156 | 156 | ||
157 | public PBody getBody() { | 157 | public PBody getBody() { |
158 | return body; | 158 | return body; |
159 | } | 159 | } |
160 | 160 | ||
161 | /** | 161 | /** |
162 | * Variables which are assigned a value at this point | 162 | * Variables which are assigned a value at this point |
163 | * (results are also included in {@link SubPlan#getAllDeducedVariables()}) | 163 | * (results are also included in {@link SubPlan#getAllDeducedVariables()}) |
164 | */ | 164 | */ |
165 | public Set<PVariable> getVisibleVariables() { | 165 | public Set<PVariable> getVisibleVariables() { |
166 | return visibleVariables; | 166 | return visibleVariables; |
167 | } | 167 | } |
168 | /** | 168 | /** |
169 | * Variables which have been assigned a value; | 169 | * Variables which have been assigned a value; |
170 | * includes visible variables (see {@link #getVisibleVariables()}) | 170 | * includes visible variables (see {@link #getVisibleVariables()}) |
171 | * and additionally any variables hidden by a projection (see {@link PProject}). | 171 | * and additionally any variables hidden by a projection (see {@link PProject}). |
172 | */ | 172 | */ |
173 | public Set<PVariable> getAllDeducedVariables() { | 173 | public Set<PVariable> getAllDeducedVariables() { |
174 | return allVariables; | 174 | return allVariables; |
@@ -185,8 +185,8 @@ public class SubPlan { | |||
185 | public POperation getOperation() { | 185 | public POperation getOperation() { |
186 | return operation; | 186 | return operation; |
187 | } | 187 | } |
188 | 188 | ||
189 | 189 | ||
190 | /** | 190 | /** |
191 | * The closure of all type judgments of enforced constraints at this point. | 191 | * The closure of all type judgments of enforced constraints at this point. |
192 | * <p> No subsumption applied. | 192 | * <p> No subsumption applied. |
@@ -201,9 +201,9 @@ public class SubPlan { | |||
201 | } | 201 | } |
202 | return impliedJudgements; | 202 | return impliedJudgements; |
203 | } | 203 | } |
204 | private WeakHashMap<IQueryMetaContext, Set<TypeJudgement>> allImpliedTypeJudgements = new WeakHashMap<IQueryMetaContext, Set<TypeJudgement>>(); | 204 | private WeakHashMap<IQueryMetaContext, Set<TypeJudgement>> allImpliedTypeJudgements = new WeakHashMap<IQueryMetaContext, Set<TypeJudgement>>(); |
205 | 205 | ||
206 | 206 | ||
207 | @Override | 207 | @Override |
208 | public int hashCode() { | 208 | public int hashCode() { |
209 | final int prime = 31; | 209 | final int prime = 31; |
@@ -236,5 +236,5 @@ public class SubPlan { | |||
236 | return true; | 236 | return true; |
237 | } | 237 | } |
238 | 238 | ||
239 | 239 | ||
240 | } | 240 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/SubPlanFactory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/SubPlanFactory.java index d0df5fac..32014ea6 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/SubPlanFactory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/SubPlanFactory.java | |||
@@ -3,13 +3,13 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.planning; | 9 | package tools.refinery.interpreter.matchers.planning; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.planning.operations.POperation; | 11 | import tools.refinery.interpreter.matchers.planning.operations.POperation; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 12 | import tools.refinery.interpreter.matchers.psystem.PBody; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Single entry point for creating subplans. | 15 | * Single entry point for creating subplans. |
@@ -25,9 +25,9 @@ public class SubPlanFactory { | |||
25 | super(); | 25 | super(); |
26 | this.body = body; | 26 | this.body = body; |
27 | } | 27 | } |
28 | 28 | ||
29 | public SubPlan createSubPlan(POperation operation, SubPlan... parentPlans) { | 29 | public SubPlan createSubPlan(POperation operation, SubPlan... parentPlans) { |
30 | return new SubPlan(body, operation, parentPlans); | 30 | return new SubPlan(body, operation, parentPlans); |
31 | } | 31 | } |
32 | 32 | ||
33 | } | 33 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/helpers/BuildHelper.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/helpers/BuildHelper.java index ed5d1cbb..20ecae2a 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/helpers/BuildHelper.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/helpers/BuildHelper.java | |||
@@ -3,32 +3,32 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.planning.helpers; | 10 | package tools.refinery.interpreter.matchers.planning.helpers; |
11 | 11 | ||
12 | import java.util.Collection; | 12 | import java.util.Collection; |
13 | import java.util.HashSet; | 13 | import java.util.HashSet; |
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 17 | import tools.refinery.interpreter.matchers.planning.operations.PProject; |
18 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 18 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
19 | import tools.refinery.viatra.runtime.matchers.planning.QueryProcessingException; | 19 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
20 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 20 | import tools.refinery.interpreter.matchers.planning.QueryProcessingException; |
21 | import tools.refinery.viatra.runtime.matchers.planning.SubPlanFactory; | 21 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
22 | import tools.refinery.viatra.runtime.matchers.planning.operations.PProject; | 22 | import tools.refinery.interpreter.matchers.planning.SubPlanFactory; |
23 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 23 | import tools.refinery.interpreter.matchers.psystem.PBody; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 24 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 25 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
26 | import tools.refinery.viatra.runtime.matchers.psystem.analysis.QueryAnalyzer; | 26 | import tools.refinery.interpreter.matchers.psystem.analysis.QueryAnalyzer; |
27 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 27 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExportedParameter; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * @author Gabor Bergmann | 30 | * @author Gabor Bergmann |
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | public class BuildHelper { | 33 | public class BuildHelper { |
34 | 34 | ||
@@ -42,15 +42,15 @@ public class BuildHelper { | |||
42 | // return buildable.buildBetaNode(primaryPlan, secondaryPlan, joinHelper.getPrimaryMask(), | 42 | // return buildable.buildBetaNode(primaryPlan, secondaryPlan, joinHelper.getPrimaryMask(), |
43 | // joinHelper.getSecondaryMask(), joinHelper.getComplementerMask(), false); | 43 | // joinHelper.getSecondaryMask(), joinHelper.getComplementerMask(), false); |
44 | // } | 44 | // } |
45 | 45 | ||
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Reduces the number of tuples by trimming (existentially quantifying) the set of variables that <ul> | 48 | * Reduces the number of tuples by trimming (existentially quantifying) the set of variables that <ul> |
49 | * <li> are visible in the subplan, | 49 | * <li> are visible in the subplan, |
50 | * <li> are not exported parameters, | 50 | * <li> are not exported parameters, |
51 | * <li> have all their constraints already enforced in the subplan, | 51 | * <li> have all their constraints already enforced in the subplan, |
52 | * </ul> and thus will not be needed anymore. | 52 | * </ul> and thus will not be needed anymore. |
53 | * | 53 | * |
54 | * @param onlyIfNotDetermined if true, no trimming performed unless there is at least one variable that is not functionally determined | 54 | * @param onlyIfNotDetermined if true, no trimming performed unless there is at least one variable that is not functionally determined |
55 | * @return the plan after the trimming (possibly the original) | 55 | * @return the plan after the trimming (possibly the original) |
56 | * @since 1.5 | 56 | * @since 1.5 |
@@ -65,17 +65,17 @@ public class BuildHelper { | |||
65 | canBeTrimmed.add(trimCandidate); | 65 | canBeTrimmed.add(trimCandidate); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | final Set<PVariable> retainedVars = setMinus(variablesInPlan, canBeTrimmed); | 68 | final Set<PVariable> retainedVars = setMinus(variablesInPlan, canBeTrimmed); |
69 | if (!canBeTrimmed.isEmpty() && !(onlyIfNotDetermined && areVariablesDetermined(plan, retainedVars, canBeTrimmed, analyzer, false))) { | 69 | if (!canBeTrimmed.isEmpty() && !(onlyIfNotDetermined && areVariablesDetermined(plan, retainedVars, canBeTrimmed, analyzer, false))) { |
70 | // TODO add smart ordering? | 70 | // TODO add smart ordering? |
71 | plan = planFactory.createSubPlan(new PProject(retainedVars), plan); | 71 | plan = planFactory.createSubPlan(new PProject(retainedVars), plan); |
72 | } | 72 | } |
73 | return plan; | 73 | return plan; |
74 | } | 74 | } |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * @return true iff a set of given variables functionally determine all visible variables in the subplan according to the subplan's constraints | 77 | * @return true iff a set of given variables functionally determine all visible variables in the subplan according to the subplan's constraints |
78 | * @param strict if true, only "hard" dependencies are taken into account that are strictly enforced by the model representation; | 78 | * @param strict if true, only "hard" dependencies are taken into account that are strictly enforced by the model representation; |
79 | * if false, user-provided soft dependencies are included as well, that are anticipated but not guaranteed by the storage mechanism; | 79 | * if false, user-provided soft dependencies are included as well, that are anticipated but not guaranteed by the storage mechanism; |
80 | * use true if superfluous dependencies may taint the correctness of a computation, false if they would merely impact performance | 80 | * use true if superfluous dependencies may taint the correctness of a computation, false if they would merely impact performance |
81 | * @since 1.5 | 81 | * @since 1.5 |
@@ -83,15 +83,15 @@ public class BuildHelper { | |||
83 | public static boolean areAllVariablesDetermined(SubPlan plan, Collection<PVariable> determining, QueryAnalyzer analyzer, boolean strict) { | 83 | public static boolean areAllVariablesDetermined(SubPlan plan, Collection<PVariable> determining, QueryAnalyzer analyzer, boolean strict) { |
84 | return areVariablesDetermined(plan, determining, plan.getVisibleVariables(), analyzer, strict); | 84 | return areVariablesDetermined(plan, determining, plan.getVisibleVariables(), analyzer, strict); |
85 | } | 85 | } |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * @return true iff one set of given variables functionally determine the other set according to the subplan's constraints | 88 | * @return true iff one set of given variables functionally determine the other set according to the subplan's constraints |
89 | * @param strict if true, only "hard" dependencies are taken into account that are strictly enforced by the model representation; | 89 | * @param strict if true, only "hard" dependencies are taken into account that are strictly enforced by the model representation; |
90 | * if false, user-provided soft dependencies are included as well, that are anticipated but not guaranteed by the storage mechanism; | 90 | * if false, user-provided soft dependencies are included as well, that are anticipated but not guaranteed by the storage mechanism; |
91 | * use true if superfluous dependencies may taint the correctness of a computation, false if they would merely impact performance | 91 | * use true if superfluous dependencies may taint the correctness of a computation, false if they would merely impact performance |
92 | * @since 1.5 | 92 | * @since 1.5 |
93 | */ | 93 | */ |
94 | public static boolean areVariablesDetermined(SubPlan plan, Collection<PVariable> determining, Collection<PVariable> determined, | 94 | public static boolean areVariablesDetermined(SubPlan plan, Collection<PVariable> determining, Collection<PVariable> determined, |
95 | QueryAnalyzer analyzer, boolean strict) { | 95 | QueryAnalyzer analyzer, boolean strict) { |
96 | Map<Set<PVariable>, Set<PVariable>> dependencies = analyzer.getFunctionalDependencies(plan.getAllEnforcedConstraints(), strict); | 96 | Map<Set<PVariable>, Set<PVariable>> dependencies = analyzer.getFunctionalDependencies(plan.getAllEnforcedConstraints(), strict); |
97 | final Set<PVariable> closure = FunctionalDependencyHelper.closureOf(determining, dependencies); | 97 | final Set<PVariable> closure = FunctionalDependencyHelper.closureOf(determining, dependencies); |
@@ -104,10 +104,10 @@ public class BuildHelper { | |||
104 | difference.removeAll(b); | 104 | difference.removeAll(b); |
105 | return difference; | 105 | return difference; |
106 | } | 106 | } |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Finds an arbitrary constraint that is not enforced at the given plan. | 109 | * Finds an arbitrary constraint that is not enforced at the given plan. |
110 | * | 110 | * |
111 | * @param pSystem | 111 | * @param pSystem |
112 | * @param plan | 112 | * @param plan |
113 | * @return a PConstraint that is not enforced, if any, or null if all are enforced | 113 | * @return a PConstraint that is not enforced, if any, or null if all are enforced |
@@ -122,11 +122,11 @@ public class BuildHelper { | |||
122 | } | 122 | } |
123 | return null; | 123 | return null; |
124 | } | 124 | } |
125 | 125 | ||
126 | /** | 126 | /** |
127 | * Skips the last few steps, if any, that are projections, so that a custom projection can be added instead. | 127 | * Skips the last few steps, if any, that are projections, so that a custom projection can be added instead. |
128 | * Useful for connecting body final plans into the production node. | 128 | * Useful for connecting body final plans into the production node. |
129 | * | 129 | * |
130 | * @since 2.1 | 130 | * @since 2.1 |
131 | */ | 131 | */ |
132 | public static SubPlan eliminateTrailingProjections(SubPlan plan) { | 132 | public static SubPlan eliminateTrailingProjections(SubPlan plan) { |
@@ -137,10 +137,10 @@ public class BuildHelper { | |||
137 | 137 | ||
138 | /** | 138 | /** |
139 | * Verifies whether all constraints are enforced and exported parameters are present. | 139 | * Verifies whether all constraints are enforced and exported parameters are present. |
140 | * | 140 | * |
141 | * @param pSystem | 141 | * @param pSystem |
142 | * @param plan | 142 | * @param plan |
143 | * @throws ViatraQueryRuntimeException | 143 | * @throws InterpreterRuntimeException |
144 | */ | 144 | */ |
145 | public static void finalCheck(final PBody pSystem, SubPlan plan, IQueryMetaContext context) { | 145 | public static void finalCheck(final PBody pSystem, SubPlan plan, IQueryMetaContext context) { |
146 | PConstraint unenforcedConstraint = getAnyUnenforcedConstraint(pSystem, plan); | 146 | PConstraint unenforcedConstraint = getAnyUnenforcedConstraint(pSystem, plan); |
@@ -160,6 +160,6 @@ public class BuildHelper { | |||
160 | null); | 160 | null); |
161 | } | 161 | } |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | } | 165 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/helpers/FunctionalDependencyHelper.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/helpers/FunctionalDependencyHelper.java index 40835f52..96969fb9 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/helpers/FunctionalDependencyHelper.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/helpers/FunctionalDependencyHelper.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.planning.helpers; | 9 | package tools.refinery.interpreter.matchers.planning.helpers; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -16,26 +16,26 @@ import java.util.Map; | |||
16 | import java.util.Map.Entry; | 16 | import java.util.Map.Entry; |
17 | import java.util.Set; | 17 | import java.util.Set; |
18 | 18 | ||
19 | import tools.refinery.viatra.runtime.matchers.util.Sets; | 19 | import tools.refinery.interpreter.matchers.util.Sets; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Helper utility class for functional dependency analysis. | 22 | * Helper utility class for functional dependency analysis. |
23 | * | 23 | * |
24 | * Throughout this class attribute sets are represented as generic sets and functional dependencies as maps from | 24 | * Throughout this class attribute sets are represented as generic sets and functional dependencies as maps from |
25 | * attribute set (generic sets) to attribute set (generic sets) | 25 | * attribute set (generic sets) to attribute set (generic sets) |
26 | * | 26 | * |
27 | * @author Adam Dudas | 27 | * @author Adam Dudas |
28 | * | 28 | * |
29 | */ | 29 | */ |
30 | public class FunctionalDependencyHelper { | 30 | public class FunctionalDependencyHelper { |
31 | 31 | ||
32 | private FunctionalDependencyHelper() { | 32 | private FunctionalDependencyHelper() { |
33 | // Hiding constructor for utility class | 33 | // Hiding constructor for utility class |
34 | } | 34 | } |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * Get the closure of the specified attribute set relative to the specified functional dependencies. | 37 | * Get the closure of the specified attribute set relative to the specified functional dependencies. |
38 | * | 38 | * |
39 | * @param attributes | 39 | * @param attributes |
40 | * The attributes to get the closure of. | 40 | * The attributes to get the closure of. |
41 | * @param dependencies | 41 | * @param dependencies |
@@ -55,7 +55,7 @@ public class FunctionalDependencyHelper { | |||
55 | 55 | ||
56 | return closureSet; | 56 | return closureSet; |
57 | } | 57 | } |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * @return true if the dependency from the left set to the right set is trivial | 60 | * @return true if the dependency from the left set to the right set is trivial |
61 | * @since 1.5 | 61 | * @since 1.5 |
@@ -63,7 +63,7 @@ public class FunctionalDependencyHelper { | |||
63 | public static <A> boolean isTrivial(Set<A> left, Set<A> right) { | 63 | public static <A> boolean isTrivial(Set<A> left, Set<A> right) { |
64 | return left.containsAll(right); | 64 | return left.containsAll(right); |
65 | } | 65 | } |
66 | 66 | ||
67 | /*** | 67 | /*** |
68 | * Returns the dependency set over attributes in {@link targetAttributes} that are implied by a given source dependency set. | 68 | * Returns the dependency set over attributes in {@link targetAttributes} that are implied by a given source dependency set. |
69 | * <p> Note: exponential in the size of the target attribute set. | 69 | * <p> Note: exponential in the size of the target attribute set. |
@@ -74,12 +74,12 @@ public class FunctionalDependencyHelper { | |||
74 | */ | 74 | */ |
75 | public static <A> Map<Set<A>, Set<A>> projectDependencies(Map<Set<A>, Set<A>> originalDependencies, Set<A> targetAttributes) { | 75 | public static <A> Map<Set<A>, Set<A>> projectDependencies(Map<Set<A>, Set<A>> originalDependencies, Set<A> targetAttributes) { |
76 | // only those attributes are considered as left-hand-side candidates that occur at least once in dependencies | 76 | // only those attributes are considered as left-hand-side candidates that occur at least once in dependencies |
77 | Set<A> leftCandidates = new HashSet<A>(); | 77 | Set<A> leftCandidates = new HashSet<A>(); |
78 | for (Entry<Set<A>, Set<A>> dependency : originalDependencies.entrySet()) { | 78 | for (Entry<Set<A>, Set<A>> dependency : originalDependencies.entrySet()) { |
79 | if (!isTrivial(dependency.getKey(), dependency.getValue())) // only if non-trivial | 79 | if (!isTrivial(dependency.getKey(), dependency.getValue())) // only if non-trivial |
80 | leftCandidates.addAll(Sets.intersection(dependency.getKey(), targetAttributes)); | 80 | leftCandidates.addAll(Sets.intersection(dependency.getKey(), targetAttributes)); |
81 | } | 81 | } |
82 | 82 | ||
83 | // Compute an initial list of nontrivial projected dependencies - it does not have to be minimal yet | 83 | // Compute an initial list of nontrivial projected dependencies - it does not have to be minimal yet |
84 | Map<Set<A>, Set<A>> initialDependencies = new HashMap<Set<A>, Set<A>>(); | 84 | Map<Set<A>, Set<A>> initialDependencies = new HashMap<Set<A>, Set<A>>(); |
85 | for (Set<A> leftSet : Sets.powerSet(leftCandidates)) { | 85 | for (Set<A> leftSet : Sets.powerSet(leftCandidates)) { |
@@ -93,7 +93,7 @@ public class FunctionalDependencyHelper { | |||
93 | if (! constants.isEmpty()) { | 93 | if (! constants.isEmpty()) { |
94 | initialDependencies.put(Collections.<A>emptySet(), constants); | 94 | initialDependencies.put(Collections.<A>emptySet(), constants); |
95 | } | 95 | } |
96 | 96 | ||
97 | // Omit those dependencies where the LHS has superfluous attributes | 97 | // Omit those dependencies where the LHS has superfluous attributes |
98 | Map<Set<A>, Set<A>> solidDependencies = new HashMap<Set<A>, Set<A>>(); | 98 | Map<Set<A>, Set<A>> solidDependencies = new HashMap<Set<A>, Set<A>>(); |
99 | for (Entry<Set<A>, Set<A>> dependency : initialDependencies.entrySet()) { | 99 | for (Entry<Set<A>, Set<A>> dependency : initialDependencies.entrySet()) { |
@@ -115,13 +115,13 @@ public class FunctionalDependencyHelper { | |||
115 | solidDependencies.put(leftSet, rightSet); | 115 | solidDependencies.put(leftSet, rightSet); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | // TODO perform proper minimization, | 119 | // TODO perform proper minimization, |
120 | // see e.g. page 45 in http://www.cs.ubc.ca/~hkhosrav/db/slides/03.design%20theory.pdf | 120 | // see e.g. page 45 in http://www.cs.ubc.ca/~hkhosrav/db/slides/03.design%20theory.pdf |
121 | 121 | ||
122 | return Collections.unmodifiableMap(solidDependencies); | 122 | return Collections.unmodifiableMap(solidDependencies); |
123 | } | 123 | } |
124 | 124 | ||
125 | /** | 125 | /** |
126 | * Adds a given dependency to a mutable accumulator. | 126 | * Adds a given dependency to a mutable accumulator. |
127 | * @since 1.5 | 127 | * @since 1.5 |
@@ -129,8 +129,8 @@ public class FunctionalDependencyHelper { | |||
129 | public static <A> void includeDependency(Map<Set<A>, Set<A>> accumulator, Set<A> left, Set<A> right) { | 129 | public static <A> void includeDependency(Map<Set<A>, Set<A>> accumulator, Set<A> left, Set<A> right) { |
130 | Set<A> accumulatorRights = accumulator.computeIfAbsent(left, l -> new HashSet<>()); | 130 | Set<A> accumulatorRights = accumulator.computeIfAbsent(left, l -> new HashSet<>()); |
131 | accumulatorRights.addAll(right); | 131 | accumulatorRights.addAll(right); |
132 | } | 132 | } |
133 | 133 | ||
134 | /** | 134 | /** |
135 | * Adds all given dependencies to a mutable accumulator. | 135 | * Adds all given dependencies to a mutable accumulator. |
136 | * @since 1.5 | 136 | * @since 1.5 |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/helpers/StatisticsHelper.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/helpers/StatisticsHelper.java index b4f848a7..edf67676 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/helpers/StatisticsHelper.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/helpers/StatisticsHelper.java | |||
@@ -3,44 +3,44 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.planning.helpers; | 9 | package tools.refinery.interpreter.matchers.planning.helpers; |
10 | 10 | ||
11 | import java.util.Optional; | 11 | import java.util.Optional; |
12 | import java.util.function.BiFunction; | 12 | import java.util.function.BiFunction; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 14 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
15 | import tools.refinery.viatra.runtime.matchers.util.Accuracy; | 15 | import tools.refinery.interpreter.matchers.util.Accuracy; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * Helpers dealing with optionally present statistics information | 18 | * Helpers dealing with optionally present statistics information |
19 | * | 19 | * |
20 | * @author Gabor Bergmann | 20 | * @author Gabor Bergmann |
21 | * @since 2.1 | 21 | * @since 2.1 |
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | public class StatisticsHelper { | 24 | public class StatisticsHelper { |
25 | 25 | ||
26 | private StatisticsHelper() { | 26 | private StatisticsHelper() { |
27 | // Hidden utility class constructor | 27 | // Hidden utility class constructor |
28 | } | 28 | } |
29 | 29 | ||
30 | public static Optional<Double> estimateAverageBucketSize(TupleMask groupMask, Accuracy requiredAccuracy, | 30 | public static Optional<Double> estimateAverageBucketSize(TupleMask groupMask, Accuracy requiredAccuracy, |
31 | BiFunction<TupleMask, Accuracy, Optional<Long>> estimateCardinality) | 31 | BiFunction<TupleMask, Accuracy, Optional<Long>> estimateCardinality) |
32 | { | 32 | { |
33 | if (groupMask.isIdentity()) return Optional.of(1.0); | 33 | if (groupMask.isIdentity()) return Optional.of(1.0); |
34 | 34 | ||
35 | Accuracy numeratorAccuracy = requiredAccuracy; | 35 | Accuracy numeratorAccuracy = requiredAccuracy; |
36 | Accuracy denominatorAccuracy = requiredAccuracy.reciprocal(); | 36 | Accuracy denominatorAccuracy = requiredAccuracy.reciprocal(); |
37 | TupleMask identityMask = TupleMask.identity(groupMask.sourceWidth); | 37 | TupleMask identityMask = TupleMask.identity(groupMask.sourceWidth); |
38 | 38 | ||
39 | Optional<Long> totalCountEstimate = estimateCardinality.apply(identityMask, numeratorAccuracy); | 39 | Optional<Long> totalCountEstimate = estimateCardinality.apply(identityMask, numeratorAccuracy); |
40 | Optional<Long> bucketCountEstimate = estimateCardinality.apply(groupMask, denominatorAccuracy); | 40 | Optional<Long> bucketCountEstimate = estimateCardinality.apply(groupMask, denominatorAccuracy); |
41 | 41 | ||
42 | return totalCountEstimate.flatMap(matchCount -> | 42 | return totalCountEstimate.flatMap(matchCount -> |
43 | bucketCountEstimate.map(bucketCount -> | 43 | bucketCountEstimate.map(bucketCount -> |
44 | bucketCount == 0L ? 0L : ((double) matchCount) / bucketCount | 44 | bucketCount == 0L ? 0L : ((double) matchCount) / bucketCount |
45 | )); | 45 | )); |
46 | } | 46 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/helpers/TypeHelper.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/helpers/TypeHelper.java index 926a591f..c9e9a8b2 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/helpers/TypeHelper.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/helpers/TypeHelper.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.planning.helpers; | 10 | package tools.refinery.interpreter.matchers.planning.helpers; |
11 | 11 | ||
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.HashMap; | 13 | import java.util.HashMap; |
@@ -19,19 +19,19 @@ import java.util.Queue; | |||
19 | import java.util.Set; | 19 | import java.util.Set; |
20 | import java.util.stream.Collectors; | 20 | import java.util.stream.Collectors; |
21 | 21 | ||
22 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 22 | import tools.refinery.interpreter.matchers.context.IInputKey; |
23 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 23 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.ITypeInfoProviderConstraint; | 24 | import tools.refinery.interpreter.matchers.psystem.ITypeInfoProviderConstraint; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 25 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
26 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 26 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
27 | import tools.refinery.viatra.runtime.matchers.psystem.TypeJudgement; | 27 | import tools.refinery.interpreter.matchers.psystem.TypeJudgement; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * @author Gabor Bergmann | 30 | * @author Gabor Bergmann |
31 | * @author Tamas Szabo | 31 | * @author Tamas Szabo |
32 | */ | 32 | */ |
33 | public class TypeHelper { | 33 | public class TypeHelper { |
34 | 34 | ||
35 | private TypeHelper() { | 35 | private TypeHelper() { |
36 | // Hiding constructor for utility class | 36 | // Hiding constructor for utility class |
37 | } | 37 | } |
@@ -40,7 +40,7 @@ public class TypeHelper { | |||
40 | * Collects the type constraints for the specified collection of variables. The type constraints consist of the | 40 | * Collects the type constraints for the specified collection of variables. The type constraints consist of the |
41 | * constraints directly enforced on the variable itself, plus all of those that the given variable is unified with | 41 | * constraints directly enforced on the variable itself, plus all of those that the given variable is unified with |
42 | * through equalities. | 42 | * through equalities. |
43 | * | 43 | * |
44 | * @param variables | 44 | * @param variables |
45 | * the variables in question | 45 | * the variables in question |
46 | * @param constraints | 46 | * @param constraints |
@@ -60,11 +60,11 @@ public class TypeHelper { | |||
60 | * Collects the type constraints for the specified collection of variables. The type constraints consist of the | 60 | * Collects the type constraints for the specified collection of variables. The type constraints consist of the |
61 | * constraints directly enforced on the variable itself, plus all of those that the given variable is unified with | 61 | * constraints directly enforced on the variable itself, plus all of those that the given variable is unified with |
62 | * through equalities. | 62 | * through equalities. |
63 | * | 63 | * |
64 | * The method accepts a type map which is the result of the basic type inference from the | 64 | * The method accepts a type map which is the result of the basic type inference from the |
65 | * {@link TypeHelper.inferUnaryTypes} method. The purpose of this method is that the type map can be reused across | 65 | * {@link TypeHelper.inferUnaryTypes} method. The purpose of this method is that the type map can be reused across |
66 | * several calls to this method. | 66 | * several calls to this method. |
67 | * | 67 | * |
68 | * @param variables | 68 | * @param variables |
69 | * the variables in question | 69 | * the variables in question |
70 | * @param typeMap | 70 | * @param typeMap |
@@ -99,9 +99,9 @@ public class TypeHelper { | |||
99 | 99 | ||
100 | /** | 100 | /** |
101 | * Infers unary type information for variables, based on the given constraints. | 101 | * Infers unary type information for variables, based on the given constraints. |
102 | * | 102 | * |
103 | * Subsumptions are not taken into account. | 103 | * Subsumptions are not taken into account. |
104 | * | 104 | * |
105 | * @param constraints | 105 | * @param constraints |
106 | * the set of constraints to extract type info from | 106 | * the set of constraints to extract type info from |
107 | */ | 107 | */ |
@@ -137,7 +137,7 @@ public class TypeHelper { | |||
137 | 137 | ||
138 | /** | 138 | /** |
139 | * Calculates the closure of a set of type judgements, with respect to supertyping. | 139 | * Calculates the closure of a set of type judgements, with respect to supertyping. |
140 | * | 140 | * |
141 | * @return the set of all type judgements in typesToClose and all their direct and indirect supertypes | 141 | * @return the set of all type judgements in typesToClose and all their direct and indirect supertypes |
142 | */ | 142 | */ |
143 | public static Set<TypeJudgement> typeClosure(Set<TypeJudgement> typesToClose, IQueryMetaContext context) { | 143 | public static Set<TypeJudgement> typeClosure(Set<TypeJudgement> typesToClose, IQueryMetaContext context) { |
@@ -149,16 +149,16 @@ public class TypeHelper { | |||
149 | * calculated before for a given base set, but not for a separate delta set. | 149 | * calculated before for a given base set, but not for a separate delta set. |
150 | * <p> | 150 | * <p> |
151 | * Precondition: the set (typesToClose MINUS delta) is already closed w.r.t. supertyping. | 151 | * Precondition: the set (typesToClose MINUS delta) is already closed w.r.t. supertyping. |
152 | * | 152 | * |
153 | * @return the set of all type judgements in typesToClose and all their direct and indirect supertypes | 153 | * @return the set of all type judgements in typesToClose and all their direct and indirect supertypes |
154 | * @since 1.6 | 154 | * @since 1.6 |
155 | */ | 155 | */ |
156 | public static Set<TypeJudgement> typeClosure(Set<TypeJudgement> preclosedBaseSet, Set<TypeJudgement> delta, | 156 | public static Set<TypeJudgement> typeClosure(Set<TypeJudgement> preclosedBaseSet, Set<TypeJudgement> delta, |
157 | IQueryMetaContext context) { | 157 | IQueryMetaContext context) { |
158 | Queue<TypeJudgement> queue = delta.stream().filter(input -> !preclosedBaseSet.contains(input)).collect(Collectors.toCollection(LinkedList::new)); | 158 | Queue<TypeJudgement> queue = delta.stream().filter(input -> !preclosedBaseSet.contains(input)).collect(Collectors.toCollection(LinkedList::new)); |
159 | if (queue.isEmpty()) | 159 | if (queue.isEmpty()) |
160 | return preclosedBaseSet; | 160 | return preclosedBaseSet; |
161 | 161 | ||
162 | Set<TypeJudgement> closure = new HashSet<TypeJudgement>(preclosedBaseSet); | 162 | Set<TypeJudgement> closure = new HashSet<TypeJudgement>(preclosedBaseSet); |
163 | 163 | ||
164 | Map<TypeJudgement, Set<TypeJudgement>> conditionalImplications = new HashMap<>(); | 164 | Map<TypeJudgement, Set<TypeJudgement>> conditionalImplications = new HashMap<>(); |
@@ -199,7 +199,7 @@ public class TypeHelper { | |||
199 | 199 | ||
200 | /** | 200 | /** |
201 | * Calculates a remainder set of types from a larger set, that are not subsumed by a given set of subsuming types. | 201 | * Calculates a remainder set of types from a larger set, that are not subsumed by a given set of subsuming types. |
202 | * | 202 | * |
203 | * @param subsumableTypes | 203 | * @param subsumableTypes |
204 | * a set of types from which some may be implied by the subsuming types | 204 | * a set of types from which some may be implied by the subsuming types |
205 | * @param subsumingTypes | 205 | * @param subsumingTypes |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PApply.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PApply.java index 2c285b54..dd467598 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PApply.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PApply.java | |||
@@ -3,31 +3,31 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.planning.operations; | 9 | package tools.refinery.interpreter.matchers.planning.operations; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 14 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 15 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
16 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 16 | import tools.refinery.interpreter.matchers.util.Preconditions; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Represents a constraint application on a single parent SubPlan. | 19 | * Represents a constraint application on a single parent SubPlan. |
20 | * <p> Either a "selection" filter operation according to a deferred PConstraint (or transform in case of eval/aggregate), or | 20 | * <p> Either a "selection" filter operation according to a deferred PConstraint (or transform in case of eval/aggregate), or |
21 | * alternatively a shorthand for PJoin + a PEnumerate on the right input for an enumerable PConstraint. | 21 | * alternatively a shorthand for PJoin + a PEnumerate on the right input for an enumerable PConstraint. |
22 | * | 22 | * |
23 | * <p> <b>WARNING</b>: if there are coinciding variables in the variable tuple of the enumerable constraint, | 23 | * <p> <b>WARNING</b>: if there are coinciding variables in the variable tuple of the enumerable constraint, |
24 | * it is the responsibility of the compiler to check them for equality. | 24 | * it is the responsibility of the compiler to check them for equality. |
25 | * | 25 | * |
26 | * @author Bergmann Gabor | 26 | * @author Bergmann Gabor |
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | public class PApply extends POperation { | 29 | public class PApply extends POperation { |
30 | 30 | ||
31 | private PConstraint pConstraint; | 31 | private PConstraint pConstraint; |
32 | 32 | ||
33 | public PApply(PConstraint pConstraint) { | 33 | public PApply(PConstraint pConstraint) { |
@@ -42,28 +42,28 @@ public class PApply extends POperation { | |||
42 | public String getShortName() { | 42 | public String getShortName() { |
43 | return String.format("APPLY_%s", pConstraint.toString()); | 43 | return String.format("APPLY_%s", pConstraint.toString()); |
44 | } | 44 | } |
45 | 45 | ||
46 | @Override | 46 | @Override |
47 | public Set<? extends PConstraint> getDeltaConstraints() { | 47 | public Set<? extends PConstraint> getDeltaConstraints() { |
48 | return Collections.singleton(pConstraint); | 48 | return Collections.singleton(pConstraint); |
49 | } | 49 | } |
50 | 50 | ||
51 | @Override | 51 | @Override |
52 | public int numParentSubPlans() { | 52 | public int numParentSubPlans() { |
53 | return 1; | 53 | return 1; |
54 | } | 54 | } |
55 | 55 | ||
56 | @Override | 56 | @Override |
57 | public void checkConsistency(SubPlan subPlan) { | 57 | public void checkConsistency(SubPlan subPlan) { |
58 | super.checkConsistency(subPlan); | 58 | super.checkConsistency(subPlan); |
59 | for (SubPlan parentPlan : subPlan.getParentPlans()) | 59 | for (SubPlan parentPlan : subPlan.getParentPlans()) |
60 | Preconditions.checkArgument(!parentPlan.getAllEnforcedConstraints().contains(pConstraint), | 60 | Preconditions.checkArgument(!parentPlan.getAllEnforcedConstraints().contains(pConstraint), |
61 | "Double-checking constraint %s", pConstraint); | 61 | "Double-checking constraint %s", pConstraint); |
62 | // TODO obtain context? | 62 | // TODO obtain context? |
63 | //if (pConstraint instanceof DeferredPConstraint) | 63 | //if (pConstraint instanceof DeferredPConstraint) |
64 | // Preconditions.checkArgument(((DeferredPConstraint) pConstraint).isReadyAt(subPlan, context)) | 64 | // Preconditions.checkArgument(((DeferredPConstraint) pConstraint).isReadyAt(subPlan, context)) |
65 | } | 65 | } |
66 | 66 | ||
67 | @Override | 67 | @Override |
68 | public int hashCode() { | 68 | public int hashCode() { |
69 | final int prime = 31; | 69 | final int prime = 31; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PEnumerate.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PEnumerate.java index a975d50c..f9baabd7 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PEnumerate.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PEnumerate.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.planning.operations; | 9 | package tools.refinery.interpreter.matchers.planning.operations; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.psystem.EnumerablePConstraint; | 14 | import tools.refinery.interpreter.matchers.psystem.EnumerablePConstraint; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 15 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * Represents a base relation defined by the instance set of an enumerable PConstraint; there are no parent SubPlans. | 18 | * Represents a base relation defined by the instance set of an enumerable PConstraint; there are no parent SubPlans. |
19 | * | 19 | * |
20 | * <p> <b>WARNING</b>: if there are coinciding variables in the variable tuple of the enumerable constraint, | 20 | * <p> <b>WARNING</b>: if there are coinciding variables in the variable tuple of the enumerable constraint, |
21 | * it is the responsibility of the compiler to check them for equality. | 21 | * it is the responsibility of the compiler to check them for equality. |
22 | * @author Bergmann Gabor | 22 | * @author Bergmann Gabor |
23 | * | 23 | * |
@@ -25,7 +25,7 @@ import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | |||
25 | public class PEnumerate extends POperation { | 25 | public class PEnumerate extends POperation { |
26 | 26 | ||
27 | EnumerablePConstraint enumerablePConstraint; | 27 | EnumerablePConstraint enumerablePConstraint; |
28 | 28 | ||
29 | public PEnumerate(EnumerablePConstraint enumerablePConstraint) { | 29 | public PEnumerate(EnumerablePConstraint enumerablePConstraint) { |
30 | super(); | 30 | super(); |
31 | this.enumerablePConstraint = enumerablePConstraint; | 31 | this.enumerablePConstraint = enumerablePConstraint; |
@@ -72,5 +72,5 @@ public class PEnumerate extends POperation { | |||
72 | return false; | 72 | return false; |
73 | return true; | 73 | return true; |
74 | } | 74 | } |
75 | 75 | ||
76 | } | 76 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PJoin.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PJoin.java index 10e0a85a..35a4ffac 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PJoin.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PJoin.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.planning.operations; | 9 | package tools.refinery.interpreter.matchers.planning.operations; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 14 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Represents a natural join of two parent SubPlans. | 17 | * Represents a natural join of two parent SubPlans. |
@@ -19,7 +19,7 @@ import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | public class PJoin extends POperation { | 21 | public class PJoin extends POperation { |
22 | 22 | ||
23 | // // TODO leave here? is this a problem in equivalnece checking? | 23 | // // TODO leave here? is this a problem in equivalnece checking? |
24 | // private Set<PVariable> onVariables; | 24 | // private Set<PVariable> onVariables; |
25 | 25 | ||
@@ -44,7 +44,7 @@ public class PJoin extends POperation { | |||
44 | public String getShortName() { | 44 | public String getShortName() { |
45 | return "JOIN"; //String.format("JOIN_{%s}", Joiner.on(",").join(onVariables)); | 45 | return "JOIN"; //String.format("JOIN_{%s}", Joiner.on(",").join(onVariables)); |
46 | } | 46 | } |
47 | 47 | ||
48 | @Override | 48 | @Override |
49 | public int hashCode() { | 49 | public int hashCode() { |
50 | return getClass().hashCode(); | 50 | return getClass().hashCode(); |
@@ -59,6 +59,6 @@ public class PJoin extends POperation { | |||
59 | return false; | 59 | return false; |
60 | return true; | 60 | return true; |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | } | 64 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/POperation.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/POperation.java index e71cf217..b1cc52f4 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/POperation.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/POperation.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.planning.operations; | 9 | package tools.refinery.interpreter.matchers.planning.operations; |
10 | 10 | ||
11 | import java.util.Set; | 11 | import java.util.Set; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 13 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 14 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
15 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 15 | import tools.refinery.interpreter.matchers.util.Preconditions; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * Abstract superclass for representing a high-level query evaluation operation. | 18 | * Abstract superclass for representing a high-level query evaluation operation. |
19 | * | 19 | * |
20 | * <p> Subclasses correspond to various POperations modeled after relational algebra. | 20 | * <p> Subclasses correspond to various POperations modeled after relational algebra. |
21 | * | 21 | * |
22 | * @author Bergmann Gabor | 22 | * @author Bergmann Gabor |
23 | * | 23 | * |
24 | */ | 24 | */ |
@@ -28,14 +28,14 @@ public abstract class POperation { | |||
28 | * Newly enforced constraints | 28 | * Newly enforced constraints |
29 | */ | 29 | */ |
30 | public abstract Set<? extends PConstraint> getDeltaConstraints(); | 30 | public abstract Set<? extends PConstraint> getDeltaConstraints(); |
31 | 31 | ||
32 | public abstract String getShortName(); | 32 | public abstract String getShortName(); |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * @return the number of SubPlans that must be specified as parents | 35 | * @return the number of SubPlans that must be specified as parents |
36 | */ | 36 | */ |
37 | public abstract int numParentSubPlans(); | 37 | public abstract int numParentSubPlans(); |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Checks whether this constraint can be properly applied at the given SubPlan. | 40 | * Checks whether this constraint can be properly applied at the given SubPlan. |
41 | */ | 41 | */ |
@@ -43,7 +43,7 @@ public abstract class POperation { | |||
43 | Preconditions.checkArgument(this == subPlan.getOperation(), "POperation misalignment"); | 43 | Preconditions.checkArgument(this == subPlan.getOperation(), "POperation misalignment"); |
44 | Preconditions.checkArgument(subPlan.getParentPlans().size() == numParentSubPlans(), "Incorrect number of parent SubPlans"); | 44 | Preconditions.checkArgument(subPlan.getParentPlans().size() == numParentSubPlans(), "Incorrect number of parent SubPlans"); |
45 | } | 45 | } |
46 | 46 | ||
47 | @Override | 47 | @Override |
48 | public String toString() { | 48 | public String toString() { |
49 | return getShortName(); | 49 | return getShortName(); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PProject.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PProject.java index d0539b2c..adf73344 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PProject.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PProject.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.planning.operations; | 9 | package tools.refinery.interpreter.matchers.planning.operations; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -14,15 +14,15 @@ import java.util.List; | |||
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | import java.util.stream.Collectors; | 15 | import java.util.stream.Collectors; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 17 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 18 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 19 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
20 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 20 | import tools.refinery.interpreter.matchers.util.Preconditions; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * Represents a projection of a single parent SubPlan onto a limited set of variables. | 23 | * Represents a projection of a single parent SubPlan onto a limited set of variables. |
24 | * <p> May optionally prescribe an ordering of variables (List, as opposed to Set). | 24 | * <p> May optionally prescribe an ordering of variables (List, as opposed to Set). |
25 | * | 25 | * |
26 | * @author Bergmann Gabor | 26 | * @author Bergmann Gabor |
27 | * | 27 | * |
28 | */ | 28 | */ |
@@ -30,8 +30,8 @@ public class PProject extends POperation { | |||
30 | 30 | ||
31 | private Collection<PVariable> toVariables; | 31 | private Collection<PVariable> toVariables; |
32 | private boolean ordered; | 32 | private boolean ordered; |
33 | 33 | ||
34 | 34 | ||
35 | public PProject(Set<PVariable> toVariables) { | 35 | public PProject(Set<PVariable> toVariables) { |
36 | super(); | 36 | super(); |
37 | this.toVariables = toVariables; | 37 | this.toVariables = toVariables; |
@@ -42,14 +42,14 @@ public class PProject extends POperation { | |||
42 | this.toVariables = toVariables; | 42 | this.toVariables = toVariables; |
43 | this.ordered = true; | 43 | this.ordered = true; |
44 | } | 44 | } |
45 | 45 | ||
46 | public Collection<PVariable> getToVariables() { | 46 | public Collection<PVariable> getToVariables() { |
47 | return toVariables; | 47 | return toVariables; |
48 | } | 48 | } |
49 | public boolean isOrdered() { | 49 | public boolean isOrdered() { |
50 | return ordered; | 50 | return ordered; |
51 | } | 51 | } |
52 | 52 | ||
53 | @Override | 53 | @Override |
54 | public Set<? extends PConstraint> getDeltaConstraints() { | 54 | public Set<? extends PConstraint> getDeltaConstraints() { |
55 | return Collections.emptySet(); | 55 | return Collections.emptySet(); |
@@ -62,8 +62,8 @@ public class PProject extends POperation { | |||
62 | public void checkConsistency(SubPlan subPlan) { | 62 | public void checkConsistency(SubPlan subPlan) { |
63 | super.checkConsistency(subPlan); | 63 | super.checkConsistency(subPlan); |
64 | final SubPlan parentPlan = subPlan.getParentPlans().get(0); | 64 | final SubPlan parentPlan = subPlan.getParentPlans().get(0); |
65 | 65 | ||
66 | Preconditions.checkArgument(parentPlan.getVisibleVariables().containsAll(toVariables), | 66 | Preconditions.checkArgument(parentPlan.getVisibleVariables().containsAll(toVariables), |
67 | () -> toVariables.stream() | 67 | () -> toVariables.stream() |
68 | .filter(input -> !parentPlan.getVisibleVariables().contains(input)).map(PVariable::getName) | 68 | .filter(input -> !parentPlan.getVisibleVariables().contains(input)).map(PVariable::getName) |
69 | .collect(Collectors.joining(",", "Variables missing from project: ", ""))); | 69 | .collect(Collectors.joining(",", "Variables missing from project: ", ""))); |
@@ -71,10 +71,10 @@ public class PProject extends POperation { | |||
71 | 71 | ||
72 | @Override | 72 | @Override |
73 | public String getShortName() { | 73 | public String getShortName() { |
74 | return String.format("PROJECT%s_{%s}", ordered? "!" : "", | 74 | return String.format("PROJECT%s_{%s}", ordered? "!" : "", |
75 | toVariables.stream().map(PVariable::getName).collect(Collectors.joining(","))); | 75 | toVariables.stream().map(PVariable::getName).collect(Collectors.joining(","))); |
76 | } | 76 | } |
77 | 77 | ||
78 | @Override | 78 | @Override |
79 | public int hashCode() { | 79 | public int hashCode() { |
80 | final int prime = 31; | 80 | final int prime = 31; |
@@ -104,6 +104,6 @@ public class PProject extends POperation { | |||
104 | } | 104 | } |
105 | 105 | ||
106 | 106 | ||
107 | 107 | ||
108 | 108 | ||
109 | } | 109 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PStart.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PStart.java index 9e6ea10e..d3befbc5 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/planning/operations/PStart.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/planning/operations/PStart.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.planning.operations; | 9 | package tools.refinery.interpreter.matchers.planning.operations; |
10 | 10 | ||
11 | import java.util.Arrays; | 11 | import java.util.Arrays; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -14,24 +14,24 @@ import java.util.HashSet; | |||
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | import java.util.stream.Collectors; | 15 | import java.util.stream.Collectors; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 17 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 18 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * No constraints, and no parent SubPlan, just a (possibly empty) set of a priori known (input) variables. Satisfied by a single tuple. | 21 | * No constraints, and no parent SubPlan, just a (possibly empty) set of a priori known (input) variables. Satisfied by a single tuple. |
22 | * | 22 | * |
23 | * <p> Can also be used without a priori variables, | 23 | * <p> Can also be used without a priori variables, |
24 | * e.g. as a "virtual parent" in extreme cases, | 24 | * e.g. as a "virtual parent" in extreme cases, |
25 | * such as <code>pattern foo(Bar) = {Bar = eval (3*4)} </code> | 25 | * such as <code>pattern foo(Bar) = {Bar = eval (3*4)} </code> |
26 | * | 26 | * |
27 | * @author Bergmann Gabor | 27 | * @author Bergmann Gabor |
28 | * | 28 | * |
29 | */ | 29 | */ |
30 | public class PStart extends POperation { | 30 | public class PStart extends POperation { |
31 | 31 | ||
32 | private Set<PVariable> aPrioriVariables; | 32 | private Set<PVariable> aPrioriVariables; |
33 | 33 | ||
34 | 34 | ||
35 | public PStart(Set<PVariable> aPrioriVariables) { | 35 | public PStart(Set<PVariable> aPrioriVariables) { |
36 | super(); | 36 | super(); |
37 | this.aPrioriVariables = aPrioriVariables; | 37 | this.aPrioriVariables = aPrioriVariables; |
@@ -85,6 +85,6 @@ public class PStart extends POperation { | |||
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | } | 90 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/BasePConstraint.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/BasePConstraint.java index eda4aa25..9e18355b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/BasePConstraint.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/BasePConstraint.java | |||
@@ -7,9 +7,9 @@ | |||
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem; | 10 | package tools.refinery.interpreter.matchers.psystem; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 12 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
13 | 13 | ||
14 | import java.util.Collections; | 14 | import java.util.Collections; |
15 | import java.util.HashSet; | 15 | import java.util.HashSet; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/DeferredPConstraint.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/DeferredPConstraint.java index d2bf088c..90e853f8 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/DeferredPConstraint.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/DeferredPConstraint.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem; | 10 | package tools.refinery.interpreter.matchers.psystem; |
11 | 11 | ||
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 14 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
15 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 15 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * Any constraint that can only be checked on certain SubPlans (e.g. those plans that already contain some variables). | 18 | * Any constraint that can only be checked on certain SubPlans (e.g. those plans that already contain some variables). |
19 | * | 19 | * |
20 | * @author Gabor Bergmann | 20 | * @author Gabor Bergmann |
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | public abstract class DeferredPConstraint extends BasePConstraint { | 23 | public abstract class DeferredPConstraint extends BasePConstraint { |
24 | 24 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/EnumerablePConstraint.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/EnumerablePConstraint.java index 9129aa47..a43fa72a 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/EnumerablePConstraint.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/EnumerablePConstraint.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem; | 10 | package tools.refinery.interpreter.matchers.psystem; |
11 | 11 | ||
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 14 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * A constraint for which all satisfying tuples of variable values can be enumerated at any point during run-time. | 17 | * A constraint for which all satisfying tuples of variable values can be enumerated at any point during run-time. |
18 | * | 18 | * |
19 | * @author Gabor Bergmann | 19 | * @author Gabor Bergmann |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | public abstract class EnumerablePConstraint extends BasePConstraint { | 22 | public abstract class EnumerablePConstraint extends BasePConstraint { |
23 | protected Tuple variablesTuple; | 23 | protected Tuple variablesTuple; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IExpressionEvaluator.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IExpressionEvaluator.java index 686999f7..197a4dfa 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IExpressionEvaluator.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IExpressionEvaluator.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem; | 9 | package tools.refinery.interpreter.matchers.psystem; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * An expression evaluator is used to execute arbitrary Java code during pattern matching. In order to include the | 12 | * An expression evaluator is used to execute arbitrary Java code during pattern matching. In order to include the |
13 | * evaluation in the planning seemlessly it is expected from the evaluator implementors to report all used PVariables by | 13 | * evaluation in the planning seemlessly it is expected from the evaluator implementors to report all used PVariables by |
14 | * name. | 14 | * name. |
15 | * | 15 | * |
16 | * @author Zoltan Ujhelyi | 16 | * @author Zoltan Ujhelyi |
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | public interface IExpressionEvaluator { | 19 | public interface IExpressionEvaluator { |
20 | 20 | ||
@@ -30,7 +30,7 @@ public interface IExpressionEvaluator { | |||
30 | 30 | ||
31 | /** | 31 | /** |
32 | * The expression evaluator code | 32 | * The expression evaluator code |
33 | * | 33 | * |
34 | * @param provider | 34 | * @param provider |
35 | * the value provider is an engine-specific way of reading internal variable tuples to evaluate the | 35 | * the value provider is an engine-specific way of reading internal variable tuples to evaluate the |
36 | * expression with | 36 | * expression with |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IMultiQueryReference.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IMultiQueryReference.java index 8f647c64..fbce20ed 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IMultiQueryReference.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IMultiQueryReference.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem; | 9 | package tools.refinery.interpreter.matchers.psystem; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 13 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * A {@link PConstraint} that implements this interface refers to a list of PQueries. | 16 | * A {@link PConstraint} that implements this interface refers to a list of PQueries. |
17 | * | 17 | * |
18 | * @author Tamas Szabo | 18 | * @author Tamas Szabo |
19 | * @since 2.8 | 19 | * @since 2.8 |
20 | * | 20 | * |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IQueryReference.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IQueryReference.java index 9ee05b39..cf0ac39b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IQueryReference.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IQueryReference.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem; | 9 | package tools.refinery.interpreter.matchers.psystem; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.List; | 12 | import java.util.List; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 14 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * A {@link PConstraint} that implements this interface refers to a {@link PQuery}. | 17 | * A {@link PConstraint} that implements this interface refers to a {@link PQuery}. |
18 | * | 18 | * |
19 | * @author Zoltan Ujhelyi | 19 | * @author Zoltan Ujhelyi |
20 | * | 20 | * |
21 | */ | 21 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IRelationEvaluator.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IRelationEvaluator.java index e4c396d8..1db05fd2 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IRelationEvaluator.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IRelationEvaluator.java | |||
@@ -3,20 +3,20 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem; | 9 | package tools.refinery.interpreter.matchers.psystem; |
10 | 10 | ||
11 | import java.util.List; | 11 | import java.util.List; |
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 14 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Implementations of this interface take an arbitrary number of input relations with their contents and compute the | 17 | * Implementations of this interface take an arbitrary number of input relations with their contents and compute the |
18 | * tuples of a single output relation. | 18 | * tuples of a single output relation. |
19 | * | 19 | * |
20 | * @author Tamas Szabo | 20 | * @author Tamas Szabo |
21 | * @since 2.8 | 21 | * @since 2.8 |
22 | * | 22 | * |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/ITypeConstraint.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/ITypeConstraint.java index b72035a8..cc04d9d1 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/ITypeConstraint.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/ITypeConstraint.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem; | 9 | package tools.refinery.interpreter.matchers.psystem; |
10 | 10 | ||
11 | import java.util.HashMap; | 11 | import java.util.HashMap; |
12 | import java.util.HashSet; | 12 | import java.util.HashSet; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.Map.Entry; | 14 | import java.util.Map.Entry; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 16 | import tools.refinery.interpreter.matchers.context.IInputKey; |
17 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 17 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | 19 | ||
20 | import java.util.Set; | 20 | import java.util.Set; |
21 | 21 | ||
@@ -27,24 +27,24 @@ import java.util.Set; | |||
27 | public interface ITypeConstraint extends ITypeInfoProviderConstraint { | 27 | public interface ITypeConstraint extends ITypeInfoProviderConstraint { |
28 | 28 | ||
29 | public abstract TypeJudgement getEquivalentJudgement(); | 29 | public abstract TypeJudgement getEquivalentJudgement(); |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Static internal utility class for implementations of {@link ITypeConstraint}s. | 32 | * Static internal utility class for implementations of {@link ITypeConstraint}s. |
33 | * @author Bergmann Gabor | 33 | * @author Bergmann Gabor |
34 | */ | 34 | */ |
35 | public static class TypeConstraintUtil { | 35 | public static class TypeConstraintUtil { |
36 | 36 | ||
37 | private TypeConstraintUtil() { | 37 | private TypeConstraintUtil() { |
38 | // Hiding constructor for utility class | 38 | // Hiding constructor for utility class |
39 | } | 39 | } |
40 | 40 | ||
41 | public static Map<Set<PVariable>, Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context, IInputKey inputKey, Tuple variablesTuple) { | 41 | public static Map<Set<PVariable>, Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context, IInputKey inputKey, Tuple variablesTuple) { |
42 | final Map<Set<PVariable>, Set<PVariable>> result = new HashMap<Set<PVariable>, Set<PVariable>>(); | 42 | final Map<Set<PVariable>, Set<PVariable>> result = new HashMap<Set<PVariable>, Set<PVariable>>(); |
43 | 43 | ||
44 | Set<Entry<Set<Integer>, Set<Integer>>> dependencies = context.getFunctionalDependencies(inputKey).entrySet(); | 44 | Set<Entry<Set<Integer>, Set<Integer>>> dependencies = context.getFunctionalDependencies(inputKey).entrySet(); |
45 | for (Entry<Set<Integer>, Set<Integer>> dependency : dependencies) { | 45 | for (Entry<Set<Integer>, Set<Integer>> dependency : dependencies) { |
46 | result.put( | 46 | result.put( |
47 | transcribeVariables(dependency.getKey(), variablesTuple), | 47 | transcribeVariables(dependency.getKey(), variablesTuple), |
48 | transcribeVariables(dependency.getValue(), variablesTuple) | 48 | transcribeVariables(dependency.getValue(), variablesTuple) |
49 | ); | 49 | ); |
50 | } | 50 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/ITypeInfoProviderConstraint.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/ITypeInfoProviderConstraint.java index ff127d38..84b2147f 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/ITypeInfoProviderConstraint.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/ITypeInfoProviderConstraint.java | |||
@@ -3,25 +3,25 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem; | 10 | package tools.refinery.interpreter.matchers.psystem; |
11 | 11 | ||
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 14 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * @author Gabor Bergmann | 17 | * @author Gabor Bergmann |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | public interface ITypeInfoProviderConstraint extends PConstraint { | 20 | public interface ITypeInfoProviderConstraint extends PConstraint { |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * Returns type information implied by this constraint. | 23 | * Returns type information implied by this constraint. |
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | public Set<TypeJudgement> getImpliedJudgements(IQueryMetaContext context); | 26 | public Set<TypeJudgement> getImpliedJudgements(IQueryMetaContext context); |
27 | 27 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IValueProvider.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IValueProvider.java index d959adc4..6eaf952a 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/IValueProvider.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/IValueProvider.java | |||
@@ -3,17 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem; | 9 | package tools.refinery.interpreter.matchers.psystem; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Helper interface to get values from a tuple of variables. All pattern matching engines are expected to implement this | 12 | * Helper interface to get values from a tuple of variables. All pattern matching engines are expected to implement this |
13 | * to handle their internal structures. | 13 | * to handle their internal structures. |
14 | * | 14 | * |
15 | * @author Zoltan Ujhelyi | 15 | * @author Zoltan Ujhelyi |
16 | * | 16 | * |
17 | */ | 17 | */ |
18 | public interface IValueProvider { | 18 | public interface IValueProvider { |
19 | 19 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/InitializablePQuery.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/InitializablePQuery.java index a82d12ec..8e087596 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/InitializablePQuery.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/InitializablePQuery.java | |||
@@ -3,17 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem; | 9 | package tools.refinery.interpreter.matchers.psystem; |
10 | 10 | ||
11 | import java.util.Set; | 11 | import java.util.Set; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 13 | import tools.refinery.interpreter.matchers.psystem.annotations.PAnnotation; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.annotations.PAnnotation; | 14 | import tools.refinery.interpreter.matchers.psystem.queries.PProblem; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PProblem; | 15 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 16 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Adds extra methods to the PQuery interface to initialize its contents. | 19 | * Adds extra methods to the PQuery interface to initialize its contents. |
@@ -29,7 +29,7 @@ public interface InitializablePQuery extends PQuery { | |||
29 | * @param status the new status | 29 | * @param status the new status |
30 | */ | 30 | */ |
31 | void setStatus(PQueryStatus status); | 31 | void setStatus(PQueryStatus status); |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Adds a detected error. Only applicable if the pattern is still {@link PQueryStatus#UNINITIALIZED uninitialized}. | 34 | * Adds a detected error. Only applicable if the pattern is still {@link PQueryStatus#UNINITIALIZED uninitialized}. |
35 | * | 35 | * |
@@ -42,7 +42,7 @@ public interface InitializablePQuery extends PQuery { | |||
42 | * uninitialized}. | 42 | * uninitialized}. |
43 | * | 43 | * |
44 | * @param bodies | 44 | * @param bodies |
45 | * @throws ViatraQueryRuntimeException | 45 | * @throws InterpreterRuntimeException |
46 | */ | 46 | */ |
47 | void initializeBodies(Set<PBody> bodies); | 47 | void initializeBodies(Set<PBody> bodies); |
48 | 48 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/KeyedEnumerablePConstraint.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/KeyedEnumerablePConstraint.java index 91eea817..7337476e 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/KeyedEnumerablePConstraint.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/KeyedEnumerablePConstraint.java | |||
@@ -3,17 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem; | 10 | package tools.refinery.interpreter.matchers.psystem; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 12 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * @author Gabor Bergmann | 15 | * @author Gabor Bergmann |
16 | * | 16 | * |
17 | */ | 17 | */ |
18 | public abstract class KeyedEnumerablePConstraint<KeyType> extends EnumerablePConstraint { | 18 | public abstract class KeyedEnumerablePConstraint<KeyType> extends EnumerablePConstraint { |
19 | 19 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PBody.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/PBody.java index c38dc23a..483a2aa2 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PBody.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/PBody.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem; | 10 | package tools.refinery.interpreter.matchers.psystem; |
11 | 11 | ||
12 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
13 | import java.util.HashMap; | 13 | import java.util.HashMap; |
@@ -19,32 +19,31 @@ import java.util.Set; | |||
19 | import java.util.WeakHashMap; | 19 | import java.util.WeakHashMap; |
20 | import java.util.stream.Collectors; | 20 | import java.util.stream.Collectors; |
21 | 21 | ||
22 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 22 | import tools.refinery.interpreter.matchers.planning.helpers.TypeHelper; |
23 | import tools.refinery.viatra.runtime.matchers.planning.helpers.TypeHelper; | 23 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExportedParameter; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 24 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.ConstantValue; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.ConstantValue; | 25 | import tools.refinery.interpreter.matchers.psystem.queries.PDisjunction; |
26 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PDisjunction; | 26 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
27 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 27 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
28 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery.PQueryStatus; | 28 | import tools.refinery.interpreter.matchers.util.Preconditions; |
29 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | ||
30 | 29 | ||
31 | /** | 30 | /** |
32 | * A set of constraints representing a pattern body | 31 | * A set of constraints representing a pattern body |
33 | * | 32 | * |
34 | * @author Gabor Bergmann | 33 | * @author Gabor Bergmann |
35 | * | 34 | * |
36 | */ | 35 | */ |
37 | public class PBody implements PTraceable { | 36 | public class PBody implements PTraceable { |
38 | 37 | ||
39 | public static final String VIRTUAL_VARIABLE_PREFIX = ".virtual"; | 38 | public static final String VIRTUAL_VARIABLE_PREFIX = ".virtual"; |
40 | private static final String VIRTUAL_VARIABLE_PATTERN = VIRTUAL_VARIABLE_PREFIX + "{%d}"; | 39 | private static final String VIRTUAL_VARIABLE_PATTERN = VIRTUAL_VARIABLE_PREFIX + "{%d}"; |
41 | 40 | ||
42 | private PQuery query; | 41 | private PQuery query; |
43 | 42 | ||
44 | /** | 43 | /** |
45 | * If null, then parent query status is reused | 44 | * If null, then parent query status is reused |
46 | */ | 45 | */ |
47 | private PQueryStatus status = PQueryStatus.UNINITIALIZED; | 46 | private PQuery.PQueryStatus status = PQuery.PQueryStatus.UNINITIALIZED; |
48 | 47 | ||
49 | private Set<PVariable> allVariables; | 48 | private Set<PVariable> allVariables; |
50 | private Set<PVariable> uniqueVariables; | 49 | private Set<PVariable> uniqueVariables; |
@@ -82,7 +81,7 @@ public class PBody implements PTraceable { | |||
82 | 81 | ||
83 | /** | 82 | /** |
84 | * Use this method to add a newly created constraint to the pSystem. | 83 | * Use this method to add a newly created constraint to the pSystem. |
85 | * | 84 | * |
86 | * @return whether the submission of the new constraint was successful | 85 | * @return whether the submission of the new constraint was successful |
87 | */ | 86 | */ |
88 | boolean registerConstraint(PConstraint constraint) { | 87 | boolean registerConstraint(PConstraint constraint) { |
@@ -92,7 +91,7 @@ public class PBody implements PTraceable { | |||
92 | 91 | ||
93 | /** | 92 | /** |
94 | * Use this method to remove an obsolete constraint from the pSystem. | 93 | * Use this method to remove an obsolete constraint from the pSystem. |
95 | * | 94 | * |
96 | * @return whether the removal of the constraint was successful | 95 | * @return whether the removal of the constraint was successful |
97 | */ | 96 | */ |
98 | boolean unregisterConstraint(PConstraint constraint) { | 97 | boolean unregisterConstraint(PConstraint constraint) { |
@@ -114,14 +113,14 @@ public class PBody implements PTraceable { | |||
114 | checkMutability(); | 113 | checkMutability(); |
115 | String name; | 114 | String name; |
116 | do { | 115 | do { |
117 | 116 | ||
118 | name = String.format(VIRTUAL_VARIABLE_PATTERN, nextVirtualNodeID++); | 117 | name = String.format(VIRTUAL_VARIABLE_PATTERN, nextVirtualNodeID++); |
119 | } while (variablesByName.containsKey(name)); | 118 | } while (variablesByName.containsKey(name)); |
120 | PVariable var = new PVariable(this, name, true); | 119 | PVariable var = new PVariable(this, name, true); |
121 | addVariable(var); | 120 | addVariable(var); |
122 | return var; | 121 | return var; |
123 | } | 122 | } |
124 | 123 | ||
125 | public PVariable newVirtualVariable(String name) { | 124 | public PVariable newVirtualVariable(String name) { |
126 | checkMutability(); | 125 | checkMutability(); |
127 | Preconditions.checkArgument(!variablesByName.containsKey(name), "ID %s already used for a virtual variable", name); | 126 | Preconditions.checkArgument(!variablesByName.containsKey(name), "ID %s already used for a virtual variable", name); |
@@ -151,7 +150,7 @@ public class PBody implements PTraceable { | |||
151 | 150 | ||
152 | /** | 151 | /** |
153 | * Find a PVariable by name | 152 | * Find a PVariable by name |
154 | * | 153 | * |
155 | * @param name | 154 | * @param name |
156 | * @return the found variable | 155 | * @return the found variable |
157 | * @throws IllegalArgumentException | 156 | * @throws IllegalArgumentException |
@@ -167,7 +166,7 @@ public class PBody implements PTraceable { | |||
167 | * Finds and returns a PVariable by name. If no PVariable exists with the name in the body, a new one is created. If | 166 | * Finds and returns a PVariable by name. If no PVariable exists with the name in the body, a new one is created. If |
168 | * the name of the variable starts with {@value #VIRTUAL_VARIABLE_PREFIX}, the created variable will be considered | 167 | * the name of the variable starts with {@value #VIRTUAL_VARIABLE_PREFIX}, the created variable will be considered |
169 | * virtual. | 168 | * virtual. |
170 | * | 169 | * |
171 | * @param name | 170 | * @param name |
172 | * @return a PVariable with the selected name; never null | 171 | * @return a PVariable with the selected name; never null |
173 | */ | 172 | */ |
@@ -194,11 +193,11 @@ public class PBody implements PTraceable { | |||
194 | 193 | ||
195 | /** | 194 | /** |
196 | * Returns the symbolic parameters of the body. </p> | 195 | * Returns the symbolic parameters of the body. </p> |
197 | * | 196 | * |
198 | * <p> | 197 | * <p> |
199 | * <strong>Warning</strong>: if two PVariables are unified, the returned list changes. If you want to have a stable | 198 | * <strong>Warning</strong>: if two PVariables are unified, the returned list changes. If you want to have a stable |
200 | * version, consider using {@link #getSymbolicParameters()}. | 199 | * version, consider using {@link #getSymbolicParameters()}. |
201 | * | 200 | * |
202 | * @return a non-null, but possibly empty list | 201 | * @return a non-null, but possibly empty list |
203 | */ | 202 | */ |
204 | public List<PVariable> getSymbolicParameterVariables() { | 203 | public List<PVariable> getSymbolicParameterVariables() { |
@@ -208,11 +207,11 @@ public class PBody implements PTraceable { | |||
208 | 207 | ||
209 | /** | 208 | /** |
210 | * Returns the exported parameter constraints of the body. | 209 | * Returns the exported parameter constraints of the body. |
211 | * | 210 | * |
212 | * @return a non-null, but possibly empty list | 211 | * @return a non-null, but possibly empty list |
213 | */ | 212 | */ |
214 | public List<ExportedParameter> getSymbolicParameters() { | 213 | public List<ExportedParameter> getSymbolicParameters() { |
215 | if (symbolicParameters == null) | 214 | if (symbolicParameters == null) |
216 | symbolicParameters = new ArrayList<>(); | 215 | symbolicParameters = new ArrayList<>(); |
217 | return symbolicParameters; | 216 | return symbolicParameters; |
218 | } | 217 | } |
@@ -229,11 +228,11 @@ public class PBody implements PTraceable { | |||
229 | /** | 228 | /** |
230 | * Sets a specific status for the body. If set, the parent PQuery status will not be checked; if set to null, its corresponding PQuery | 229 | * Sets a specific status for the body. If set, the parent PQuery status will not be checked; if set to null, its corresponding PQuery |
231 | * status is checked for mutability. | 230 | * status is checked for mutability. |
232 | * | 231 | * |
233 | * @param status | 232 | * @param status |
234 | * the status to set | 233 | * the status to set |
235 | */ | 234 | */ |
236 | public void setStatus(PQueryStatus status) { | 235 | public void setStatus(PQuery.PQueryStatus status) { |
237 | this.status = status; | 236 | this.status = status; |
238 | } | 237 | } |
239 | 238 | ||
@@ -241,22 +240,22 @@ public class PBody implements PTraceable { | |||
241 | if (status == null) { | 240 | if (status == null) { |
242 | return query.isMutable(); | 241 | return query.isMutable(); |
243 | } else { | 242 | } else { |
244 | return status.equals(PQueryStatus.UNINITIALIZED); | 243 | return status.equals(PQuery.PQueryStatus.UNINITIALIZED); |
245 | } | 244 | } |
246 | } | 245 | } |
247 | 246 | ||
248 | void checkMutability() { | 247 | void checkMutability() { |
249 | if (status == null) { | 248 | if (status == null) { |
250 | query.checkMutability(); | 249 | query.checkMutability(); |
251 | } else { | 250 | } else { |
252 | Preconditions.checkState(status.equals(PQueryStatus.UNINITIALIZED), "Initialized queries are not mutable"); | 251 | Preconditions.checkState(status.equals(PQuery.PQueryStatus.UNINITIALIZED), "Initialized queries are not mutable"); |
253 | } | 252 | } |
254 | } | 253 | } |
255 | 254 | ||
256 | /** | 255 | /** |
257 | * Returns the disjunction the body is contained with. This disjunction may either be the | 256 | * Returns the disjunction the body is contained with. This disjunction may either be the |
258 | * {@link PQuery#getDisjunctBodies() canonical disjunction of the corresponding query} or something equivalent. | 257 | * {@link PQuery#getDisjunctBodies() canonical disjunction of the corresponding query} or something equivalent. |
259 | * | 258 | * |
260 | * @return the container disjunction of the body. Can be null if body is not in a disjunction yet. | 259 | * @return the container disjunction of the body. Can be null if body is not in a disjunction yet. |
261 | */ | 260 | */ |
262 | public PDisjunction getContainerDisjunction() { | 261 | public PDisjunction getContainerDisjunction() { |
@@ -284,6 +283,6 @@ public class PBody implements PTraceable { | |||
284 | } | 283 | } |
285 | return currentRestrictions; | 284 | return currentRestrictions; |
286 | } | 285 | } |
287 | private WeakHashMap<IQueryMetaContext, Map<PVariable, Set<TypeJudgement>>> allUnaryTypeRestrictions = new WeakHashMap<IQueryMetaContext, Map<PVariable,Set<TypeJudgement>>>(); | 286 | private WeakHashMap<IQueryMetaContext, Map<PVariable, Set<TypeJudgement>>> allUnaryTypeRestrictions = new WeakHashMap<IQueryMetaContext, Map<PVariable,Set<TypeJudgement>>>(); |
288 | 287 | ||
289 | } | 288 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PConstraint.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/PConstraint.java index ae2c4632..4a19f985 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PConstraint.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/PConstraint.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem; | 10 | package tools.refinery.interpreter.matchers.psystem; |
11 | 11 | ||
12 | import java.util.Comparator; | 12 | import java.util.Comparator; |
13 | import java.util.Map; | 13 | import java.util.Map; |
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 16 | import tools.refinery.interpreter.matchers.psystem.analysis.QueryAnalyzer; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.analysis.QueryAnalyzer; | 17 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * @author Gabor Bergmann | 20 | * @author Gabor Bergmann |
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | public interface PConstraint extends PTraceable { | 23 | public interface PConstraint extends PTraceable { |
24 | 24 | ||
@@ -34,16 +34,16 @@ public interface PConstraint extends PTraceable { | |||
34 | public Set<PVariable> getAffectedVariables(); | 34 | public Set<PVariable> getAffectedVariables(); |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * The set of variables whose potential values can be enumerated (once all non-deduced variables have known values). | 37 | * The set of variables whose potential values can be enumerated (once all non-deduced variables have known values). |
38 | */ | 38 | */ |
39 | public Set<PVariable> getDeducedVariables(); | 39 | public Set<PVariable> getDeducedVariables(); |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * A (preferably minimal) cover of known functional dependencies between variables. | 42 | * A (preferably minimal) cover of known functional dependencies between variables. |
43 | * @noreference Use {@link QueryAnalyzer} instead to properly handle dependencies of pattern calls. | 43 | * @noreference Use {@link QueryAnalyzer} instead to properly handle dependencies of pattern calls. |
44 | * @return non-trivial functional dependencies in the form of {variables} --> {variables}, where dependencies with the same lhs are unified. | 44 | * @return non-trivial functional dependencies in the form of {variables} --> {variables}, where dependencies with the same lhs are unified. |
45 | */ | 45 | */ |
46 | public Map<Set<PVariable>,Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context); | 46 | public Map<Set<PVariable>,Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context); |
47 | 47 | ||
48 | public void replaceVariable(PVariable obsolete, PVariable replacement); | 48 | public void replaceVariable(PVariable obsolete, PVariable replacement); |
49 | 49 | ||
@@ -55,16 +55,16 @@ public interface PConstraint extends PTraceable { | |||
55 | * Returns an integer ID that is guaranteed to increase strictly monotonously for constraints within a pBody. | 55 | * Returns an integer ID that is guaranteed to increase strictly monotonously for constraints within a pBody. |
56 | */ | 56 | */ |
57 | public abstract int getMonotonousID(); | 57 | public abstract int getMonotonousID(); |
58 | 58 | ||
59 | 59 | ||
60 | /** | 60 | /** |
61 | * A comparator that orders constraints by their {@link #getMonotonousID() monotonous identifiers}. Should only used | 61 | * A comparator that orders constraints by their {@link #getMonotonousID() monotonous identifiers}. Should only used |
62 | * for tiebreaking in other comparators. | 62 | * for tiebreaking in other comparators. |
63 | * | 63 | * |
64 | * @since 2.0 | 64 | * @since 2.0 |
65 | */ | 65 | */ |
66 | public static final Comparator<PConstraint> COMPARE_BY_MONOTONOUS_ID = (arg0, arg1) -> arg0.getMonotonousID() - arg1.getMonotonousID(); | 66 | public static final Comparator<PConstraint> COMPARE_BY_MONOTONOUS_ID = (arg0, arg1) -> arg0.getMonotonousID() - arg1.getMonotonousID(); |
67 | 67 | ||
68 | 68 | ||
69 | 69 | ||
70 | } | 70 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PTraceable.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/PTraceable.java index f0241a9c..a1bb0bf8 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PTraceable.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/PTraceable.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem; | 9 | package tools.refinery.interpreter.matchers.psystem; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Marker interface for PSystem elements that can be traced. | 12 | * Marker interface for PSystem elements that can be traced. |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PVariable.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/PVariable.java index b6ea4861..12ad89a5 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PVariable.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/PVariable.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem; | 10 | package tools.refinery.interpreter.matchers.psystem; |
11 | 11 | ||
12 | import java.util.HashSet; | 12 | import java.util.HashSet; |
13 | import java.util.Set; | 13 | import java.util.Set; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/TypeJudgement.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/TypeJudgement.java index 4447b225..672e91aa 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/TypeJudgement.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/TypeJudgement.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem; | 9 | package tools.refinery.interpreter.matchers.psystem; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.HashSet; | 12 | import java.util.HashSet; |
@@ -15,13 +15,13 @@ import java.util.Map; | |||
15 | import java.util.stream.Collectors; | 15 | import java.util.stream.Collectors; |
16 | import java.util.Set; | 16 | import java.util.Set; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 18 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.TypeFilterConstraint; |
19 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 19 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.TypeConstraint; |
20 | import tools.refinery.viatra.runtime.matchers.context.InputKeyImplication; | 20 | import tools.refinery.interpreter.matchers.context.IInputKey; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.TypeFilterConstraint; | 21 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 22 | import tools.refinery.interpreter.matchers.context.InputKeyImplication; |
23 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 23 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
24 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 24 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * A judgement that means that the given tuple of variables will represent a tuple of values that is a member of the extensional relation identified by the given input key. | 27 | * A judgement that means that the given tuple of variables will represent a tuple of values that is a member of the extensional relation identified by the given input key. |
@@ -29,7 +29,7 @@ import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | |||
29 | * | 29 | * |
30 | */ | 30 | */ |
31 | public class TypeJudgement { | 31 | public class TypeJudgement { |
32 | 32 | ||
33 | private IInputKey inputKey; | 33 | private IInputKey inputKey; |
34 | private Tuple variablesTuple; | 34 | private Tuple variablesTuple; |
35 | /** | 35 | /** |
@@ -78,37 +78,37 @@ public class TypeJudgement { | |||
78 | return false; | 78 | return false; |
79 | return true; | 79 | return true; |
80 | } | 80 | } |
81 | 81 | ||
82 | public Set<TypeJudgement> getDirectlyImpliedJudgements(IQueryMetaContext context) { | 82 | public Set<TypeJudgement> getDirectlyImpliedJudgements(IQueryMetaContext context) { |
83 | Set<TypeJudgement> results = new HashSet<TypeJudgement>(); | 83 | Set<TypeJudgement> results = new HashSet<TypeJudgement>(); |
84 | results.add(this); | 84 | results.add(this); |
85 | 85 | ||
86 | Collection<InputKeyImplication> implications = context.getImplications(this.inputKey); | 86 | Collection<InputKeyImplication> implications = context.getImplications(this.inputKey); |
87 | for (InputKeyImplication inputKeyImplication : implications) { | 87 | for (InputKeyImplication inputKeyImplication : implications) { |
88 | results.add( | 88 | results.add( |
89 | transcribeImplication(inputKeyImplication) | 89 | transcribeImplication(inputKeyImplication) |
90 | ); | 90 | ); |
91 | } | 91 | } |
92 | 92 | ||
93 | return results; | 93 | return results; |
94 | } | 94 | } |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * @since 1.6 | 97 | * @since 1.6 |
98 | */ | 98 | */ |
99 | public Set<TypeJudgement> getWeakenedAlternativeJudgements(IQueryMetaContext context) { | 99 | public Set<TypeJudgement> getWeakenedAlternativeJudgements(IQueryMetaContext context) { |
100 | Set<TypeJudgement> results = new HashSet<TypeJudgement>(); | 100 | Set<TypeJudgement> results = new HashSet<TypeJudgement>(); |
101 | 101 | ||
102 | Collection<InputKeyImplication> implications = context.getWeakenedAlternatives(this.inputKey); | 102 | Collection<InputKeyImplication> implications = context.getWeakenedAlternatives(this.inputKey); |
103 | for (InputKeyImplication inputKeyImplication : implications) { | 103 | for (InputKeyImplication inputKeyImplication : implications) { |
104 | results.add( | 104 | results.add( |
105 | transcribeImplication(inputKeyImplication) | 105 | transcribeImplication(inputKeyImplication) |
106 | ); | 106 | ); |
107 | } | 107 | } |
108 | 108 | ||
109 | return results; | 109 | return results; |
110 | } | 110 | } |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * @since 2.0 | 113 | * @since 2.0 |
114 | */ | 114 | */ |
@@ -117,12 +117,12 @@ public class TypeJudgement { | |||
117 | entry -> transcribeImplication(entry.getKey()), | 117 | entry -> transcribeImplication(entry.getKey()), |
118 | entry -> entry.getValue().stream().map(this::transcribeImplication).collect(Collectors.toSet()))); | 118 | entry -> entry.getValue().stream().map(this::transcribeImplication).collect(Collectors.toSet()))); |
119 | } | 119 | } |
120 | 120 | ||
121 | 121 | ||
122 | 122 | ||
123 | private TypeJudgement transcribeImplication(InputKeyImplication inputKeyImplication) { | 123 | private TypeJudgement transcribeImplication(InputKeyImplication inputKeyImplication) { |
124 | return new TypeJudgement( | 124 | return new TypeJudgement( |
125 | inputKeyImplication.getImpliedKey(), | 125 | inputKeyImplication.getImpliedKey(), |
126 | transcribeVariablesToTuple(inputKeyImplication.getImpliedIndices()) | 126 | transcribeVariablesToTuple(inputKeyImplication.getImpliedIndices()) |
127 | ); | 127 | ); |
128 | } | 128 | } |
@@ -137,7 +137,7 @@ public class TypeJudgement { | |||
137 | public String toString() { | 137 | public String toString() { |
138 | return "TypeJudgement:" + inputKey.getPrettyPrintableName() + "@" + variablesTuple.toString(); | 138 | return "TypeJudgement:" + inputKey.getPrettyPrintableName() + "@" + variablesTuple.toString(); |
139 | } | 139 | } |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * Creates this judgement as a direct type constraint in the given PBody under construction. | 142 | * Creates this judgement as a direct type constraint in the given PBody under construction. |
143 | * <p> pre: the variables tuple must be formed of variables of that PBody. | 143 | * <p> pre: the variables tuple must be formed of variables of that PBody. |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/VariableDeferredPConstraint.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/VariableDeferredPConstraint.java index 8ea6bb93..48610bc6 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/VariableDeferredPConstraint.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/VariableDeferredPConstraint.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem; | 10 | package tools.refinery.interpreter.matchers.psystem; |
11 | 11 | ||
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 14 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
15 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 15 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | * A kind of deferred constraint that can only be checked when a set of deferring variables are all present in a plan. | 18 | * A kind of deferred constraint that can only be checked when a set of deferring variables are all present in a plan. |
19 | * | 19 | * |
20 | * @author Gabor Bergmann | 20 | * @author Gabor Bergmann |
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | public abstract class VariableDeferredPConstraint extends DeferredPConstraint { | 23 | public abstract class VariableDeferredPConstraint extends DeferredPConstraint { |
24 | 24 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/AbstractMemorylessAggregationOperator.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/AbstractMemorylessAggregationOperator.java index 63a37bbe..54e714e5 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/AbstractMemorylessAggregationOperator.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/AbstractMemorylessAggregationOperator.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.aggregations; | 9 | package tools.refinery.interpreter.matchers.psystem.aggregations; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * | 12 | * |
13 | * An aggregation operator that does not store interim results beyond the final aggregated value. | 13 | * An aggregation operator that does not store interim results beyond the final aggregated value. |
14 | * @author Gabor Bergmann | 14 | * @author Gabor Bergmann |
15 | * @since 1.4 | 15 | * @since 1.4 |
16 | */ | 16 | */ |
17 | public abstract class AbstractMemorylessAggregationOperator<Domain, AggregateResult> | 17 | public abstract class AbstractMemorylessAggregationOperator<Domain, AggregateResult> |
18 | implements IMultisetAggregationOperator<Domain, AggregateResult, AggregateResult> | 18 | implements IMultisetAggregationOperator<Domain, AggregateResult, AggregateResult> |
19 | { | 19 | { |
20 | 20 | ||
21 | @Override | 21 | @Override |
@@ -27,5 +27,5 @@ public abstract class AbstractMemorylessAggregationOperator<Domain, AggregateRes | |||
27 | public AggregateResult clone(AggregateResult original) { | 27 | public AggregateResult clone(AggregateResult original) { |
28 | return original; | 28 | return original; |
29 | } | 29 | } |
30 | 30 | ||
31 | } | 31 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/AggregatorType.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/AggregatorType.java index 4cc40a2b..8e6263b0 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/AggregatorType.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/AggregatorType.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.aggregations; | 9 | package tools.refinery.interpreter.matchers.psystem.aggregations; |
10 | 10 | ||
11 | import java.lang.annotation.ElementType; | 11 | import java.lang.annotation.ElementType; |
12 | import java.lang.annotation.Inherited; | 12 | import java.lang.annotation.Inherited; |
@@ -14,26 +14,26 @@ import java.lang.annotation.Retention; | |||
14 | import java.lang.annotation.RetentionPolicy; | 14 | import java.lang.annotation.RetentionPolicy; |
15 | import java.lang.annotation.Target; | 15 | import java.lang.annotation.Target; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.aggregators.count; | 17 | import tools.refinery.interpreter.matchers.aggregators.count; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * The aggregator type annotation describes the type constraints for the selected aggregator. In version 1.4, two kinds of | 20 | * The aggregator type annotation describes the type constraints for the selected aggregator. In version 1.4, two kinds of |
21 | * aggregators are supported: | 21 | * aggregators are supported: |
22 | * | 22 | * |
23 | * <ol> | 23 | * <ol> |
24 | * <li>An aggregator that does not consider any parameter value from the call ({@link count}), just calculates the | 24 | * <li>An aggregator that does not consider any parameter value from the call ({@link count}), just calculates the |
25 | * number of matches. This is represented by a single {@link Void} and a single corresponding return type.</li> | 25 | * number of matches. This is represented by a single {@link Void} and a single corresponding return type.</li> |
26 | * <li>An aggregator that considers a single parameter from the call, and executes some aggregate operations over it. | 26 | * <li>An aggregator that considers a single parameter from the call, and executes some aggregate operations over it. |
27 | * Such an aggregate operation can be defined over multiple types, where each possible parameter type has a corresponding return type declared.</li> | 27 | * Such an aggregate operation can be defined over multiple types, where each possible parameter type has a corresponding return type declared.</li> |
28 | * </ol> | 28 | * </ol> |
29 | * | 29 | * |
30 | * <strong>Important!</strong> The parameterTypes and returnTypes arrays must have | 30 | * <strong>Important!</strong> The parameterTypes and returnTypes arrays must have |
31 | * <ul> | 31 | * <ul> |
32 | * <li>The same number of classes defined each.</li> | 32 | * <li>The same number of classes defined each.</li> |
33 | * <li>Items are corresponded by index.</li> | 33 | * <li>Items are corresponded by index.</li> |
34 | * <li>Items should represent data types</li> | 34 | * <li>Items should represent data types</li> |
35 | * </ul> | 35 | * </ul> |
36 | * | 36 | * |
37 | * @author Zoltan Ujhelyi | 37 | * @author Zoltan Ujhelyi |
38 | * @since 1.4 | 38 | * @since 1.4 |
39 | * | 39 | * |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/BoundAggregator.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/BoundAggregator.java index e6972544..71363624 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/BoundAggregator.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/BoundAggregator.java | |||
@@ -3,13 +3,13 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.aggregations; | 9 | package tools.refinery.interpreter.matchers.psystem.aggregations; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 11 | import tools.refinery.interpreter.matchers.context.IInputKey; |
12 | import tools.refinery.viatra.runtime.matchers.context.common.JavaTransitiveInstancesKey; | 12 | import tools.refinery.interpreter.matchers.context.common.JavaTransitiveInstancesKey; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Augments an aggregator operator with type bindings for the type of values being aggregated and the aggregate result. | 15 | * Augments an aggregator operator with type bindings for the type of values being aggregated and the aggregate result. |
@@ -22,7 +22,7 @@ public class BoundAggregator { | |||
22 | private final Class<?> domainType; | 22 | private final Class<?> domainType; |
23 | private final Class<?> aggregateResultType; | 23 | private final Class<?> aggregateResultType; |
24 | 24 | ||
25 | public BoundAggregator(IMultisetAggregationOperator<?, ?, ?> operator, | 25 | public BoundAggregator(IMultisetAggregationOperator<?, ?, ?> operator, |
26 | Class<?> domainType, | 26 | Class<?> domainType, |
27 | Class<?> aggregateResultType) { | 27 | Class<?> aggregateResultType) { |
28 | super(); | 28 | super(); |
@@ -54,7 +54,7 @@ public class BoundAggregator { | |||
54 | private static IInputKey toJavaInputKey(Class<?> type) { | 54 | private static IInputKey toJavaInputKey(Class<?> type) { |
55 | if (type==null) { | 55 | if (type==null) { |
56 | return null; | 56 | return null; |
57 | } else { | 57 | } else { |
58 | return new JavaTransitiveInstancesKey(type); | 58 | return new JavaTransitiveInstancesKey(type); |
59 | } | 59 | } |
60 | } | 60 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/IAggregatorFactory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/IAggregatorFactory.java index c970bd6a..9cc309cf 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/IAggregatorFactory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/IAggregatorFactory.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.aggregations; | 9 | package tools.refinery.interpreter.matchers.psystem.aggregations; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * | 12 | * |
13 | * Describes an aggregation operator keyword, potentially with type polymorphism. The actual runtime | 13 | * Describes an aggregation operator keyword, potentially with type polymorphism. The actual runtime |
14 | * {@link IMultisetAggregationOperator} that implements the aggregation logic may depend on the type context. | 14 | * {@link IMultisetAggregationOperator} that implements the aggregation logic may depend on the type context. |
15 | * | 15 | * |
16 | * <p> | 16 | * <p> |
17 | * Implementors are suggested to use lower-case classnames (as it will end up in the language) and are required use the | 17 | * Implementors are suggested to use lower-case classnames (as it will end up in the language) and are required use the |
18 | * annotation {@link AggregatorType} to indicate type inference rules. | 18 | * annotation {@link AggregatorType} to indicate type inference rules. |
19 | * | 19 | * |
20 | * <p> | 20 | * <p> |
21 | * <strong>Important!</strong> Implemented aggregators must be (1) deterministic (2) pure and (3)support incremental | 21 | * <strong>Important!</strong> Implemented aggregators must be (1) deterministic (2) pure and (3)support incremental |
22 | * value updates in the internal operation. | 22 | * value updates in the internal operation. |
23 | * | 23 | * |
24 | * @author Zoltan Ujhelyi | 24 | * @author Zoltan Ujhelyi |
25 | * @since 1.4 | 25 | * @since 1.4 |
26 | */ | 26 | */ |
@@ -30,7 +30,7 @@ public interface IAggregatorFactory { | |||
30 | /** | 30 | /** |
31 | * Given type parameters selected from {@link AggregatorType} annotations, returns a run-time aggregator operator | 31 | * Given type parameters selected from {@link AggregatorType} annotations, returns a run-time aggregator operator |
32 | * that is bound to the actual types. | 32 | * that is bound to the actual types. |
33 | * | 33 | * |
34 | * @param domainClass | 34 | * @param domainClass |
35 | * Java type of the values that are being aggregated | 35 | * Java type of the values that are being aggregated |
36 | * @return the actual run-time aggregator logic, with type bindings | 36 | * @return the actual run-time aggregator logic, with type bindings |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/IMultisetAggregationOperator.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/IMultisetAggregationOperator.java index 3bc22274..659d6bd6 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/aggregations/IMultisetAggregationOperator.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/aggregations/IMultisetAggregationOperator.java | |||
@@ -3,55 +3,55 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.aggregations; | 9 | package tools.refinery.interpreter.matchers.psystem.aggregations; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.stream.Stream; | 12 | import java.util.stream.Stream; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.aggregators.ExtremumOperator; | 14 | import tools.refinery.interpreter.matchers.aggregators.ExtremumOperator; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * A single column aggregator is used to incrementally compute the aggregate of a multiset of values according to an aggregator operator. | 17 | * A single column aggregator is used to incrementally compute the aggregate of a multiset of values according to an aggregator operator. |
18 | * | 18 | * |
19 | * <p> The operator provides two methods of computation: <ul> | 19 | * <p> The operator provides two methods of computation: <ul> |
20 | * <li>Stateless aggregation of an explicit multiset, provided by {@link #aggregateStatelessly(Collection)}.</li> | 20 | * <li>Stateless aggregation of an explicit multiset, provided by {@link #aggregateStatelessly(Collection)}.</li> |
21 | * <li>Incremental aggregation, provided by {@link #createNeutral()}, {@link #update(Object, Object, boolean)}, {@link #isNeutral(Object)}, {@link #getAggregate(Object)}. | 21 | * <li>Incremental aggregation, provided by {@link #createNeutral()}, {@link #update(Object, Object, boolean)}, {@link #isNeutral(Object)}, {@link #getAggregate(Object)}. |
22 | * </ul> | 22 | * </ul> |
23 | * | 23 | * |
24 | * <p> In case of incremental computation, the aggregable multiset is conceptual; it is not represented by an explicit Collection<Domain> object, but its update operations are tracked. | 24 | * <p> In case of incremental computation, the aggregable multiset is conceptual; it is not represented by an explicit Collection<Domain> object, but its update operations are tracked. |
25 | * | 25 | * |
26 | * <p> In case of incremental computation, internal results, potentially distinct from the final aggregate result, may be stored in a helper data structure called <b>accumulator</b>. | 26 | * <p> In case of incremental computation, internal results, potentially distinct from the final aggregate result, may be stored in a helper data structure called <b>accumulator</b>. |
27 | * The goal of this distinction is that the final result may not be sufficient for incremental updates (see e.g. {@link ExtremumOperator}). | 27 | * The goal of this distinction is that the final result may not be sufficient for incremental updates (see e.g. {@link ExtremumOperator}). |
28 | * | 28 | * |
29 | * @author Gabor Bergmann | 29 | * @author Gabor Bergmann |
30 | * | 30 | * |
31 | * @param <Domain> the type of elements to be aggregated. | 31 | * @param <Domain> the type of elements to be aggregated. |
32 | * @param <Accumulator> the type used to store the interim results of the aggregate computation, | 32 | * @param <Accumulator> the type used to store the interim results of the aggregate computation, |
33 | * that may be incrementally refreshed upon updates to the multiset, and that can easily yield the final result. | 33 | * that may be incrementally refreshed upon updates to the multiset, and that can easily yield the final result. |
34 | * @param <AggregateResult> the type of the final result of the aggregation to be output. | 34 | * @param <AggregateResult> the type of the final result of the aggregation to be output. |
35 | * | 35 | * |
36 | * @since 1.4 | 36 | * @since 1.4 |
37 | */ | 37 | */ |
38 | public interface IMultisetAggregationOperator<Domain, Accumulator, AggregateResult> { | 38 | public interface IMultisetAggregationOperator<Domain, Accumulator, AggregateResult> { |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * A textual description of the operator. | 41 | * A textual description of the operator. |
42 | */ | 42 | */ |
43 | String getShortDescription(); | 43 | String getShortDescription(); |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * A name or identifier of the operator. | 46 | * A name or identifier of the operator. |
47 | */ | 47 | */ |
48 | String getName(); | 48 | String getName(); |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * @return the neutral element, i.e. the interim result of aggregating an empty multiset. | 51 | * @return the neutral element, i.e. the interim result of aggregating an empty multiset. |
52 | */ | 52 | */ |
53 | Accumulator createNeutral(); | 53 | Accumulator createNeutral(); |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * @return true if the interim result is equivalent to the neutral element, as if there are no values in the multiset. | 56 | * @return true if the interim result is equivalent to the neutral element, as if there are no values in the multiset. |
57 | * Must return true if the multiset is empty. | 57 | * Must return true if the multiset is empty. |
@@ -59,14 +59,14 @@ public interface IMultisetAggregationOperator<Domain, Accumulator, AggregateResu | |||
59 | boolean isNeutral(Accumulator result); | 59 | boolean isNeutral(Accumulator result); |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * @return an updated intermediate result, | 62 | * @return an updated intermediate result, |
63 | * changed to reflect that a given object was added to / removed from the multiset | 63 | * changed to reflect that a given object was added to / removed from the multiset |
64 | * (as indicated by the parameter isInsertion) | 64 | * (as indicated by the parameter isInsertion) |
65 | */ | 65 | */ |
66 | Accumulator update(Accumulator oldResult, Domain updateValue, boolean isInsertion); | 66 | Accumulator update(Accumulator oldResult, Domain updateValue, boolean isInsertion); |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * @return the aggregate result obtained from the given intermediate result. | 69 | * @return the aggregate result obtained from the given intermediate result. |
70 | * May be null to indicate that the current multiset cannot be aggregated (e.g. 0 elements have no minimum). | 70 | * May be null to indicate that the current multiset cannot be aggregated (e.g. 0 elements have no minimum). |
71 | */ | 71 | */ |
72 | AggregateResult getAggregate(Accumulator result); | 72 | AggregateResult getAggregate(Accumulator result); |
@@ -77,30 +77,30 @@ public interface IMultisetAggregationOperator<Domain, Accumulator, AggregateResu | |||
77 | * @since 2.0 | 77 | * @since 2.0 |
78 | */ | 78 | */ |
79 | AggregateResult aggregateStream(Stream<Domain> stream); | 79 | AggregateResult aggregateStream(Stream<Domain> stream); |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Clones the given accumulator (with all its internal contents). | 82 | * Clones the given accumulator (with all its internal contents). |
83 | */ | 83 | */ |
84 | default Accumulator clone(Accumulator original) { | 84 | default Accumulator clone(Accumulator original) { |
85 | throw new UnsupportedOperationException(); | 85 | throw new UnsupportedOperationException(); |
86 | } | 86 | } |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * Combines the given aggregate result and accumulator into a single aggregate result. | 89 | * Combines the given aggregate result and accumulator into a single aggregate result. |
90 | */ | 90 | */ |
91 | default AggregateResult combine(AggregateResult left, Accumulator right) { | 91 | default AggregateResult combine(AggregateResult left, Accumulator right) { |
92 | throw new UnsupportedOperationException(); | 92 | throw new UnsupportedOperationException(); |
93 | } | 93 | } |
94 | 94 | ||
95 | default boolean contains(Domain value, Accumulator accumulator) { | 95 | default boolean contains(Domain value, Accumulator accumulator) { |
96 | throw new UnsupportedOperationException(); | 96 | throw new UnsupportedOperationException(); |
97 | } | 97 | } |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * Pretty prints the contents of the given accumulator. | 100 | * Pretty prints the contents of the given accumulator. |
101 | */ | 101 | */ |
102 | default String prettyPrint(final Accumulator accumulator) { | 102 | default String prettyPrint(final Accumulator accumulator) { |
103 | return accumulator.toString(); | 103 | return accumulator.toString(); |
104 | } | 104 | } |
105 | 105 | ||
106 | } | 106 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/analysis/QueryAnalyzer.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/analysis/QueryAnalyzer.java index e3f28cff..967aaa9e 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/analysis/QueryAnalyzer.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/analysis/QueryAnalyzer.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.analysis; | 9 | package tools.refinery.interpreter.matchers.psystem.analysis; |
10 | 10 | ||
11 | import java.util.HashMap; | 11 | import java.util.HashMap; |
12 | import java.util.HashSet; | 12 | import java.util.HashSet; |
@@ -15,32 +15,32 @@ import java.util.Map.Entry; | |||
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | import java.util.stream.Collectors; | 16 | import java.util.stream.Collectors; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | 18 | import tools.refinery.interpreter.matchers.planning.helpers.FunctionalDependencyHelper; |
19 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 19 | import tools.refinery.interpreter.matchers.psystem.annotations.PAnnotation; |
20 | import tools.refinery.viatra.runtime.matchers.planning.helpers.FunctionalDependencyHelper; | 20 | import tools.refinery.interpreter.matchers.psystem.annotations.ParameterReference; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 21 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExportedParameter; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 22 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
23 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 23 | import tools.refinery.interpreter.matchers.context.IQueryBackendContext; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.annotations.PAnnotation; | 24 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.annotations.ParameterReference; | 25 | import tools.refinery.interpreter.matchers.psystem.PBody; |
26 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 26 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
27 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 27 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
28 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 28 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
29 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 29 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Object responsible for computing and caching static query analysis results. | 32 | * Object responsible for computing and caching static query analysis results. |
33 | * <p> Any client can instantiate this to statically analyze queries. | 33 | * <p> Any client can instantiate this to statically analyze queries. |
34 | * Query backends should share an instance obtained via {@link IQueryBackendContext} to save resources. | 34 | * Query backends should share an instance obtained via {@link IQueryBackendContext} to save resources. |
35 | * <p> Precondition: all involved queries must be initialized. | 35 | * <p> Precondition: all involved queries must be initialized. |
36 | * @noinstantiate Considered unstable API; subject to change in future versions. | 36 | * @noinstantiate Considered unstable API; subject to change in future versions. |
37 | * Either use the analyzer provided by {@link IQueryBackendContext}, or anticipate | 37 | * Either use the analyzer provided by {@link IQueryBackendContext}, or anticipate |
38 | * potential future breakage when instantiating your own analyzer. | 38 | * potential future breakage when instantiating your own analyzer. |
39 | * @author Gabor Bergmann | 39 | * @author Gabor Bergmann |
40 | * @since 1.5 | 40 | * @since 1.5 |
41 | */ | 41 | */ |
42 | public final class QueryAnalyzer { | 42 | public final class QueryAnalyzer { |
43 | 43 | ||
44 | private IQueryMetaContext metaContext; | 44 | private IQueryMetaContext metaContext; |
45 | 45 | ||
46 | public QueryAnalyzer(IQueryMetaContext metaContext) { | 46 | public QueryAnalyzer(IQueryMetaContext metaContext) { |
@@ -48,20 +48,20 @@ public final class QueryAnalyzer { | |||
48 | } | 48 | } |
49 | 49 | ||
50 | // Functional dependencies | 50 | // Functional dependencies |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Maps query and strictness to functional dependencies | 53 | * Maps query and strictness to functional dependencies |
54 | */ | 54 | */ |
55 | private Map<PQuery, Map<Set<Integer>, Set<Integer>>> strictFunctionalDependencyGuarantees = | 55 | private Map<PQuery, Map<Set<Integer>, Set<Integer>>> strictFunctionalDependencyGuarantees = |
56 | new HashMap<>(); | 56 | new HashMap<>(); |
57 | private Map<PQuery, Map<Set<Integer>, Set<Integer>>> softFunctionalDependencyGuarantees = | 57 | private Map<PQuery, Map<Set<Integer>, Set<Integer>>> softFunctionalDependencyGuarantees = |
58 | new HashMap<>(); | 58 | new HashMap<>(); |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Functional dependency information, expressed on query parameters, that the match set of the query is guaranteed to respect. | 61 | * Functional dependency information, expressed on query parameters, that the match set of the query is guaranteed to respect. |
62 | * <p> The type dependencies shall be expressed on the <i>parameter index</i> integers, NOT the {@link PParameter} object. | 62 | * <p> The type dependencies shall be expressed on the <i>parameter index</i> integers, NOT the {@link PParameter} object. |
63 | * @return a non-null map of functional dependencies on parameters that can be processed by {@link FunctionalDependencyHelper} | 63 | * @return a non-null map of functional dependencies on parameters that can be processed by {@link FunctionalDependencyHelper} |
64 | * @param strict if true, only "hard" dependencies are taken into account that are strictly enforced by the model representation; | 64 | * @param strict if true, only "hard" dependencies are taken into account that are strictly enforced by the model representation; |
65 | * if false, user-provided soft dependencies (@FunctionalDependency) are included as well, that are anticipated but not guaranteed by the storage mechanism; | 65 | * if false, user-provided soft dependencies (@FunctionalDependency) are included as well, that are anticipated but not guaranteed by the storage mechanism; |
66 | * use true if superfluous dependencies may taint the correctness of a computation, false if they would merely impact performance | 66 | * use true if superfluous dependencies may taint the correctness of a computation, false if they would merely impact performance |
67 | * @since 1.5 | 67 | * @since 1.5 |
@@ -74,10 +74,10 @@ public final class QueryAnalyzer { | |||
74 | // and may thus recurs back into #getProjectedFunctionalDependencies, causing a ConcurrentModificationException | 74 | // and may thus recurs back into #getProjectedFunctionalDependencies, causing a ConcurrentModificationException |
75 | // if the called query has not been previously analyzed. | 75 | // if the called query has not been previously analyzed. |
76 | // | 76 | // |
77 | // Note: if patterns are recursive, the empty accumulator will be found in the store | 77 | // Note: if patterns are recursive, the empty accumulator will be found in the store |
78 | // (this yields a safe lower estimate and guarantees termination for #getProjectedFunctionalDependencies) | 78 | // (this yields a safe lower estimate and guarantees termination for #getProjectedFunctionalDependencies) |
79 | // But this case probably will not occur due to recursive queries having a disjunction at some point, | 79 | // But this case probably will not occur due to recursive queries having a disjunction at some point, |
80 | // and thus ignored by #computeFunctionalDependencies | 80 | // and thus ignored by #computeFunctionalDependencies |
81 | if (dependencies == null) { | 81 | if (dependencies == null) { |
82 | dependencies = new HashMap<>(); // accumulator | 82 | dependencies = new HashMap<>(); // accumulator |
83 | guaranteeStore.put(query, dependencies); | 83 | guaranteeStore.put(query, dependencies); |
@@ -87,24 +87,24 @@ public final class QueryAnalyzer { | |||
87 | } | 87 | } |
88 | 88 | ||
89 | private void computeFunctionalDependencies(Map<Set<Integer>, Set<Integer>> accumulator, PQuery query, boolean strict) { | 89 | private void computeFunctionalDependencies(Map<Set<Integer>, Set<Integer>> accumulator, PQuery query, boolean strict) { |
90 | Set<PBody> bodies = query.getDisjunctBodies().getBodies(); | 90 | Set<PBody> bodies = query.getDisjunctBodies().getBodies(); |
91 | if (bodies.size() == 1) { // no support for recursion or disjunction | 91 | if (bodies.size() == 1) { // no support for recursion or disjunction |
92 | 92 | ||
93 | PBody body = bodies.iterator().next(); | 93 | PBody body = bodies.iterator().next(); |
94 | 94 | ||
95 | // collect parameter variables | 95 | // collect parameter variables |
96 | Map<PVariable, Integer> parameters = body.getSymbolicParameters().stream() | 96 | Map<PVariable, Integer> parameters = body.getSymbolicParameters().stream() |
97 | .collect(Collectors.toMap(ExportedParameter::getParameterVariable, | 97 | .collect(Collectors.toMap(ExportedParameter::getParameterVariable, |
98 | param -> query.getParameters().indexOf(param.getPatternParameter()))); | 98 | param -> query.getParameters().indexOf(param.getPatternParameter()))); |
99 | 99 | ||
100 | // collect all internal dependencies | 100 | // collect all internal dependencies |
101 | Map<Set<PVariable>, Set<PVariable>> internalDependencies = | 101 | Map<Set<PVariable>, Set<PVariable>> internalDependencies = |
102 | getFunctionalDependencies(body.getConstraints(), strict); | 102 | getFunctionalDependencies(body.getConstraints(), strict); |
103 | 103 | ||
104 | // project onto parameter variables | 104 | // project onto parameter variables |
105 | Map<Set<PVariable>, Set<PVariable>> projectedDeps = | 105 | Map<Set<PVariable>, Set<PVariable>> projectedDeps = |
106 | FunctionalDependencyHelper.projectDependencies(internalDependencies, parameters.keySet()); | 106 | FunctionalDependencyHelper.projectDependencies(internalDependencies, parameters.keySet()); |
107 | 107 | ||
108 | // translate into indices | 108 | // translate into indices |
109 | for (Entry<Set<PVariable>, Set<PVariable>> entry : projectedDeps.entrySet()) { | 109 | for (Entry<Set<PVariable>, Set<PVariable>> entry : projectedDeps.entrySet()) { |
110 | Set<Integer> left = new HashSet<Integer>(); | 110 | Set<Integer> left = new HashSet<Integer>(); |
@@ -117,21 +117,21 @@ public final class QueryAnalyzer { | |||
117 | } | 117 | } |
118 | accumulator.put(left, right); | 118 | accumulator.put(left, right); |
119 | } | 119 | } |
120 | 120 | ||
121 | } else { | 121 | } else { |
122 | // Disjunctive case, no dependencies are inferred | 122 | // Disjunctive case, no dependencies are inferred |
123 | // TODO: we can still salvage the intersection of dependencies IF | 123 | // TODO: we can still salvage the intersection of dependencies IF |
124 | // - all bodies have disjoint match sets | 124 | // - all bodies have disjoint match sets |
125 | // - and we avoid recursion | 125 | // - and we avoid recursion |
126 | } | 126 | } |
127 | 127 | ||
128 | // add annotation-based soft dependencies (regardless of number of bodies) | 128 | // add annotation-based soft dependencies (regardless of number of bodies) |
129 | if (!strict) { | 129 | if (!strict) { |
130 | outer: | 130 | outer: |
131 | for (PAnnotation annotation : query.getAnnotationsByName("FunctionalDependency")) { | 131 | for (PAnnotation annotation : query.getAnnotationsByName("FunctionalDependency")) { |
132 | Set<Integer> lefts = new HashSet<Integer>(); | 132 | Set<Integer> lefts = new HashSet<Integer>(); |
133 | Set<Integer> rights = new HashSet<Integer>(); | 133 | Set<Integer> rights = new HashSet<Integer>(); |
134 | 134 | ||
135 | for (Object object : annotation.getAllValues("forEach")) { | 135 | for (Object object : annotation.getAllValues("forEach")) { |
136 | ParameterReference parameter = (ParameterReference) object; | 136 | ParameterReference parameter = (ParameterReference) object; |
137 | Integer position = query.getPositionOfParameter(parameter.getName()); | 137 | Integer position = query.getPositionOfParameter(parameter.getName()); |
@@ -144,17 +144,17 @@ public final class QueryAnalyzer { | |||
144 | if (position == null) continue outer; | 144 | if (position == null) continue outer; |
145 | rights.add(position); | 145 | rights.add(position); |
146 | } | 146 | } |
147 | 147 | ||
148 | FunctionalDependencyHelper.includeDependency(accumulator, lefts, rights); | 148 | FunctionalDependencyHelper.includeDependency(accumulator, lefts, rights); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * Functional dependency information, expressed on PVariables within a body, that the selected constraints imply. | 154 | * Functional dependency information, expressed on PVariables within a body, that the selected constraints imply. |
155 | * @return a non-null map of functional dependencies on PVariables that can be processed by {@link FunctionalDependencyHelper} | 155 | * @return a non-null map of functional dependencies on PVariables that can be processed by {@link FunctionalDependencyHelper} |
156 | * @param constraints the set of constraints whose consequences will be analyzed | 156 | * @param constraints the set of constraints whose consequences will be analyzed |
157 | * @param strict if true, only "hard" dependencies are taken into account that are strictly enforced by the model representation; | 157 | * @param strict if true, only "hard" dependencies are taken into account that are strictly enforced by the model representation; |
158 | * if false, user-provided soft dependencies (@FunctionalDependency) are included as well, that are anticipated but not guaranteed by the storage mechanism; | 158 | * if false, user-provided soft dependencies (@FunctionalDependency) are included as well, that are anticipated but not guaranteed by the storage mechanism; |
159 | * use true if superfluous dependencies may taint the correctness of a computation, false if they would merely impact performance | 159 | * use true if superfluous dependencies may taint the correctness of a computation, false if they would merely impact performance |
160 | * @since 1.5 | 160 | * @since 1.5 |
@@ -170,20 +170,20 @@ public final class QueryAnalyzer { | |||
170 | for (Entry<Set<Integer>, Set<Integer>> entry : paramDependencies.entrySet()) { | 170 | for (Entry<Set<Integer>, Set<Integer>> entry : paramDependencies.entrySet()) { |
171 | Set<PVariable> lefts = new HashSet<PVariable>(); | 171 | Set<PVariable> lefts = new HashSet<PVariable>(); |
172 | Set<PVariable> rights = new HashSet<PVariable>(); | 172 | Set<PVariable> rights = new HashSet<PVariable>(); |
173 | 173 | ||
174 | for (Integer index : entry.getKey()) { | 174 | for (Integer index : entry.getKey()) { |
175 | lefts.add(call.getVariableInTuple(index)); | 175 | lefts.add(call.getVariableInTuple(index)); |
176 | } | 176 | } |
177 | for (Integer index : entry.getValue()) { | 177 | for (Integer index : entry.getValue()) { |
178 | rights.add(call.getVariableInTuple(index)); | 178 | rights.add(call.getVariableInTuple(index)); |
179 | } | 179 | } |
180 | 180 | ||
181 | FunctionalDependencyHelper.includeDependency(accumulator, | 181 | FunctionalDependencyHelper.includeDependency(accumulator, |
182 | lefts, rights); | 182 | lefts, rights); |
183 | } | 183 | } |
184 | } else { | 184 | } else { |
185 | // delegate to PConstraint | 185 | // delegate to PConstraint |
186 | FunctionalDependencyHelper.includeDependencies(accumulator, | 186 | FunctionalDependencyHelper.includeDependencies(accumulator, |
187 | pConstraint.getFunctionalDependencies(metaContext)); | 187 | pConstraint.getFunctionalDependencies(metaContext)); |
188 | } | 188 | } |
189 | } | 189 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/annotations/PAnnotation.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/annotations/PAnnotation.java index c4fbe0e9..3a9883ed 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/annotations/PAnnotation.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/annotations/PAnnotation.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.annotations; | 9 | package tools.refinery.interpreter.matchers.psystem.annotations; |
10 | 10 | ||
11 | import java.util.List; | 11 | import java.util.List; |
12 | import java.util.Optional; | 12 | import java.util.Optional; |
@@ -56,7 +56,7 @@ public class PAnnotation { | |||
56 | public Optional<Object> getFirstValue(String attributeName) { | 56 | public Optional<Object> getFirstValue(String attributeName) { |
57 | return getAllValues(attributeName).stream().findFirst(); | 57 | return getAllValues(attributeName).stream().findFirst(); |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Returns the value of the first occurrence of an attribute | 61 | * Returns the value of the first occurrence of an attribute |
62 | * @param attributeName | 62 | * @param attributeName |
@@ -75,7 +75,7 @@ public class PAnnotation { | |||
75 | public List<Object> getAllValues(String attributeName) { | 75 | public List<Object> getAllValues(String attributeName) { |
76 | return attributes.get(attributeName).toList(); | 76 | return attributes.get(attributeName).toList(); |
77 | } | 77 | } |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Executes a consumer over all attributes. A selected attribute name (key) can appear (and thus consumed) multiple times. | 80 | * Executes a consumer over all attributes. A selected attribute name (key) can appear (and thus consumed) multiple times. |
81 | * @since 2.0 | 81 | * @since 2.0 |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/annotations/ParameterReference.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/annotations/ParameterReference.java index c67e9046..199b7291 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/annotations/ParameterReference.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/annotations/ParameterReference.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.annotations; | 9 | package tools.refinery.interpreter.matchers.psystem.annotations; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * An annotation parameter referencing a query parameter by name. Does not check whether the parameter exists. | 12 | * An annotation parameter referencing a query parameter by name. Does not check whether the parameter exists. |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/AggregatorConstraint.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/AggregatorConstraint.java index 56f86e89..41870544 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/AggregatorConstraint.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/AggregatorConstraint.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.basicdeferred; | 9 | package tools.refinery.interpreter.matchers.psystem.basicdeferred; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.HashMap; | 12 | import java.util.HashMap; |
@@ -14,20 +14,20 @@ import java.util.HashSet; | |||
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 17 | import tools.refinery.interpreter.matchers.context.IInputKey; |
18 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 18 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.ITypeInfoProviderConstraint; | 19 | import tools.refinery.interpreter.matchers.psystem.ITypeInfoProviderConstraint; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 20 | import tools.refinery.interpreter.matchers.psystem.PBody; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 21 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.TypeJudgement; | 22 | import tools.refinery.interpreter.matchers.psystem.TypeJudgement; |
23 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.BoundAggregator; | 23 | import tools.refinery.interpreter.matchers.psystem.aggregations.BoundAggregator; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 24 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
25 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 25 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
26 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 26 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * The PSystem representation of an aggregation. | 29 | * The PSystem representation of an aggregation. |
30 | * | 30 | * |
31 | * @author Tamas Szabo | 31 | * @author Tamas Szabo |
32 | * @since 1.4 | 32 | * @since 1.4 |
33 | */ | 33 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/BaseTypeSafeConstraint.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/BaseTypeSafeConstraint.java index 7bc949a8..722e5cb4 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/BaseTypeSafeConstraint.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/BaseTypeSafeConstraint.java | |||
@@ -3,31 +3,31 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem.basicdeferred; | 10 | package tools.refinery.interpreter.matchers.psystem.basicdeferred; |
11 | 11 | ||
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | import java.util.stream.Collectors; | 14 | import java.util.stream.Collectors; |
15 | import java.util.stream.Stream; | 15 | import java.util.stream.Stream; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 17 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
18 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 18 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 19 | import tools.refinery.interpreter.matchers.psystem.PBody; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 20 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.TypeJudgement; | 21 | import tools.refinery.interpreter.matchers.psystem.TypeJudgement; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.VariableDeferredPConstraint; | 22 | import tools.refinery.interpreter.matchers.psystem.VariableDeferredPConstraint; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * @author Gabor Bergmann | 25 | * @author Gabor Bergmann |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | public abstract class BaseTypeSafeConstraint extends | 28 | public abstract class BaseTypeSafeConstraint extends |
29 | VariableDeferredPConstraint { | 29 | VariableDeferredPConstraint { |
30 | 30 | ||
31 | protected Set<PVariable> inputVariables; | 31 | protected Set<PVariable> inputVariables; |
32 | protected PVariable outputVariable; | 32 | protected PVariable outputVariable; |
33 | 33 | ||
@@ -42,9 +42,9 @@ public abstract class BaseTypeSafeConstraint extends | |||
42 | */ | 42 | */ |
43 | public BaseTypeSafeConstraint(PBody pBody, | 43 | public BaseTypeSafeConstraint(PBody pBody, |
44 | Set<PVariable> inputVariables, final PVariable outputVariable) { | 44 | Set<PVariable> inputVariables, final PVariable outputVariable) { |
45 | super(pBody, | 45 | super(pBody, |
46 | (outputVariable == null) ? | 46 | (outputVariable == null) ? |
47 | inputVariables : | 47 | inputVariables : |
48 | Stream.concat(inputVariables.stream(), Stream.of(outputVariable)).collect(Collectors.toSet()) | 48 | Stream.concat(inputVariables.stream(), Stream.of(outputVariable)).collect(Collectors.toSet()) |
49 | ); | 49 | ); |
50 | this.inputVariables = inputVariables; | 50 | this.inputVariables = inputVariables; |
@@ -53,8 +53,8 @@ public abstract class BaseTypeSafeConstraint extends | |||
53 | 53 | ||
54 | @Override | 54 | @Override |
55 | public Set<PVariable> getDeducedVariables() { | 55 | public Set<PVariable> getDeducedVariables() { |
56 | if (outputVariable == null) | 56 | if (outputVariable == null) |
57 | return Collections.emptySet(); | 57 | return Collections.emptySet(); |
58 | else | 58 | else |
59 | return Collections.singleton(outputVariable); | 59 | return Collections.singleton(outputVariable); |
60 | } | 60 | } |
@@ -74,13 +74,13 @@ public abstract class BaseTypeSafeConstraint extends | |||
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Checks whether all type restrictions are already enforced on affected variables. | 76 | * Checks whether all type restrictions are already enforced on affected variables. |
77 | * | 77 | * |
78 | * @param plan | 78 | * @param plan |
79 | * @return a variable whose type safety is not enforced yet, or null if the plan is typesafe | 79 | * @return a variable whose type safety is not enforced yet, or null if the plan is typesafe |
80 | */ | 80 | */ |
81 | public PVariable checkTypeSafety(SubPlan plan, IQueryMetaContext context) { | 81 | public PVariable checkTypeSafety(SubPlan plan, IQueryMetaContext context) { |
82 | Set<TypeJudgement> impliedJudgements = plan.getAllImpliedTypeJudgements(context); | 82 | Set<TypeJudgement> impliedJudgements = plan.getAllImpliedTypeJudgements(context); |
83 | 83 | ||
84 | for (PVariable pVariable : inputVariables) { | 84 | for (PVariable pVariable : inputVariables) { |
85 | Set<TypeJudgement> allTypeRestrictionsForVariable = pBody.getAllUnaryTypeRestrictions(context).get(pVariable); | 85 | Set<TypeJudgement> allTypeRestrictionsForVariable = pBody.getAllUnaryTypeRestrictions(context).get(pVariable); |
86 | if (allTypeRestrictionsForVariable != null && !impliedJudgements.containsAll(allTypeRestrictionsForVariable)) | 86 | if (allTypeRestrictionsForVariable != null && !impliedJudgements.containsAll(allTypeRestrictionsForVariable)) |
@@ -88,12 +88,12 @@ public abstract class BaseTypeSafeConstraint extends | |||
88 | } | 88 | } |
89 | return null; | 89 | return null; |
90 | } | 90 | } |
91 | 91 | ||
92 | @Override | 92 | @Override |
93 | protected void doReplaceVariable(PVariable obsolete, PVariable replacement) { | 93 | protected void doReplaceVariable(PVariable obsolete, PVariable replacement) { |
94 | if (inputVariables.remove(obsolete)) | 94 | if (inputVariables.remove(obsolete)) |
95 | inputVariables.add(replacement); | 95 | inputVariables.add(replacement); |
96 | if (outputVariable == obsolete) | 96 | if (outputVariable == obsolete) |
97 | outputVariable = replacement; | 97 | outputVariable = replacement; |
98 | } | 98 | } |
99 | } | 99 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/Equality.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/Equality.java index b978b62c..7649a80a 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/Equality.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/Equality.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem.basicdeferred; | 10 | package tools.refinery.interpreter.matchers.psystem.basicdeferred; |
11 | 11 | ||
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.HashMap; | 13 | import java.util.HashMap; |
@@ -15,15 +15,15 @@ import java.util.HashSet; | |||
15 | import java.util.Map; | 15 | import java.util.Map; |
16 | import java.util.Set; | 16 | import java.util.Set; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 18 | import tools.refinery.interpreter.matchers.planning.SubPlan; |
19 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | 19 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.DeferredPConstraint; | 20 | import tools.refinery.interpreter.matchers.psystem.DeferredPConstraint; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 21 | import tools.refinery.interpreter.matchers.psystem.PBody; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 22 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * @author Gabor Bergmann | 25 | * @author Gabor Bergmann |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | public class Equality extends DeferredPConstraint { | 28 | public class Equality extends DeferredPConstraint { |
29 | 29 | ||
@@ -45,7 +45,7 @@ public class Equality extends DeferredPConstraint { | |||
45 | 45 | ||
46 | /** | 46 | /** |
47 | * An equality is moot if it compares the a variable with itself. | 47 | * An equality is moot if it compares the a variable with itself. |
48 | * | 48 | * |
49 | * @return true, if the equality is moot | 49 | * @return true, if the equality is moot |
50 | */ | 50 | */ |
51 | public boolean isMoot() { | 51 | public boolean isMoot() { |
@@ -77,7 +77,7 @@ public class Equality extends DeferredPConstraint { | |||
77 | public Set<PVariable> getDeducedVariables() { | 77 | public Set<PVariable> getDeducedVariables() { |
78 | return Collections.emptySet(); | 78 | return Collections.emptySet(); |
79 | } | 79 | } |
80 | 80 | ||
81 | @Override | 81 | @Override |
82 | public Map<Set<PVariable>, Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context) { | 82 | public Map<Set<PVariable>, Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context) { |
83 | final Map<Set<PVariable>, Set<PVariable>> result = new HashMap<Set<PVariable>, Set<PVariable>>(); | 83 | final Map<Set<PVariable>, Set<PVariable>> result = new HashMap<Set<PVariable>, Set<PVariable>>(); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/ExportedParameter.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/ExportedParameter.java index 80706792..246da4ff 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/ExportedParameter.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/ExportedParameter.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem.basicdeferred; | 10 | package tools.refinery.interpreter.matchers.psystem.basicdeferred; |
11 | 11 | ||
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.planning.QueryProcessingException; | 15 | import tools.refinery.interpreter.matchers.planning.QueryProcessingException; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 16 | import tools.refinery.interpreter.matchers.psystem.PBody; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 17 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.VariableDeferredPConstraint; | 18 | import tools.refinery.interpreter.matchers.psystem.VariableDeferredPConstraint; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 19 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 20 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * @author Gabor Bergmann | 23 | * @author Gabor Bergmann |
@@ -58,7 +58,7 @@ public class ExportedParameter extends VariableDeferredPConstraint { | |||
58 | /** | 58 | /** |
59 | * The name of the parameter; usually, it is expected that {@link #getParameterVariable()} is more useful, except | 59 | * The name of the parameter; usually, it is expected that {@link #getParameterVariable()} is more useful, except |
60 | * maybe for debugging purposes. | 60 | * maybe for debugging purposes. |
61 | * | 61 | * |
62 | * @return a non-null name of the parameter | 62 | * @return a non-null name of the parameter |
63 | */ | 63 | */ |
64 | public String getParameterName() { | 64 | public String getParameterName() { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/ExpressionEvaluation.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/ExpressionEvaluation.java index 06688c36..3f090205 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/ExpressionEvaluation.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/ExpressionEvaluation.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.basicdeferred; | 9 | package tools.refinery.interpreter.matchers.psystem.basicdeferred; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -14,11 +14,11 @@ import java.util.LinkedHashSet; | |||
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 17 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.IExpressionEvaluator; | 18 | import tools.refinery.interpreter.matchers.psystem.IExpressionEvaluator; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 19 | import tools.refinery.interpreter.matchers.psystem.PBody; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 20 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
21 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * @author Zoltan Ujhelyi | 24 | * @author Zoltan Ujhelyi |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/Inequality.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/Inequality.java index 5cac33dc..f434accf 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/Inequality.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/Inequality.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem.basicdeferred; | 10 | package tools.refinery.interpreter.matchers.psystem.basicdeferred; |
11 | 11 | ||
12 | import java.util.Arrays; | 12 | import java.util.Arrays; |
13 | import java.util.Collections; | 13 | import java.util.Collections; |
14 | import java.util.HashSet; | 14 | import java.util.HashSet; |
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 17 | import tools.refinery.interpreter.matchers.psystem.PBody; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 18 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.VariableDeferredPConstraint; | 19 | import tools.refinery.interpreter.matchers.psystem.VariableDeferredPConstraint; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @author Gabor Bergmann | 22 | * @author Gabor Bergmann |
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | public class Inequality extends VariableDeferredPConstraint { | 25 | public class Inequality extends VariableDeferredPConstraint { |
26 | 26 | ||
@@ -117,7 +117,7 @@ public class Inequality extends VariableDeferredPConstraint { | |||
117 | /** | 117 | /** |
118 | * The inequality constraint is weak if it can be ignored when who is the same as withWhom, or if any if them is | 118 | * The inequality constraint is weak if it can be ignored when who is the same as withWhom, or if any if them is |
119 | * undeducible. | 119 | * undeducible. |
120 | * | 120 | * |
121 | * @return the weak | 121 | * @return the weak |
122 | */ | 122 | */ |
123 | public boolean isWeak() { | 123 | public boolean isWeak() { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/NegativePatternCall.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/NegativePatternCall.java index 87d9d9fc..add51f99 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/NegativePatternCall.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/NegativePatternCall.java | |||
@@ -3,23 +3,23 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem.basicdeferred; | 10 | package tools.refinery.interpreter.matchers.psystem.basicdeferred; |
11 | 11 | ||
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 15 | import tools.refinery.interpreter.matchers.psystem.PBody; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 16 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 17 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * @author Gabor Bergmann | 21 | * @author Gabor Bergmann |
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | public class NegativePatternCall extends PatternCallBasedDeferred { | 24 | public class NegativePatternCall extends PatternCallBasedDeferred { |
25 | 25 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/PatternCallBasedDeferred.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/PatternCallBasedDeferred.java index 93eeffec..3616a2b1 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/PatternCallBasedDeferred.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/PatternCallBasedDeferred.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem.basicdeferred; | 10 | package tools.refinery.interpreter.matchers.psystem.basicdeferred; |
11 | 11 | ||
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.HashSet; | 13 | import java.util.HashSet; |
14 | import java.util.Set; | 14 | import java.util.Set; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.planning.QueryProcessingException; | 16 | import tools.refinery.interpreter.matchers.planning.QueryProcessingException; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.IQueryReference; | 17 | import tools.refinery.interpreter.matchers.psystem.IQueryReference; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 18 | import tools.refinery.interpreter.matchers.psystem.PBody; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 19 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 20 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.VariableDeferredPConstraint; | 21 | import tools.refinery.interpreter.matchers.psystem.VariableDeferredPConstraint; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 22 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
23 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 23 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * @author Gabor Bergmann | 26 | * @author Gabor Bergmann |
@@ -78,7 +78,7 @@ public abstract class PatternCallBasedDeferred extends VariableDeferredPConstrai | |||
78 | for (PConstraint pConstraint : var.getReferringConstraints()) { | 78 | for (PConstraint pConstraint : var.getReferringConstraints()) { |
79 | if (pConstraint != this | 79 | if (pConstraint != this |
80 | && !(pConstraint instanceof Equality && ((Equality) pConstraint).isMoot())) | 80 | && !(pConstraint instanceof Equality && ((Equality) pConstraint).isMoot())) |
81 | throw new QueryProcessingException ( | 81 | throw new QueryProcessingException( |
82 | "Variable {1} of constraint {2} is not a positively determined part of the pattern, yet it is also affected by {3}.", | 82 | "Variable {1} of constraint {2} is not a positively determined part of the pattern, yet it is also affected by {3}.", |
83 | new String[] { var.toString(), this.toString(), pConstraint.toString() }, | 83 | new String[] { var.toString(), this.toString(), pConstraint.toString() }, |
84 | "Read-only variable can not be deduced", null); | 84 | "Read-only variable can not be deduced", null); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/PatternMatchCounter.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/PatternMatchCounter.java index 0c40d91e..6a6e7dcf 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/PatternMatchCounter.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/PatternMatchCounter.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem.basicdeferred; | 10 | package tools.refinery.interpreter.matchers.psystem.basicdeferred; |
11 | 11 | ||
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.HashMap; | 13 | import java.util.HashMap; |
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 17 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 18 | import tools.refinery.interpreter.matchers.psystem.PBody; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 19 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 20 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
21 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * @author Gabor Bergmann | 24 | * @author Gabor Bergmann |
@@ -37,7 +37,7 @@ public class PatternMatchCounter extends PatternCallBasedDeferred { | |||
37 | public Set<PVariable> getDeducedVariables() { | 37 | public Set<PVariable> getDeducedVariables() { |
38 | return Collections.singleton(resultVariable); | 38 | return Collections.singleton(resultVariable); |
39 | } | 39 | } |
40 | 40 | ||
41 | @Override | 41 | @Override |
42 | public Map<Set<PVariable>, Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context) { | 42 | public Map<Set<PVariable>, Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context) { |
43 | final Map<Set<PVariable>, Set<PVariable>> result = new HashMap<Set<PVariable>, Set<PVariable>>(); | 43 | final Map<Set<PVariable>, Set<PVariable>> result = new HashMap<Set<PVariable>, Set<PVariable>>(); |
@@ -67,4 +67,4 @@ public class PatternMatchCounter extends PatternCallBasedDeferred { | |||
67 | return resultVariable; | 67 | return resultVariable; |
68 | } | 68 | } |
69 | 69 | ||
70 | } \ No newline at end of file | 70 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/RelationEvaluation.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/RelationEvaluation.java index 336a83fb..45ad19bf 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/RelationEvaluation.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/RelationEvaluation.java | |||
@@ -3,33 +3,33 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.basicdeferred; | 9 | package tools.refinery.interpreter.matchers.psystem.basicdeferred; |
10 | 10 | ||
11 | import java.util.List; | 11 | import java.util.List; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.psystem.EnumerablePConstraint; | 13 | import tools.refinery.interpreter.matchers.psystem.EnumerablePConstraint; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.IMultiQueryReference; | 14 | import tools.refinery.interpreter.matchers.psystem.IMultiQueryReference; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.IRelationEvaluator; | 15 | import tools.refinery.interpreter.matchers.psystem.IRelationEvaluator; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 16 | import tools.refinery.interpreter.matchers.psystem.PBody; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 17 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * A constraint which prescribes the evaluation of custom Java logic that takes an arbitrary number of input relations | 21 | * A constraint which prescribes the evaluation of custom Java logic that takes an arbitrary number of input relations |
22 | * and produces one output relation. Contrast this to {@link ExpressionEvaluation}, which produces a single output value | 22 | * and produces one output relation. Contrast this to {@link ExpressionEvaluation}, which produces a single output value |
23 | * given an input tuple. | 23 | * given an input tuple. |
24 | * | 24 | * |
25 | * The assumption is that the relation evaluation logic is not incremental, that is, it can only perform from-scratch | 25 | * The assumption is that the relation evaluation logic is not incremental, that is, it can only perform from-scratch |
26 | * computation of the output relation given the complete input relations. To this end, the relation evaluator always | 26 | * computation of the output relation given the complete input relations. To this end, the relation evaluator always |
27 | * receives the complete input relations with all their contents as input. However, the evaluator engine makes sure that | 27 | * receives the complete input relations with all their contents as input. However, the evaluator engine makes sure that |
28 | * the output of the relation evaluation is at least "seemingly" incremental. This means that the underlying computation | 28 | * the output of the relation evaluation is at least "seemingly" incremental. This means that the underlying computation |
29 | * network computes the delta on the output compared to the previous output and only propagates the delta further. | 29 | * network computes the delta on the output compared to the previous output and only propagates the delta further. |
30 | * | 30 | * |
31 | * @author Tamas Szabo | 31 | * @author Tamas Szabo |
32 | * | 32 | * |
33 | * @since 2.8 | 33 | * @since 2.8 |
34 | * | 34 | * |
35 | */ | 35 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/TypeFilterConstraint.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/TypeFilterConstraint.java index 8b6e29ef..46e67757 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicdeferred/TypeFilterConstraint.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicdeferred/TypeFilterConstraint.java | |||
@@ -3,31 +3,31 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.basicdeferred; | 9 | package tools.refinery.interpreter.matchers.psystem.basicdeferred; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 15 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.TypeConstraint; |
16 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 16 | import tools.refinery.interpreter.matchers.context.IInputKey; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.ITypeConstraint; | 17 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 18 | import tools.refinery.interpreter.matchers.psystem.ITypeConstraint; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 19 | import tools.refinery.interpreter.matchers.psystem.PBody; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.TypeJudgement; | 20 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.VariableDeferredPConstraint; | 21 | import tools.refinery.interpreter.matchers.psystem.TypeJudgement; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 22 | import tools.refinery.interpreter.matchers.psystem.VariableDeferredPConstraint; |
23 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 23 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * Represents a non-enumerable type constraint that asserts that values substituted for the given tuple of variables | 26 | * Represents a non-enumerable type constraint that asserts that values substituted for the given tuple of variables |
27 | * form a tuple that belongs to a (typically non-enumerable) extensional relation identified by an {@link IInputKey}. | 27 | * form a tuple that belongs to a (typically non-enumerable) extensional relation identified by an {@link IInputKey}. |
28 | * | 28 | * |
29 | * <p> The InputKey is typically not enumerable. If it is enumerable, use {@link TypeConstraint} instead, so that the PConstraint carries over the property of enumerability. | 29 | * <p> The InputKey is typically not enumerable. If it is enumerable, use {@link TypeConstraint} instead, so that the PConstraint carries over the property of enumerability. |
30 | * | 30 | * |
31 | * @author Bergmann Gabor | 31 | * @author Bergmann Gabor |
32 | * | 32 | * |
33 | */ | 33 | */ |
@@ -36,26 +36,26 @@ public class TypeFilterConstraint extends VariableDeferredPConstraint implements | |||
36 | 36 | ||
37 | private Tuple variablesTuple; | 37 | private Tuple variablesTuple; |
38 | private IInputKey inputKey; | 38 | private IInputKey inputKey; |
39 | 39 | ||
40 | private TypeJudgement equivalentJudgement; | 40 | private TypeJudgement equivalentJudgement; |
41 | 41 | ||
42 | 42 | ||
43 | public TypeFilterConstraint(PBody pBody, Tuple variablesTuple, IInputKey inputKey) { | 43 | public TypeFilterConstraint(PBody pBody, Tuple variablesTuple, IInputKey inputKey) { |
44 | super(pBody, variablesTuple.<PVariable> getDistinctElements()); | 44 | super(pBody, variablesTuple.<PVariable> getDistinctElements()); |
45 | this.equivalentJudgement = new TypeJudgement(inputKey, variablesTuple); | 45 | this.equivalentJudgement = new TypeJudgement(inputKey, variablesTuple); |
46 | 46 | ||
47 | this.variablesTuple = variablesTuple; | 47 | this.variablesTuple = variablesTuple; |
48 | this.inputKey = inputKey; | 48 | this.inputKey = inputKey; |
49 | 49 | ||
50 | if (variablesTuple.getSize() != inputKey.getArity()) | 50 | if (variablesTuple.getSize() != inputKey.getArity()) |
51 | throw new IllegalArgumentException( | 51 | throw new IllegalArgumentException( |
52 | this.getClass().getSimpleName() + | 52 | this.getClass().getSimpleName() + |
53 | " applied for variable tuple " + variablesTuple + " having wrong arity for input key " + | 53 | " applied for variable tuple " + variablesTuple + " having wrong arity for input key " + |
54 | inputKey); | 54 | inputKey); |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
58 | 58 | ||
59 | public Tuple getVariablesTuple() { | 59 | public Tuple getVariablesTuple() { |
60 | return variablesTuple; | 60 | return variablesTuple; |
61 | } | 61 | } |
@@ -94,12 +94,12 @@ public class TypeFilterConstraint extends VariableDeferredPConstraint implements | |||
94 | protected String toStringRest() { | 94 | protected String toStringRest() { |
95 | return inputKey.getPrettyPrintableName() + "@" + variablesTuple; | 95 | return inputKey.getPrettyPrintableName() + "@" + variablesTuple; |
96 | } | 96 | } |
97 | 97 | ||
98 | @Override | 98 | @Override |
99 | public Map<Set<PVariable>, Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context) { | 99 | public Map<Set<PVariable>, Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context) { |
100 | return TypeConstraintUtil.getFunctionalDependencies(context, inputKey, variablesTuple); | 100 | return TypeConstraintUtil.getFunctionalDependencies(context, inputKey, variablesTuple); |
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
104 | 104 | ||
105 | } | 105 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/AbstractTransitiveClosure.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/AbstractTransitiveClosure.java index 7bbf7118..ad60e3cc 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/AbstractTransitiveClosure.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/AbstractTransitiveClosure.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.basicenumerables; | 9 | package tools.refinery.interpreter.matchers.psystem.basicenumerables; |
10 | 10 | ||
11 | import java.util.Set; | 11 | import java.util.Set; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 13 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.IQueryReference; | 14 | import tools.refinery.interpreter.matchers.psystem.IQueryReference; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.ITypeInfoProviderConstraint; | 15 | import tools.refinery.interpreter.matchers.psystem.ITypeInfoProviderConstraint; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.KeyedEnumerablePConstraint; | 16 | import tools.refinery.interpreter.matchers.psystem.KeyedEnumerablePConstraint; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 17 | import tools.refinery.interpreter.matchers.psystem.PBody; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.TypeJudgement; | 18 | import tools.refinery.interpreter.matchers.psystem.TypeJudgement; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 19 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
20 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 20 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * @since 2.0 | 23 | * @since 2.0 |
@@ -41,4 +41,4 @@ public abstract class AbstractTransitiveClosure extends KeyedEnumerablePConstrai | |||
41 | return PositivePatternCall.getTypesImpliedByCall(supplierKey, variablesTuple); | 41 | return PositivePatternCall.getTypesImpliedByCall(supplierKey, variablesTuple); |
42 | } | 42 | } |
43 | 43 | ||
44 | } \ No newline at end of file | 44 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/BinaryReflexiveTransitiveClosure.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/BinaryReflexiveTransitiveClosure.java index e3dae240..a7c7fae7 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/BinaryReflexiveTransitiveClosure.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/BinaryReflexiveTransitiveClosure.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem.basicenumerables; | 10 | package tools.refinery.interpreter.matchers.psystem.basicenumerables; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 12 | import tools.refinery.interpreter.matchers.planning.QueryProcessingException; |
13 | import tools.refinery.viatra.runtime.matchers.planning.QueryProcessingException; | 13 | import tools.refinery.interpreter.matchers.context.IInputKey; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 14 | import tools.refinery.interpreter.matchers.psystem.PBody; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 15 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 16 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * For a binary base pattern over an enumerable universe type, computes the reflexive transitive closure (base)* | 19 | * For a binary base pattern over an enumerable universe type, computes the reflexive transitive closure (base)* |
20 | * | 20 | * |
21 | * @author Gabor Bergmann, Zoltan Ujhelyi | 21 | * @author Gabor Bergmann, Zoltan Ujhelyi |
22 | * @since 2.0 | 22 | * @since 2.0 |
23 | */ | 23 | */ |
@@ -37,7 +37,7 @@ public class BinaryReflexiveTransitiveClosure extends AbstractTransitiveClosure | |||
37 | } | 37 | } |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Returns the type whose instances should be returned as 0-long paths. | 40 | * Returns the type whose instances should be returned as 0-long paths. |
41 | * @since 2.0 | 41 | * @since 2.0 |
42 | */ | 42 | */ |
43 | public IInputKey getUniverseType() { | 43 | public IInputKey getUniverseType() { |
@@ -53,5 +53,5 @@ public class BinaryReflexiveTransitiveClosure extends AbstractTransitiveClosure | |||
53 | pBody.getPattern()); | 53 | pBody.getPattern()); |
54 | } | 54 | } |
55 | } | 55 | } |
56 | 56 | ||
57 | } | 57 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/BinaryTransitiveClosure.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/BinaryTransitiveClosure.java index 716d043b..ae961cea 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/BinaryTransitiveClosure.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/BinaryTransitiveClosure.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem.basicenumerables; | 10 | package tools.refinery.interpreter.matchers.psystem.basicenumerables; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 12 | import tools.refinery.interpreter.matchers.psystem.PBody; |
13 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 13 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
14 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 14 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * For a binary base pattern, computes the irreflexive transitive closure (base)+ | 17 | * For a binary base pattern, computes the irreflexive transitive closure (base)+ |
18 | * | 18 | * |
19 | * @author Gabor Bergmann | 19 | * @author Gabor Bergmann |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | public class BinaryTransitiveClosure extends AbstractTransitiveClosure { | 22 | public class BinaryTransitiveClosure extends AbstractTransitiveClosure { |
23 | 23 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/Connectivity.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/Connectivity.java index 10da2e21..8127926b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/Connectivity.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/Connectivity.java | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.viatra.runtime.matchers.psystem.basicenumerables; | 6 | package tools.refinery.interpreter.matchers.psystem.basicenumerables; |
7 | 7 | ||
8 | public enum Connectivity { | 8 | public enum Connectivity { |
9 | WEAK, | 9 | WEAK, |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/ConstantValue.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/ConstantValue.java index 251146c8..21950a7b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/ConstantValue.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/ConstantValue.java | |||
@@ -3,26 +3,26 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem.basicenumerables; | 10 | package tools.refinery.interpreter.matchers.psystem.basicenumerables; |
11 | 11 | ||
12 | import java.util.Collections; | 12 | import java.util.Collections; |
13 | import java.util.HashMap; | 13 | import java.util.HashMap; |
14 | import java.util.Map; | 14 | import java.util.Map; |
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 17 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.KeyedEnumerablePConstraint; | 18 | import tools.refinery.interpreter.matchers.psystem.KeyedEnumerablePConstraint; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 19 | import tools.refinery.interpreter.matchers.psystem.PBody; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 20 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
21 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * @author Gabor Bergmann | 24 | * @author Gabor Bergmann |
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | public class ConstantValue extends KeyedEnumerablePConstraint<Object> { | 27 | public class ConstantValue extends KeyedEnumerablePConstraint<Object> { |
28 | 28 | ||
@@ -37,14 +37,14 @@ public class ConstantValue extends KeyedEnumerablePConstraint<Object> { | |||
37 | protected String keyToString() { | 37 | protected String keyToString() { |
38 | return supplierKey.toString(); | 38 | return supplierKey.toString(); |
39 | } | 39 | } |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * @since 1.7 | 42 | * @since 1.7 |
43 | */ | 43 | */ |
44 | public PVariable getVariable() { | 44 | public PVariable getVariable() { |
45 | return variable; | 45 | return variable; |
46 | } | 46 | } |
47 | 47 | ||
48 | @Override | 48 | @Override |
49 | public Map<Set<PVariable>, Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context) { | 49 | public Map<Set<PVariable>, Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context) { |
50 | final Map<Set<PVariable>, Set<PVariable>> result = new HashMap<Set<PVariable>, Set<PVariable>>(); | 50 | final Map<Set<PVariable>, Set<PVariable>> result = new HashMap<Set<PVariable>, Set<PVariable>>(); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/PositivePatternCall.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/PositivePatternCall.java index 25ab34b4..be3556d0 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/PositivePatternCall.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/PositivePatternCall.java | |||
@@ -3,25 +3,25 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem.basicenumerables; | 10 | package tools.refinery.interpreter.matchers.psystem.basicenumerables; |
11 | 11 | ||
12 | import java.util.HashSet; | 12 | import java.util.HashSet; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 15 | import tools.refinery.interpreter.matchers.context.IInputKey; |
16 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 16 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.IQueryReference; | 17 | import tools.refinery.interpreter.matchers.psystem.IQueryReference; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.ITypeInfoProviderConstraint; | 18 | import tools.refinery.interpreter.matchers.psystem.ITypeInfoProviderConstraint; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.KeyedEnumerablePConstraint; | 19 | import tools.refinery.interpreter.matchers.psystem.KeyedEnumerablePConstraint; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 20 | import tools.refinery.interpreter.matchers.psystem.PBody; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.TypeJudgement; | 21 | import tools.refinery.interpreter.matchers.psystem.TypeJudgement; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 22 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
23 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 23 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
24 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 24 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * @author Gabor Bergmann | 27 | * @author Gabor Bergmann |
@@ -60,15 +60,15 @@ public class PositivePatternCall extends KeyedEnumerablePConstraint<PQuery> impl | |||
60 | */ | 60 | */ |
61 | public static Set<TypeJudgement> getTypesImpliedByCall(PQuery calledQuery, Tuple actualParametersTuple) { | 61 | public static Set<TypeJudgement> getTypesImpliedByCall(PQuery calledQuery, Tuple actualParametersTuple) { |
62 | Set<TypeJudgement> result = new HashSet<TypeJudgement>(); | 62 | Set<TypeJudgement> result = new HashSet<TypeJudgement>(); |
63 | for (TypeJudgement parameterJudgement : calledQuery.getTypeGuarantees()) { | 63 | for (TypeJudgement parameterJudgement : calledQuery.getTypeGuarantees()) { |
64 | IInputKey inputKey = parameterJudgement.getInputKey(); | 64 | IInputKey inputKey = parameterJudgement.getInputKey(); |
65 | Tuple judgementIndexTuple = parameterJudgement.getVariablesTuple(); | 65 | Tuple judgementIndexTuple = parameterJudgement.getVariablesTuple(); |
66 | 66 | ||
67 | Object[] judgementVariables = new Object[judgementIndexTuple.getSize()]; | 67 | Object[] judgementVariables = new Object[judgementIndexTuple.getSize()]; |
68 | for (int i=0; i<judgementVariables.length; ++i) | 68 | for (int i=0; i<judgementVariables.length; ++i) |
69 | judgementVariables[i] = actualParametersTuple.get((int) judgementIndexTuple.get(i)); | 69 | judgementVariables[i] = actualParametersTuple.get((int) judgementIndexTuple.get(i)); |
70 | 70 | ||
71 | result.add(new TypeJudgement(inputKey, Tuples.flatTupleOf(judgementVariables))); | 71 | result.add(new TypeJudgement(inputKey, Tuples.flatTupleOf(judgementVariables))); |
72 | } | 72 | } |
73 | return result; | 73 | return result; |
74 | } | 74 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/RepresentativeElectionConstraint.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/RepresentativeElectionConstraint.java index b97ff55f..8edcb0b3 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/RepresentativeElectionConstraint.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/RepresentativeElectionConstraint.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.viatra.runtime.matchers.psystem.basicenumerables; | 6 | package tools.refinery.interpreter.matchers.psystem.basicenumerables; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 8 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
9 | import tools.refinery.viatra.runtime.matchers.psystem.*; | 9 | import tools.refinery.interpreter.matchers.psystem.*; |
10 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 10 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
11 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 11 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
12 | 12 | ||
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
@@ -17,7 +17,7 @@ public class RepresentativeElectionConstraint extends KeyedEnumerablePConstraint | |||
17 | private final Connectivity connectivity; | 17 | private final Connectivity connectivity; |
18 | 18 | ||
19 | public RepresentativeElectionConstraint(PBody pBody, Tuple variablesTuple, PQuery supplierKey, | 19 | public RepresentativeElectionConstraint(PBody pBody, Tuple variablesTuple, PQuery supplierKey, |
20 | Connectivity connectivity) { | 20 | Connectivity connectivity) { |
21 | super(pBody, variablesTuple, supplierKey); | 21 | super(pBody, variablesTuple, supplierKey); |
22 | this.connectivity = connectivity; | 22 | this.connectivity = connectivity; |
23 | } | 23 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/TypeConstraint.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/TypeConstraint.java index 2ca54cc0..cc3b8d12 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/basicenumerables/TypeConstraint.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/basicenumerables/TypeConstraint.java | |||
@@ -3,26 +3,26 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.basicenumerables; | 9 | package tools.refinery.interpreter.matchers.psystem.basicenumerables; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Map; | 12 | import java.util.Map; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 15 | import tools.refinery.interpreter.matchers.context.IInputKey; |
16 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 16 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.ITypeConstraint; | 17 | import tools.refinery.interpreter.matchers.psystem.ITypeConstraint; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.KeyedEnumerablePConstraint; | 18 | import tools.refinery.interpreter.matchers.psystem.KeyedEnumerablePConstraint; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 19 | import tools.refinery.interpreter.matchers.psystem.PBody; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 20 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.TypeJudgement; | 21 | import tools.refinery.interpreter.matchers.psystem.TypeJudgement; |
22 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 22 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Represents an enumerable type constraint that asserts that values substituted for the given tuple of variables | 25 | * Represents an enumerable type constraint that asserts that values substituted for the given tuple of variables |
26 | * form a tuple that belongs to an enumerable extensional relation identified by an {@link IInputKey}. | 26 | * form a tuple that belongs to an enumerable extensional relation identified by an {@link IInputKey}. |
27 | * | 27 | * |
28 | * <p> The InputKey must be enumerable! | 28 | * <p> The InputKey must be enumerable! |
@@ -31,22 +31,22 @@ import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | |||
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | public class TypeConstraint extends KeyedEnumerablePConstraint<IInputKey> implements ITypeConstraint { | 33 | public class TypeConstraint extends KeyedEnumerablePConstraint<IInputKey> implements ITypeConstraint { |
34 | 34 | ||
35 | private TypeJudgement equivalentJudgement; | 35 | private TypeJudgement equivalentJudgement; |
36 | 36 | ||
37 | public TypeConstraint(PBody pBody, Tuple variablesTuple, IInputKey inputKey) { | 37 | public TypeConstraint(PBody pBody, Tuple variablesTuple, IInputKey inputKey) { |
38 | super(pBody, variablesTuple, inputKey); | 38 | super(pBody, variablesTuple, inputKey); |
39 | this.equivalentJudgement = new TypeJudgement(inputKey, variablesTuple); | 39 | this.equivalentJudgement = new TypeJudgement(inputKey, variablesTuple); |
40 | 40 | ||
41 | if (! inputKey.isEnumerable()) | 41 | if (! inputKey.isEnumerable()) |
42 | throw new IllegalArgumentException( | 42 | throw new IllegalArgumentException( |
43 | this.getClass().getSimpleName() + | 43 | this.getClass().getSimpleName() + |
44 | " applicable for enumerable input keys only; received instead " + | 44 | " applicable for enumerable input keys only; received instead " + |
45 | inputKey); | 45 | inputKey); |
46 | if (variablesTuple.getSize() != inputKey.getArity()) | 46 | if (variablesTuple.getSize() != inputKey.getArity()) |
47 | throw new IllegalArgumentException( | 47 | throw new IllegalArgumentException( |
48 | this.getClass().getSimpleName() + | 48 | this.getClass().getSimpleName() + |
49 | " applied for variable tuple " + variablesTuple + " having wrong arity for input key " + | 49 | " applied for variable tuple " + variablesTuple + " having wrong arity for input key " + |
50 | inputKey); | 50 | inputKey); |
51 | } | 51 | } |
52 | 52 | ||
@@ -54,7 +54,7 @@ public class TypeConstraint extends KeyedEnumerablePConstraint<IInputKey> implem | |||
54 | protected String keyToString() { | 54 | protected String keyToString() { |
55 | return supplierKey.getPrettyPrintableName(); | 55 | return supplierKey.getPrettyPrintableName(); |
56 | } | 56 | } |
57 | 57 | ||
58 | @Override | 58 | @Override |
59 | public TypeJudgement getEquivalentJudgement() { | 59 | public TypeJudgement getEquivalentJudgement() { |
60 | return equivalentJudgement; | 60 | return equivalentJudgement; |
@@ -65,7 +65,7 @@ public class TypeConstraint extends KeyedEnumerablePConstraint<IInputKey> implem | |||
65 | return Collections.singleton(equivalentJudgement); | 65 | return Collections.singleton(equivalentJudgement); |
66 | //return equivalentJudgement.getDirectlyImpliedJudgements(context); | 66 | //return equivalentJudgement.getDirectlyImpliedJudgements(context); |
67 | } | 67 | } |
68 | 68 | ||
69 | @Override | 69 | @Override |
70 | public Map<Set<PVariable>, Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context) { | 70 | public Map<Set<PVariable>, Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context) { |
71 | return TypeConstraintUtil.getFunctionalDependencies(context, supplierKey, variablesTuple); | 71 | return TypeConstraintUtil.getFunctionalDependencies(context, supplierKey, variablesTuple); |
@@ -76,4 +76,4 @@ public class TypeConstraint extends KeyedEnumerablePConstraint<IInputKey> implem | |||
76 | super.doReplaceVariable(obsolete, replacement); | 76 | super.doReplaceVariable(obsolete, replacement); |
77 | this.equivalentJudgement = new TypeJudgement(getSupplierKey(), variablesTuple); | 77 | this.equivalentJudgement = new TypeJudgement(getSupplierKey(), variablesTuple); |
78 | } | 78 | } |
79 | } \ No newline at end of file | 79 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/BasePQuery.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/BasePQuery.java index 2c03a894..06f01f57 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/BasePQuery.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/BasePQuery.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.queries; | 9 | package tools.refinery.interpreter.matchers.psystem.queries; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collections; | 12 | import java.util.Collections; |
@@ -18,19 +18,19 @@ import java.util.Set; | |||
18 | import java.util.stream.Collectors; | 18 | import java.util.stream.Collectors; |
19 | import java.util.stream.Stream; | 19 | import java.util.stream.Stream; |
20 | 20 | ||
21 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | 21 | import tools.refinery.interpreter.matchers.psystem.annotations.PAnnotation; |
22 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendFactory; | 22 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; |
23 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 23 | import tools.refinery.interpreter.matchers.backend.IQueryBackendFactory; |
24 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 24 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 25 | import tools.refinery.interpreter.matchers.context.IInputKey; |
26 | import tools.refinery.viatra.runtime.matchers.psystem.TypeJudgement; | 26 | import tools.refinery.interpreter.matchers.psystem.PBody; |
27 | import tools.refinery.viatra.runtime.matchers.psystem.annotations.PAnnotation; | 27 | import tools.refinery.interpreter.matchers.psystem.TypeJudgement; |
28 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 28 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
29 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 29 | import tools.refinery.interpreter.matchers.util.Preconditions; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Default implementation of PQuery. | 32 | * Default implementation of PQuery. |
33 | * | 33 | * |
34 | * @author Bergmann Gabor | 34 | * @author Bergmann Gabor |
35 | */ | 35 | */ |
36 | public abstract class BasePQuery implements PQuery { | 36 | public abstract class BasePQuery implements PQuery { |
@@ -45,7 +45,7 @@ public abstract class BasePQuery implements PQuery { | |||
45 | private QueryEvaluationHint evaluationHints = new QueryEvaluationHint(null, (IQueryBackendFactory)null); | 45 | private QueryEvaluationHint evaluationHints = new QueryEvaluationHint(null, (IQueryBackendFactory)null); |
46 | PDisjunction canonicalDisjunction; | 46 | PDisjunction canonicalDisjunction; |
47 | private List<String> parameterNames = null; // Lazy initialization | 47 | private List<String> parameterNames = null; // Lazy initialization |
48 | 48 | ||
49 | /** For traceability only. */ | 49 | /** For traceability only. */ |
50 | private List<Object> wrappingQuerySpecifications = new ArrayList<Object>(1); | 50 | private List<Object> wrappingQuerySpecifications = new ArrayList<Object>(1); |
51 | 51 | ||
@@ -115,7 +115,7 @@ public abstract class BasePQuery implements PQuery { | |||
115 | ensureInitialized(); | 115 | ensureInitialized(); |
116 | return annotations.stream().filter(Objects::nonNull).filter(annotation -> Objects.equals(name, annotation.getName())); | 116 | return annotations.stream().filter(Objects::nonNull).filter(annotation -> Objects.equals(name, annotation.getName())); |
117 | } | 117 | } |
118 | 118 | ||
119 | @Override | 119 | @Override |
120 | public List<PAnnotation> getAnnotationsByName(final String annotationName) { | 120 | public List<PAnnotation> getAnnotationsByName(final String annotationName) { |
121 | return getAnnotationStreamByName(annotationName).collect(Collectors.toList()); | 121 | return getAnnotationStreamByName(annotationName).collect(Collectors.toList()); |
@@ -130,7 +130,7 @@ public abstract class BasePQuery implements PQuery { | |||
130 | public List<String> getParameterNames() { | 130 | public List<String> getParameterNames() { |
131 | ensureInitialized(); | 131 | ensureInitialized(); |
132 | if (parameterNames == null) { | 132 | if (parameterNames == null) { |
133 | parameterNames = getParameters().stream().map(PParameter::getName).collect(Collectors.toList()); | 133 | parameterNames = getParameters().stream().map(PParameter::getName).collect(Collectors.toList()); |
134 | } | 134 | } |
135 | return parameterNames; | 135 | return parameterNames; |
136 | } | 136 | } |
@@ -152,12 +152,12 @@ public abstract class BasePQuery implements PQuery { | |||
152 | public List<Object> publishedAs() { | 152 | public List<Object> publishedAs() { |
153 | return wrappingQuerySpecifications; | 153 | return wrappingQuerySpecifications; |
154 | } | 154 | } |
155 | 155 | ||
156 | @Override | 156 | @Override |
157 | public Set<TypeJudgement> getTypeGuarantees() { | 157 | public Set<TypeJudgement> getTypeGuarantees() { |
158 | ensureInitialized(); | 158 | ensureInitialized(); |
159 | Set<TypeJudgement> result = new HashSet<TypeJudgement>(); | 159 | Set<TypeJudgement> result = new HashSet<TypeJudgement>(); |
160 | 160 | ||
161 | List<PParameter> parameters = getParameters(); | 161 | List<PParameter> parameters = getParameters(); |
162 | for (int i=0; i<parameters.size(); ++i) { | 162 | for (int i=0; i<parameters.size(); ++i) { |
163 | PParameter parameter = parameters.get(i); | 163 | PParameter parameter = parameters.get(i); |
@@ -166,10 +166,10 @@ public abstract class BasePQuery implements PQuery { | |||
166 | result.add(new TypeJudgement(declaredUnaryType, Tuples.staticArityFlatTupleOf(i))); | 166 | result.add(new TypeJudgement(declaredUnaryType, Tuples.staticArityFlatTupleOf(i))); |
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | return result; | 170 | return result; |
171 | } | 171 | } |
172 | 172 | ||
173 | /** | 173 | /** |
174 | * @since 2.0 | 174 | * @since 2.0 |
175 | */ | 175 | */ |
@@ -209,9 +209,9 @@ public abstract class BasePQuery implements PQuery { | |||
209 | 209 | ||
210 | /** | 210 | /** |
211 | * Creates and returns the bodies of the query. If recalled again, a new instance is created. | 211 | * Creates and returns the bodies of the query. If recalled again, a new instance is created. |
212 | * | 212 | * |
213 | * @return | 213 | * @return |
214 | * @throws ViatraQueryRuntimeException | 214 | * @throws InterpreterRuntimeException |
215 | */ | 215 | */ |
216 | protected abstract Set<PBody> doGetContainedBodies(); | 216 | protected abstract Set<PBody> doGetContainedBodies(); |
217 | 217 | ||
@@ -227,5 +227,5 @@ public abstract class BasePQuery implements PQuery { | |||
227 | public PVisibility getVisibility() { | 227 | public PVisibility getVisibility() { |
228 | return visibility; | 228 | return visibility; |
229 | } | 229 | } |
230 | 230 | ||
231 | } \ No newline at end of file | 231 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PDisjunction.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PDisjunction.java index eae4eacf..7f1cfd01 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PDisjunction.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PDisjunction.java | |||
@@ -3,25 +3,25 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.queries; | 9 | package tools.refinery.interpreter.matchers.psystem.queries; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.LinkedHashSet; | 12 | import java.util.LinkedHashSet; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | import java.util.stream.Collectors; | 14 | import java.util.stream.Collectors; |
15 | 15 | ||
16 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 16 | import tools.refinery.interpreter.matchers.psystem.PBody; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * | 19 | * |
20 | * A disjunction is a set of bodies representing separate conditions. A {@link PQuery} has a single, canonical | 20 | * A disjunction is a set of bodies representing separate conditions. A {@link PQuery} has a single, canonical |
21 | * PDisjunction, that can be replaced using rewriter | 21 | * PDisjunction, that can be replaced using rewriter |
22 | * | 22 | * |
23 | * @author Zoltan Ujhelyi | 23 | * @author Zoltan Ujhelyi |
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | public class PDisjunction { | 26 | public class PDisjunction { |
27 | 27 | ||
@@ -41,7 +41,7 @@ public class PDisjunction { | |||
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Returns an immutable set of bodies that consists of this disjunction | 43 | * Returns an immutable set of bodies that consists of this disjunction |
44 | * | 44 | * |
45 | * @return the bodies | 45 | * @return the bodies |
46 | */ | 46 | */ |
47 | public Set<PBody> getBodies() { | 47 | public Set<PBody> getBodies() { |
@@ -57,7 +57,7 @@ public class PDisjunction { | |||
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Returns all queries directly referred in the constraints. They are all required to evaluate this query | 59 | * Returns all queries directly referred in the constraints. They are all required to evaluate this query |
60 | * | 60 | * |
61 | * @return a non-null, but possibly empty list of query definitions | 61 | * @return a non-null, but possibly empty list of query definitions |
62 | */ | 62 | */ |
63 | public Set<PQuery> getDirectReferredQueries() { | 63 | public Set<PQuery> getDirectReferredQueries() { |
@@ -68,7 +68,7 @@ public class PDisjunction { | |||
68 | 68 | ||
69 | /** | 69 | /** |
70 | * Returns all queries required to evaluate this query (transitively). | 70 | * Returns all queries required to evaluate this query (transitively). |
71 | * | 71 | * |
72 | * @return a non-null, but possibly empty list of query definitions | 72 | * @return a non-null, but possibly empty list of query definitions |
73 | */ | 73 | */ |
74 | public Set<PQuery> getAllReferredQueries() { | 74 | public Set<PQuery> getAllReferredQueries() { |
@@ -76,7 +76,7 @@ public class PDisjunction { | |||
76 | processedQueries.add(this.getQuery()); | 76 | processedQueries.add(this.getQuery()); |
77 | Set<PQuery> foundQueries = getDirectReferredQueries(); | 77 | Set<PQuery> foundQueries = getDirectReferredQueries(); |
78 | Set<PQuery> newQueries = new LinkedHashSet<>(foundQueries); | 78 | Set<PQuery> newQueries = new LinkedHashSet<>(foundQueries); |
79 | 79 | ||
80 | while(!processedQueries.containsAll(newQueries)) { | 80 | while(!processedQueries.containsAll(newQueries)) { |
81 | PQuery query = newQueries.iterator().next(); | 81 | PQuery query = newQueries.iterator().next(); |
82 | processedQueries.add(query); | 82 | processedQueries.add(query); |
@@ -88,10 +88,10 @@ public class PDisjunction { | |||
88 | } | 88 | } |
89 | return foundQueries; | 89 | return foundQueries; |
90 | } | 90 | } |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * Decides whether a disjunction is mutable. A disjunction is mutable if all its contained bodies are mutable. | 93 | * Decides whether a disjunction is mutable. A disjunction is mutable if all its contained bodies are mutable. |
94 | * | 94 | * |
95 | */ | 95 | */ |
96 | public boolean isMutable() { | 96 | public boolean isMutable() { |
97 | for (PBody body : bodies) { | 97 | for (PBody body : bodies) { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PParameter.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PParameter.java index 07165aa2..8aa26198 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PParameter.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PParameter.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.queries; | 9 | package tools.refinery.interpreter.matchers.psystem.queries; |
10 | 10 | ||
11 | import java.util.Objects; | 11 | import java.util.Objects; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 13 | import tools.refinery.interpreter.matchers.context.IInputKey; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * A descriptor for declared PQuery parameters. A parameter has a name, a declared type and a direction constraint | 16 | * A descriptor for declared PQuery parameters. A parameter has a name, a declared type and a direction constraint |
@@ -70,7 +70,7 @@ public class PParameter { | |||
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Returns a textual representation of the declared type of the parameter | 72 | * Returns a textual representation of the declared type of the parameter |
73 | * | 73 | * |
74 | * @return the type description, or null if not available | 74 | * @return the type description, or null if not available |
75 | */ | 75 | */ |
76 | public String getTypeName() { | 76 | public String getTypeName() { |
@@ -79,7 +79,7 @@ public class PParameter { | |||
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Yield an {@link IInputKey} representation of the type declared for this parameter. | 81 | * Yield an {@link IInputKey} representation of the type declared for this parameter. |
82 | * | 82 | * |
83 | * @return the unary type that was declared on this parameter in the query header, or null if not available | 83 | * @return the unary type that was declared on this parameter in the query header, or null if not available |
84 | */ | 84 | */ |
85 | public IInputKey getDeclaredUnaryType() { | 85 | public IInputKey getDeclaredUnaryType() { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PParameterDirection.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PParameterDirection.java index c94d4797..d8bdda61 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PParameterDirection.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PParameterDirection.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.queries; | 9 | package tools.refinery.interpreter.matchers.psystem.queries; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Values of this enum describe a constraint to the calling of patterns regarding its parameters. | 12 | * Values of this enum describe a constraint to the calling of patterns regarding its parameters. |
13 | * | 13 | * |
14 | * @author Grill Balázs | 14 | * @author Grill Balázs |
15 | * @since 1.4 | 15 | * @since 1.4 |
16 | * | 16 | * |
@@ -21,15 +21,15 @@ public enum PParameterDirection { | |||
21 | * Default value, no additional constraint is applied | 21 | * Default value, no additional constraint is applied |
22 | */ | 22 | */ |
23 | INOUT, | 23 | INOUT, |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * The parameters marked with this constraints shall be set to a value before calling the pattern | 26 | * The parameters marked with this constraints shall be set to a value before calling the pattern |
27 | */ | 27 | */ |
28 | IN, | 28 | IN, |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * The parameters marked with this constraints shall not be set to a value before calling the pattern | 31 | * The parameters marked with this constraints shall not be set to a value before calling the pattern |
32 | */ | 32 | */ |
33 | OUT | 33 | OUT |
34 | 34 | ||
35 | } | 35 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PProblem.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PProblem.java index 1fe4f541..03405420 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PProblem.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PProblem.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.queries; | 9 | package tools.refinery.interpreter.matchers.psystem.queries; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.planning.QueryProcessingException; | 11 | import tools.refinery.interpreter.matchers.planning.QueryProcessingException; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Represents an error that was detected while the {@link PQuery} object was built from a source. | 14 | * Represents an error that was detected while the {@link PQuery} object was built from a source. |
@@ -18,7 +18,7 @@ import tools.refinery.viatra.runtime.matchers.planning.QueryProcessingException; | |||
18 | public class PProblem { | 18 | public class PProblem { |
19 | 19 | ||
20 | private final String shortMessage; | 20 | private final String shortMessage; |
21 | private final String location; | 21 | private final String location; |
22 | private final Exception exception; | 22 | private final Exception exception; |
23 | 23 | ||
24 | public PProblem(String shortMessage) { | 24 | public PProblem(String shortMessage) { |
@@ -36,7 +36,7 @@ public class PProblem { | |||
36 | public PProblem(Exception exception, String shortMessage) { | 36 | public PProblem(Exception exception, String shortMessage) { |
37 | this(exception, shortMessage, null, null); | 37 | this(exception, shortMessage, null, null); |
38 | } | 38 | } |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * @since 2.0 | 41 | * @since 2.0 |
42 | */ | 42 | */ |
@@ -64,5 +64,5 @@ public class PProblem { | |||
64 | public String getLocation() { | 64 | public String getLocation() { |
65 | return location; | 65 | return location; |
66 | } | 66 | } |
67 | 67 | ||
68 | } | 68 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PQueries.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PQueries.java index 56f8ca76..a4898d09 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PQueries.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PQueries.java | |||
@@ -3,10 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.queries; | 9 | package tools.refinery.interpreter.matchers.psystem.queries; |
10 | |||
11 | import tools.refinery.interpreter.matchers.context.IInputKey; | ||
12 | import tools.refinery.interpreter.matchers.psystem.IMultiQueryReference; | ||
13 | import tools.refinery.interpreter.matchers.psystem.ITypeConstraint; | ||
14 | import tools.refinery.interpreter.matchers.psystem.PBody; | ||
15 | import tools.refinery.interpreter.matchers.psystem.PTraceable; | ||
16 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.TypeConstraint; | ||
10 | 17 | ||
11 | import java.util.HashSet; | 18 | import java.util.HashSet; |
12 | import java.util.Set; | 19 | import java.util.Set; |
@@ -14,14 +21,6 @@ import java.util.function.Function; | |||
14 | import java.util.function.Predicate; | 21 | import java.util.function.Predicate; |
15 | import java.util.stream.Stream; | 22 | import java.util.stream.Stream; |
16 | 23 | ||
17 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | ||
18 | import tools.refinery.viatra.runtime.matchers.psystem.IMultiQueryReference; | ||
19 | import tools.refinery.viatra.runtime.matchers.psystem.ITypeConstraint; | ||
20 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | ||
21 | import tools.refinery.viatra.runtime.matchers.psystem.PTraceable; | ||
22 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
23 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery.PQueryStatus; | ||
24 | |||
25 | /** | 24 | /** |
26 | * Utility class for using PQueries in functional/streaming collection operations effectively | 25 | * Utility class for using PQueries in functional/streaming collection operations effectively |
27 | * | 26 | * |
@@ -40,7 +39,7 @@ public final class PQueries { | |||
40 | * Predicate checking for the status of selected queries | 39 | * Predicate checking for the status of selected queries |
41 | * | 40 | * |
42 | */ | 41 | */ |
43 | public static Predicate<PQuery> queryStatusPredicate(final PQueryStatus status) { | 42 | public static Predicate<PQuery> queryStatusPredicate(final PQuery.PQueryStatus status) { |
44 | return query -> query.getStatus().equals(status); | 43 | return query -> query.getStatus().equals(status); |
45 | } | 44 | } |
46 | 45 | ||
@@ -54,7 +53,7 @@ public final class PQueries { | |||
54 | 53 | ||
55 | /** | 54 | /** |
56 | * Enumerates directly referred extensional relations (without duplicates) in the canonical form of the given query | 55 | * Enumerates directly referred extensional relations (without duplicates) in the canonical form of the given query |
57 | * | 56 | * |
58 | * @param enumerablesOnly | 57 | * @param enumerablesOnly |
59 | * only enumerable type constraints are considered | 58 | * only enumerable type constraints are considered |
60 | * @since 2.0 | 59 | * @since 2.0 |
@@ -65,7 +64,7 @@ public final class PQueries { | |||
65 | 64 | ||
66 | /** | 65 | /** |
67 | * Enumerates directly referred extensional relations (without duplicates) for the given formulation of a query. | 66 | * Enumerates directly referred extensional relations (without duplicates) for the given formulation of a query. |
68 | * | 67 | * |
69 | * @param enumerablesOnly | 68 | * @param enumerablesOnly |
70 | * only enumerable type constraints are considered | 69 | * only enumerable type constraints are considered |
71 | * @since 2.0 | 70 | * @since 2.0 |
@@ -86,7 +85,7 @@ public final class PQueries { | |||
86 | 85 | ||
87 | /** | 86 | /** |
88 | * Returns all {@link PTraceable}s contained in the given {@link PQuery}: itself, its bodies and their constraints. | 87 | * Returns all {@link PTraceable}s contained in the given {@link PQuery}: itself, its bodies and their constraints. |
89 | * | 88 | * |
90 | * @since 1.6 | 89 | * @since 1.6 |
91 | */ | 90 | */ |
92 | public static Set<PTraceable> getTraceables(PQuery query) { | 91 | public static Set<PTraceable> getTraceables(PQuery query) { |
@@ -101,7 +100,7 @@ public final class PQueries { | |||
101 | 100 | ||
102 | /** | 101 | /** |
103 | * Calculates the simple name related from a given qualified name by finding the part after the last '.' character. | 102 | * Calculates the simple name related from a given qualified name by finding the part after the last '.' character. |
104 | * | 103 | * |
105 | * @since 2.0 | 104 | * @since 2.0 |
106 | */ | 105 | */ |
107 | public static String calculateSimpleName(String qualifiedName) { | 106 | public static String calculateSimpleName(String qualifiedName) { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PQuery.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PQuery.java index a909c650..39c08b07 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PQuery.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PQuery.java | |||
@@ -3,34 +3,34 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.queries; | 9 | package tools.refinery.interpreter.matchers.psystem.queries; |
10 | |||
11 | import tools.refinery.interpreter.matchers.InterpreterRuntimeException; | ||
12 | import tools.refinery.interpreter.matchers.backend.IQueryBackend; | ||
13 | import tools.refinery.interpreter.matchers.backend.IQueryBackendHintProvider; | ||
14 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; | ||
15 | import tools.refinery.interpreter.matchers.psystem.PBody; | ||
16 | import tools.refinery.interpreter.matchers.psystem.PTraceable; | ||
17 | import tools.refinery.interpreter.matchers.psystem.TypeJudgement; | ||
10 | 18 | ||
11 | import java.util.List; | 19 | import java.util.List; |
12 | import java.util.Set; | 20 | import java.util.Set; |
13 | 21 | ||
14 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | ||
15 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackend; | ||
16 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendHintProvider; | ||
17 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | ||
18 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | ||
19 | import tools.refinery.viatra.runtime.matchers.psystem.PTraceable; | ||
20 | import tools.refinery.viatra.runtime.matchers.psystem.TypeJudgement; | ||
21 | |||
22 | /** | 22 | /** |
23 | * Internal representation of a query / graph pattern (using a constraint system formalism), | 23 | * Internal representation of a query / graph pattern (using a constraint system formalism), |
24 | * to be interpreted by a query evaluator ({@link IQueryBackend}). | 24 | * to be interpreted by a query evaluator ({@link IQueryBackend}). |
25 | * End-users of VIATRA Query should access a query as an IQuerySpecification instead. | 25 | * End-users of Refinery Intepreter should access a query as an IQuerySpecification instead. |
26 | * | 26 | * |
27 | * <p> | 27 | * <p> |
28 | * PQuerys are definitions of queries usable inside pattern descriptions. Such description always has (a non-null) name. The query | 28 | * PQuerys are definitions of queries usable inside pattern descriptions. Such description always has (a non-null) name. The query |
29 | * itself is defined as a (non-empty) set of {@link PBody} instances, the result is the disjunction of the single | 29 | * itself is defined as a (non-empty) set of {@link PBody} instances, the result is the disjunction of the single |
30 | * {@link PBody} instances. </p> | 30 | * {@link PBody} instances. </p> |
31 | * <p> | 31 | * <p> |
32 | * A PQuery might be constructed from erroneous patterns or might be uninitialized - this is represented by its status. | 32 | * A PQuery might be constructed from erroneous patterns or might be uninitialized - this is represented by its status. |
33 | * | 33 | * |
34 | * @author Zoltan Ujhelyi | 34 | * @author Zoltan Ujhelyi |
35 | * @since 0.8.0 | 35 | * @since 0.8.0 |
36 | * @noimplement This interface is not intended to be implemented by clients. Use {@link BasePQuery} as a base class instead. | 36 | * @noimplement This interface is not intended to be implemented by clients. Use {@link BasePQuery} as a base class instead. |
@@ -38,10 +38,10 @@ import tools.refinery.viatra.runtime.matchers.psystem.TypeJudgement; | |||
38 | public interface PQuery extends PQueryHeader, PTraceable { | 38 | public interface PQuery extends PQueryHeader, PTraceable { |
39 | 39 | ||
40 | // TODO rewritten as / rewritten from traceability to PDisjunction? | 40 | // TODO rewritten as / rewritten from traceability to PDisjunction? |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * @author Zoltan Ujhelyi | 43 | * @author Zoltan Ujhelyi |
44 | * | 44 | * |
45 | */ | 45 | */ |
46 | public enum PQueryStatus { | 46 | public enum PQueryStatus { |
47 | /** | 47 | /** |
@@ -70,35 +70,35 @@ public interface PQuery extends PQueryHeader, PTraceable { | |||
70 | /** | 70 | /** |
71 | * Returns all bodies associated with the query in their canonical form. If called multiple times, the same set with | 71 | * Returns all bodies associated with the query in their canonical form. If called multiple times, the same set with |
72 | * the same contents will be returned. | 72 | * the same contents will be returned. |
73 | * | 73 | * |
74 | */ | 74 | */ |
75 | PDisjunction getDisjunctBodies(); | 75 | PDisjunction getDisjunctBodies(); |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * Returns all queries directly referred in the constraints. They are all required to evaluate this query | 78 | * Returns all queries directly referred in the constraints. They are all required to evaluate this query |
79 | * | 79 | * |
80 | * @return a non-null, but possibly empty list of query definitions | 80 | * @return a non-null, but possibly empty list of query definitions |
81 | */ | 81 | */ |
82 | Set<PQuery> getDirectReferredQueries(); | 82 | Set<PQuery> getDirectReferredQueries(); |
83 | 83 | ||
84 | /** | 84 | /** |
85 | * Returns all queries required to evaluate this query (transitively). | 85 | * Returns all queries required to evaluate this query (transitively). |
86 | * | 86 | * |
87 | * @return a non-null, but possibly empty list of query definitions | 87 | * @return a non-null, but possibly empty list of query definitions |
88 | */ | 88 | */ |
89 | Set<PQuery> getAllReferredQueries(); | 89 | Set<PQuery> getAllReferredQueries(); |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * Returns the initialization status of the definition | 92 | * Returns the initialization status of the definition |
93 | * | 93 | * |
94 | */ | 94 | */ |
95 | PQueryStatus getStatus(); | 95 | PQueryStatus getStatus(); |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * Returns a list describing the problems that were found in this query. | 98 | * Returns a list describing the problems that were found in this query. |
99 | * | 99 | * |
100 | * <p> TODO: formulate invariant connecting {@link #getPProblems()} and {@link #getStatus()}. | 100 | * <p> TODO: formulate invariant connecting {@link #getPProblems()} and {@link #getStatus()}. |
101 | * | 101 | * |
102 | * @return a non-null, but possibly empty list of problems | 102 | * @return a non-null, but possibly empty list of problems |
103 | */ | 103 | */ |
104 | List<PProblem> getPProblems(); | 104 | List<PProblem> getPProblems(); |
@@ -112,43 +112,43 @@ public interface PQuery extends PQueryHeader, PTraceable { | |||
112 | /** | 112 | /** |
113 | * An option to check mutability of the query. It can be used to avoid getting an {@link IllegalStateException} by | 113 | * An option to check mutability of the query. It can be used to avoid getting an {@link IllegalStateException} by |
114 | * the execution of {@link #checkMutability()}. | 114 | * the execution of {@link #checkMutability()}. |
115 | * | 115 | * |
116 | * @return true if the query specification is still editable | 116 | * @return true if the query specification is still editable |
117 | */ | 117 | */ |
118 | boolean isMutable(); | 118 | boolean isMutable(); |
119 | 119 | ||
120 | /** | 120 | /** |
121 | * Optional hints regarding the query evaluation strategy, to be interpreted by the query engine. | 121 | * Optional hints regarding the query evaluation strategy, to be interpreted by the query engine. |
122 | * <p> To ensure the possibility of external overrides, | 122 | * <p> To ensure the possibility of external overrides, |
123 | * the evaluation engine should not directly consult this field, | 123 | * the evaluation engine should not directly consult this field, |
124 | * but use an {@link IQueryBackendHintProvider} instead. | 124 | * but use an {@link IQueryBackendHintProvider} instead. |
125 | */ | 125 | */ |
126 | public QueryEvaluationHint getEvaluationHints(); | 126 | public QueryEvaluationHint getEvaluationHints(); |
127 | 127 | ||
128 | 128 | ||
129 | /** | 129 | /** |
130 | * Type information, expressed on query parameters, that all matches of the query are guaranteed to respect. | 130 | * Type information, expressed on query parameters, that all matches of the query are guaranteed to respect. |
131 | * <p> At the very minimum, this should include the declared types of the parameters. | 131 | * <p> At the very minimum, this should include the declared types of the parameters. |
132 | * <p> The type judgement tuples shall contain the <i>parameter index</i>, NOT the {@link PParameter} object. | 132 | * <p> The type judgement tuples shall contain the <i>parameter index</i>, NOT the {@link PParameter} object. |
133 | * | 133 | * |
134 | * @return a non-null set of type judgements that the query guarantees for its matches | 134 | * @return a non-null set of type judgements that the query guarantees for its matches |
135 | */ | 135 | */ |
136 | public Set<TypeJudgement> getTypeGuarantees(); | 136 | public Set<TypeJudgement> getTypeGuarantees(); |
137 | 137 | ||
138 | /** | 138 | /** |
139 | * If the query definition is uninitialized, initializes it. | 139 | * If the query definition is uninitialized, initializes it. |
140 | * @throws ViatraQueryRuntimeException if initialization of query specification fails | 140 | * @throws InterpreterRuntimeException if initialization of query specification fails |
141 | */ | 141 | */ |
142 | public abstract void ensureInitialized(); | 142 | public abstract void ensureInitialized(); |
143 | 143 | ||
144 | /** | 144 | /** |
145 | * Returns the end-user query specification API objects that wrap this query. | 145 | * Returns the end-user query specification API objects that wrap this query. |
146 | * | 146 | * |
147 | * <p> Intended for traceability and debug purposes, not part of normal operation. | 147 | * <p> Intended for traceability and debug purposes, not part of normal operation. |
148 | * Returned list is intended to be appended during query specification construction time. | 148 | * Returned list is intended to be appended during query specification construction time. |
149 | * | 149 | * |
150 | * @return a non-null, but possibly empty list of query specification objects; | 150 | * @return a non-null, but possibly empty list of query specification objects; |
151 | */ | 151 | */ |
152 | List<Object> publishedAs(); | 152 | List<Object> publishedAs(); |
153 | 153 | ||
154 | } \ No newline at end of file | 154 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PQueryHeader.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PQueryHeader.java index f3671934..54678755 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PQueryHeader.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PQueryHeader.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.queries; | 9 | package tools.refinery.interpreter.matchers.psystem.queries; |
10 | 10 | ||
11 | import java.util.List; | 11 | import java.util.List; |
12 | import java.util.Optional; | 12 | import java.util.Optional; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.psystem.annotations.PAnnotation; | 14 | import tools.refinery.interpreter.matchers.psystem.annotations.PAnnotation; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * Represents header information (metainfo) about a query. | 17 | * Represents header information (metainfo) about a query. |
18 | * <p> To be implemented both by IQuerySpecifications intended for end users, | 18 | * <p> To be implemented both by IQuerySpecifications intended for end users, |
19 | * and the internal query representation {@link PQuery}. | 19 | * and the internal query representation {@link PQuery}. |
20 | * | 20 | * |
21 | * | 21 | * |
22 | * @author Bergmann Gabor | 22 | * @author Bergmann Gabor |
23 | * @since 0.9 | 23 | * @since 0.9 |
24 | */ | 24 | */ |
@@ -31,21 +31,21 @@ public interface PQueryHeader { | |||
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Return the list of parameter names | 33 | * Return the list of parameter names |
34 | * | 34 | * |
35 | * @return a non-null, but possibly empty list of parameter names | 35 | * @return a non-null, but possibly empty list of parameter names |
36 | */ | 36 | */ |
37 | public List<String> getParameterNames(); | 37 | public List<String> getParameterNames(); |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Returns a list of parameter descriptions | 40 | * Returns a list of parameter descriptions |
41 | * | 41 | * |
42 | * @return a non-null, but possibly empty list of parameter descriptions | 42 | * @return a non-null, but possibly empty list of parameter descriptions |
43 | */ | 43 | */ |
44 | public List<PParameter> getParameters(); | 44 | public List<PParameter> getParameters(); |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Returns the index of a named parameter | 47 | * Returns the index of a named parameter |
48 | * | 48 | * |
49 | * @param parameterName | 49 | * @param parameterName |
50 | * @return the index, or null of no such parameter is available | 50 | * @return the index, or null of no such parameter is available |
51 | */ | 51 | */ |
@@ -59,17 +59,17 @@ public interface PQueryHeader { | |||
59 | return Optional.ofNullable(getPositionOfParameter(parameterName)) | 59 | return Optional.ofNullable(getPositionOfParameter(parameterName)) |
60 | .map(getParameters()::get); | 60 | .map(getParameters()::get); |
61 | } | 61 | } |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Returns the list of annotations specified for this query | 64 | * Returns the list of annotations specified for this query |
65 | * | 65 | * |
66 | * @return a non-null, but possibly empty list of annotations | 66 | * @return a non-null, but possibly empty list of annotations |
67 | */ | 67 | */ |
68 | public List<PAnnotation> getAllAnnotations(); | 68 | public List<PAnnotation> getAllAnnotations(); |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * Returns the list of annotations with a specified name | 71 | * Returns the list of annotations with a specified name |
72 | * | 72 | * |
73 | * @param annotationName | 73 | * @param annotationName |
74 | * @return a non-null, but possibly empty list of annotations | 74 | * @return a non-null, but possibly empty list of annotations |
75 | */ | 75 | */ |
@@ -77,25 +77,25 @@ public interface PQueryHeader { | |||
77 | 77 | ||
78 | /** | 78 | /** |
79 | * Returns the first annotation with a specified name | 79 | * Returns the first annotation with a specified name |
80 | * | 80 | * |
81 | * @since 2.0 | 81 | * @since 2.0 |
82 | */ | 82 | */ |
83 | public Optional<PAnnotation> getFirstAnnotationByName(String annotationName); | 83 | public Optional<PAnnotation> getFirstAnnotationByName(String annotationName); |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * Returns the visibility information about the query. | 86 | * Returns the visibility information about the query. |
87 | * @since 2.0 | 87 | * @since 2.0 |
88 | */ | 88 | */ |
89 | public PVisibility getVisibility(); | 89 | public PVisibility getVisibility(); |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * Returns the non-qualified name of the query. By default this means returning the qualified name after the last | 92 | * Returns the non-qualified name of the query. By default this means returning the qualified name after the last |
93 | * '.' character. | 93 | * '.' character. |
94 | * | 94 | * |
95 | * @since 2.0 | 95 | * @since 2.0 |
96 | */ | 96 | */ |
97 | public default String getSimpleName() { | 97 | public default String getSimpleName() { |
98 | return PQueries.calculateSimpleName(getFullyQualifiedName()); | 98 | return PQueries.calculateSimpleName(getFullyQualifiedName()); |
99 | } | 99 | } |
100 | 100 | ||
101 | } \ No newline at end of file | 101 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PVisibility.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PVisibility.java index 7cb312bd..074648a4 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/PVisibility.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/PVisibility.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.queries; | 9 | package tools.refinery.interpreter.matchers.psystem.queries; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * @author Zoltan Ujhelyi | 12 | * @author Zoltan Ujhelyi |
@@ -20,13 +20,13 @@ public enum PVisibility { | |||
20 | */ | 20 | */ |
21 | PUBLIC, | 21 | PUBLIC, |
22 | /** | 22 | /** |
23 | * A private query is not expected to be called directly, only by a different query matcher. | 23 | * A private query is not expected to be called directly, only by a different query matcher. |
24 | */ | 24 | */ |
25 | PRIVATE, | 25 | PRIVATE, |
26 | /** | 26 | /** |
27 | * A query that is only used inside a single caller query and is not visible outside its container query. Such | 27 | * A query that is only used inside a single caller query and is not visible outside its container query. Such |
28 | * patterns must also fulfill the following additional constraints: | 28 | * patterns must also fulfill the following additional constraints: |
29 | * | 29 | * |
30 | * <ul> | 30 | * <ul> |
31 | * <li>An embedded query must have only a single body.</li> | 31 | * <li>An embedded query must have only a single body.</li> |
32 | * <li>An embedded query must not be recursice.</li> | 32 | * <li>An embedded query must not be recursice.</li> |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/QueryInitializationException.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/QueryInitializationException.java index 470d7287..9d05a0dd 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/queries/QueryInitializationException.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/queries/QueryInitializationException.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.queries; | 9 | package tools.refinery.interpreter.matchers.psystem.queries; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.planning.QueryProcessingException; | 11 | import tools.refinery.interpreter.matchers.planning.QueryProcessingException; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Represent an exception that occurred while initializing the specification of a query. | 14 | * Represent an exception that occurred while initializing the specification of a query. |
15 | * @author Bergmann Gabor | 15 | * @author Bergmann Gabor |
16 | * @since 0.9 | 16 | * @since 0.9 |
17 | * | 17 | * |
@@ -30,6 +30,6 @@ public class QueryInitializationException extends QueryProcessingException { | |||
30 | private static final long serialVersionUID = 9106033062252951489L; | 30 | private static final long serialVersionUID = 9106033062252951489L; |
31 | 31 | ||
32 | 32 | ||
33 | 33 | ||
34 | 34 | ||
35 | } | 35 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/AbstractRewriterTraceSource.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/AbstractRewriterTraceSource.java index 276b2b42..59422e3e 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/AbstractRewriterTraceSource.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/AbstractRewriterTraceSource.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import java.util.Objects; | 11 | import java.util.Objects; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 13 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.PTraceable; | 14 | import tools.refinery.interpreter.matchers.psystem.PTraceable; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * @since 1.6 | 17 | * @since 1.6 |
@@ -20,19 +20,19 @@ import tools.refinery.viatra.runtime.matchers.psystem.PTraceable; | |||
20 | public class AbstractRewriterTraceSource { | 20 | public class AbstractRewriterTraceSource { |
21 | 21 | ||
22 | private IRewriterTraceCollector traceCollector = NopTraceCollector.INSTANCE; | 22 | private IRewriterTraceCollector traceCollector = NopTraceCollector.INSTANCE; |
23 | 23 | ||
24 | public void setTraceCollector(IRewriterTraceCollector traceCollector) { | 24 | public void setTraceCollector(IRewriterTraceCollector traceCollector) { |
25 | this.traceCollector = Objects.requireNonNull(traceCollector); | 25 | this.traceCollector = Objects.requireNonNull(traceCollector); |
26 | } | 26 | } |
27 | 27 | ||
28 | public IPTraceableTraceProvider getTraces() { | 28 | public IPTraceableTraceProvider getTraces() { |
29 | return traceCollector; | 29 | return traceCollector; |
30 | } | 30 | } |
31 | 31 | ||
32 | protected IRewriterTraceCollector getTraceCollector() { | 32 | protected IRewriterTraceCollector getTraceCollector() { |
33 | return traceCollector; | 33 | return traceCollector; |
34 | } | 34 | } |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * Mark the given derivative to be originated from the given original constraint. | 37 | * Mark the given derivative to be originated from the given original constraint. |
38 | * @since 1.6 | 38 | * @since 1.6 |
@@ -40,7 +40,7 @@ public class AbstractRewriterTraceSource { | |||
40 | protected void addTrace(PTraceable original, PTraceable derivative){ | 40 | protected void addTrace(PTraceable original, PTraceable derivative){ |
41 | traceCollector.addTrace(original, derivative); | 41 | traceCollector.addTrace(original, derivative); |
42 | } | 42 | } |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Indicate that the given derivative is removed from the resulting query, thus its trace | 45 | * Indicate that the given derivative is removed from the resulting query, thus its trace |
46 | * information should be removed also. | 46 | * information should be removed also. |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/ConstraintRemovalReason.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/ConstraintRemovalReason.java index 237a762d..4948c1e5 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/ConstraintRemovalReason.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/ConstraintRemovalReason.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Common reasons for removing constraint through rewriters | 12 | * Common reasons for removing constraint through rewriters |
@@ -19,5 +19,5 @@ public enum ConstraintRemovalReason implements IDerivativeModificationReason { | |||
19 | WEAK_INEQUALITY_SELF_LOOP, | 19 | WEAK_INEQUALITY_SELF_LOOP, |
20 | TYPE_SUBSUMED, | 20 | TYPE_SUBSUMED, |
21 | DUPLICATE | 21 | DUPLICATE |
22 | 22 | ||
23 | } | 23 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/DefaultFlattenCallPredicate.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/DefaultFlattenCallPredicate.java index 3b5d7390..b2e46ee6 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/DefaultFlattenCallPredicate.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/DefaultFlattenCallPredicate.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 10 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * @author Marton Bur | 13 | * @author Marton Bur |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/FlattenerCopier.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/FlattenerCopier.java index 06b8d372..cddd182b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/FlattenerCopier.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/FlattenerCopier.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import java.util.HashMap; | 11 | import java.util.HashMap; |
12 | import java.util.List; | 12 | import java.util.List; |
@@ -16,19 +16,19 @@ import java.util.Objects; | |||
16 | import java.util.Set; | 16 | import java.util.Set; |
17 | import java.util.stream.Collectors; | 17 | import java.util.stream.Collectors; |
18 | 18 | ||
19 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 19 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.Equality; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 20 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExportedParameter; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 21 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExpressionEvaluation; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.Equality; | 22 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
23 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 23 | import tools.refinery.interpreter.matchers.psystem.PBody; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExpressionEvaluation; | 24 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 25 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
26 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 26 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
27 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 27 | import tools.refinery.interpreter.matchers.util.Preconditions; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * This rewriter class can add new equality constraints to the copied body | 30 | * This rewriter class can add new equality constraints to the copied body |
31 | * | 31 | * |
32 | * @author Marton Bur | 32 | * @author Marton Bur |
33 | * | 33 | * |
34 | */ | 34 | */ |
@@ -39,18 +39,18 @@ class FlattenerCopier extends PBodyCopier { | |||
39 | private static class CallInformation { | 39 | private static class CallInformation { |
40 | final PBody body; | 40 | final PBody body; |
41 | final Map<PVariable, PVariable> variableMapping; | 41 | final Map<PVariable, PVariable> variableMapping; |
42 | 42 | ||
43 | private CallInformation(PBody body) { | 43 | private CallInformation(PBody body) { |
44 | this.body = body; | 44 | this.body = body; |
45 | this.variableMapping = new HashMap<>(); | 45 | this.variableMapping = new HashMap<>(); |
46 | } | 46 | } |
47 | } | 47 | } |
48 | 48 | ||
49 | public FlattenerCopier(PQuery query, Map<PositivePatternCall, PBody> callsToFlatten) { | 49 | public FlattenerCopier(PQuery query, Map<PositivePatternCall, PBody> callsToFlatten) { |
50 | super(query); | 50 | super(query); |
51 | this.calls = callsToFlatten.entrySet().stream().collect(Collectors.toMap(Entry::getKey, entry -> new CallInformation(entry.getValue()))); | 51 | this.calls = callsToFlatten.entrySet().stream().collect(Collectors.toMap(Entry::getKey, entry -> new CallInformation(entry.getValue()))); |
52 | } | 52 | } |
53 | 53 | ||
54 | protected void copyVariable(PositivePatternCall contextPatternCall, PVariable variable, String newName) { | 54 | protected void copyVariable(PositivePatternCall contextPatternCall, PVariable variable, String newName) { |
55 | PVariable newPVariable = body.getOrCreateVariableByName(newName); | 55 | PVariable newPVariable = body.getOrCreateVariableByName(newName); |
56 | calls.get(contextPatternCall).variableMapping.put(variable, newPVariable); | 56 | calls.get(contextPatternCall).variableMapping.put(variable, newPVariable); |
@@ -60,7 +60,7 @@ class FlattenerCopier extends PBodyCopier { | |||
60 | /** | 60 | /** |
61 | * Merge all variables and constraints from the body called through the given pattern call to a target body. If | 61 | * Merge all variables and constraints from the body called through the given pattern call to a target body. If |
62 | * multiple bodies are merged into a single one, use the renamer and filter options to avoid collisions. | 62 | * multiple bodies are merged into a single one, use the renamer and filter options to avoid collisions. |
63 | * | 63 | * |
64 | * @param sourceBody | 64 | * @param sourceBody |
65 | * @param namingTool | 65 | * @param namingTool |
66 | * @param filter | 66 | * @param filter |
@@ -121,9 +121,9 @@ class FlattenerCopier extends PBodyCopier { | |||
121 | Map<PVariable, PVariable> variableMapping = this.variableMapping.entrySet().stream() | 121 | Map<PVariable, PVariable> variableMapping = this.variableMapping.entrySet().stream() |
122 | .filter(input -> expressionEvaluation.getPSystem().getAllVariables().contains(input.getKey())) | 122 | .filter(input -> expressionEvaluation.getPSystem().getAllVariables().contains(input.getKey())) |
123 | .collect(Collectors.toMap(Entry::getKey, Entry::getValue)); | 123 | .collect(Collectors.toMap(Entry::getKey, Entry::getValue)); |
124 | 124 | ||
125 | PVariable mappedOutputVariable = variableMapping.get(expressionEvaluation.getOutputVariable()); | 125 | PVariable mappedOutputVariable = variableMapping.get(expressionEvaluation.getOutputVariable()); |
126 | addTrace(expressionEvaluation, new ExpressionEvaluation(body, new VariableMappingExpressionEvaluatorWrapper(expressionEvaluation.getEvaluator(), variableMapping), mappedOutputVariable, expressionEvaluation.isUnwinding())); | 126 | addTrace(expressionEvaluation, new ExpressionEvaluation(body, new VariableMappingExpressionEvaluatorWrapper(expressionEvaluation.getEvaluator(), variableMapping), mappedOutputVariable, expressionEvaluation.isUnwinding())); |
127 | } | 127 | } |
128 | 128 | ||
129 | } | 129 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IConstraintFilter.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IConstraintFilter.java index 518b9c64..85c30296 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IConstraintFilter.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IConstraintFilter.java | |||
@@ -3,46 +3,46 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 11 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExportedParameter; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 12 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Helper interface to exclude constraints from PBody copy processes | 15 | * Helper interface to exclude constraints from PBody copy processes |
16 | * | 16 | * |
17 | * @author Marton Bur | 17 | * @author Marton Bur |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | public interface IConstraintFilter { | 20 | public interface IConstraintFilter { |
21 | /** | 21 | /** |
22 | * Returns true, if the given constraint should be filtered (thus should not be copied) | 22 | * Returns true, if the given constraint should be filtered (thus should not be copied) |
23 | * | 23 | * |
24 | * @param constraint | 24 | * @param constraint |
25 | * to check | 25 | * to check |
26 | * @return true, if the constraint should be filtered | 26 | * @return true, if the constraint should be filtered |
27 | */ | 27 | */ |
28 | boolean filter(PConstraint constraint); | 28 | boolean filter(PConstraint constraint); |
29 | 29 | ||
30 | public static class ExportedParameterFilter implements IConstraintFilter { | 30 | public static class ExportedParameterFilter implements IConstraintFilter { |
31 | 31 | ||
32 | @Override | 32 | @Override |
33 | public boolean filter(PConstraint constraint) { | 33 | public boolean filter(PConstraint constraint) { |
34 | return constraint instanceof ExportedParameter; | 34 | return constraint instanceof ExportedParameter; |
35 | } | 35 | } |
36 | 36 | ||
37 | } | 37 | } |
38 | 38 | ||
39 | public static class AllowAllFilter implements IConstraintFilter { | 39 | public static class AllowAllFilter implements IConstraintFilter { |
40 | 40 | ||
41 | @Override | 41 | @Override |
42 | public boolean filter(PConstraint constraint) { | 42 | public boolean filter(PConstraint constraint) { |
43 | // Nothing is filtered | 43 | // Nothing is filtered |
44 | return false; | 44 | return false; |
45 | } | 45 | } |
46 | 46 | ||
47 | } | 47 | } |
48 | } \ No newline at end of file | 48 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IDerivativeModificationReason.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IDerivativeModificationReason.java index dbd6a78d..0afc3456 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IDerivativeModificationReason.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IDerivativeModificationReason.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * This is a role indication interface, implementations may provide a reason about | 12 | * This is a role indication interface, implementations may provide a reason about |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IFlattenCallPredicate.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IFlattenCallPredicate.java index 7e224e98..2d43b17b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IFlattenCallPredicate.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IFlattenCallPredicate.java | |||
@@ -3,31 +3,31 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 11 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
12 | 12 | ||
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Interface used by the PQueryFlattener to decide which positive pattern calls to flatten | 15 | * Interface used by the PQueryFlattener to decide which positive pattern calls to flatten |
16 | * | 16 | * |
17 | * @author Marton Bur | 17 | * @author Marton Bur |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | public interface IFlattenCallPredicate { | 20 | public interface IFlattenCallPredicate { |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * Decides whether the called query by the pattern call should be flattened into the caller or not. | 23 | * Decides whether the called query by the pattern call should be flattened into the caller or not. |
24 | * | 24 | * |
25 | * @param positivePatternCall | 25 | * @param positivePatternCall |
26 | * the pattern call | 26 | * the pattern call |
27 | * @return true if the call should be flattened | 27 | * @return true if the call should be flattened |
28 | */ | 28 | */ |
29 | boolean shouldFlatten(PositivePatternCall positivePatternCall); | 29 | boolean shouldFlatten(PositivePatternCall positivePatternCall); |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Flattens only if all operand predicates vote for flattening. | 32 | * Flattens only if all operand predicates vote for flattening. |
33 | * @author Gabor Bergmann | 33 | * @author Gabor Bergmann |
@@ -38,7 +38,7 @@ public interface IFlattenCallPredicate { | |||
38 | public And(IFlattenCallPredicate... operands) { | 38 | public And(IFlattenCallPredicate... operands) { |
39 | this.operands = operands; | 39 | this.operands = operands; |
40 | } | 40 | } |
41 | 41 | ||
42 | @Override | 42 | @Override |
43 | public boolean shouldFlatten(PositivePatternCall positivePatternCall) { | 43 | public boolean shouldFlatten(PositivePatternCall positivePatternCall) { |
44 | for (IFlattenCallPredicate operand : operands) { | 44 | for (IFlattenCallPredicate operand : operands) { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IPTraceableTraceProvider.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IPTraceableTraceProvider.java index 84da4d1b..4699c4eb 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IPTraceableTraceProvider.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IPTraceableTraceProvider.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import java.util.stream.Stream; | 11 | import java.util.stream.Stream; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.psystem.PTraceable; | 13 | import tools.refinery.interpreter.matchers.psystem.PTraceable; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 14 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * This interface provides methods to trace the {@link PTraceable}s of a transformed {@link PQuery} produced by | 17 | * This interface provides methods to trace the {@link PTraceable}s of a transformed {@link PQuery} produced by |
18 | * a {@link PDisjunctionRewriter}. In case the associated rewriter is a composite (a.k.a. {@link PDisjunctionRewriterCacher}), | 18 | * a {@link PDisjunctionRewriter}. In case the associated rewriter is a composite (a.k.a. {@link PDisjunctionRewriterCacher}), |
19 | * this trace provider handles traces end-to-end, hiding all the intermediate transformation steps. | 19 | * this trace provider handles traces end-to-end, hiding all the intermediate transformation steps. |
20 | * | 20 | * |
21 | * @since 1.6 | 21 | * @since 1.6 |
22 | * @noimplement This interface is not intended to be implemented by clients. | 22 | * @noimplement This interface is not intended to be implemented by clients. |
23 | */ | 23 | */ |
@@ -26,21 +26,21 @@ public interface IPTraceableTraceProvider { | |||
26 | /** | 26 | /** |
27 | * Find and return the canonical {@link PTraceable}s in the original query which are the sources of the given derivative | 27 | * Find and return the canonical {@link PTraceable}s in the original query which are the sources of the given derivative |
28 | * {@link PTraceable} according to the transformation. | 28 | * {@link PTraceable} according to the transformation. |
29 | * | 29 | * |
30 | * @param derivative a {@link PTraceable} which is contained by the {@link PQuery} produced by the associated rewriter | 30 | * @param derivative a {@link PTraceable} which is contained by the {@link PQuery} produced by the associated rewriter |
31 | * @since 2.0 | 31 | * @since 2.0 |
32 | */ | 32 | */ |
33 | public Stream<PTraceable> getCanonicalTraceables(PTraceable derivative); | 33 | public Stream<PTraceable> getCanonicalTraceables(PTraceable derivative); |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Find and return the {@link PTraceable}s in the rewritten query which are the destinations of the given source | 36 | * Find and return the {@link PTraceable}s in the rewritten query which are the destinations of the given source |
37 | * {@link PTraceable} according to the transformation. | 37 | * {@link PTraceable} according to the transformation. |
38 | * | 38 | * |
39 | * @param source a {@link PTraceable} which is contained by a {@link PQuery} before rewriting | 39 | * @param source a {@link PTraceable} which is contained by a {@link PQuery} before rewriting |
40 | * @since 2.0 | 40 | * @since 2.0 |
41 | */ | 41 | */ |
42 | public Stream<PTraceable> getRewrittenTraceables(PTraceable source); | 42 | public Stream<PTraceable> getRewrittenTraceables(PTraceable source); |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Returns whether the given traceable element has been removed by every rewriter for a reason. | 45 | * Returns whether the given traceable element has been removed by every rewriter for a reason. |
46 | */ | 46 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IRewriterTraceCollector.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IRewriterTraceCollector.java index 70771ea7..883ca737 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IRewriterTraceCollector.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IRewriterTraceCollector.java | |||
@@ -3,17 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.PTraceable; | 11 | import tools.refinery.interpreter.matchers.psystem.PTraceable; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * This is the internal API of {@link IPTraceableTraceProvider} expected to be used by | 14 | * This is the internal API of {@link IPTraceableTraceProvider} expected to be used by |
15 | * copier and rewriter implementations. | 15 | * copier and rewriter implementations. |
16 | * | 16 | * |
17 | * @since 1.6 | 17 | * @since 1.6 |
18 | * @noreference This interface is not intended to be referenced by clients. | 18 | * @noreference This interface is not intended to be referenced by clients. |
19 | */ | 19 | */ |
@@ -23,11 +23,11 @@ public interface IRewriterTraceCollector extends IPTraceableTraceProvider { | |||
23 | * Mark the given derivative to be originated from the given original constraint. | 23 | * Mark the given derivative to be originated from the given original constraint. |
24 | */ | 24 | */ |
25 | public void addTrace(PTraceable origin, PTraceable derivative); | 25 | public void addTrace(PTraceable origin, PTraceable derivative); |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * Indicate that the given derivative is removed from the resulting query, thus its trace | 28 | * Indicate that the given derivative is removed from the resulting query, thus its trace |
29 | * information should be removed also. | 29 | * information should be removed also. |
30 | */ | 30 | */ |
31 | public void derivativeRemoved(PTraceable derivative, IDerivativeModificationReason reason); | 31 | public void derivativeRemoved(PTraceable derivative, IDerivativeModificationReason reason); |
32 | 32 | ||
33 | } | 33 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IVariableRenamer.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IVariableRenamer.java index ce446e0d..27fc433d 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/IVariableRenamer.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/IVariableRenamer.java | |||
@@ -3,38 +3,38 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 11 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 12 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Helper interface to ease the naming of the new variables during flattening | 15 | * Helper interface to ease the naming of the new variables during flattening |
16 | * | 16 | * |
17 | * @author Marton Bur | 17 | * @author Marton Bur |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | public interface IVariableRenamer { | 20 | public interface IVariableRenamer { |
21 | /** | 21 | /** |
22 | * Creates a variable name based on a given variable and a given query. It only creates a String, doesn't set | 22 | * Creates a variable name based on a given variable and a given query. It only creates a String, doesn't set |
23 | * anything. | 23 | * anything. |
24 | * | 24 | * |
25 | * @param pVariable | 25 | * @param pVariable |
26 | * @param query | 26 | * @param query |
27 | * @return the new variable name as a String | 27 | * @return the new variable name as a String |
28 | */ | 28 | */ |
29 | String createVariableName(PVariable pVariable, PQuery query); | 29 | String createVariableName(PVariable pVariable, PQuery query); |
30 | 30 | ||
31 | public class SameName implements IVariableRenamer { | 31 | public class SameName implements IVariableRenamer { |
32 | @Override | 32 | @Override |
33 | public String createVariableName(PVariable pVariable, PQuery query) { | 33 | public String createVariableName(PVariable pVariable, PQuery query) { |
34 | return pVariable.getName(); | 34 | return pVariable.getName(); |
35 | } | 35 | } |
36 | } | 36 | } |
37 | 37 | ||
38 | public class HierarchicalName implements IVariableRenamer { | 38 | public class HierarchicalName implements IVariableRenamer { |
39 | 39 | ||
40 | private int callCount; | 40 | private int callCount; |
@@ -49,11 +49,11 @@ public interface IVariableRenamer { | |||
49 | String newVarName = getShortName(query) + "<" + callCount + ">" + "_" + pVariable.getName(); | 49 | String newVarName = getShortName(query) + "<" + callCount + ">" + "_" + pVariable.getName(); |
50 | return pVariable.getName().startsWith("_") ? "_" + newVarName : newVarName ; | 50 | return pVariable.getName().startsWith("_") ? "_" + newVarName : newVarName ; |
51 | } | 51 | } |
52 | 52 | ||
53 | private String getShortName(PQuery query) { | 53 | private String getShortName(PQuery query) { |
54 | String fullyQualifiedName = query.getFullyQualifiedName(); | 54 | String fullyQualifiedName = query.getFullyQualifiedName(); |
55 | int beginIndex = fullyQualifiedName.lastIndexOf('.') + 1; | 55 | int beginIndex = fullyQualifiedName.lastIndexOf('.') + 1; |
56 | return fullyQualifiedName.substring(beginIndex); | 56 | return fullyQualifiedName.substring(beginIndex); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | } \ No newline at end of file | 59 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/MappingTraceCollector.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/MappingTraceCollector.java index 7429fc60..3b9e5d78 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/MappingTraceCollector.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/MappingTraceCollector.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.HashMap; | 12 | import java.util.HashMap; |
@@ -18,17 +18,17 @@ import java.util.Set; | |||
18 | import java.util.function.Predicate; | 18 | import java.util.function.Predicate; |
19 | import java.util.stream.Stream; | 19 | import java.util.stream.Stream; |
20 | 20 | ||
21 | import tools.refinery.viatra.runtime.matchers.psystem.PTraceable; | 21 | import tools.refinery.interpreter.matchers.psystem.PTraceable; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 22 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
23 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 23 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
24 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | 24 | import tools.refinery.interpreter.matchers.util.CollectionsFactory.MemoryType; |
25 | import tools.refinery.viatra.runtime.matchers.util.IMemoryView; | 25 | import tools.refinery.interpreter.matchers.util.IMemoryView; |
26 | import tools.refinery.viatra.runtime.matchers.util.IMultiLookup; | 26 | import tools.refinery.interpreter.matchers.util.IMultiLookup; |
27 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 27 | import tools.refinery.interpreter.matchers.util.Preconditions; |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * Multimap-based implementation to contain and query traces | 30 | * Multimap-based implementation to contain and query traces |
31 | * | 31 | * |
32 | * @since 1.6 | 32 | * @since 1.6 |
33 | * | 33 | * |
34 | */ | 34 | */ |
@@ -43,12 +43,12 @@ public class MappingTraceCollector implements IRewriterTraceCollector { | |||
43 | * Traces from original to derivative | 43 | * Traces from original to derivative |
44 | */ | 44 | */ |
45 | private final IMultiLookup<PTraceable, PTraceable> inverseTraces = CollectionsFactory.createMultiLookup(Object.class, MemoryType.SETS, Object.class); | 45 | private final IMultiLookup<PTraceable, PTraceable> inverseTraces = CollectionsFactory.createMultiLookup(Object.class, MemoryType.SETS, Object.class); |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Reasons for removing {@link PTraceable}s | 48 | * Reasons for removing {@link PTraceable}s |
49 | */ | 49 | */ |
50 | private final Map<PTraceable, IDerivativeModificationReason> removals = new HashMap<>(); | 50 | private final Map<PTraceable, IDerivativeModificationReason> removals = new HashMap<>(); |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * Decides whether {@link PTraceable} is removed | 53 | * Decides whether {@link PTraceable} is removed |
54 | */ | 54 | */ |
@@ -71,7 +71,7 @@ public class MappingTraceCollector implements IRewriterTraceCollector { | |||
71 | } | 71 | } |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * Returns the end of trace chains starting from the given {@link PTraceable} along the given trace edges. | 74 | * Returns the end of trace chains starting from the given {@link PTraceable} along the given trace edges. |
75 | */ | 75 | */ |
76 | private Set<PTraceable> findTraceEnds(PTraceable traceable, IMultiLookup<PTraceable, PTraceable> traceRecords) { | 76 | private Set<PTraceable> findTraceEnds(PTraceable traceable, IMultiLookup<PTraceable, PTraceable> traceRecords) { |
77 | if (traceable instanceof PQuery) { // PQueries are preserved | 77 | if (traceable instanceof PQuery) { // PQueries are preserved |
@@ -108,11 +108,11 @@ public class MappingTraceCollector implements IRewriterTraceCollector { | |||
108 | // Even if this element was marked as removed earlier, now we replace it with another constraint! | 108 | // Even if this element was marked as removed earlier, now we replace it with another constraint! |
109 | removals.remove(original); | 109 | removals.remove(original); |
110 | } | 110 | } |
111 | 111 | ||
112 | @Override | 112 | @Override |
113 | public void derivativeRemoved(PTraceable derivative, IDerivativeModificationReason reason){ | 113 | public void derivativeRemoved(PTraceable derivative, IDerivativeModificationReason reason){ |
114 | Preconditions.checkState(!removals.containsKey(derivative), "Traceable %s removed multiple times", derivative); | 114 | Preconditions.checkState(!removals.containsKey(derivative), "Traceable %s removed multiple times", derivative); |
115 | // XXX the derivative must not be removed from the trace chain, as some rewriters, e.g. the normalizer keeps trace links to deleted elements | 115 | // XXX the derivative must not be removed from the trace chain, as some rewriters, e.g. the normalizer keeps trace links to deleted elements |
116 | if (!inverseTraces.lookupExists(derivative)) { | 116 | if (!inverseTraces.lookupExists(derivative)) { |
117 | // If there already exists a trace link, this removal means an update | 117 | // If there already exists a trace link, this removal means an update |
118 | removals.put(derivative, reason); | 118 | removals.put(derivative, reason); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/NeverFlattenCallPredicate.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/NeverFlattenCallPredicate.java index 96c0b205..1d3484bb 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/NeverFlattenCallPredicate.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/NeverFlattenCallPredicate.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 11 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * @author Grill Balázs | 14 | * @author Grill Balázs |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/NopTraceCollector.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/NopTraceCollector.java index 15cf577e..ce768636 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/NopTraceCollector.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/NopTraceCollector.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import java.util.stream.Stream; | 11 | import java.util.stream.Stream; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.psystem.PTraceable; | 13 | import tools.refinery.interpreter.matchers.psystem.PTraceable; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * This implementation does not store any traces and scales to NOP for every traceability feature. | 16 | * This implementation does not store any traces and scales to NOP for every traceability feature. |
@@ -20,11 +20,11 @@ import tools.refinery.viatra.runtime.matchers.psystem.PTraceable; | |||
20 | public class NopTraceCollector implements IRewriterTraceCollector { | 20 | public class NopTraceCollector implements IRewriterTraceCollector { |
21 | 21 | ||
22 | public static final IRewriterTraceCollector INSTANCE = new NopTraceCollector(); | 22 | public static final IRewriterTraceCollector INSTANCE = new NopTraceCollector(); |
23 | 23 | ||
24 | private NopTraceCollector() { | 24 | private NopTraceCollector() { |
25 | // Private constructor to force using the common instance | 25 | // Private constructor to force using the common instance |
26 | } | 26 | } |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * @since 2.0 | 29 | * @since 2.0 |
30 | */ | 30 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PBodyCopier.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PBodyCopier.java index 10ab19c8..99350185 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PBodyCopier.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PBodyCopier.java | |||
@@ -7,21 +7,19 @@ | |||
7 | * | 7 | * |
8 | * SPDX-License-Identifier: EPL-2.0 | 8 | * SPDX-License-Identifier: EPL-2.0 |
9 | *******************************************************************************/ | 9 | *******************************************************************************/ |
10 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 10 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
11 | 11 | ||
12 | import tools.refinery.viatra.runtime.matchers.planning.QueryProcessingException; | 12 | import tools.refinery.interpreter.matchers.planning.QueryProcessingException; |
13 | import tools.refinery.viatra.runtime.matchers.psystem.EnumerablePConstraint; | 13 | import tools.refinery.interpreter.matchers.psystem.EnumerablePConstraint; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 14 | import tools.refinery.interpreter.matchers.psystem.PBody; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 15 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 16 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.*; | 17 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.*; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.*; | 18 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.*; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 19 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 20 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.IConstraintFilter.AllowAllFilter; | 21 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.IVariableRenamer.SameName; | 22 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
23 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | ||
24 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | ||
25 | 23 | ||
26 | import java.util.*; | 24 | import java.util.*; |
27 | import java.util.stream.Collectors; | 25 | import java.util.stream.Collectors; |
@@ -66,7 +64,7 @@ public class PBodyCopier extends AbstractRewriterTraceSource { | |||
66 | } | 64 | } |
67 | 65 | ||
68 | public void mergeBody(PBody sourceBody) { | 66 | public void mergeBody(PBody sourceBody) { |
69 | mergeBody(sourceBody, new SameName(), new AllowAllFilter()); | 67 | mergeBody(sourceBody, new IVariableRenamer.SameName(), new IConstraintFilter.AllowAllFilter()); |
70 | } | 68 | } |
71 | 69 | ||
72 | /** | 70 | /** |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PBodyNormalizer.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PBodyNormalizer.java index 90943129..5a189394 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PBodyNormalizer.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PBodyNormalizer.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 10 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
11 | 11 | ||
12 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
13 | import java.util.Collection; | 13 | import java.util.Collection; |
@@ -23,29 +23,29 @@ import java.util.Map; | |||
23 | import java.util.Queue; | 23 | import java.util.Queue; |
24 | import java.util.Set; | 24 | import java.util.Set; |
25 | 25 | ||
26 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 26 | import tools.refinery.interpreter.matchers.planning.QueryProcessingException; |
27 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | 27 | import tools.refinery.interpreter.matchers.planning.helpers.TypeHelper; |
28 | import tools.refinery.viatra.runtime.matchers.planning.QueryProcessingException; | 28 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.Equality; |
29 | import tools.refinery.viatra.runtime.matchers.planning.helpers.TypeHelper; | 29 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.Inequality; |
30 | import tools.refinery.viatra.runtime.matchers.psystem.ITypeConstraint; | 30 | import tools.refinery.interpreter.matchers.context.IInputKey; |
31 | import tools.refinery.viatra.runtime.matchers.psystem.ITypeInfoProviderConstraint; | 31 | import tools.refinery.interpreter.matchers.context.IQueryMetaContext; |
32 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 32 | import tools.refinery.interpreter.matchers.psystem.ITypeConstraint; |
33 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 33 | import tools.refinery.interpreter.matchers.psystem.ITypeInfoProviderConstraint; |
34 | import tools.refinery.viatra.runtime.matchers.psystem.TypeJudgement; | 34 | import tools.refinery.interpreter.matchers.psystem.PBody; |
35 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.Equality; | 35 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
36 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.Inequality; | 36 | import tools.refinery.interpreter.matchers.psystem.TypeJudgement; |
37 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PDisjunction; | 37 | import tools.refinery.interpreter.matchers.psystem.queries.PDisjunction; |
38 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 38 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
39 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery.PQueryStatus; | 39 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery.PQueryStatus; |
40 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory; | 40 | import tools.refinery.interpreter.matchers.util.CollectionsFactory; |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * A disjunction rewriter for creating a normalized form of specification, unifying variables and running basic sanity | 43 | * A disjunction rewriter for creating a normalized form of specification, unifying variables and running basic sanity |
44 | * checks. This rewriter does not copy but modifies directly the original specification, requiring a mutable | 44 | * checks. This rewriter does not copy but modifies directly the original specification, requiring a mutable |
45 | * disjunction. | 45 | * disjunction. |
46 | * | 46 | * |
47 | * @author Gabor Bergmann | 47 | * @author Gabor Bergmann |
48 | * | 48 | * |
49 | */ | 49 | */ |
50 | public class PBodyNormalizer extends PDisjunctionRewriter { | 50 | public class PBodyNormalizer extends PDisjunctionRewriter { |
51 | 51 | ||
@@ -58,7 +58,7 @@ public class PBodyNormalizer extends PDisjunctionRewriter { | |||
58 | /** | 58 | /** |
59 | * Returns whether unary constraint elimination is enabled. This behavior can be customized by creating a subclass | 59 | * Returns whether unary constraint elimination is enabled. This behavior can be customized by creating a subclass |
60 | * with a custom implementation. | 60 | * with a custom implementation. |
61 | * | 61 | * |
62 | * @since 1.6 | 62 | * @since 1.6 |
63 | */ | 63 | */ |
64 | protected boolean shouldCalculateImpliedTypes(PQuery query) { | 64 | protected boolean shouldCalculateImpliedTypes(PQuery query) { |
@@ -66,10 +66,10 @@ public class PBodyNormalizer extends PDisjunctionRewriter { | |||
66 | } | 66 | } |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Returns whether 'weakened alternative' suggestions of the context shall be expanded as additional PConstraints. | 69 | * Returns whether 'weakened alternative' suggestions of the context shall be expanded as additional PConstraints. |
70 | * This behavior can be customized by creating a subclass | 70 | * This behavior can be customized by creating a subclass |
71 | * with a custom implementation. | 71 | * with a custom implementation. |
72 | * | 72 | * |
73 | * @since 1.6 | 73 | * @since 1.6 |
74 | */ | 74 | */ |
75 | protected boolean shouldExpandWeakenedAlternatives(PQuery query) { | 75 | protected boolean shouldExpandWeakenedAlternatives(PQuery query) { |
@@ -96,7 +96,7 @@ public class PBodyNormalizer extends PDisjunctionRewriter { | |||
96 | /** | 96 | /** |
97 | * Provides a normalized version of the pattern body. May return a different version than the original version if | 97 | * Provides a normalized version of the pattern body. May return a different version than the original version if |
98 | * needed. | 98 | * needed. |
99 | * | 99 | * |
100 | * @param body | 100 | * @param body |
101 | */ | 101 | */ |
102 | public PBody normalizeBody(PBody body) { | 102 | public PBody normalizeBody(PBody body) { |
@@ -118,7 +118,7 @@ public class PBodyNormalizer extends PDisjunctionRewriter { | |||
118 | if (shouldExpandWeakenedAlternatives(body.getPattern())) { | 118 | if (shouldExpandWeakenedAlternatives(body.getPattern())) { |
119 | expandWeakenedAlternativeConstraints(body); | 119 | expandWeakenedAlternativeConstraints(body); |
120 | } | 120 | } |
121 | 121 | ||
122 | // CONSTRAINT ELIMINATION WITH TYPE INFERENCE | 122 | // CONSTRAINT ELIMINATION WITH TYPE INFERENCE |
123 | if (shouldCalculateImpliedTypes(body.getPattern())) { | 123 | if (shouldCalculateImpliedTypes(body.getPattern())) { |
124 | eliminateInferrableTypes(body, context); | 124 | eliminateInferrableTypes(body, context); |
@@ -127,12 +127,12 @@ public class PBodyNormalizer extends PDisjunctionRewriter { | |||
127 | eliminateDuplicateTypeConstraints(body); | 127 | eliminateDuplicateTypeConstraints(body); |
128 | } | 128 | } |
129 | 129 | ||
130 | 130 | ||
131 | // PREVENTIVE CHECKS | 131 | // PREVENTIVE CHECKS |
132 | checkSanity(body); | 132 | checkSanity(body); |
133 | return body; | 133 | return body; |
134 | } | 134 | } |
135 | 135 | ||
136 | private void removeMootEqualities(PBody body) { | 136 | private void removeMootEqualities(PBody body) { |
137 | Set<Equality> equals = body.getConstraintsOfType(Equality.class); | 137 | Set<Equality> equals = body.getConstraintsOfType(Equality.class); |
138 | for (Equality equality : equals) { | 138 | for (Equality equality : equals) { |
@@ -145,7 +145,7 @@ public class PBodyNormalizer extends PDisjunctionRewriter { | |||
145 | 145 | ||
146 | /** | 146 | /** |
147 | * Unifies allVariables along equalities so that they can be handled as one. | 147 | * Unifies allVariables along equalities so that they can be handled as one. |
148 | * | 148 | * |
149 | * @param body | 149 | * @param body |
150 | */ | 150 | */ |
151 | void unifyVariablesAlongEqualities(PBody body) { | 151 | void unifyVariablesAlongEqualities(PBody body) { |
@@ -159,7 +159,7 @@ public class PBodyNormalizer extends PDisjunctionRewriter { | |||
159 | 159 | ||
160 | /** | 160 | /** |
161 | * Eliminates weak inequalities if they are not substantiated. | 161 | * Eliminates weak inequalities if they are not substantiated. |
162 | * | 162 | * |
163 | * @param body | 163 | * @param body |
164 | */ | 164 | */ |
165 | void eliminateWeakInequalities(PBody body) { | 165 | void eliminateWeakInequalities(PBody body) { |
@@ -191,13 +191,13 @@ public class PBodyNormalizer extends PDisjunctionRewriter { | |||
191 | Comparator<ITypeConstraint> eliminationOrder = (o1, o2) -> { | 191 | Comparator<ITypeConstraint> eliminationOrder = (o1, o2) -> { |
192 | IInputKey type1 = o1.getEquivalentJudgement().getInputKey(); | 192 | IInputKey type1 = o1.getEquivalentJudgement().getInputKey(); |
193 | IInputKey type2 = o2.getEquivalentJudgement().getInputKey(); | 193 | IInputKey type2 = o2.getEquivalentJudgement().getInputKey(); |
194 | 194 | ||
195 | int result = context.getSuggestedEliminationOrdering().compare(type1, type2); | 195 | int result = context.getSuggestedEliminationOrdering().compare(type1, type2); |
196 | return (result == 0) | 196 | return (result == 0) |
197 | ? PConstraint.COMPARE_BY_MONOTONOUS_ID.compare(o1, o2) | 197 | ? PConstraint.COMPARE_BY_MONOTONOUS_ID.compare(o1, o2) |
198 | : result; | 198 | : result; |
199 | }; | 199 | }; |
200 | 200 | ||
201 | Collections.sort(allTypeConstraints, eliminationOrder); | 201 | Collections.sort(allTypeConstraints, eliminationOrder); |
202 | Queue<ITypeConstraint> potentialConstraints = allTypeConstraints; // rename for better comprehension | 202 | Queue<ITypeConstraint> potentialConstraints = allTypeConstraints; // rename for better comprehension |
203 | 203 | ||
@@ -235,14 +235,14 @@ public class PBodyNormalizer extends PDisjunctionRewriter { | |||
235 | Set<TypeJudgement> newJudgementsToAdd = new HashSet<TypeJudgement>(); | 235 | Set<TypeJudgement> newJudgementsToAdd = new HashSet<TypeJudgement>(); |
236 | Queue<TypeJudgement> judgementsToProcess = new LinkedList<TypeJudgement>(); | 236 | Queue<TypeJudgement> judgementsToProcess = new LinkedList<TypeJudgement>(); |
237 | Map<TypeJudgement, List<PConstraint>> traceability = CollectionsFactory.createMap(); | 237 | Map<TypeJudgement, List<PConstraint>> traceability = CollectionsFactory.createMap(); |
238 | 238 | ||
239 | for (ITypeConstraint typeConstraint : body.getConstraintsOfType(ITypeConstraint.class)) { | 239 | for (ITypeConstraint typeConstraint : body.getConstraintsOfType(ITypeConstraint.class)) { |
240 | TypeJudgement equivalentJudgement = typeConstraint.getEquivalentJudgement(); | 240 | TypeJudgement equivalentJudgement = typeConstraint.getEquivalentJudgement(); |
241 | judgementsToProcess.add(equivalentJudgement); | 241 | judgementsToProcess.add(equivalentJudgement); |
242 | allJudgements.add(equivalentJudgement); | 242 | allJudgements.add(equivalentJudgement); |
243 | traceability.computeIfAbsent(equivalentJudgement, k-> new ArrayList<>()).add(typeConstraint); | 243 | traceability.computeIfAbsent(equivalentJudgement, k-> new ArrayList<>()).add(typeConstraint); |
244 | } | 244 | } |
245 | 245 | ||
246 | while (!judgementsToProcess.isEmpty()) { | 246 | while (!judgementsToProcess.isEmpty()) { |
247 | TypeJudgement judgement = judgementsToProcess.poll(); | 247 | TypeJudgement judgement = judgementsToProcess.poll(); |
248 | for (TypeJudgement alternativeJudgement : judgement.getWeakenedAlternativeJudgements(context)) { | 248 | for (TypeJudgement alternativeJudgement : judgement.getWeakenedAlternativeJudgements(context)) { |
@@ -250,22 +250,22 @@ public class PBodyNormalizer extends PDisjunctionRewriter { | |||
250 | newJudgementsToAdd.add(alternativeJudgement); | 250 | newJudgementsToAdd.add(alternativeJudgement); |
251 | judgementsToProcess.add(alternativeJudgement); | 251 | judgementsToProcess.add(alternativeJudgement); |
252 | traceability.merge( | 252 | traceability.merge( |
253 | alternativeJudgement, | 253 | alternativeJudgement, |
254 | traceability.getOrDefault(judgement, new ArrayList<>()), | 254 | traceability.getOrDefault(judgement, new ArrayList<>()), |
255 | (old,further) -> {old.addAll(further); return old;} | 255 | (old,further) -> {old.addAll(further); return old;} |
256 | ); | 256 | ); |
257 | } | 257 | } |
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | for (TypeJudgement typeJudgement : newJudgementsToAdd) { | 261 | for (TypeJudgement typeJudgement : newJudgementsToAdd) { |
262 | PConstraint newConstraint = typeJudgement.createConstraintFor(body); | 262 | PConstraint newConstraint = typeJudgement.createConstraintFor(body); |
263 | for (PConstraint source : traceability.getOrDefault(typeJudgement, Collections.emptyList())) { | 263 | for (PConstraint source : traceability.getOrDefault(typeJudgement, Collections.emptyList())) { |
264 | addTrace(source, newConstraint); | 264 | addTrace(source, newConstraint); |
265 | } | 265 | } |
266 | } | 266 | } |
267 | } | 267 | } |
268 | 268 | ||
269 | private Object getConstraintKey(PConstraint constraint) { | 269 | private Object getConstraintKey(PConstraint constraint) { |
270 | if (constraint instanceof ITypeConstraint) { | 270 | if (constraint instanceof ITypeConstraint) { |
271 | return ((ITypeConstraint) constraint).getEquivalentJudgement(); | 271 | return ((ITypeConstraint) constraint).getEquivalentJudgement(); |
@@ -273,7 +273,7 @@ public class PBodyNormalizer extends PDisjunctionRewriter { | |||
273 | // Do not check duplication for any other types | 273 | // Do not check duplication for any other types |
274 | return constraint; | 274 | return constraint; |
275 | } | 275 | } |
276 | 276 | ||
277 | void eliminateDuplicateTypeConstraints(PBody body) { | 277 | void eliminateDuplicateTypeConstraints(PBody body) { |
278 | Map<Object, PConstraint> constraints = new HashMap<>(); | 278 | Map<Object, PConstraint> constraints = new HashMap<>(); |
279 | for (PConstraint constraint : body.getConstraints()) { | 279 | for (PConstraint constraint : body.getConstraints()) { |
@@ -286,7 +286,7 @@ public class PBodyNormalizer extends PDisjunctionRewriter { | |||
286 | 286 | ||
287 | // Retain collected constraints, remove everything else | 287 | // Retain collected constraints, remove everything else |
288 | Iterator<PConstraint> iterator = body.getConstraints().iterator(); | 288 | Iterator<PConstraint> iterator = body.getConstraints().iterator(); |
289 | Collection<PConstraint> toRetain = constraints.values(); | 289 | Collection<PConstraint> toRetain = constraints.values(); |
290 | while(iterator.hasNext()){ | 290 | while(iterator.hasNext()){ |
291 | PConstraint next = iterator.next(); | 291 | PConstraint next = iterator.next(); |
292 | if (!toRetain.contains(next)){ | 292 | if (!toRetain.contains(next)){ |
@@ -295,10 +295,10 @@ public class PBodyNormalizer extends PDisjunctionRewriter { | |||
295 | } | 295 | } |
296 | } | 296 | } |
297 | } | 297 | } |
298 | 298 | ||
299 | /** | 299 | /** |
300 | * Verifies the sanity of all constraints. Should be issued as a preventive check before layouting. | 300 | * Verifies the sanity of all constraints. Should be issued as a preventive check before layouting. |
301 | * | 301 | * |
302 | * @param body | 302 | * @param body |
303 | * @throws RetePatternBuildException | 303 | * @throws RetePatternBuildException |
304 | */ | 304 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PDisjunctionRewriter.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PDisjunctionRewriter.java index c844ccf7..8eea0585 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PDisjunctionRewriter.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PDisjunctionRewriter.java | |||
@@ -3,13 +3,13 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PDisjunction; | 11 | import tools.refinery.interpreter.matchers.psystem.queries.PDisjunction; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 12 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * An abstract base class for creating alternative representations for PDisjunctions. | 15 | * An abstract base class for creating alternative representations for PDisjunctions. |
@@ -17,11 +17,11 @@ import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | |||
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | public abstract class PDisjunctionRewriter extends AbstractRewriterTraceSource{ | 19 | public abstract class PDisjunctionRewriter extends AbstractRewriterTraceSource{ |
20 | 20 | ||
21 | public abstract PDisjunction rewrite(PDisjunction disjunction); | 21 | public abstract PDisjunction rewrite(PDisjunction disjunction); |
22 | 22 | ||
23 | public PDisjunction rewrite(PQuery query) { | 23 | public PDisjunction rewrite(PQuery query) { |
24 | return rewrite(query.getDisjunctBodies()); | 24 | return rewrite(query.getDisjunctBodies()); |
25 | } | 25 | } |
26 | 26 | ||
27 | } | 27 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PDisjunctionRewriterCacher.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PDisjunctionRewriterCacher.java index eb5422ca..58491961 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PDisjunctionRewriterCacher.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PDisjunctionRewriterCacher.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Arrays; | 12 | import java.util.Arrays; |
@@ -14,11 +14,11 @@ import java.util.Collections; | |||
14 | import java.util.List; | 14 | import java.util.List; |
15 | import java.util.WeakHashMap; | 15 | import java.util.WeakHashMap; |
16 | 16 | ||
17 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PDisjunction; | 17 | import tools.refinery.interpreter.matchers.psystem.queries.PDisjunction; |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * A rewriter that stores the previously computed results of a rewriter or a rewriter chain. | 20 | * A rewriter that stores the previously computed results of a rewriter or a rewriter chain. |
21 | * | 21 | * |
22 | * @author Zoltan Ujhelyi | 22 | * @author Zoltan Ujhelyi |
23 | * @since 1.0 | 23 | * @since 1.0 |
24 | */ | 24 | */ |
@@ -34,19 +34,19 @@ public class PDisjunctionRewriterCacher extends PDisjunctionRewriter { | |||
34 | rewriter.setTraceCollector(collector); | 34 | rewriter.setTraceCollector(collector); |
35 | } | 35 | } |
36 | } | 36 | } |
37 | 37 | ||
38 | public PDisjunctionRewriterCacher(PDisjunctionRewriter rewriter) { | 38 | public PDisjunctionRewriterCacher(PDisjunctionRewriter rewriter) { |
39 | rewriterChain = Collections.singletonList(rewriter); | 39 | rewriterChain = Collections.singletonList(rewriter); |
40 | } | 40 | } |
41 | 41 | ||
42 | public PDisjunctionRewriterCacher(PDisjunctionRewriter... rewriters) { | 42 | public PDisjunctionRewriterCacher(PDisjunctionRewriter... rewriters) { |
43 | rewriterChain = new ArrayList<>(Arrays.asList(rewriters)); | 43 | rewriterChain = new ArrayList<>(Arrays.asList(rewriters)); |
44 | } | 44 | } |
45 | 45 | ||
46 | public PDisjunctionRewriterCacher(List<PDisjunctionRewriter> rewriterChain) { | 46 | public PDisjunctionRewriterCacher(List<PDisjunctionRewriter> rewriterChain) { |
47 | this.rewriterChain = new ArrayList<>(rewriterChain); | 47 | this.rewriterChain = new ArrayList<>(rewriterChain); |
48 | } | 48 | } |
49 | 49 | ||
50 | @Override | 50 | @Override |
51 | public PDisjunction rewrite(PDisjunction disjunction) { | 51 | public PDisjunction rewrite(PDisjunction disjunction) { |
52 | if (!cachedResults.containsKey(disjunction)) { | 52 | if (!cachedResults.containsKey(disjunction)) { |
@@ -55,10 +55,10 @@ public class PDisjunctionRewriterCacher extends PDisjunctionRewriter { | |||
55 | for (PDisjunctionRewriter rewriter : rewriterChain) { | 55 | for (PDisjunctionRewriter rewriter : rewriterChain) { |
56 | rewritten = rewriter.rewrite(rewritten); | 56 | rewritten = rewriter.rewrite(rewritten); |
57 | } | 57 | } |
58 | 58 | ||
59 | cachedResults.put(disjunction, rewritten); | 59 | cachedResults.put(disjunction, rewritten); |
60 | } | 60 | } |
61 | return cachedResults.get(disjunction); | 61 | return cachedResults.get(disjunction); |
62 | } | 62 | } |
63 | 63 | ||
64 | } | 64 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PQueryFlattener.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PQueryFlattener.java index 76311d8f..d1447199 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/PQueryFlattener.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/PQueryFlattener.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import java.util.ArrayDeque; | 11 | import java.util.ArrayDeque; |
12 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
@@ -20,30 +20,28 @@ import java.util.List; | |||
20 | import java.util.Map; | 20 | import java.util.Map; |
21 | import java.util.Set; | 21 | import java.util.Set; |
22 | 22 | ||
23 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 23 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.PConstraint; | 24 | import tools.refinery.interpreter.matchers.psystem.PBody; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 25 | import tools.refinery.interpreter.matchers.psystem.PConstraint; |
26 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PDisjunction; | 26 | import tools.refinery.interpreter.matchers.psystem.queries.PDisjunction; |
27 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 27 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
28 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery.PQueryStatus; | 28 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery.PQueryStatus; |
29 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.IConstraintFilter.AllowAllFilter; | 29 | import tools.refinery.interpreter.matchers.psystem.rewriters.IConstraintFilter.AllowAllFilter; |
30 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.IConstraintFilter.ExportedParameterFilter; | 30 | import tools.refinery.interpreter.matchers.psystem.rewriters.IConstraintFilter.ExportedParameterFilter; |
31 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.IVariableRenamer.HierarchicalName; | 31 | import tools.refinery.interpreter.matchers.util.Preconditions; |
32 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.IVariableRenamer.SameName; | 32 | import tools.refinery.interpreter.matchers.util.Sets; |
33 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | ||
34 | import tools.refinery.viatra.runtime.matchers.util.Sets; | ||
35 | 33 | ||
36 | /** | 34 | /** |
37 | * This rewriter class holds the query flattening logic | 35 | * This rewriter class holds the query flattening logic |
38 | * | 36 | * |
39 | * @author Marton Bur | 37 | * @author Marton Bur |
40 | * | 38 | * |
41 | */ | 39 | */ |
42 | public class PQueryFlattener extends PDisjunctionRewriter { | 40 | public class PQueryFlattener extends PDisjunctionRewriter { |
43 | 41 | ||
44 | /** | 42 | /** |
45 | * Utility function to produce the permutation of every possible mapping of values. | 43 | * Utility function to produce the permutation of every possible mapping of values. |
46 | * | 44 | * |
47 | * @param values | 45 | * @param values |
48 | * @return | 46 | * @return |
49 | */ | 47 | */ |
@@ -98,7 +96,7 @@ public class PQueryFlattener extends PDisjunctionRewriter { | |||
98 | 96 | ||
99 | /** | 97 | /** |
100 | * Return the list of dependencies (including the root) in chronological order | 98 | * Return the list of dependencies (including the root) in chronological order |
101 | * | 99 | * |
102 | * @param rootDisjunction | 100 | * @param rootDisjunction |
103 | * @return | 101 | * @return |
104 | */ | 102 | */ |
@@ -131,13 +129,13 @@ public class PQueryFlattener extends PDisjunctionRewriter { | |||
131 | // Remove duplicates (keeping the last instance) and reverse order | 129 | // Remove duplicates (keeping the last instance) and reverse order |
132 | Set<PDisjunction> visited = new HashSet<PDisjunction>(); | 130 | Set<PDisjunction> visited = new HashSet<PDisjunction>(); |
133 | List<PDisjunction> result = new ArrayList<PDisjunction>(list.size()); | 131 | List<PDisjunction> result = new ArrayList<PDisjunction>(list.size()); |
134 | 132 | ||
135 | list.descendingIterator().forEachRemaining(item -> { | 133 | list.descendingIterator().forEachRemaining(item -> { |
136 | if (!visited.contains(item)) { | 134 | if (!visited.contains(item)) { |
137 | result.add(item); | 135 | result.add(item); |
138 | visited.add(item); | 136 | visited.add(item); |
139 | } | 137 | } |
140 | 138 | ||
141 | }); | 139 | }); |
142 | 140 | ||
143 | return result; | 141 | return result; |
@@ -145,7 +143,7 @@ public class PQueryFlattener extends PDisjunctionRewriter { | |||
145 | 143 | ||
146 | /** | 144 | /** |
147 | * This function holds the actual flattening logic for a PQuery | 145 | * This function holds the actual flattening logic for a PQuery |
148 | * | 146 | * |
149 | * @param rootDisjunction | 147 | * @param rootDisjunction |
150 | * to be flattened | 148 | * to be flattened |
151 | * @return the flattened bodies of the pQuery | 149 | * @return the flattened bodies of the pQuery |
@@ -189,7 +187,7 @@ public class PQueryFlattener extends PDisjunctionRewriter { | |||
189 | 187 | ||
190 | /** | 188 | /** |
191 | * Creates the flattened bodies based on the caller body and the called (and already flattened) disjunctions | 189 | * Creates the flattened bodies based on the caller body and the called (and already flattened) disjunctions |
192 | * | 190 | * |
193 | * @param pBody | 191 | * @param pBody |
194 | * the body to flatten | 192 | * the body to flatten |
195 | * @param flattenedDisjunctions | 193 | * @param flattenedDisjunctions |
@@ -209,7 +207,7 @@ public class PQueryFlattener extends PDisjunctionRewriter { | |||
209 | FlattenerCopier copier = createBodyCopier(pQuery, calledBodies); | 207 | FlattenerCopier copier = createBodyCopier(pQuery, calledBodies); |
210 | 208 | ||
211 | int i = 0; | 209 | int i = 0; |
212 | HierarchicalName hierarchicalNamingTool = new HierarchicalName(); | 210 | IVariableRenamer.HierarchicalName hierarchicalNamingTool = new IVariableRenamer.HierarchicalName(); |
213 | for (PositivePatternCall patternCall : calledBodies.keySet()) { | 211 | for (PositivePatternCall patternCall : calledBodies.keySet()) { |
214 | // Merge each called body | 212 | // Merge each called body |
215 | hierarchicalNamingTool.setCallCount(i++); | 213 | hierarchicalNamingTool.setCallCount(i++); |
@@ -235,7 +233,7 @@ public class PQueryFlattener extends PDisjunctionRewriter { | |||
235 | 233 | ||
236 | private PBody prepareFlatPBody(PBody pBody) { | 234 | private PBody prepareFlatPBody(PBody pBody) { |
237 | PBodyCopier copier = createBodyCopier(pBody.getPattern(), Collections.<PositivePatternCall, PBody> emptyMap()); | 235 | PBodyCopier copier = createBodyCopier(pBody.getPattern(), Collections.<PositivePatternCall, PBody> emptyMap()); |
238 | copier.mergeBody(pBody, new SameName(), new AllowAllFilter()); | 236 | copier.mergeBody(pBody, new IVariableRenamer.SameName(), new AllowAllFilter()); |
239 | // the copying of the body here is necessary for only one containing PDisjunction can be assigned to a PBody | 237 | // the copying of the body here is necessary for only one containing PDisjunction can be assigned to a PBody |
240 | return copier.getCopiedBody(); | 238 | return copier.getCopiedBody(); |
241 | } | 239 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/RewriterException.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/RewriterException.java index d0fc286b..61b5049b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/RewriterException.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/RewriterException.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.queries.QueryInitializationException; | 11 | import tools.refinery.interpreter.matchers.psystem.queries.QueryInitializationException; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * An exception to wrap various issues during PDisjunction rewriting. | 14 | * An exception to wrap various issues during PDisjunction rewriting. |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/SurrogateQueryRewriter.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/SurrogateQueryRewriter.java index 71459558..6ab2a3de 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/SurrogateQueryRewriter.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/SurrogateQueryRewriter.java | |||
@@ -3,25 +3,25 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import java.util.LinkedHashSet; | 11 | import java.util.LinkedHashSet; |
12 | import java.util.Set; | 12 | import java.util.Set; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 14 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
15 | import tools.refinery.viatra.runtime.matchers.context.surrogate.SurrogateQueryRegistry; | 15 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.TypeConstraint; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 16 | import tools.refinery.interpreter.matchers.context.IInputKey; |
17 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 17 | import tools.refinery.interpreter.matchers.context.surrogate.SurrogateQueryRegistry; |
18 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 18 | import tools.refinery.interpreter.matchers.psystem.PBody; |
19 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 19 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
20 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PDisjunction; | 20 | import tools.refinery.interpreter.matchers.psystem.queries.PDisjunction; |
21 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 21 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery.PQueryStatus; | 22 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery.PQueryStatus; |
23 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 23 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
24 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 24 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * @author Zoltan Ujhelyi | 27 | * @author Zoltan Ujhelyi |
@@ -34,17 +34,17 @@ public class SurrogateQueryRewriter extends PDisjunctionRewriter { | |||
34 | Set<PBody> replacedBodies = new LinkedHashSet<>(); | 34 | Set<PBody> replacedBodies = new LinkedHashSet<>(); |
35 | for (PBody body : disjunction.getBodies()) { | 35 | for (PBody body : disjunction.getBodies()) { |
36 | PBodyCopier copier = new PBodyCopier(body, getTraceCollector()) { | 36 | PBodyCopier copier = new PBodyCopier(body, getTraceCollector()) { |
37 | 37 | ||
38 | @Override | 38 | @Override |
39 | protected void copyTypeConstraint(TypeConstraint typeConstraint) { | 39 | protected void copyTypeConstraint(TypeConstraint typeConstraint) { |
40 | PVariable[] mappedVariables = extractMappedVariables(typeConstraint); | 40 | PVariable[] mappedVariables = extractMappedVariables(typeConstraint); |
41 | Tuple variablesTuple = Tuples.flatTupleOf((Object[])mappedVariables); | 41 | Tuple variablesTuple = Tuples.flatTupleOf((Object[])mappedVariables); |
42 | final IInputKey supplierKey = typeConstraint.getSupplierKey(); | 42 | final IInputKey supplierKey = typeConstraint.getSupplierKey(); |
43 | if(SurrogateQueryRegistry.instance().hasSurrogateQueryFQN(supplierKey)) { | 43 | if(SurrogateQueryRegistry.instance().hasSurrogateQueryFQN(supplierKey)) { |
44 | PQuery surrogateQuery = SurrogateQueryRegistry.instance().getSurrogateQuery(supplierKey); | 44 | PQuery surrogateQuery = SurrogateQueryRegistry.instance().getSurrogateQuery(supplierKey); |
45 | if (surrogateQuery == null) { | 45 | if (surrogateQuery == null) { |
46 | throw new IllegalStateException( | 46 | throw new IllegalStateException( |
47 | String.format("Surrogate query for feature %s not found", | 47 | String.format("Surrogate query for feature %s not found", |
48 | supplierKey.getPrettyPrintableName())); | 48 | supplierKey.getPrettyPrintableName())); |
49 | } | 49 | } |
50 | addTrace(typeConstraint, new PositivePatternCall(getCopiedBody(), variablesTuple, surrogateQuery)); | 50 | addTrace(typeConstraint, new PositivePatternCall(getCopiedBody(), variablesTuple, surrogateQuery)); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/VariableMappingExpressionEvaluatorWrapper.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/VariableMappingExpressionEvaluatorWrapper.java index e0e17b5e..29920a4d 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/rewriters/VariableMappingExpressionEvaluatorWrapper.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/psystem/rewriters/VariableMappingExpressionEvaluatorWrapper.java | |||
@@ -6,12 +6,12 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.psystem.rewriters; | 9 | package tools.refinery.interpreter.matchers.psystem.rewriters; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.psystem.IExpressionEvaluator; | 11 | import tools.refinery.interpreter.matchers.psystem.IExpressionEvaluator; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.IValueProvider; | 12 | import tools.refinery.interpreter.matchers.psystem.IValueProvider; |
13 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 13 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
14 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 14 | import tools.refinery.interpreter.matchers.util.Preconditions; |
15 | 15 | ||
16 | import java.util.HashMap; | 16 | import java.util.HashMap; |
17 | import java.util.LinkedHashMap; | 17 | import java.util.LinkedHashMap; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/AbstractTuple.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/AbstractTuple.java index a26d9193..854ce717 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/AbstractTuple.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/AbstractTuple.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.HashMap; | 12 | import java.util.HashMap; |
@@ -19,7 +19,7 @@ import java.util.Set; | |||
19 | /** | 19 | /** |
20 | * Common implementation methods for immutable and volatile tuples. The class should not be used directly in client | 20 | * Common implementation methods for immutable and volatile tuples. The class should not be used directly in client |
21 | * code, except for the definition of new tuple implementations. | 21 | * code, except for the definition of new tuple implementations. |
22 | * | 22 | * |
23 | * @author Zoltan Ujhelyi | 23 | * @author Zoltan Ujhelyi |
24 | * @since 1.7 | 24 | * @since 1.7 |
25 | */ | 25 | */ |
@@ -27,7 +27,7 @@ public abstract class AbstractTuple implements ITuple { | |||
27 | 27 | ||
28 | /** | 28 | /** |
29 | * As the tuple is supposed to be immutable, do not modify the returned array. | 29 | * As the tuple is supposed to be immutable, do not modify the returned array. |
30 | * | 30 | * |
31 | * @return the array containing all elements of this Tuple | 31 | * @return the array containing all elements of this Tuple |
32 | */ | 32 | */ |
33 | @Override | 33 | @Override |
@@ -55,7 +55,7 @@ public abstract class AbstractTuple implements ITuple { | |||
55 | /** | 55 | /** |
56 | * Calculates an inverted index of the elements of this pattern. For each element, the index of the (last) | 56 | * Calculates an inverted index of the elements of this pattern. For each element, the index of the (last) |
57 | * occurrence is calculated. | 57 | * occurrence is calculated. |
58 | * | 58 | * |
59 | * @return the inverted index mapping each element of this pattern to its index in the array | 59 | * @return the inverted index mapping each element of this pattern to its index in the array |
60 | */ | 60 | */ |
61 | @Override | 61 | @Override |
@@ -69,7 +69,7 @@ public abstract class AbstractTuple implements ITuple { | |||
69 | /** | 69 | /** |
70 | * Calculates an inverted index of the elements of this pattern. For each element, the index of all of its | 70 | * Calculates an inverted index of the elements of this pattern. For each element, the index of all of its |
71 | * occurrences is calculated. | 71 | * occurrences is calculated. |
72 | * | 72 | * |
73 | * @return the inverted index mapping each element of this pattern to its index in the array | 73 | * @return the inverted index mapping each element of this pattern to its index in the array |
74 | */ | 74 | */ |
75 | @Override | 75 | @Override |
@@ -133,4 +133,4 @@ public abstract class AbstractTuple implements ITuple { | |||
133 | return hash; | 133 | return hash; |
134 | } | 134 | } |
135 | 135 | ||
136 | } \ No newline at end of file | 136 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/BaseFlatTuple.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/BaseFlatTuple.java index 6f46b763..3c13e0fd 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/BaseFlatTuple.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/BaseFlatTuple.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Base class for all flat tuple implementations. | 12 | * Base class for all flat tuple implementations. |
13 | * Flat tuples store all elements locally (do not reference other tuples). | 13 | * Flat tuples store all elements locally (do not reference other tuples). |
14 | * | 14 | * |
15 | * @author Gabor Bergmann | 15 | * @author Gabor Bergmann |
16 | * @since 1.7 | 16 | * @since 1.7 |
17 | */ | 17 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/BaseLeftInheritanceTuple.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/BaseLeftInheritanceTuple.java index 03f9ea89..5a6b7564 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/BaseLeftInheritanceTuple.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/BaseLeftInheritanceTuple.java | |||
@@ -3,17 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Common functionality of left inheritance tuple implementations. | 12 | * Common functionality of left inheritance tuple implementations. |
13 | * | 13 | * |
14 | * <p>Left inheritance tuples inherit their first few elements from another tuple, | 14 | * <p>Left inheritance tuples inherit their first few elements from another tuple, |
15 | * and extend it with additional "local" elements. | 15 | * and extend it with additional "local" elements. |
16 | * | 16 | * |
17 | * @author Gabor Bergmann | 17 | * @author Gabor Bergmann |
18 | * @since 1.7 | 18 | * @since 1.7 |
19 | */ | 19 | */ |
@@ -27,7 +27,7 @@ public abstract class BaseLeftInheritanceTuple extends Tuple { | |||
27 | * This object contains the same elements as the ancestor on the first inheritedIndex positions | 27 | * This object contains the same elements as the ancestor on the first inheritedIndex positions |
28 | */ | 28 | */ |
29 | protected final Tuple ancestor; | 29 | protected final Tuple ancestor; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * @param ancestor | 32 | * @param ancestor |
33 | */ | 33 | */ |
@@ -41,10 +41,10 @@ public abstract class BaseLeftInheritanceTuple extends Tuple { | |||
41 | * @return the number of local (non-inherited) elements | 41 | * @return the number of local (non-inherited) elements |
42 | */ | 42 | */ |
43 | public abstract int getLocalSize(); | 43 | public abstract int getLocalSize(); |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * Optimized equals calculation (prediction: true, since hash values match) | 46 | * Optimized equals calculation (prediction: true, since hash values match) |
47 | */ | 47 | */ |
48 | @Override | 48 | @Override |
49 | protected boolean internalEquals(ITuple other) { | 49 | protected boolean internalEquals(ITuple other) { |
50 | if (other instanceof BaseLeftInheritanceTuple) { | 50 | if (other instanceof BaseLeftInheritanceTuple) { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple.java index 8bbb0ac2..c28d55db 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple.java | |||
@@ -3,17 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.tuple; | 10 | package tools.refinery.interpreter.matchers.tuple; |
11 | 11 | ||
12 | import java.util.Arrays; | 12 | import java.util.Arrays; |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * Default Tuple implementation, with statically unknown arity. | 15 | * Default Tuple implementation, with statically unknown arity. |
16 | * @author Gabor Bergmann | 16 | * @author Gabor Bergmann |
17 | */ | 17 | */ |
18 | public final class FlatTuple extends BaseFlatTuple { | 18 | public final class FlatTuple extends BaseFlatTuple { |
19 | 19 | ||
@@ -25,9 +25,9 @@ public final class FlatTuple extends BaseFlatTuple { | |||
25 | /** | 25 | /** |
26 | * Creates a FlatTuple instance, fills it with the given array. | 26 | * Creates a FlatTuple instance, fills it with the given array. |
27 | * <p> Users should consider calling {@link Tuples#flatTupleOf(Object...)} instead to save memory on low-arity tuples. | 27 | * <p> Users should consider calling {@link Tuples#flatTupleOf(Object...)} instead to save memory on low-arity tuples. |
28 | * | 28 | * |
29 | * @param elements | 29 | * @param elements |
30 | * array of substitution values | 30 | * array of substitution values |
31 | */ | 31 | */ |
32 | protected FlatTuple(Object... elements) { | 32 | protected FlatTuple(Object... elements) { |
33 | this.elements = Arrays.copyOf(elements, elements.length); | 33 | this.elements = Arrays.copyOf(elements, elements.length); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple0.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple0.java index 93f412b7..4b5d507a 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple0.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple0.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Flat tuple with statically known arity of 0. | 12 | * Flat tuple with statically known arity of 0. |
13 | * | 13 | * |
14 | * @author Gabor Bergmann | 14 | * @author Gabor Bergmann |
15 | * @since 1.7 | 15 | * @since 1.7 |
16 | * | 16 | * |
@@ -21,7 +21,7 @@ public final class FlatTuple0 extends BaseFlatTuple { | |||
21 | private FlatTuple0() { | 21 | private FlatTuple0() { |
22 | calcHash(); | 22 | calcHash(); |
23 | } | 23 | } |
24 | 24 | ||
25 | @Override | 25 | @Override |
26 | public int getSize() { | 26 | public int getSize() { |
27 | return 0; | 27 | return 0; |
@@ -33,12 +33,12 @@ public final class FlatTuple0 extends BaseFlatTuple { | |||
33 | } | 33 | } |
34 | 34 | ||
35 | private static final Object[] NULLARY_ARRAY = new Object[0]; | 35 | private static final Object[] NULLARY_ARRAY = new Object[0]; |
36 | 36 | ||
37 | @Override | 37 | @Override |
38 | public Object[] getElements() { | 38 | public Object[] getElements() { |
39 | return NULLARY_ARRAY; | 39 | return NULLARY_ARRAY; |
40 | } | 40 | } |
41 | 41 | ||
42 | @Override | 42 | @Override |
43 | protected boolean internalEquals(ITuple other) { | 43 | protected boolean internalEquals(ITuple other) { |
44 | return 0 == other.getSize(); | 44 | return 0 == other.getSize(); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple1.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple1.java index b3b1c312..1ab6a379 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple1.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple1.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import java.util.Objects; | 11 | import java.util.Objects; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Flat tuple with statically known arity of 1. | 14 | * Flat tuple with statically known arity of 1. |
15 | * | 15 | * |
16 | * @author Gabor Bergmann | 16 | * @author Gabor Bergmann |
17 | * @since 1.7 | 17 | * @since 1.7 |
18 | * | 18 | * |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple2.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple2.java index 2dcfd718..0e128013 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple2.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple2.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import java.util.Objects; | 11 | import java.util.Objects; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Flat tuple with statically known arity of 2. | 14 | * Flat tuple with statically known arity of 2. |
15 | * | 15 | * |
16 | * @author Gabor Bergmann | 16 | * @author Gabor Bergmann |
17 | * @since 1.7 | 17 | * @since 1.7 |
18 | * | 18 | * |
@@ -40,7 +40,7 @@ public final class FlatTuple2 extends BaseFlatTuple { | |||
40 | default: throw raiseIndexingError(index); | 40 | default: throw raiseIndexingError(index); |
41 | } | 41 | } |
42 | } | 42 | } |
43 | 43 | ||
44 | @Override | 44 | @Override |
45 | protected boolean internalEquals(ITuple other) { | 45 | protected boolean internalEquals(ITuple other) { |
46 | return 2 == other.getSize() && | 46 | return 2 == other.getSize() && |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple3.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple3.java index 50cee57e..d44f06f9 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple3.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple3.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import java.util.Objects; | 11 | import java.util.Objects; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Flat tuple with statically known arity of 3. | 14 | * Flat tuple with statically known arity of 3. |
15 | * | 15 | * |
16 | * @author Gabor Bergmann | 16 | * @author Gabor Bergmann |
17 | * @since 1.7 | 17 | * @since 1.7 |
18 | * | 18 | * |
@@ -21,7 +21,7 @@ public final class FlatTuple3 extends BaseFlatTuple { | |||
21 | private final Object element0; | 21 | private final Object element0; |
22 | private final Object element1; | 22 | private final Object element1; |
23 | private final Object element2; | 23 | private final Object element2; |
24 | 24 | ||
25 | protected FlatTuple3(Object element0, Object element1, Object element2) { | 25 | protected FlatTuple3(Object element0, Object element1, Object element2) { |
26 | this.element0 = element0; | 26 | this.element0 = element0; |
27 | this.element1 = element1; | 27 | this.element1 = element1; |
@@ -43,7 +43,7 @@ public final class FlatTuple3 extends BaseFlatTuple { | |||
43 | default: throw raiseIndexingError(index); | 43 | default: throw raiseIndexingError(index); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | @Override | 47 | @Override |
48 | protected boolean internalEquals(ITuple other) { | 48 | protected boolean internalEquals(ITuple other) { |
49 | return 3 == other.getSize() && | 49 | return 3 == other.getSize() && |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple4.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple4.java index 024c94f4..cd88f3dc 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/FlatTuple4.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/FlatTuple4.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import java.util.Objects; | 11 | import java.util.Objects; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Flat tuple with statically known arity of 4. | 14 | * Flat tuple with statically known arity of 4. |
15 | * | 15 | * |
16 | * @author Gabor Bergmann | 16 | * @author Gabor Bergmann |
17 | * @since 1.7 | 17 | * @since 1.7 |
18 | * | 18 | * |
@@ -30,7 +30,7 @@ public final class FlatTuple4 extends BaseFlatTuple { | |||
30 | this.element3 = element3; | 30 | this.element3 = element3; |
31 | calcHash(); | 31 | calcHash(); |
32 | } | 32 | } |
33 | 33 | ||
34 | @Override | 34 | @Override |
35 | public int getSize() { | 35 | public int getSize() { |
36 | return 4; | 36 | return 4; |
@@ -46,7 +46,7 @@ public final class FlatTuple4 extends BaseFlatTuple { | |||
46 | default: throw raiseIndexingError(index); | 46 | default: throw raiseIndexingError(index); |
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | @Override | 50 | @Override |
51 | protected boolean internalEquals(ITuple other) { | 51 | protected boolean internalEquals(ITuple other) { |
52 | return 4 == other.getSize() && | 52 | return 4 == other.getSize() && |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/IModifiableTuple.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/IModifiableTuple.java index f5dab2a5..7719e6bc 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/IModifiableTuple.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/IModifiableTuple.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * A tuple that allows modifying the underlying value. Should not be used for non-volatile tuples. | 12 | * A tuple that allows modifying the underlying value. Should not be used for non-volatile tuples. |
13 | * | 13 | * |
14 | * @author Zoltan Ujhelyi | 14 | * @author Zoltan Ujhelyi |
15 | * @since 1.7 | 15 | * @since 1.7 |
16 | */ | 16 | */ |
@@ -18,9 +18,9 @@ public interface IModifiableTuple extends ITuple { | |||
18 | 18 | ||
19 | /** | 19 | /** |
20 | * Sets the selected value for a tuple | 20 | * Sets the selected value for a tuple |
21 | * | 21 | * |
22 | * @pre: 0 <= index < getSize() | 22 | * @pre: 0 <= index < getSize() |
23 | * | 23 | * |
24 | */ | 24 | */ |
25 | void set(int index, Object value); | 25 | void set(int index, Object value); |
26 | 26 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/ITuple.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/ITuple.java index 92014781..8394163f 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/ITuple.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/ITuple.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import java.util.List; | 11 | import java.util.List; |
12 | import java.util.Map; | 12 | import java.util.Map; |
@@ -14,7 +14,7 @@ import java.util.Set; | |||
14 | 14 | ||
15 | /** | 15 | /** |
16 | * Represents both mutable and immutable tuples | 16 | * Represents both mutable and immutable tuples |
17 | * | 17 | * |
18 | * @author Zoltan Ujhelyi | 18 | * @author Zoltan Ujhelyi |
19 | * @since 1.7 | 19 | * @since 1.7 |
20 | * | 20 | * |
@@ -23,7 +23,7 @@ public interface ITuple { | |||
23 | 23 | ||
24 | /** | 24 | /** |
25 | * @pre: 0 <= index < getSize() | 25 | * @pre: 0 <= index < getSize() |
26 | * | 26 | * |
27 | * @return the element at the specified index | 27 | * @return the element at the specified index |
28 | */ | 28 | */ |
29 | Object get(int index); | 29 | Object get(int index); |
@@ -43,11 +43,11 @@ public interface ITuple { | |||
43 | * @return number of elements | 43 | * @return number of elements |
44 | */ | 44 | */ |
45 | int getSize(); | 45 | int getSize(); |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Calculates an inverted index of the elements of this pattern. For each element, the index of the (last) | 48 | * Calculates an inverted index of the elements of this pattern. For each element, the index of the (last) |
49 | * occurrence is calculated. | 49 | * occurrence is calculated. |
50 | * | 50 | * |
51 | * @return the inverted index mapping each element of this pattern to its index in the array | 51 | * @return the inverted index mapping each element of this pattern to its index in the array |
52 | */ | 52 | */ |
53 | Map<Object, Integer> invertIndex(); | 53 | Map<Object, Integer> invertIndex(); |
@@ -55,10 +55,10 @@ public interface ITuple { | |||
55 | /** | 55 | /** |
56 | * Calculates an inverted index of the elements of this pattern. For each element, the index of all of its | 56 | * Calculates an inverted index of the elements of this pattern. For each element, the index of all of its |
57 | * occurrences is calculated. | 57 | * occurrences is calculated. |
58 | * | 58 | * |
59 | * @return the inverted index mapping each element of this pattern to its index in the array | 59 | * @return the inverted index mapping each element of this pattern to its index in the array |
60 | */ | 60 | */ |
61 | Map<Object, List<Integer>> invertIndexWithMupliplicity(); | 61 | Map<Object, List<Integer>> invertIndexWithMupliplicity(); |
62 | 62 | ||
63 | Tuple toImmutable(); | 63 | Tuple toImmutable(); |
64 | } \ No newline at end of file | 64 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple.java index dcdfc376..92ca62b2 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.tuple; | 10 | package tools.refinery.interpreter.matchers.tuple; |
11 | 11 | ||
12 | import java.util.Arrays; | 12 | import java.util.Arrays; |
13 | import java.util.Objects; | 13 | import java.util.Objects; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * | 16 | * |
17 | * Tuple that inherits another tuple on the left. | 17 | * Tuple that inherits another tuple on the left. |
18 | * | 18 | * |
19 | * @author Gabor Bergmann | 19 | * @author Gabor Bergmann |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | public final class LeftInheritanceTuple extends BaseLeftInheritanceTuple { | 22 | public final class LeftInheritanceTuple extends BaseLeftInheritanceTuple { |
23 | /** | 23 | /** |
@@ -39,14 +39,14 @@ public final class LeftInheritanceTuple extends BaseLeftInheritanceTuple { | |||
39 | // calcHash(); | 39 | // calcHash(); |
40 | // } | 40 | // } |
41 | 41 | ||
42 | 42 | ||
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Creates a Tuple instance, lets it inherit from an ancestor, extends it with a given array. @pre: no elements are | 45 | * Creates a Tuple instance, lets it inherit from an ancestor, extends it with a given array. @pre: no elements are |
46 | * null | 46 | * null |
47 | * | 47 | * |
48 | * @param localElements | 48 | * @param localElements |
49 | * array of substitution values | 49 | * array of substitution values |
50 | */ | 50 | */ |
51 | LeftInheritanceTuple(Tuple ancestor, Object[] localElements) { | 51 | LeftInheritanceTuple(Tuple ancestor, Object[] localElements) { |
52 | super(ancestor); | 52 | super(ancestor); |
@@ -105,7 +105,7 @@ public final class LeftInheritanceTuple extends BaseLeftInheritanceTuple { | |||
105 | public int getSize() { | 105 | public int getSize() { |
106 | return inheritedIndex + localElements.length; | 106 | return inheritedIndex + localElements.length; |
107 | } | 107 | } |
108 | 108 | ||
109 | @Override | 109 | @Override |
110 | public int getLocalSize() { | 110 | public int getLocalSize() { |
111 | return localElements.length; | 111 | return localElements.length; |
@@ -113,7 +113,7 @@ public final class LeftInheritanceTuple extends BaseLeftInheritanceTuple { | |||
113 | 113 | ||
114 | /** | 114 | /** |
115 | * @pre: 0 <= index < getSize() | 115 | * @pre: 0 <= index < getSize() |
116 | * | 116 | * |
117 | * @return the element at the specified index | 117 | * @return the element at the specified index |
118 | */ | 118 | */ |
119 | public Object get(int index) { | 119 | public Object get(int index) { |
@@ -137,7 +137,7 @@ public final class LeftInheritanceTuple extends BaseLeftInheritanceTuple { | |||
137 | 137 | ||
138 | /** | 138 | /** |
139 | * Optimized equals calculation (prediction: true, since hash values match) | 139 | * Optimized equals calculation (prediction: true, since hash values match) |
140 | */ | 140 | */ |
141 | @Override | 141 | @Override |
142 | protected boolean localEquals(BaseLeftInheritanceTuple other) { | 142 | protected boolean localEquals(BaseLeftInheritanceTuple other) { |
143 | if (other instanceof LeftInheritanceTuple) { | 143 | if (other instanceof LeftInheritanceTuple) { |
@@ -148,7 +148,7 @@ public final class LeftInheritanceTuple extends BaseLeftInheritanceTuple { | |||
148 | return false; | 148 | return false; |
149 | int index = inheritedIndex; | 149 | int index = inheritedIndex; |
150 | for (int i = 0; i<localElements.length; ++i) { | 150 | for (int i = 0; i<localElements.length; ++i) { |
151 | if (! Objects.equals(localElements[i], other.get(index++))) | 151 | if (! Objects.equals(localElements[i], other.get(index++))) |
152 | return false; | 152 | return false; |
153 | } | 153 | } |
154 | return true; | 154 | return true; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple1.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple1.java index 61123176..a4df4781 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple1.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple1.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import java.util.Objects; | 11 | import java.util.Objects; |
12 | 12 | ||
@@ -16,7 +16,7 @@ import java.util.Objects; | |||
16 | */ | 16 | */ |
17 | public final class LeftInheritanceTuple1 extends BaseLeftInheritanceTuple { | 17 | public final class LeftInheritanceTuple1 extends BaseLeftInheritanceTuple { |
18 | /** | 18 | /** |
19 | * A single substituted value after inheritedIndex. | 19 | * A single substituted value after inheritedIndex. |
20 | */ | 20 | */ |
21 | private final Object localElement; | 21 | private final Object localElement; |
22 | 22 | ||
@@ -29,7 +29,7 @@ public final class LeftInheritanceTuple1 extends BaseLeftInheritanceTuple { | |||
29 | this.localElement = localElement; | 29 | this.localElement = localElement; |
30 | calcHash(); | 30 | calcHash(); |
31 | } | 31 | } |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * @return number of elements | 34 | * @return number of elements |
35 | */ | 35 | */ |
@@ -44,12 +44,12 @@ public final class LeftInheritanceTuple1 extends BaseLeftInheritanceTuple { | |||
44 | 44 | ||
45 | /** | 45 | /** |
46 | * @pre: 0 <= index < getSize() | 46 | * @pre: 0 <= index < getSize() |
47 | * | 47 | * |
48 | * @return the element at the specified index | 48 | * @return the element at the specified index |
49 | */ | 49 | */ |
50 | public Object get(int index) { | 50 | public Object get(int index) { |
51 | int local = index - inheritedIndex; | 51 | int local = index - inheritedIndex; |
52 | if (local < 0) | 52 | if (local < 0) |
53 | return ancestor.get(index); | 53 | return ancestor.get(index); |
54 | else if (local == 0) return localElement; | 54 | else if (local == 0) return localElement; |
55 | else throw raiseIndexingError(index); | 55 | else throw raiseIndexingError(index); |
@@ -68,14 +68,14 @@ public final class LeftInheritanceTuple1 extends BaseLeftInheritanceTuple { | |||
68 | 68 | ||
69 | /** | 69 | /** |
70 | * Optimized equals calculation (prediction: true, since hash values match) | 70 | * Optimized equals calculation (prediction: true, since hash values match) |
71 | */ | 71 | */ |
72 | @Override | 72 | @Override |
73 | protected boolean localEquals(BaseLeftInheritanceTuple other) { | 73 | protected boolean localEquals(BaseLeftInheritanceTuple other) { |
74 | if (other instanceof LeftInheritanceTuple1) { | 74 | if (other instanceof LeftInheritanceTuple1) { |
75 | LeftInheritanceTuple1 lit = (LeftInheritanceTuple1)other; | 75 | LeftInheritanceTuple1 lit = (LeftInheritanceTuple1)other; |
76 | return Objects.equals(this.localElement, lit.localElement); | 76 | return Objects.equals(this.localElement, lit.localElement); |
77 | } else { | 77 | } else { |
78 | return (1 == other.getLocalSize()) && | 78 | return (1 == other.getLocalSize()) && |
79 | Objects.equals(localElement, other.get(inheritedIndex)); | 79 | Objects.equals(localElement, other.get(inheritedIndex)); |
80 | } | 80 | } |
81 | } | 81 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple2.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple2.java index e9fb98e8..af5f2d0a 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple2.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple2.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import java.util.Objects; | 11 | import java.util.Objects; |
12 | 12 | ||
@@ -17,7 +17,7 @@ import java.util.Objects; | |||
17 | public final class LeftInheritanceTuple2 extends BaseLeftInheritanceTuple { | 17 | public final class LeftInheritanceTuple2 extends BaseLeftInheritanceTuple { |
18 | private final Object localElement0; | 18 | private final Object localElement0; |
19 | private final Object localElement1; | 19 | private final Object localElement1; |
20 | 20 | ||
21 | protected LeftInheritanceTuple2(Tuple ancestor, Object localElement0, Object localElement1) { | 21 | protected LeftInheritanceTuple2(Tuple ancestor, Object localElement0, Object localElement1) { |
22 | super(ancestor); | 22 | super(ancestor); |
23 | this.localElement0 = localElement0; | 23 | this.localElement0 = localElement0; |
@@ -29,7 +29,7 @@ public final class LeftInheritanceTuple2 extends BaseLeftInheritanceTuple { | |||
29 | public int getLocalSize() { | 29 | public int getLocalSize() { |
30 | return 2; | 30 | return 2; |
31 | } | 31 | } |
32 | 32 | ||
33 | @Override | 33 | @Override |
34 | public int getSize() { | 34 | public int getSize() { |
35 | return inheritedIndex + 2; | 35 | return inheritedIndex + 2; |
@@ -38,7 +38,7 @@ public final class LeftInheritanceTuple2 extends BaseLeftInheritanceTuple { | |||
38 | @Override | 38 | @Override |
39 | public Object get(int index) { | 39 | public Object get(int index) { |
40 | int local = index - inheritedIndex; | 40 | int local = index - inheritedIndex; |
41 | if (local < 0) | 41 | if (local < 0) |
42 | return ancestor.get(index); | 42 | return ancestor.get(index); |
43 | else if (local == 0) return localElement0; | 43 | else if (local == 0) return localElement0; |
44 | else if (local == 1) return localElement1; | 44 | else if (local == 1) return localElement1; |
@@ -65,8 +65,8 @@ public final class LeftInheritanceTuple2 extends BaseLeftInheritanceTuple { | |||
65 | return Objects.equals(this.localElement0, lit.localElement0) && | 65 | return Objects.equals(this.localElement0, lit.localElement0) && |
66 | Objects.equals(this.localElement1, lit.localElement1); | 66 | Objects.equals(this.localElement1, lit.localElement1); |
67 | } else { | 67 | } else { |
68 | return (2 == other.getLocalSize()) && | 68 | return (2 == other.getLocalSize()) && |
69 | Objects.equals(localElement0, other.get(inheritedIndex)) && | 69 | Objects.equals(localElement0, other.get(inheritedIndex)) && |
70 | Objects.equals(localElement1, other.get(inheritedIndex + 1)); | 70 | Objects.equals(localElement1, other.get(inheritedIndex + 1)); |
71 | } | 71 | } |
72 | } | 72 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple3.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple3.java index e61d196f..108e011f 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple3.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple3.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import java.util.Objects; | 11 | import java.util.Objects; |
12 | 12 | ||
@@ -26,12 +26,12 @@ public final class LeftInheritanceTuple3 extends BaseLeftInheritanceTuple { | |||
26 | this.localElement2 = localElement2; | 26 | this.localElement2 = localElement2; |
27 | calcHash(); | 27 | calcHash(); |
28 | } | 28 | } |
29 | 29 | ||
30 | @Override | 30 | @Override |
31 | public int getLocalSize() { | 31 | public int getLocalSize() { |
32 | return 3; | 32 | return 3; |
33 | } | 33 | } |
34 | 34 | ||
35 | @Override | 35 | @Override |
36 | public int getSize() { | 36 | public int getSize() { |
37 | return inheritedIndex + 3; | 37 | return inheritedIndex + 3; |
@@ -40,7 +40,7 @@ public final class LeftInheritanceTuple3 extends BaseLeftInheritanceTuple { | |||
40 | @Override | 40 | @Override |
41 | public Object get(int index) { | 41 | public Object get(int index) { |
42 | int local = index - inheritedIndex; | 42 | int local = index - inheritedIndex; |
43 | if (local < 0) | 43 | if (local < 0) |
44 | return ancestor.get(index); | 44 | return ancestor.get(index); |
45 | else if (local == 0) return localElement0; | 45 | else if (local == 0) return localElement0; |
46 | else if (local == 1) return localElement1; | 46 | else if (local == 1) return localElement1; |
@@ -71,11 +71,11 @@ public final class LeftInheritanceTuple3 extends BaseLeftInheritanceTuple { | |||
71 | Objects.equals(this.localElement1, lit.localElement1) && | 71 | Objects.equals(this.localElement1, lit.localElement1) && |
72 | Objects.equals(this.localElement2, lit.localElement2); | 72 | Objects.equals(this.localElement2, lit.localElement2); |
73 | } else { | 73 | } else { |
74 | return (3 == other.getLocalSize()) && | 74 | return (3 == other.getLocalSize()) && |
75 | Objects.equals(localElement0, other.get(inheritedIndex)) && | 75 | Objects.equals(localElement0, other.get(inheritedIndex)) && |
76 | Objects.equals(localElement1, other.get(inheritedIndex + 1)) && | 76 | Objects.equals(localElement1, other.get(inheritedIndex + 1)) && |
77 | Objects.equals(localElement2, other.get(inheritedIndex + 2)); | 77 | Objects.equals(localElement2, other.get(inheritedIndex + 2)); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | } | 81 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple4.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple4.java index 4e50f1e1..793c4e3a 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/LeftInheritanceTuple4.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/LeftInheritanceTuple4.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import java.util.Objects; | 11 | import java.util.Objects; |
12 | 12 | ||
@@ -34,7 +34,7 @@ public final class LeftInheritanceTuple4 extends BaseLeftInheritanceTuple { | |||
34 | public int getLocalSize() { | 34 | public int getLocalSize() { |
35 | return 4; | 35 | return 4; |
36 | } | 36 | } |
37 | 37 | ||
38 | @Override | 38 | @Override |
39 | public int getSize() { | 39 | public int getSize() { |
40 | return inheritedIndex + 4; | 40 | return inheritedIndex + 4; |
@@ -43,7 +43,7 @@ public final class LeftInheritanceTuple4 extends BaseLeftInheritanceTuple { | |||
43 | @Override | 43 | @Override |
44 | public Object get(int index) { | 44 | public Object get(int index) { |
45 | int local = index - inheritedIndex; | 45 | int local = index - inheritedIndex; |
46 | if (local < 0) | 46 | if (local < 0) |
47 | return ancestor.get(index); | 47 | return ancestor.get(index); |
48 | else if (local == 0) return localElement0; | 48 | else if (local == 0) return localElement0; |
49 | else if (local == 1) return localElement1; | 49 | else if (local == 1) return localElement1; |
@@ -78,10 +78,10 @@ public final class LeftInheritanceTuple4 extends BaseLeftInheritanceTuple { | |||
78 | Objects.equals(this.localElement2, lit.localElement2) && | 78 | Objects.equals(this.localElement2, lit.localElement2) && |
79 | Objects.equals(this.localElement3, lit.localElement3); | 79 | Objects.equals(this.localElement3, lit.localElement3); |
80 | } else { | 80 | } else { |
81 | return (4 == other.getLocalSize()) && | 81 | return (4 == other.getLocalSize()) && |
82 | Objects.equals(localElement0, other.get(inheritedIndex)) && | 82 | Objects.equals(localElement0, other.get(inheritedIndex)) && |
83 | Objects.equals(localElement1, other.get(inheritedIndex + 1)) && | 83 | Objects.equals(localElement1, other.get(inheritedIndex + 1)) && |
84 | Objects.equals(localElement2, other.get(inheritedIndex + 2)) && | 84 | Objects.equals(localElement2, other.get(inheritedIndex + 2)) && |
85 | Objects.equals(localElement3, other.get(inheritedIndex + 3)); | 85 | Objects.equals(localElement3, other.get(inheritedIndex + 3)); |
86 | } | 86 | } |
87 | } | 87 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/MaskedTuple.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/MaskedTuple.java index a5d1991c..fdc92b71 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/MaskedTuple.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/MaskedTuple.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.tuple; | 10 | package tools.refinery.interpreter.matchers.tuple; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * A tuple that transparently provides a masked (transformed) view of another tuple. | 13 | * A tuple that transparently provides a masked (transformed) view of another tuple. |
14 | * | 14 | * |
15 | * @author Gabor Bergmann | 15 | * @author Gabor Bergmann |
16 | * @since 2.0 | 16 | * @since 2.0 |
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | public class MaskedTuple extends Tuple { | 19 | public class MaskedTuple extends Tuple { |
20 | 20 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/Tuple.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/Tuple.java index d94f545f..a3d2745a 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/Tuple.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/Tuple.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.tuple; | 10 | package tools.refinery.interpreter.matchers.tuple; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * Immutable tuple. Obtain instances via utility class {@link Tuples}. | 13 | * Immutable tuple. Obtain instances via utility class {@link Tuples}. |
14 | * @author Gabor Bergmann | 14 | * @author Gabor Bergmann |
15 | * | 15 | * |
16 | */ | 16 | */ |
17 | public abstract class Tuple extends AbstractTuple { | 17 | public abstract class Tuple extends AbstractTuple { |
18 | 18 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleMask.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/TupleMask.java index 49c55fef..bc31c747 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleMask.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/TupleMask.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.tuple; | 10 | package tools.refinery.interpreter.matchers.tuple; |
11 | 11 | ||
12 | import java.util.ArrayList; | 12 | import java.util.ArrayList; |
13 | import java.util.Arrays; | 13 | import java.util.Arrays; |
@@ -19,10 +19,10 @@ import java.util.OptionalInt; | |||
19 | import java.util.Set; | 19 | import java.util.Set; |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * | 22 | * |
23 | * Specifies select indices of a tuple. If viewed through this mask (see {@link #transform(ITuple)}), the signature of the pattern will consist of its | 23 | * Specifies select indices of a tuple. If viewed through this mask (see {@link #transform(ITuple)}), the signature of the pattern will consist of its |
24 | * individual substitutions at the given positions, in the exact same order as they appear in indices[]. | 24 | * individual substitutions at the given positions, in the exact same order as they appear in indices[]. |
25 | * | 25 | * |
26 | * @author Gabor Bergmann | 26 | * @author Gabor Bergmann |
27 | */ | 27 | */ |
28 | public class TupleMask { | 28 | public class TupleMask { |
@@ -36,11 +36,11 @@ public class TupleMask { | |||
36 | */ | 36 | */ |
37 | public int sourceWidth; | 37 | public int sourceWidth; |
38 | /** | 38 | /** |
39 | * indicesSorted is indices, sorted in ascending order. | 39 | * indicesSorted is indices, sorted in ascending order. |
40 | * null by default, call {@link #ensureIndicesSorted()} before using | 40 | * null by default, call {@link #ensureIndicesSorted()} before using |
41 | */ | 41 | */ |
42 | int[] indicesSorted; | 42 | int[] indicesSorted; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * true if no index occurs twice; computed on demand by {@link #isNonrepeating()} | 45 | * true if no index occurs twice; computed on demand by {@link #isNonrepeating()} |
46 | */ | 46 | */ |
@@ -57,21 +57,21 @@ public class TupleMask { | |||
57 | this.indicesSorted = indicesSorted; | 57 | this.indicesSorted = indicesSorted; |
58 | this.isNonrepeating = isNonrepeating; | 58 | this.isNonrepeating = isNonrepeating; |
59 | } | 59 | } |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * Creates a TupleMask instance that selects given positions. | 62 | * Creates a TupleMask instance that selects given positions. |
63 | * The mask takes ownership of the array selectedIndices, the client must not modify it afterwards. | 63 | * The mask takes ownership of the array selectedIndices, the client must not modify it afterwards. |
64 | * | 64 | * |
65 | * <p> indicesSorted and isNonrepeating may be OPTIONALLY given if known. | 65 | * <p> indicesSorted and isNonrepeating may be OPTIONALLY given if known. |
66 | * @since 2.0 | 66 | * @since 2.0 |
67 | */ | 67 | */ |
68 | protected static TupleMask fromSelectedIndicesInternal( | 68 | protected static TupleMask fromSelectedIndicesInternal( |
69 | int[] selectedIndices, int sourceArity, | 69 | int[] selectedIndices, int sourceArity, |
70 | int[] indicesSorted, Boolean isNonrepeating) | 70 | int[] indicesSorted, Boolean isNonrepeating) |
71 | { | 71 | { |
72 | if (selectedIndices.length == 0) // is it nullary? | 72 | if (selectedIndices.length == 0) // is it nullary? |
73 | return new TupleMask0(sourceArity); | 73 | return new TupleMask0(sourceArity); |
74 | 74 | ||
75 | // is it identity? | 75 | // is it identity? |
76 | boolean identity = sourceArity == selectedIndices.length; | 76 | boolean identity = sourceArity == selectedIndices.length; |
77 | if (identity) { | 77 | if (identity) { |
@@ -80,15 +80,15 @@ public class TupleMask { | |||
80 | identity = false; | 80 | identity = false; |
81 | break; | 81 | break; |
82 | } | 82 | } |
83 | } | 83 | } |
84 | } | 84 | } |
85 | if (identity) | 85 | if (identity) |
86 | return new TupleMaskIdentity(selectedIndices, sourceArity); | 86 | return new TupleMaskIdentity(selectedIndices, sourceArity); |
87 | 87 | ||
88 | // generic case | 88 | // generic case |
89 | return new TupleMask(selectedIndices, sourceArity, indicesSorted, isNonrepeating); | 89 | return new TupleMask(selectedIndices, sourceArity, indicesSorted, isNonrepeating); |
90 | } | 90 | } |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * Creates a TupleMask instance that selects given positions in monotonically increasing order. | 93 | * Creates a TupleMask instance that selects given positions in monotonically increasing order. |
94 | * The mask takes ownership of the array selectedIndices, the client must not modify it afterwards. | 94 | * The mask takes ownership of the array selectedIndices, the client must not modify it afterwards. |
@@ -123,7 +123,7 @@ public class TupleMask { | |||
123 | * Creates a TupleMask instance of the given size that maps every single element intact | 123 | * Creates a TupleMask instance of the given size that maps every single element intact |
124 | */ | 124 | */ |
125 | public static TupleMask identity(int size) { | 125 | public static TupleMask identity(int size) { |
126 | return new TupleMaskIdentity(size); | 126 | return new TupleMaskIdentity(size); |
127 | } | 127 | } |
128 | 128 | ||
129 | /** | 129 | /** |
@@ -147,7 +147,7 @@ public class TupleMask { | |||
147 | return fromSelectedMonotonicIndicesInternal(indices, sourceWidth); | 147 | return fromSelectedMonotonicIndicesInternal(indices, sourceWidth); |
148 | } | 148 | } |
149 | 149 | ||
150 | 150 | ||
151 | /** | 151 | /** |
152 | * Creates a TupleMask instance that selects positions where keep is true | 152 | * Creates a TupleMask instance that selects positions where keep is true |
153 | * @since 1.7 | 153 | * @since 1.7 |
@@ -165,7 +165,7 @@ public class TupleMask { | |||
165 | indices[l++] = k; | 165 | indices[l++] = k; |
166 | return fromSelectedMonotonicIndicesInternal(indices, keep.length); | 166 | return fromSelectedMonotonicIndicesInternal(indices, keep.length); |
167 | } | 167 | } |
168 | 168 | ||
169 | /** | 169 | /** |
170 | * Creates a TupleMask instance that selects given positions. | 170 | * Creates a TupleMask instance that selects given positions. |
171 | * @since 1.7 | 171 | * @since 1.7 |
@@ -264,9 +264,9 @@ public class TupleMask { | |||
264 | indicesSorted[i++] = a; | 264 | indicesSorted[i++] = a; |
265 | } | 265 | } |
266 | } | 266 | } |
267 | 267 | ||
268 | 268 | ||
269 | 269 | ||
270 | /** | 270 | /** |
271 | * Returns the first index of the source that is not selected by the mask, or empty if all indices are selected. | 271 | * Returns the first index of the source that is not selected by the mask, or empty if all indices are selected. |
272 | * <p> PRE: mask indices are all different | 272 | * <p> PRE: mask indices are all different |
@@ -274,7 +274,7 @@ public class TupleMask { | |||
274 | */ | 274 | */ |
275 | public OptionalInt getFirstOmittedIndex() { | 275 | public OptionalInt getFirstOmittedIndex() { |
276 | ensureIndicesSorted(); | 276 | ensureIndicesSorted(); |
277 | int column = 0; | 277 | int column = 0; |
278 | while (column < getSize() && indicesSorted[column] == column) column++; | 278 | while (column < getSize() && indicesSorted[column] == column) column++; |
279 | if (column < getSourceWidth()) return OptionalInt.of(column); | 279 | if (column < getSourceWidth()) return OptionalInt.of(column); |
280 | else return OptionalInt.empty(); | 280 | else return OptionalInt.empty(); |
@@ -283,26 +283,26 @@ public class TupleMask { | |||
283 | 283 | ||
284 | /** | 284 | /** |
285 | * Returns a selected masked value from the selected tuple. | 285 | * Returns a selected masked value from the selected tuple. |
286 | * @pre: 0 <= index < getSize() | 286 | * @pre: 0 <= index < getSize() |
287 | * @since 1.7 | 287 | * @since 1.7 |
288 | */ | 288 | */ |
289 | public Object getValue(ITuple original, int index) { | 289 | public Object getValue(ITuple original, int index) { |
290 | return original.get(indices[index]); | 290 | return original.get(indices[index]); |
291 | } | 291 | } |
292 | 292 | ||
293 | /** | 293 | /** |
294 | * Sets the selected value in the original tuple based on the mask definition | 294 | * Sets the selected value in the original tuple based on the mask definition |
295 | * | 295 | * |
296 | * @pre: 0 <= index < getSize() | 296 | * @pre: 0 <= index < getSize() |
297 | * @since 1.7 | 297 | * @since 1.7 |
298 | */ | 298 | */ |
299 | public void set(IModifiableTuple tuple, int index, Object value) { | 299 | public void set(IModifiableTuple tuple, int index, Object value) { |
300 | tuple.set(indices[index], value); | 300 | tuple.set(indices[index], value); |
301 | } | 301 | } |
302 | 302 | ||
303 | /** | 303 | /** |
304 | * Generates an immutable, masked view of the original tuple. | 304 | * Generates an immutable, masked view of the original tuple. |
305 | * <p> The new tuple will have arity {@link #getSize()}, | 305 | * <p> The new tuple will have arity {@link #getSize()}, |
306 | * and will consist of the elements of the original tuple, at positions indicated by this mask. | 306 | * and will consist of the elements of the original tuple, at positions indicated by this mask. |
307 | * @since 1.7 | 307 | * @since 1.7 |
308 | */ | 308 | */ |
@@ -325,7 +325,7 @@ public class TupleMask { | |||
325 | return new FlatTuple(signature); | 325 | return new FlatTuple(signature); |
326 | } | 326 | } |
327 | } | 327 | } |
328 | 328 | ||
329 | /** | 329 | /** |
330 | * @return true iff no two selected indices are the same | 330 | * @return true iff no two selected indices are the same |
331 | * @since 2.0 | 331 | * @since 2.0 |
@@ -342,11 +342,11 @@ public class TupleMask { | |||
342 | } | 342 | } |
343 | return isNonrepeating; | 343 | return isNonrepeating; |
344 | } | 344 | } |
345 | 345 | ||
346 | /** | 346 | /** |
347 | * Returns a tuple `result` that satisfies `this.transform(result).equals(masked)`. Positions of the result tuple | 347 | * Returns a tuple `result` that satisfies `this.transform(result).equals(masked)`. Positions of the result tuple |
348 | * that are not determined this way will be filled with null. | 348 | * that are not determined this way will be filled with null. |
349 | * | 349 | * |
350 | * @pre: all indices of the mask must be different, i.e {@link #isNonrepeating()} must return true | 350 | * @pre: all indices of the mask must be different, i.e {@link #isNonrepeating()} must return true |
351 | * @since 1.7 | 351 | * @since 1.7 |
352 | */ | 352 | */ |
@@ -356,14 +356,14 @@ public class TupleMask { | |||
356 | signature[indices[i]] = masked.get(i); | 356 | signature[indices[i]] = masked.get(i); |
357 | return Tuples.flatTupleOf(signature); | 357 | return Tuples.flatTupleOf(signature); |
358 | } | 358 | } |
359 | 359 | ||
360 | /** | 360 | /** |
361 | * Returns a tuple `result`, same arity as the original tuple, that satisfies | 361 | * Returns a tuple `result`, same arity as the original tuple, that satisfies |
362 | * `this.transform(result).equals(this.transform(tuple))`. | 362 | * `this.transform(result).equals(this.transform(tuple))`. |
363 | * Positions of the result tuple that are not determined this way will be filled with null. | 363 | * Positions of the result tuple that are not determined this way will be filled with null. |
364 | * <p> In other words, a copy of the original tuple is returned, | 364 | * <p> In other words, a copy of the original tuple is returned, |
365 | * with null substituted at each position that is <em>not</em> selected by this mask. | 365 | * with null substituted at each position that is <em>not</em> selected by this mask. |
366 | * | 366 | * |
367 | * @pre: all indices of the mask must be different, i.e {@link #isNonrepeating()} must return true | 367 | * @pre: all indices of the mask must be different, i.e {@link #isNonrepeating()} must return true |
368 | * @since 2.1 | 368 | * @since 2.1 |
369 | */ | 369 | */ |
@@ -376,7 +376,7 @@ public class TupleMask { | |||
376 | 376 | ||
377 | /** | 377 | /** |
378 | * Generates an immutable, masked view of the original tuple. | 378 | * Generates an immutable, masked view of the original tuple. |
379 | * <p> The list will have arity {@link #getSize()}, | 379 | * <p> The list will have arity {@link #getSize()}, |
380 | * and will consist of the elements of the original tuple, at positions indicated by this mask. | 380 | * and will consist of the elements of the original tuple, at positions indicated by this mask. |
381 | */ | 381 | */ |
382 | public <T> List<T> transform(List<T> original) { | 382 | public <T> List<T> transform(List<T> original) { |
@@ -388,7 +388,7 @@ public class TupleMask { | |||
388 | 388 | ||
389 | /** | 389 | /** |
390 | * Transforms a given mask directly, instead of transforming tuples that were transformed by the other mask. | 390 | * Transforms a given mask directly, instead of transforming tuples that were transformed by the other mask. |
391 | * | 391 | * |
392 | * @return a mask that cascades the effects this mask after the mask provided as parameter. | 392 | * @return a mask that cascades the effects this mask after the mask provided as parameter. |
393 | */ | 393 | */ |
394 | public TupleMask transform(TupleMask mask) { | 394 | public TupleMask transform(TupleMask mask) { |
@@ -425,9 +425,9 @@ public class TupleMask { | |||
425 | /** | 425 | /** |
426 | * Combines two substitutions. The new pattern will contain all substitutions of masked and unmasked, assuming that | 426 | * Combines two substitutions. The new pattern will contain all substitutions of masked and unmasked, assuming that |
427 | * the elements of masked indicated by this mask are already matched against unmasked. | 427 | * the elements of masked indicated by this mask are already matched against unmasked. |
428 | * | 428 | * |
429 | * POST: the result will start with an exact copy of unmasked | 429 | * POST: the result will start with an exact copy of unmasked |
430 | * | 430 | * |
431 | * @param unmasked | 431 | * @param unmasked |
432 | * primary pattern substitution that is left intact. | 432 | * primary pattern substitution that is left intact. |
433 | * @param masked | 433 | * @param masked |
@@ -506,10 +506,10 @@ public class TupleMask { | |||
506 | s.append(')'); | 506 | s.append(')'); |
507 | return s.toString(); | 507 | return s.toString(); |
508 | } | 508 | } |
509 | 509 | ||
510 | /** | 510 | /** |
511 | * Returns the size of the masked tuples described by this mask | 511 | * Returns the size of the masked tuples described by this mask |
512 | * @since 1.7 | 512 | * @since 1.7 |
513 | */ | 513 | */ |
514 | public int getSize() { | 514 | public int getSize() { |
515 | return indices.length; | 515 | return indices.length; |
@@ -522,21 +522,21 @@ public class TupleMask { | |||
522 | public int getSourceWidth() { | 522 | public int getSourceWidth() { |
523 | return sourceWidth; | 523 | return sourceWidth; |
524 | } | 524 | } |
525 | 525 | ||
526 | 526 | ||
527 | /** | 527 | /** |
528 | * @return true iff this mask is a no-op | 528 | * @return true iff this mask is a no-op |
529 | * @since 2.0 | 529 | * @since 2.0 |
530 | */ | 530 | */ |
531 | public boolean isIdentity() { | 531 | public boolean isIdentity() { |
532 | // Contract: if identity mask, a specialized subclass is constructed instead | 532 | // Contract: if identity mask, a specialized subclass is constructed instead |
533 | return false; | 533 | return false; |
534 | } | 534 | } |
535 | 535 | ||
536 | /** | 536 | /** |
537 | * Transforms the given list by applying the mask and putting all results into a set; keeping only a single element | 537 | * Transforms the given list by applying the mask and putting all results into a set; keeping only a single element |
538 | * in case of the mapping result in duplicate values. | 538 | * in case of the mapping result in duplicate values. |
539 | * | 539 | * |
540 | * @since 1.7 | 540 | * @since 1.7 |
541 | */ | 541 | */ |
542 | public <T> Set<T> transformUnique(List<T> original) { | 542 | public <T> Set<T> transformUnique(List<T> original) { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleMask0.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/TupleMask0.java index 5a0c79ff..7e4449fc 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleMask0.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/TupleMask0.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.List; | 12 | import java.util.List; |
@@ -16,7 +16,7 @@ import java.util.List; | |||
16 | * @since 1.7 | 16 | * @since 1.7 |
17 | */ | 17 | */ |
18 | public final class TupleMask0 extends TupleMask { | 18 | public final class TupleMask0 extends TupleMask { |
19 | 19 | ||
20 | private final static int[] EMPTY_ARRAY = {}; | 20 | private final static int[] EMPTY_ARRAY = {}; |
21 | 21 | ||
22 | /** | 22 | /** |
@@ -25,12 +25,12 @@ public final class TupleMask0 extends TupleMask { | |||
25 | TupleMask0(int sourceWidth) { | 25 | TupleMask0(int sourceWidth) { |
26 | super(EMPTY_ARRAY, sourceWidth, EMPTY_ARRAY, true); | 26 | super(EMPTY_ARRAY, sourceWidth, EMPTY_ARRAY, true); |
27 | } | 27 | } |
28 | 28 | ||
29 | @Override | 29 | @Override |
30 | public <T> List<T> transform(List<T> original) { | 30 | public <T> List<T> transform(List<T> original) { |
31 | return Collections.emptyList(); | 31 | return Collections.emptyList(); |
32 | } | 32 | } |
33 | 33 | ||
34 | @Override | 34 | @Override |
35 | public Tuple transform(ITuple original) { | 35 | public Tuple transform(ITuple original) { |
36 | return Tuples.staticArityFlatTupleOf(); | 36 | return Tuples.staticArityFlatTupleOf(); |
@@ -48,7 +48,7 @@ public final class TupleMask0 extends TupleMask { | |||
48 | else | 48 | else |
49 | return super.combine(unmasked, masked, useInheritance, asComplementer); | 49 | return super.combine(unmasked, masked, useInheritance, asComplementer); |
50 | } | 50 | } |
51 | 51 | ||
52 | @Override | 52 | @Override |
53 | public boolean isIdentity() { | 53 | public boolean isIdentity() { |
54 | return 0 == sourceWidth; | 54 | return 0 == sourceWidth; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleMaskIdentity.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/TupleMaskIdentity.java index 62746587..a3f78560 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleMaskIdentity.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/TupleMaskIdentity.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import java.util.List; | 11 | import java.util.List; |
12 | 12 | ||
@@ -27,12 +27,12 @@ public final class TupleMaskIdentity extends TupleMask { | |||
27 | public <T> List<T> transform(List<T> original) { | 27 | public <T> List<T> transform(List<T> original) { |
28 | return original; | 28 | return original; |
29 | } | 29 | } |
30 | 30 | ||
31 | @Override | 31 | @Override |
32 | public Tuple transform(ITuple original) { | 32 | public Tuple transform(ITuple original) { |
33 | return original.toImmutable(); | 33 | return original.toImmutable(); |
34 | } | 34 | } |
35 | 35 | ||
36 | @Override | 36 | @Override |
37 | public TupleMask transform(TupleMask mask) { | 37 | public TupleMask transform(TupleMask mask) { |
38 | return mask; | 38 | return mask; |
@@ -42,10 +42,10 @@ public final class TupleMaskIdentity extends TupleMask { | |||
42 | public Tuple revertFrom(ITuple masked) { | 42 | public Tuple revertFrom(ITuple masked) { |
43 | return masked.toImmutable(); | 43 | return masked.toImmutable(); |
44 | } | 44 | } |
45 | 45 | ||
46 | @Override | 46 | @Override |
47 | public boolean isIdentity() { | 47 | public boolean isIdentity() { |
48 | return true; | 48 | return true; |
49 | } | 49 | } |
50 | 50 | ||
51 | } | 51 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleValueProvider.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/TupleValueProvider.java index 79193516..c28cc309 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/TupleValueProvider.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/TupleValueProvider.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import java.util.Map; | 11 | import java.util.Map; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.psystem.IValueProvider; | 13 | import tools.refinery.interpreter.matchers.psystem.IValueProvider; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * @author Zoltan Ujhelyi | 16 | * @author Zoltan Ujhelyi |
@@ -20,7 +20,7 @@ public class TupleValueProvider implements IValueProvider { | |||
20 | 20 | ||
21 | final ITuple tuple; | 21 | final ITuple tuple; |
22 | final Map<String, Integer> indexMapping; | 22 | final Map<String, Integer> indexMapping; |
23 | 23 | ||
24 | /** | 24 | /** |
25 | * Wraps a tuple with an index mapping | 25 | * Wraps a tuple with an index mapping |
26 | * @param tuple | 26 | * @param tuple |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/Tuples.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/Tuples.java index 5e41d7d8..66c3a71f 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/Tuples.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/Tuples.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Common static factory utilities for tuples. | 12 | * Common static factory utilities for tuples. |
13 | * | 13 | * |
14 | * @author Gabor Bergmann | 14 | * @author Gabor Bergmann |
15 | * @since 1.7 | 15 | * @since 1.7 |
16 | */ | 16 | */ |
@@ -19,20 +19,20 @@ public class Tuples { | |||
19 | private Tuples() { | 19 | private Tuples() { |
20 | // Empty utility class constructor | 20 | // Empty utility class constructor |
21 | } | 21 | } |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * Creates a flat tuple consisting of the given elements. | 24 | * Creates a flat tuple consisting of the given elements. |
25 | * For low-arity tuples, specialized implementations | 25 | * For low-arity tuples, specialized implementations |
26 | * (such as {@link FlatTuple2}) will be instantiated. | 26 | * (such as {@link FlatTuple2}) will be instantiated. |
27 | * | 27 | * |
28 | * <p> In case the exact arity is <i>statically</i> known, | 28 | * <p> In case the exact arity is <i>statically</i> known, |
29 | * it may be more efficient for the client to instantiate | 29 | * it may be more efficient for the client to instantiate |
30 | * the appropriate specialized implementation | 30 | * the appropriate specialized implementation |
31 | * (via {@link #staticArityFlatTupleOf(Object, Object)} etc. | 31 | * (via {@link #staticArityFlatTupleOf(Object, Object)} etc. |
32 | * or {@link #wideFlatTupleOf(Object...)}), | 32 | * or {@link #wideFlatTupleOf(Object...)}), |
33 | * instead of invoking this method. | 33 | * instead of invoking this method. |
34 | * This method does a runtime arity check, and therefore | 34 | * This method does a runtime arity check, and therefore |
35 | * also appropriate if the arity is determined at runtime. | 35 | * also appropriate if the arity is determined at runtime. |
36 | */ | 36 | */ |
37 | public static Tuple flatTupleOf(Object... elements) { | 37 | public static Tuple flatTupleOf(Object... elements) { |
38 | switch (elements.length) { | 38 | switch (elements.length) { |
@@ -51,19 +51,19 @@ public class Tuples { | |||
51 | } | 51 | } |
52 | } | 52 | } |
53 | /** | 53 | /** |
54 | * Creates a left inheritance tuple that extends an ancestor tuple | 54 | * Creates a left inheritance tuple that extends an ancestor tuple |
55 | * by the given "local" elements. | 55 | * by the given "local" elements. |
56 | * For locally low-arity tuples, specialized implementations | 56 | * For locally low-arity tuples, specialized implementations |
57 | * (such as {@link LeftInheritanceTuple2}) will be instantiated. | 57 | * (such as {@link LeftInheritanceTuple2}) will be instantiated. |
58 | * | 58 | * |
59 | * <p> In case the exact arity is <i>statically</i> known, | 59 | * <p> In case the exact arity is <i>statically</i> known, |
60 | * it may be more efficient for the client to instantiate | 60 | * it may be more efficient for the client to instantiate |
61 | * the appropriate specialized implementation | 61 | * the appropriate specialized implementation |
62 | * (via {@link #staticArityLeftInheritanceTupleOf(Object, Object)} etc. | 62 | * (via {@link #staticArityLeftInheritanceTupleOf(Object, Object)} etc. |
63 | * or {@link #wideLeftInheritanceTupleOf(Object...)}), | 63 | * or {@link #wideLeftInheritanceTupleOf(Object...)}), |
64 | * instead of invoking this method. | 64 | * instead of invoking this method. |
65 | * This method does a runtime arity check, and therefore | 65 | * This method does a runtime arity check, and therefore |
66 | * also appropriate if the arity is determined at runtime. | 66 | * also appropriate if the arity is determined at runtime. |
67 | */ | 67 | */ |
68 | public static Tuple leftInheritanceTupleOf(Tuple ancestor, Object... localElements) { | 68 | public static Tuple leftInheritanceTupleOf(Tuple ancestor, Object... localElements) { |
69 | switch (localElements.length) { | 69 | switch (localElements.length) { |
@@ -83,75 +83,75 @@ public class Tuples { | |||
83 | } | 83 | } |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * Creates a flat tuple consisting of no elements. | 86 | * Creates a flat tuple consisting of no elements. |
87 | */ | 87 | */ |
88 | public static Tuple staticArityFlatTupleOf() { | 88 | public static Tuple staticArityFlatTupleOf() { |
89 | return FlatTuple0.INSTANCE; | 89 | return FlatTuple0.INSTANCE; |
90 | } | 90 | } |
91 | /** | 91 | /** |
92 | * Creates a flat tuple consisting of the given single element. | 92 | * Creates a flat tuple consisting of the given single element. |
93 | */ | 93 | */ |
94 | public static Tuple staticArityFlatTupleOf(Object element) { | 94 | public static Tuple staticArityFlatTupleOf(Object element) { |
95 | return new FlatTuple1(element); | 95 | return new FlatTuple1(element); |
96 | } | 96 | } |
97 | /** | 97 | /** |
98 | * Creates a flat tuple consisting of the given elements. | 98 | * Creates a flat tuple consisting of the given elements. |
99 | */ | 99 | */ |
100 | public static Tuple staticArityFlatTupleOf(Object element0, Object element1) { | 100 | public static Tuple staticArityFlatTupleOf(Object element0, Object element1) { |
101 | return new FlatTuple2(element0, element1); | 101 | return new FlatTuple2(element0, element1); |
102 | } | 102 | } |
103 | /** | 103 | /** |
104 | * Creates a flat tuple consisting of the given elements. | 104 | * Creates a flat tuple consisting of the given elements. |
105 | */ | 105 | */ |
106 | public static Tuple staticArityFlatTupleOf(Object element0, Object element1, Object element2) { | 106 | public static Tuple staticArityFlatTupleOf(Object element0, Object element1, Object element2) { |
107 | return new FlatTuple3(element0, element1, element2); | 107 | return new FlatTuple3(element0, element1, element2); |
108 | } | 108 | } |
109 | /** | 109 | /** |
110 | * Creates a flat tuple consisting of the given elements. | 110 | * Creates a flat tuple consisting of the given elements. |
111 | */ | 111 | */ |
112 | public static Tuple staticArityFlatTupleOf(Object element0, Object element1, Object element2, Object element3) { | 112 | public static Tuple staticArityFlatTupleOf(Object element0, Object element1, Object element2, Object element3) { |
113 | return new FlatTuple4(element0, element1, element2, element3); | 113 | return new FlatTuple4(element0, element1, element2, element3); |
114 | } | 114 | } |
115 | /** | 115 | /** |
116 | * Creates a flat tuple consisting of the given elements. | 116 | * Creates a flat tuple consisting of the given elements. |
117 | * <p> Invoke this only if it is statically known that the tuple will be wide. | 117 | * <p> Invoke this only if it is statically known that the tuple will be wide. |
118 | * Otherwise, use {@link #flatTupleOf(Object...)}. | 118 | * Otherwise, use {@link #flatTupleOf(Object...)}. |
119 | */ | 119 | */ |
120 | public static Tuple wideFlatTupleOf(Object... elements) { | 120 | public static Tuple wideFlatTupleOf(Object... elements) { |
121 | return new FlatTuple(elements); | 121 | return new FlatTuple(elements); |
122 | } | 122 | } |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * Creates a left inheritance tuple consisting of the given single local element. | 125 | * Creates a left inheritance tuple consisting of the given single local element. |
126 | */ | 126 | */ |
127 | public static Tuple staticArityLeftInheritanceTupleOf(Tuple ancestor, Object element) { | 127 | public static Tuple staticArityLeftInheritanceTupleOf(Tuple ancestor, Object element) { |
128 | return new LeftInheritanceTuple1(ancestor, element); | 128 | return new LeftInheritanceTuple1(ancestor, element); |
129 | } | 129 | } |
130 | /** | 130 | /** |
131 | * Creates a left inheritance tuple consisting of the given local elements. | 131 | * Creates a left inheritance tuple consisting of the given local elements. |
132 | */ | 132 | */ |
133 | public static Tuple staticArityLeftInheritanceTupleOf(Tuple ancestor, Object element0, Object element1) { | 133 | public static Tuple staticArityLeftInheritanceTupleOf(Tuple ancestor, Object element0, Object element1) { |
134 | return new LeftInheritanceTuple2(ancestor, element0, element1); | 134 | return new LeftInheritanceTuple2(ancestor, element0, element1); |
135 | } | 135 | } |
136 | /** | 136 | /** |
137 | * Creates a left inheritance tuple consisting of the given local elements. | 137 | * Creates a left inheritance tuple consisting of the given local elements. |
138 | */ | 138 | */ |
139 | public static Tuple staticArityLeftInheritanceTupleOf(Tuple ancestor, Object element0, Object element1, Object element2) { | 139 | public static Tuple staticArityLeftInheritanceTupleOf(Tuple ancestor, Object element0, Object element1, Object element2) { |
140 | return new LeftInheritanceTuple3(ancestor, element0, element1, element2); | 140 | return new LeftInheritanceTuple3(ancestor, element0, element1, element2); |
141 | } | 141 | } |
142 | /** | 142 | /** |
143 | * Creates a left inheritance tuple consisting of the given local elements. | 143 | * Creates a left inheritance tuple consisting of the given local elements. |
144 | */ | 144 | */ |
145 | public static Tuple staticArityLeftInheritanceTupleOf(Tuple ancestor, Object element0, Object element1, Object element2, Object element3) { | 145 | public static Tuple staticArityLeftInheritanceTupleOf(Tuple ancestor, Object element0, Object element1, Object element2, Object element3) { |
146 | return new LeftInheritanceTuple4(ancestor, element0, element1, element2, element3); | 146 | return new LeftInheritanceTuple4(ancestor, element0, element1, element2, element3); |
147 | } | 147 | } |
148 | /** | 148 | /** |
149 | * Creates a left inheritance tuple consisting of the given local elements. | 149 | * Creates a left inheritance tuple consisting of the given local elements. |
150 | * <p> Invoke this only if it is statically known that the tuple will be wide. | 150 | * <p> Invoke this only if it is statically known that the tuple will be wide. |
151 | * Otherwise, use {@link #leftInheritanceTupleOf(Tuple, Object...)}. | 151 | * Otherwise, use {@link #leftInheritanceTupleOf(Tuple, Object...)}. |
152 | */ | 152 | */ |
153 | public static Tuple wideLeftInheritanceTupleOf(Tuple ancestor, Object... elements) { | 153 | public static Tuple wideLeftInheritanceTupleOf(Tuple ancestor, Object... elements) { |
154 | return new LeftInheritanceTuple(ancestor, elements); | 154 | return new LeftInheritanceTuple(ancestor, elements); |
155 | } | 155 | } |
156 | 156 | ||
157 | } | 157 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/VolatileMaskedTuple.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/VolatileMaskedTuple.java index f683d544..c47a1b89 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/VolatileMaskedTuple.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/VolatileMaskedTuple.java | |||
@@ -3,17 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 11 | import tools.refinery.interpreter.matchers.util.Preconditions; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * This class provides a volatile tuple view with a given mask of a given tuple instance. If the masked tuple changes, | 14 | * This class provides a volatile tuple view with a given mask of a given tuple instance. If the masked tuple changes, |
15 | * the view updates as well. | 15 | * the view updates as well. |
16 | * | 16 | * |
17 | * @author Zoltan Ujhelyi | 17 | * @author Zoltan Ujhelyi |
18 | * @since 1.7 | 18 | * @since 1.7 |
19 | * | 19 | * |
@@ -31,14 +31,14 @@ public class VolatileMaskedTuple extends VolatileTuple { | |||
31 | public VolatileMaskedTuple(TupleMask mask) { | 31 | public VolatileMaskedTuple(TupleMask mask) { |
32 | this(null, mask); | 32 | this(null, mask); |
33 | } | 33 | } |
34 | 34 | ||
35 | public void updateTuple(ITuple newSource) { | 35 | public void updateTuple(ITuple newSource) { |
36 | source = newSource; | 36 | source = newSource; |
37 | } | 37 | } |
38 | 38 | ||
39 | @Override | 39 | @Override |
40 | public Object get(int index) { | 40 | public Object get(int index) { |
41 | Preconditions.checkState(source != null, "Source tuple is not set."); | 41 | Preconditions.checkState(source != null, "Source tuple is not set."); |
42 | return mask.getValue(source, index); | 42 | return mask.getValue(source, index); |
43 | } | 43 | } |
44 | 44 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/VolatileModifiableMaskedTuple.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/VolatileModifiableMaskedTuple.java index 92306c6e..2a388150 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/VolatileModifiableMaskedTuple.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/VolatileModifiableMaskedTuple.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.tuple; | 9 | package tools.refinery.interpreter.matchers.tuple; |
10 | 10 | ||
11 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | 11 | import tools.refinery.interpreter.matchers.util.Preconditions; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * A masked tuple implementation that allows modifying the backing tuple. | 14 | * A masked tuple implementation that allows modifying the backing tuple. |
@@ -28,13 +28,13 @@ public class VolatileModifiableMaskedTuple extends VolatileMaskedTuple implement | |||
28 | public VolatileModifiableMaskedTuple(TupleMask mask) { | 28 | public VolatileModifiableMaskedTuple(TupleMask mask) { |
29 | this(null, mask); | 29 | this(null, mask); |
30 | } | 30 | } |
31 | 31 | ||
32 | @Override | 32 | @Override |
33 | public void updateTuple(ITuple newSource) { | 33 | public void updateTuple(ITuple newSource) { |
34 | Preconditions.checkArgument(newSource instanceof IModifiableTuple, "Provided tuple does not support updates"); | 34 | Preconditions.checkArgument(newSource instanceof IModifiableTuple, "Provided tuple does not support updates"); |
35 | this.updateTuple((IModifiableTuple)newSource); | 35 | this.updateTuple((IModifiableTuple)newSource); |
36 | } | 36 | } |
37 | 37 | ||
38 | public void updateTuple(IModifiableTuple newSource) { | 38 | public void updateTuple(IModifiableTuple newSource) { |
39 | super.updateTuple(newSource); | 39 | super.updateTuple(newSource); |
40 | modifiableTuple = newSource; | 40 | modifiableTuple = newSource; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/VolatileTuple.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/VolatileTuple.java index 699105a5..2e4e0b9d 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/tuple/VolatileTuple.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/tuple/VolatileTuple.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.tuple; | 10 | package tools.refinery.interpreter.matchers.tuple; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * Mutable tuple without explicit modification commands. In practical terms, the values stored in a volatile tuple can | 13 | * Mutable tuple without explicit modification commands. In practical terms, the values stored in a volatile tuple can |
14 | * be changed without any notification. | 14 | * be changed without any notification. |
15 | * | 15 | * |
16 | * @author Zoltan Ujhelyi | 16 | * @author Zoltan Ujhelyi |
17 | * @since 1.7 | 17 | * @since 1.7 |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | public abstract class VolatileTuple extends AbstractTuple { | 20 | public abstract class VolatileTuple extends AbstractTuple { |
21 | 21 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Accuracy.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Accuracy.java index 338990ab..8c1dfca4 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Accuracy.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Accuracy.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * The degree of accuracy of a cardinality estimate | 12 | * The degree of accuracy of a cardinality estimate |
@@ -18,7 +18,7 @@ public enum Accuracy { | |||
18 | BEST_UPPER_BOUND, | 18 | BEST_UPPER_BOUND, |
19 | BEST_LOWER_BOUND, | 19 | BEST_LOWER_BOUND, |
20 | APPROXIMATION; | 20 | APPROXIMATION; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * Partial order comparison. | 23 | * Partial order comparison. |
24 | */ | 24 | */ |
@@ -26,14 +26,14 @@ public enum Accuracy { | |||
26 | switch (this) { | 26 | switch (this) { |
27 | case EXACT_COUNT: return true; | 27 | case EXACT_COUNT: return true; |
28 | case APPROXIMATION: return APPROXIMATION == other; | 28 | case APPROXIMATION: return APPROXIMATION == other; |
29 | case BEST_UPPER_BOUND: return BEST_UPPER_BOUND == other || APPROXIMATION == other; | 29 | case BEST_UPPER_BOUND: return BEST_UPPER_BOUND == other || APPROXIMATION == other; |
30 | case BEST_LOWER_BOUND: return BEST_LOWER_BOUND == other || APPROXIMATION == other; | 30 | case BEST_LOWER_BOUND: return BEST_LOWER_BOUND == other || APPROXIMATION == other; |
31 | default: throw new IllegalArgumentException(); | 31 | default: throw new IllegalArgumentException(); |
32 | } | 32 | } |
33 | } | 33 | } |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * @return another accuracy value that is anti-monotonic to this one, | 36 | * @return another accuracy value that is anti-monotonic to this one, |
37 | * i.e. an accuracy that should be used in the denominator to obtain a fraction with this accuracy | 37 | * i.e. an accuracy that should be used in the denominator to obtain a fraction with this accuracy |
38 | */ | 38 | */ |
39 | public Accuracy reciprocal() { | 39 | public Accuracy reciprocal() { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Clearable.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Clearable.java index 1b09aec6..5291cd28 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Clearable.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Clearable.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.util; | 10 | package tools.refinery.interpreter.matchers.util; |
11 | 11 | ||
12 | /** | 12 | /** |
13 | * @author Gabor Bergmann | 13 | * @author Gabor Bergmann |
@@ -17,7 +17,7 @@ package tools.refinery.viatra.runtime.matchers.util; | |||
17 | public interface Clearable { | 17 | public interface Clearable { |
18 | /** | 18 | /** |
19 | * Clear all partial matchings stored in memory | 19 | * Clear all partial matchings stored in memory |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | void clear(); | 22 | void clear(); |
23 | } | 23 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/CollectionsFactory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/CollectionsFactory.java index 590a1ec3..c1ede988 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/CollectionsFactory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/CollectionsFactory.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.Collection; | 11 | import java.util.Collection; |
12 | import java.util.List; | 12 | import java.util.List; |
@@ -16,12 +16,12 @@ import java.util.TreeMap; | |||
16 | import java.util.function.Function; | 16 | import java.util.function.Function; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Factory class used as an accessor to Collections implementations. | 19 | * Factory class used as an accessor to Collections implementations. |
20 | * @author istvanrath | 20 | * @author istvanrath |
21 | */ | 21 | */ |
22 | public final class CollectionsFactory | 22 | public final class CollectionsFactory |
23 | { | 23 | { |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * Instantiates a new empty map. | 26 | * Instantiates a new empty map. |
27 | * @since 1.7 | 27 | * @since 1.7 |
@@ -37,15 +37,15 @@ public final class CollectionsFactory | |||
37 | public static <K, V> Map<K, V> createMap(Map<K, V> initial) { | 37 | public static <K, V> Map<K, V> createMap(Map<K, V> initial) { |
38 | return FRAMEWORK.createMap(initial); | 38 | return FRAMEWORK.createMap(initial); |
39 | } | 39 | } |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * Instantiates a new tree map. | 42 | * Instantiates a new tree map. |
43 | * @since 2.3 | 43 | * @since 2.3 |
44 | */ | 44 | */ |
45 | public static <K, V> TreeMap<K, V> createTreeMap() { | 45 | public static <K, V> TreeMap<K, V> createTreeMap() { |
46 | return FRAMEWORK.createTreeMap(); | 46 | return FRAMEWORK.createTreeMap(); |
47 | } | 47 | } |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * Instantiates a new empty set. | 50 | * Instantiates a new empty set. |
51 | * @since 1.7 | 51 | * @since 1.7 |
@@ -65,7 +65,7 @@ public final class CollectionsFactory | |||
65 | /** | 65 | /** |
66 | * Instantiates an empty set; the key parameter is used to allow using this as a method reference as a | 66 | * Instantiates an empty set; the key parameter is used to allow using this as a method reference as a |
67 | * {@link Function}, e.g. in {@link Map#computeIfAbsent(Object, Function)}. | 67 | * {@link Function}, e.g. in {@link Map#computeIfAbsent(Object, Function)}. |
68 | * | 68 | * |
69 | * @param key | 69 | * @param key |
70 | * the value of this parameter is ignored | 70 | * the value of this parameter is ignored |
71 | * @since 2.0 | 71 | * @since 2.0 |
@@ -85,7 +85,7 @@ public final class CollectionsFactory | |||
85 | /** | 85 | /** |
86 | * Instantiates an empty multiset; the key parameter is used to allow using this as a method reference as a | 86 | * Instantiates an empty multiset; the key parameter is used to allow using this as a method reference as a |
87 | * {@link Function}, e.g. in {@link Map#computeIfAbsent(Object, Function)}. | 87 | * {@link Function}, e.g. in {@link Map#computeIfAbsent(Object, Function)}. |
88 | * | 88 | * |
89 | * @param key | 89 | * @param key |
90 | * the value of this parameter is ignored | 90 | * the value of this parameter is ignored |
91 | * @since 2.0 | 91 | * @since 2.0 |
@@ -93,7 +93,7 @@ public final class CollectionsFactory | |||
93 | public static <T> IMultiset<T> emptyMultiset(Object key) { | 93 | public static <T> IMultiset<T> emptyMultiset(Object key) { |
94 | return FRAMEWORK.createMultiset(); | 94 | return FRAMEWORK.createMultiset(); |
95 | } | 95 | } |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * Instantiates a new empty delta bag. | 98 | * Instantiates a new empty delta bag. |
99 | * @since 1.7 | 99 | * @since 1.7 |
@@ -109,11 +109,11 @@ public final class CollectionsFactory | |||
109 | public static <O> List<O> createObserverList() { | 109 | public static <O> List<O> createObserverList() { |
110 | return FRAMEWORK.createObserverList(); | 110 | return FRAMEWORK.createObserverList(); |
111 | } | 111 | } |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * Instantiates a size-optimized multimap from keys to sets of values. | 114 | * Instantiates a size-optimized multimap from keys to sets of values. |
115 | * <p>For a single key, many values can be associated according to the given bucket semantics. | 115 | * <p>For a single key, many values can be associated according to the given bucket semantics. |
116 | * <p>The keys and values are stored as type fromKeys resp. ofValues; | 116 | * <p>The keys and values are stored as type fromKeys resp. ofValues; |
117 | * currently Object.class and Long.class are supported. | 117 | * currently Object.class and Long.class are supported. |
118 | * @since 2.0 | 118 | * @since 2.0 |
119 | */ | 119 | */ |
@@ -121,11 +121,11 @@ public final class CollectionsFactory | |||
121 | Class<? super K> fromKeys, MemoryType toBuckets, Class<? super V> ofValues) { | 121 | Class<? super K> fromKeys, MemoryType toBuckets, Class<? super V> ofValues) { |
122 | return FRAMEWORK.createMultiLookup(fromKeys, toBuckets, ofValues); | 122 | return FRAMEWORK.createMultiLookup(fromKeys, toBuckets, ofValues); |
123 | } | 123 | } |
124 | 124 | ||
125 | /** | 125 | /** |
126 | * Instantiates a memory storing values. | 126 | * Instantiates a memory storing values. |
127 | * <p>For a single key, many values can be associated according to the given memory semantics. | 127 | * <p>For a single key, many values can be associated according to the given memory semantics. |
128 | * <p>The values are stored as type 'values'; | 128 | * <p>The values are stored as type 'values'; |
129 | * currently Object.class and Long.class are supported. | 129 | * currently Object.class and Long.class are supported. |
130 | * @since 2.0 | 130 | * @since 2.0 |
131 | */ | 131 | */ |
@@ -133,7 +133,7 @@ public final class CollectionsFactory | |||
133 | Class<? super T> values, MemoryType memoryType) { | 133 | Class<? super T> values, MemoryType memoryType) { |
134 | return FRAMEWORK.createMemory(values, memoryType); | 134 | return FRAMEWORK.createMemory(values, memoryType); |
135 | } | 135 | } |
136 | 136 | ||
137 | /** | 137 | /** |
138 | * The type of {@link IMemory} | 138 | * The type of {@link IMemory} |
139 | * @since 2.0 | 139 | * @since 2.0 |
@@ -149,19 +149,19 @@ public final class CollectionsFactory | |||
149 | */ | 149 | */ |
150 | MULTISETS | 150 | MULTISETS |
151 | } | 151 | } |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * The collections framework of the current configuration. | 154 | * The collections framework of the current configuration. |
155 | * @since 1.7 | 155 | * @since 1.7 |
156 | */ | 156 | */ |
157 | private static final ICollectionsFramework FRAMEWORK = new EclipseCollectionsFactory(); | 157 | private static final ICollectionsFramework FRAMEWORK = new EclipseCollectionsFactory(); |
158 | 158 | ||
159 | /** | 159 | /** |
160 | * Interface abstracting over a collections technology that provides custom collection implementations. | 160 | * Interface abstracting over a collections technology that provides custom collection implementations. |
161 | * @since 1.7 | 161 | * @since 1.7 |
162 | */ | 162 | */ |
163 | public static interface ICollectionsFramework { | 163 | public static interface ICollectionsFramework { |
164 | 164 | ||
165 | public abstract <K,V> Map<K,V> createMap(); | 165 | public abstract <K,V> Map<K,V> createMap(); |
166 | public abstract <K,V> Map<K,V> createMap(Map<K,V> initial); | 166 | public abstract <K,V> Map<K,V> createMap(Map<K,V> initial); |
167 | /** | 167 | /** |
@@ -173,7 +173,7 @@ public final class CollectionsFactory | |||
173 | public abstract <T> IMultiset<T> createMultiset(); | 173 | public abstract <T> IMultiset<T> createMultiset(); |
174 | public abstract <T> IDeltaBag<T> createDeltaBag(); | 174 | public abstract <T> IDeltaBag<T> createDeltaBag(); |
175 | public abstract <O> List<O> createObserverList(); | 175 | public abstract <O> List<O> createObserverList(); |
176 | 176 | ||
177 | /** | 177 | /** |
178 | * @since 2.0 | 178 | * @since 2.0 |
179 | */ | 179 | */ |
@@ -184,5 +184,5 @@ public final class CollectionsFactory | |||
184 | */ | 184 | */ |
185 | public abstract <T> IMemory<T> createMemory(Class<? super T> values, MemoryType memoryType); | 185 | public abstract <T> IMemory<T> createMemory(Class<? super T> values, MemoryType memoryType); |
186 | } | 186 | } |
187 | 187 | ||
188 | } \ No newline at end of file | 188 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Direction.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Direction.java index 88f7ec00..18824cbf 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Direction.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Direction.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Indicates whether a propagated update event signals the insertion or deletion of an element | 12 | * Indicates whether a propagated update event signals the insertion or deletion of an element |
13 | * | 13 | * |
14 | * @author Gabor Bergmann | 14 | * @author Gabor Bergmann |
15 | */ | 15 | */ |
16 | public enum Direction { | 16 | public enum Direction { |
@@ -39,14 +39,14 @@ public enum Direction { | |||
39 | return '-'; | 39 | return '-'; |
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * Returns the direction that is the product of this direction and the other direction. | 44 | * Returns the direction that is the product of this direction and the other direction. |
45 | * | 45 | * |
46 | * DELETE x DELETE = INSERT | 46 | * DELETE x DELETE = INSERT |
47 | * DELETE x INSERT = DELETE | 47 | * DELETE x INSERT = DELETE |
48 | * INSERT x DELETE = DELETE | 48 | * INSERT x DELETE = DELETE |
49 | * INSERT x INSERT = INSERT | 49 | * INSERT x INSERT = INSERT |
50 | * @since 2.4 | 50 | * @since 2.4 |
51 | */ | 51 | */ |
52 | public Direction multiply(final Direction other) { | 52 | public Direction multiply(final Direction other) { |
@@ -57,5 +57,5 @@ public enum Direction { | |||
57 | return other; | 57 | return other; |
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
61 | } | 61 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsBagMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsBagMemory.java index e24b2448..eded382f 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsBagMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsBagMemory.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | 9 | ||
10 | package tools.refinery.viatra.runtime.matchers.util; | 10 | package tools.refinery.interpreter.matchers.util; |
11 | 11 | ||
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
13 | import java.util.Set; | 13 | import java.util.Set; |
@@ -17,10 +17,10 @@ import org.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap; | |||
17 | 17 | ||
18 | /** | 18 | /** |
19 | * Eclipse Collections-based multiset for tuples. Can contain duplicate occurrences of the same matching. | 19 | * Eclipse Collections-based multiset for tuples. Can contain duplicate occurrences of the same matching. |
20 | * | 20 | * |
21 | * <p>Inherits Eclipse Collections' Object-to-Int primitive hashmap and counts the number of occurrences of each value. | 21 | * <p>Inherits Eclipse Collections' Object-to-Int primitive hashmap and counts the number of occurrences of each value. |
22 | * Element is deleted if # of occurences drops to 0. | 22 | * Element is deleted if # of occurences drops to 0. |
23 | * | 23 | * |
24 | * @author Gabor Bergmann. | 24 | * @author Gabor Bergmann. |
25 | * @since 1.7 | 25 | * @since 1.7 |
26 | * @noreference | 26 | * @noreference |
@@ -63,7 +63,7 @@ public abstract class EclipseCollectionsBagMemory<T> extends ObjectIntHashMap<T> | |||
63 | public String toString() { | 63 | public String toString() { |
64 | return "TM" + super.toString(); | 64 | return "TM" + super.toString(); |
65 | } | 65 | } |
66 | 66 | ||
67 | @Override | 67 | @Override |
68 | public Set<T> distinctValues() { | 68 | public Set<T> distinctValues() { |
69 | return super.keySet(); | 69 | return super.keySet(); |
@@ -73,7 +73,7 @@ public abstract class EclipseCollectionsBagMemory<T> extends ObjectIntHashMap<T> | |||
73 | public void forEachEntryWithMultiplicities(BiConsumer<T, Integer> entryConsumer) { | 73 | public void forEachEntryWithMultiplicities(BiConsumer<T, Integer> entryConsumer) { |
74 | super.forEachKeyValue(entryConsumer::accept); | 74 | super.forEachKeyValue(entryConsumer::accept); |
75 | } | 75 | } |
76 | 76 | ||
77 | @Override | 77 | @Override |
78 | public int hashCode() { | 78 | public int hashCode() { |
79 | return IMemoryView.hashCode(this); | 79 | return IMemoryView.hashCode(this); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsDeltaBag.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsDeltaBag.java index 94ec33cd..139145d8 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsDeltaBag.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsDeltaBag.java | |||
@@ -3,37 +3,37 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * @author Gabor Bergmann | 12 | * @author Gabor Bergmann |
13 | * @since 1.7 | 13 | * @since 1.7 |
14 | */ | 14 | */ |
15 | public class EclipseCollectionsDeltaBag<T> extends EclipseCollectionsBagMemory<T> implements IDeltaBag<T> { | 15 | public class EclipseCollectionsDeltaBag<T> extends EclipseCollectionsBagMemory<T> implements IDeltaBag<T> { |
16 | 16 | ||
17 | @Override | 17 | @Override |
18 | public boolean addOne(T value) { | 18 | public boolean addOne(T value) { |
19 | return addSigned(value, +1); | 19 | return addSigned(value, +1); |
20 | } | 20 | } |
21 | 21 | ||
22 | @Override | 22 | @Override |
23 | public boolean addSigned(T value, int count) { | 23 | public boolean addSigned(T value, int count) { |
24 | int oldCount = super.getIfAbsent(value, 0); | 24 | int oldCount = super.getIfAbsent(value, 0); |
25 | int newCount = oldCount + count; | 25 | int newCount = oldCount + count; |
26 | 26 | ||
27 | boolean becomesZero = newCount == 0; | 27 | boolean becomesZero = newCount == 0; |
28 | if (becomesZero) | 28 | if (becomesZero) |
29 | super.removeKey(value); | 29 | super.removeKey(value); |
30 | else | 30 | else |
31 | super.put(value, newCount); | 31 | super.put(value, newCount); |
32 | 32 | ||
33 | return becomesZero || oldCount == 0; | 33 | return becomesZero || oldCount == 0; |
34 | } | 34 | } |
35 | 35 | ||
36 | 36 | ||
37 | @Override | 37 | @Override |
38 | public boolean removeOne(T value) { | 38 | public boolean removeOne(T value) { |
39 | return addSigned(value, -1); | 39 | return addSigned(value, -1); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsFactory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsFactory.java index 5a623c9b..6907df2f 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsFactory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsFactory.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
@@ -18,28 +18,26 @@ import java.util.TreeMap; | |||
18 | import org.eclipse.collections.api.map.MutableMap; | 18 | import org.eclipse.collections.api.map.MutableMap; |
19 | import org.eclipse.collections.impl.factory.Maps; | 19 | import org.eclipse.collections.impl.factory.Maps; |
20 | import org.eclipse.collections.impl.factory.Sets; | 20 | import org.eclipse.collections.impl.factory.Sets; |
21 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.ICollectionsFramework; | ||
22 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | ||
23 | 21 | ||
24 | /** | 22 | /** |
25 | * @author Gabor Bergmann | 23 | * @author Gabor Bergmann |
26 | * @since 1.7 | 24 | * @since 1.7 |
27 | * @noreference This class is not intended to be referenced by clients. | 25 | * @noreference This class is not intended to be referenced by clients. |
28 | */ | 26 | */ |
29 | public class EclipseCollectionsFactory implements ICollectionsFramework { | 27 | public class EclipseCollectionsFactory implements CollectionsFactory.ICollectionsFramework { |
30 | 28 | ||
31 | @Override | 29 | @Override |
32 | public <K, V> Map<K, V> createMap() { | 30 | public <K, V> Map<K, V> createMap() { |
33 | return Maps.mutable.empty(); | 31 | return Maps.mutable.empty(); |
34 | } | 32 | } |
35 | 33 | ||
36 | @Override | 34 | @Override |
37 | public <K, V> Map<K, V> createMap(Map<K, V> initial) { | 35 | public <K, V> Map<K, V> createMap(Map<K, V> initial) { |
38 | MutableMap<K, V> result = Maps.mutable.ofInitialCapacity(initial.size()); | 36 | MutableMap<K, V> result = Maps.mutable.ofInitialCapacity(initial.size()); |
39 | result.putAll(initial); | 37 | result.putAll(initial); |
40 | return result; | 38 | return result; |
41 | } | 39 | } |
42 | 40 | ||
43 | @Override | 41 | @Override |
44 | public <K, V> TreeMap<K, V> createTreeMap() { | 42 | public <K, V> TreeMap<K, V> createTreeMap() { |
45 | // eclipse collections is doing the same | 43 | // eclipse collections is doing the same |
@@ -55,30 +53,30 @@ public class EclipseCollectionsFactory implements ICollectionsFramework { | |||
55 | public <E> Set<E> createSet(Collection<E> initial) { | 53 | public <E> Set<E> createSet(Collection<E> initial) { |
56 | return Sets.mutable.ofAll(initial); | 54 | return Sets.mutable.ofAll(initial); |
57 | } | 55 | } |
58 | 56 | ||
59 | @Override | 57 | @Override |
60 | public <T> IMultiset<T> createMultiset() { | 58 | public <T> IMultiset<T> createMultiset() { |
61 | return new EclipseCollectionsMultiset<T>(); | 59 | return new EclipseCollectionsMultiset<T>(); |
62 | } | 60 | } |
63 | 61 | ||
64 | @Override | 62 | @Override |
65 | public <T> IDeltaBag<T> createDeltaBag() { | 63 | public <T> IDeltaBag<T> createDeltaBag() { |
66 | return new EclipseCollectionsDeltaBag<T>(); | 64 | return new EclipseCollectionsDeltaBag<T>(); |
67 | } | 65 | } |
68 | 66 | ||
69 | @Override | 67 | @Override |
70 | public <O> List<O> createObserverList() { | 68 | public <O> List<O> createObserverList() { |
71 | return new ArrayList<O>(1); // keep concurrent modification exceptions for error detection | 69 | return new ArrayList<O>(1); // keep concurrent modification exceptions for error detection |
72 | // Lists.mutable.empty | 70 | // Lists.mutable.empty |
73 | 71 | ||
74 | } | 72 | } |
75 | 73 | ||
76 | @Override | 74 | @Override |
77 | @SuppressWarnings({ "unchecked", "rawtypes" }) | 75 | @SuppressWarnings({ "unchecked", "rawtypes" }) |
78 | public <K, V> IMultiLookup<K, V> createMultiLookup( | 76 | public <K, V> IMultiLookup<K, V> createMultiLookup( |
79 | Class<? super K> fromKeys, | 77 | Class<? super K> fromKeys, |
80 | MemoryType toBuckets, | 78 | CollectionsFactory.MemoryType toBuckets, |
81 | Class<? super V> ofValues) | 79 | Class<? super V> ofValues) |
82 | { | 80 | { |
83 | boolean longKeys = Long.class.equals(fromKeys); | 81 | boolean longKeys = Long.class.equals(fromKeys); |
84 | boolean objectKeys = Object.class.equals(fromKeys); | 82 | boolean objectKeys = Object.class.equals(fromKeys); |
@@ -86,7 +84,7 @@ public class EclipseCollectionsFactory implements ICollectionsFramework { | |||
86 | boolean longValues = Long.class.equals(ofValues); | 84 | boolean longValues = Long.class.equals(ofValues); |
87 | boolean objectValues = Object.class.equals(ofValues); | 85 | boolean objectValues = Object.class.equals(ofValues); |
88 | if (! (longValues || objectValues)) throw new IllegalArgumentException(ofValues.getName()); | 86 | if (! (longValues || objectValues)) throw new IllegalArgumentException(ofValues.getName()); |
89 | 87 | ||
90 | if (longKeys) { // K == java.lang.Long | 88 | if (longKeys) { // K == java.lang.Long |
91 | if (longValues) { // V == java.lang.Long | 89 | if (longValues) { // V == java.lang.Long |
92 | switch(toBuckets) { | 90 | switch(toBuckets) { |
@@ -129,10 +127,10 @@ public class EclipseCollectionsFactory implements ICollectionsFramework { | |||
129 | } | 127 | } |
130 | } | 128 | } |
131 | } | 129 | } |
132 | 130 | ||
133 | @Override | 131 | @Override |
134 | @SuppressWarnings("unchecked") | 132 | @SuppressWarnings("unchecked") |
135 | public <T> IMemory<T> createMemory(Class<? super T> values, MemoryType memoryType) { | 133 | public <T> IMemory<T> createMemory(Class<? super T> values, CollectionsFactory.MemoryType memoryType) { |
136 | if (Long.class.equals(values)) { // T == java.lang.Long | 134 | if (Long.class.equals(values)) { // T == java.lang.Long |
137 | switch(memoryType) { | 135 | switch(memoryType) { |
138 | case MULTISETS: | 136 | case MULTISETS: |
@@ -153,7 +151,7 @@ public class EclipseCollectionsFactory implements ICollectionsFramework { | |||
153 | } | 151 | } |
154 | } | 152 | } |
155 | } | 153 | } |
156 | 154 | ||
157 | 155 | ||
158 | 156 | ||
159 | } | 157 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsLongMultiset.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsLongMultiset.java index 88773c5d..b05d8cb7 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsLongMultiset.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsLongMultiset.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.Iterator; | 11 | import java.util.Iterator; |
12 | import java.util.Set; | 12 | import java.util.Set; |
@@ -35,17 +35,17 @@ public class EclipseCollectionsLongMultiset extends LongIntHashMap implements IM | |||
35 | public boolean addSigned(Long value, int count) { | 35 | public boolean addSigned(Long value, int count) { |
36 | int oldCount = super.getIfAbsent(value, 0); | 36 | int oldCount = super.getIfAbsent(value, 0); |
37 | int newCount = oldCount + count; | 37 | int newCount = oldCount + count; |
38 | 38 | ||
39 | boolean becomesZero = newCount == 0; | 39 | boolean becomesZero = newCount == 0; |
40 | if (newCount < 0) | 40 | if (newCount < 0) |
41 | throw new IllegalStateException(String.format( | 41 | throw new IllegalStateException(String.format( |
42 | "Cannot remove %d occurrences of value '%s' as only %d would remain in %s", | 42 | "Cannot remove %d occurrences of value '%s' as only %d would remain in %s", |
43 | count, value, newCount, this)); | 43 | count, value, newCount, this)); |
44 | else if (becomesZero) | 44 | else if (becomesZero) |
45 | super.removeKey(value); | 45 | super.removeKey(value); |
46 | else // (newCount > 0) | 46 | else // (newCount > 0) |
47 | super.put(value, newCount); | 47 | super.put(value, newCount); |
48 | 48 | ||
49 | return becomesZero || oldCount == 0; | 49 | return becomesZero || oldCount == 0; |
50 | } | 50 | } |
51 | 51 | ||
@@ -60,8 +60,8 @@ public class EclipseCollectionsLongMultiset extends LongIntHashMap implements IM | |||
60 | public boolean removeOneOrNop(Long value) { | 60 | public boolean removeOneOrNop(Long value) { |
61 | return removeOneInternal(value, false); | 61 | return removeOneInternal(value, false); |
62 | } | 62 | } |
63 | 63 | ||
64 | 64 | ||
65 | /** | 65 | /** |
66 | * @since 2.3 | 66 | * @since 2.3 |
67 | */ | 67 | */ |
@@ -69,11 +69,11 @@ public class EclipseCollectionsLongMultiset extends LongIntHashMap implements IM | |||
69 | int oldCount = super.getIfAbsent(value, 0); | 69 | int oldCount = super.getIfAbsent(value, 0); |
70 | if (oldCount == 0) { | 70 | if (oldCount == 0) { |
71 | if (throwIfImpossible) throw new IllegalStateException(String.format( | 71 | if (throwIfImpossible) throw new IllegalStateException(String.format( |
72 | "Cannot remove value '%s' that is not contained in %s", | 72 | "Cannot remove value '%s' that is not contained in %s", |
73 | value, this)); | 73 | value, this)); |
74 | else return false; | 74 | else return false; |
75 | } | 75 | } |
76 | 76 | ||
77 | int rest = oldCount - 1; | 77 | int rest = oldCount - 1; |
78 | boolean empty = rest == 0; | 78 | boolean empty = rest == 0; |
79 | 79 | ||
@@ -104,7 +104,7 @@ public class EclipseCollectionsLongMultiset extends LongIntHashMap implements IM | |||
104 | public boolean containsNonZero(Long value) { | 104 | public boolean containsNonZero(Long value) { |
105 | return super.containsKey(value); | 105 | return super.containsKey(value); |
106 | } | 106 | } |
107 | 107 | ||
108 | @Override | 108 | @Override |
109 | public boolean containsNonZeroUnsafe(Object value) { | 109 | public boolean containsNonZeroUnsafe(Object value) { |
110 | return value instanceof Long && containsNonZero((Long) value); | 110 | return value instanceof Long && containsNonZero((Long) value); |
@@ -137,7 +137,7 @@ public class EclipseCollectionsLongMultiset extends LongIntHashMap implements IM | |||
137 | public void forEachEntryWithMultiplicities(BiConsumer<Long, Integer> entryConsumer) { | 137 | public void forEachEntryWithMultiplicities(BiConsumer<Long, Integer> entryConsumer) { |
138 | super.forEachKeyValue(entryConsumer::accept); | 138 | super.forEachKeyValue(entryConsumer::accept); |
139 | } | 139 | } |
140 | 140 | ||
141 | @Override | 141 | @Override |
142 | public int hashCode() { | 142 | public int hashCode() { |
143 | return IMemoryView.hashCode(this); | 143 | return IMemoryView.hashCode(this); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsLongSetMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsLongSetMemory.java index ce3efa92..c6f1ae96 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsLongSetMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsLongSetMemory.java | |||
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import org.eclipse.collections.api.LongIterable; | 11 | import org.eclipse.collections.api.LongIterable; |
12 | import org.eclipse.collections.api.iterator.LongIterator; | 12 | import org.eclipse.collections.api.iterator.LongIterator; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsMultiLookup.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsMultiLookup.java index 394135c9..b9836137 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsMultiLookup.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsMultiLookup.java | |||
@@ -6,12 +6,12 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import org.eclipse.collections.impl.map.mutable.UnifiedMap; | 11 | import org.eclipse.collections.impl.map.mutable.UnifiedMap; |
12 | import org.eclipse.collections.impl.map.mutable.primitive.LongObjectHashMap; | 12 | import org.eclipse.collections.impl.map.mutable.primitive.LongObjectHashMap; |
13 | import tools.refinery.viatra.runtime.matchers.util.MarkedMemory.MarkedMultiset; | 13 | import tools.refinery.interpreter.matchers.util.MarkedMemory.MarkedMultiset; |
14 | import tools.refinery.viatra.runtime.matchers.util.MarkedMemory.MarkedSet; | 14 | import tools.refinery.interpreter.matchers.util.MarkedMemory.MarkedSet; |
15 | 15 | ||
16 | import java.util.Set; | 16 | import java.util.Set; |
17 | import java.util.stream.Stream; | 17 | import java.util.stream.Stream; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsMultiset.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsMultiset.java index 46977c8b..c9aed507 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsMultiset.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsMultiset.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * @author Gabor Bergmann | 12 | * @author Gabor Bergmann |
@@ -35,31 +35,31 @@ public class EclipseCollectionsMultiset<T> extends EclipseCollectionsBagMemory<T | |||
35 | 35 | ||
36 | return oldCount == 0; | 36 | return oldCount == 0; |
37 | } | 37 | } |
38 | 38 | ||
39 | @Override | 39 | @Override |
40 | public boolean addSigned(T value, int count) { | 40 | public boolean addSigned(T value, int count) { |
41 | int oldCount = super.getIfAbsent(value, 0); | 41 | int oldCount = super.getIfAbsent(value, 0); |
42 | int newCount = oldCount + count; | 42 | int newCount = oldCount + count; |
43 | 43 | ||
44 | boolean becomesZero = newCount == 0; | 44 | boolean becomesZero = newCount == 0; |
45 | if (newCount < 0) | 45 | if (newCount < 0) |
46 | throw new IllegalStateException(String.format( | 46 | throw new IllegalStateException(String.format( |
47 | "Cannot remove %d occurrences of value '%s' as only %d would remain in %s", | 47 | "Cannot remove %d occurrences of value '%s' as only %d would remain in %s", |
48 | count, value, newCount, this)); | 48 | count, value, newCount, this)); |
49 | else if (becomesZero) | 49 | else if (becomesZero) |
50 | super.removeKey(value); | 50 | super.removeKey(value); |
51 | else // (newCount > 0) | 51 | else // (newCount > 0) |
52 | super.put(value, newCount); | 52 | super.put(value, newCount); |
53 | 53 | ||
54 | return becomesZero || oldCount == 0; | 54 | return becomesZero || oldCount == 0; |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
58 | @Override | 58 | @Override |
59 | public boolean removeOne(T value) { | 59 | public boolean removeOne(T value) { |
60 | return removeOneInternal(value, true); | 60 | return removeOneInternal(value, true); |
61 | } | 61 | } |
62 | 62 | ||
63 | @Override | 63 | @Override |
64 | public boolean removeOneOrNop(T value) { | 64 | public boolean removeOneOrNop(T value) { |
65 | return removeOneInternal(value, false); | 65 | return removeOneInternal(value, false); |
@@ -72,11 +72,11 @@ public class EclipseCollectionsMultiset<T> extends EclipseCollectionsBagMemory<T | |||
72 | int oldCount = super.getIfAbsent(value, 0); | 72 | int oldCount = super.getIfAbsent(value, 0); |
73 | if (oldCount == 0) { | 73 | if (oldCount == 0) { |
74 | if (throwIfImpossible) throw new IllegalStateException(String.format( | 74 | if (throwIfImpossible) throw new IllegalStateException(String.format( |
75 | "Cannot remove value '%s' that is not contained in %s", | 75 | "Cannot remove value '%s' that is not contained in %s", |
76 | value, this)); | 76 | value, this)); |
77 | else return false; | 77 | else return false; |
78 | } | 78 | } |
79 | 79 | ||
80 | int rest = oldCount - 1; | 80 | int rest = oldCount - 1; |
81 | boolean empty = rest == 0; | 81 | boolean empty = rest == 0; |
82 | 82 | ||
@@ -88,6 +88,6 @@ public class EclipseCollectionsMultiset<T> extends EclipseCollectionsBagMemory<T | |||
88 | 88 | ||
89 | return empty; | 89 | return empty; |
90 | } | 90 | } |
91 | 91 | ||
92 | 92 | ||
93 | } | 93 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsSetMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsSetMemory.java index 92f65246..82d255c1 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EclipseCollectionsSetMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EclipseCollectionsSetMemory.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.Set; | 11 | import java.util.Set; |
12 | 12 | ||
@@ -29,7 +29,7 @@ public class EclipseCollectionsSetMemory<Value> extends UnifiedSet<Value> implem | |||
29 | public boolean containsNonZero(Value value) { | 29 | public boolean containsNonZero(Value value) { |
30 | return super.contains(value); | 30 | return super.contains(value); |
31 | } | 31 | } |
32 | 32 | ||
33 | @Override | 33 | @Override |
34 | public boolean containsNonZeroUnsafe(Object value) { | 34 | public boolean containsNonZeroUnsafe(Object value) { |
35 | return super.contains(value); | 35 | return super.contains(value); |
@@ -43,16 +43,16 @@ public class EclipseCollectionsSetMemory<Value> extends UnifiedSet<Value> implem | |||
43 | @Override | 43 | @Override |
44 | public boolean addSigned(Value value, int count) { | 44 | public boolean addSigned(Value value, int count) { |
45 | if (count == 1) return addOne(value); | 45 | if (count == 1) return addOne(value); |
46 | else if (count == -1) return removeOne(value); | 46 | else if (count == -1) return removeOne(value); |
47 | else throw new IllegalStateException(); | 47 | else throw new IllegalStateException(); |
48 | } | 48 | } |
49 | 49 | ||
50 | @Override | 50 | @Override |
51 | public boolean removeOne(Value value) { | 51 | public boolean removeOne(Value value) { |
52 | // Kept for binary compatibility | 52 | // Kept for binary compatibility |
53 | return ISetMemory.super.removeOne(value); | 53 | return ISetMemory.super.removeOne(value); |
54 | } | 54 | } |
55 | 55 | ||
56 | @Override | 56 | @Override |
57 | public boolean removeOneOrNop(Value value) { | 57 | public boolean removeOneOrNop(Value value) { |
58 | return super.remove(value); | 58 | return super.remove(value); |
@@ -67,20 +67,20 @@ public class EclipseCollectionsSetMemory<Value> extends UnifiedSet<Value> implem | |||
67 | public Set<Value> distinctValues() { | 67 | public Set<Value> distinctValues() { |
68 | return this; | 68 | return this; |
69 | } | 69 | } |
70 | 70 | ||
71 | @Override | 71 | @Override |
72 | public Value theContainedVersionOf(Value value) { | 72 | public Value theContainedVersionOf(Value value) { |
73 | return super.get(value); | 73 | return super.get(value); |
74 | } | 74 | } |
75 | 75 | ||
76 | @Override | 76 | @Override |
77 | @SuppressWarnings("unchecked") | 77 | @SuppressWarnings("unchecked") |
78 | public Value theContainedVersionOfUnsafe(Object value) { | 78 | public Value theContainedVersionOfUnsafe(Object value) { |
79 | if (super.contains(value)) | 79 | if (super.contains(value)) |
80 | return super.get((Value)value); | 80 | return super.get((Value)value); |
81 | else return null; | 81 | else return null; |
82 | } | 82 | } |
83 | 83 | ||
84 | @Override | 84 | @Override |
85 | public int hashCode() { | 85 | public int hashCode() { |
86 | return IMemoryView.hashCode(this); | 86 | return IMemoryView.hashCode(this); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EmptyMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EmptyMemory.java index a17b3a3f..9a46b343 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/EmptyMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/EmptyMemory.java | |||
@@ -3,17 +3,17 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
13 | import java.util.Set; | 13 | import java.util.Set; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * A singleton immutable empty memory. | 16 | * A singleton immutable empty memory. |
17 | * @author Gabor Bergmann | 17 | * @author Gabor Bergmann |
18 | * @since 2.0 | 18 | * @since 2.0 |
19 | * | 19 | * |
@@ -22,14 +22,14 @@ public class EmptyMemory<T> implements IMemoryView<T> { | |||
22 | 22 | ||
23 | @SuppressWarnings("rawtypes") | 23 | @SuppressWarnings("rawtypes") |
24 | private static final EmptyMemory INSTANCE = new EmptyMemory(); | 24 | private static final EmptyMemory INSTANCE = new EmptyMemory(); |
25 | 25 | ||
26 | @SuppressWarnings("unchecked") | 26 | @SuppressWarnings("unchecked") |
27 | public static <T> EmptyMemory<T> instance() { | 27 | public static <T> EmptyMemory<T> instance() { |
28 | return INSTANCE; | 28 | return INSTANCE; |
29 | } | 29 | } |
30 | 30 | ||
31 | 31 | ||
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Singleton; hidden constructor | 34 | * Singleton; hidden constructor |
35 | */ | 35 | */ |
@@ -76,7 +76,7 @@ public class EmptyMemory<T> implements IMemoryView<T> { | |||
76 | public Set<T> distinctValues() { | 76 | public Set<T> distinctValues() { |
77 | return Collections.emptySet(); | 77 | return Collections.emptySet(); |
78 | } | 78 | } |
79 | 79 | ||
80 | @Override | 80 | @Override |
81 | public int hashCode() { | 81 | public int hashCode() { |
82 | return IMemoryView.hashCode(this); | 82 | return IMemoryView.hashCode(this); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/ICache.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/ICache.java index 8c2e54ad..3e9c5770 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/ICache.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/ICache.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.function.Supplier; | 11 | import java.util.function.Supplier; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * A cache is a simple key-value pair that stores calculated values for specific key objects | 14 | * A cache is a simple key-value pair that stores calculated values for specific key objects |
15 | * | 15 | * |
16 | * <p> | 16 | * <p> |
17 | * <b>NOTE</b> These caches are not expected to be used outside query backend implementations | 17 | * <b>NOTE</b> These caches are not expected to be used outside query backend implementations |
18 | * | 18 | * |
19 | * @author Zoltan Ujhelyi | 19 | * @author Zoltan Ujhelyi |
20 | * @since 1.7 | 20 | * @since 1.7 |
21 | * @noreference This interface is not intended to be referenced by clients. | 21 | * @noreference This interface is not intended to be referenced by clients. |
@@ -29,4 +29,4 @@ public interface ICache { | |||
29 | */ | 29 | */ |
30 | <T> T getValue(Object key, Class<? extends T> clazz, Supplier<T> valueProvider); | 30 | <T> T getValue(Object key, Class<? extends T> clazz, Supplier<T> valueProvider); |
31 | 31 | ||
32 | } \ No newline at end of file | 32 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IDeltaBag.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IDeltaBag.java index 99a4cb3b..2651535d 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IDeltaBag.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IDeltaBag.java | |||
@@ -3,20 +3,20 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * An {@link IMemory} that represents the difference between two states of a set or {@link IMultiset}, and therefore | 12 | * An {@link IMemory} that represents the difference between two states of a set or {@link IMultiset}, and therefore |
13 | * may contain values with a negative multiplicity. | 13 | * may contain values with a negative multiplicity. |
14 | * | 14 | * |
15 | * @author Gabor Bergmann | 15 | * @author Gabor Bergmann |
16 | * @since 1.7 | 16 | * @since 1.7 |
17 | */ | 17 | */ |
18 | public interface IDeltaBag<T> extends IMemory<T> { | 18 | public interface IDeltaBag<T> extends IMemory<T> { |
19 | 19 | ||
20 | @Override | 20 | @Override |
21 | default boolean removeOneOrNop(T value) { | 21 | default boolean removeOneOrNop(T value) { |
22 | // makes no difference for delta bags | 22 | // makes no difference for delta bags |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMemory.java index ea788e53..037b949d 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMemory.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * A memory containing a positive or negative number of equal() copies for some values. | 12 | * A memory containing a positive or negative number of equal() copies for some values. |
13 | * During iterations, each distinct value is iterated only once. | 13 | * During iterations, each distinct value is iterated only once. |
14 | * | 14 | * |
15 | * <p> Refined by: <ul> | 15 | * <p> Refined by: <ul> |
16 | * <li>{@link IMultiset}, which always contains values with a nonnegative multiplicity. </li> | 16 | * <li>{@link IMultiset}, which always contains values with a nonnegative multiplicity. </li> |
17 | * <li>{@link IDeltaBag}, which may contain values with negative multiplicity. </li> | 17 | * <li>{@link IDeltaBag}, which may contain values with negative multiplicity. </li> |
18 | * <li>{@link ISetMemory}, which is just a set (allowed multiplicities: 0 and 1). </li> | 18 | * <li>{@link ISetMemory}, which is just a set (allowed multiplicities: 0 and 1). </li> |
19 | * </ul> | 19 | * </ul> |
20 | * | 20 | * |
21 | * @author Gabor Bergmann | 21 | * @author Gabor Bergmann |
22 | * @since 1.7 | 22 | * @since 1.7 |
23 | * @noimplement This interface is not intended to be implemented by clients. | 23 | * @noimplement This interface is not intended to be implemented by clients. |
@@ -26,9 +26,9 @@ public interface IMemory<T> extends IMemoryView<T>, Clearable { | |||
26 | 26 | ||
27 | /** | 27 | /** |
28 | * Adds one value occurrence to the memory. | 28 | * Adds one value occurrence to the memory. |
29 | * | 29 | * |
30 | * @return true if the tuple was not present before in the memory, or | 30 | * @return true if the tuple was not present before in the memory, or |
31 | * (in case of {@link IDeltaBag}) is no longer present in the memory | 31 | * (in case of {@link IDeltaBag}) is no longer present in the memory |
32 | */ | 32 | */ |
33 | boolean addOne(T value); | 33 | boolean addOne(T value); |
34 | 34 | ||
@@ -36,7 +36,7 @@ public interface IMemory<T> extends IMemoryView<T>, Clearable { | |||
36 | * Adds the given number of occurrences to the memory. The count value may or may not be negative. | 36 | * Adds the given number of occurrences to the memory. The count value may or may not be negative. |
37 | * <p> Precondition if {@link IMultiset}: at least the given amount of occurrences exist, if count is negative. | 37 | * <p> Precondition if {@link IMultiset}: at least the given amount of occurrences exist, if count is negative. |
38 | * <p> Precondition if {@link ISetMemory}: count is +1 or -1, the latter is only allowed if the set contains the value. | 38 | * <p> Precondition if {@link ISetMemory}: count is +1 or -1, the latter is only allowed if the set contains the value. |
39 | * | 39 | * |
40 | * @param count | 40 | * @param count |
41 | * the number of occurrences | 41 | * the number of occurrences |
42 | * @return true if the tuple was not present before in the memory, or is no longer present in the memory | 42 | * @return true if the tuple was not present before in the memory, or is no longer present in the memory |
@@ -47,22 +47,22 @@ public interface IMemory<T> extends IMemoryView<T>, Clearable { | |||
47 | /** | 47 | /** |
48 | * Removes one occurrence of the given value from the memory. | 48 | * Removes one occurrence of the given value from the memory. |
49 | * <p> Precondition if {@link IMultiset} or {@link ISetMemory}: the value must have a positive amount of occurrences in the memory. | 49 | * <p> Precondition if {@link IMultiset} or {@link ISetMemory}: the value must have a positive amount of occurrences in the memory. |
50 | * | 50 | * |
51 | * @return true if this was the the last occurrence of the value, or | 51 | * @return true if this was the the last occurrence of the value, or |
52 | * (in case of {@link IDeltaBag}) is the first negative occurrence of the value | 52 | * (in case of {@link IDeltaBag}) is the first negative occurrence of the value |
53 | * @throws IllegalStateException if {@link IMultiset} or {@link ISetMemory} and value had no occurrences in the memory | 53 | * @throws IllegalStateException if {@link IMultiset} or {@link ISetMemory} and value had no occurrences in the memory |
54 | */ | 54 | */ |
55 | boolean removeOne(T value); | 55 | boolean removeOne(T value); |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Removes one occurrence of the given value from the memory, if possible. | 58 | * Removes one occurrence of the given value from the memory, if possible. |
59 | * | 59 | * |
60 | * <p> Memory is unchanged and false is returned if | 60 | * <p> Memory is unchanged and false is returned if |
61 | * {@link IMultiset} or {@link ISetMemory} and value had no occurrences in the memory | 61 | * {@link IMultiset} or {@link ISetMemory} and value had no occurrences in the memory |
62 | * | 62 | * |
63 | * @return true if this was the the last occurrence of the value, or | 63 | * @return true if this was the the last occurrence of the value, or |
64 | * (in case of {@link IDeltaBag}) is the first negative occurrence of the value | 64 | * (in case of {@link IDeltaBag}) is the first negative occurrence of the value |
65 | * | 65 | * |
66 | * @since 2.3 | 66 | * @since 2.3 |
67 | */ | 67 | */ |
68 | boolean removeOneOrNop(T value); | 68 | boolean removeOneOrNop(T value); |
@@ -73,9 +73,9 @@ public interface IMemory<T> extends IMemoryView<T>, Clearable { | |||
73 | void clearAllOf(T value); | 73 | void clearAllOf(T value); |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Empties out the memory. | 76 | * Empties out the memory. |
77 | */ | 77 | */ |
78 | @Override | 78 | @Override |
79 | void clear(); | 79 | void clear(); |
80 | 80 | ||
81 | } \ No newline at end of file | 81 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMemoryView.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMemoryView.java index add575c6..8510e649 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMemoryView.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMemoryView.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.Iterator; | 11 | import java.util.Iterator; |
12 | import java.util.Map; | 12 | import java.util.Map; |
@@ -19,11 +19,11 @@ import java.util.stream.StreamSupport; | |||
19 | /** | 19 | /** |
20 | * A read-only view on a memory containing a positive or negative number of equal() copies for some values. | 20 | * A read-only view on a memory containing a positive or negative number of equal() copies for some values. |
21 | * During iterations, each distinct value is iterated only once. | 21 | * During iterations, each distinct value is iterated only once. |
22 | * | 22 | * |
23 | * <p> See {@link IMemory}. | 23 | * <p> See {@link IMemory}. |
24 | * | 24 | * |
25 | * <p> Implementors must provide semantic (not identity-based) hashCode() and equals() using the static helpers {@link #hashCode(IMemoryView)} and {@link #equals(IMemoryView, Object)} here. | 25 | * <p> Implementors must provide semantic (not identity-based) hashCode() and equals() using the static helpers {@link #hashCode(IMemoryView)} and {@link #equals(IMemoryView, Object)} here. |
26 | * | 26 | * |
27 | * @author Gabor Bergmann | 27 | * @author Gabor Bergmann |
28 | * | 28 | * |
29 | * @since 2.0 | 29 | * @since 2.0 |
@@ -32,14 +32,14 @@ public interface IMemoryView<T> extends Iterable<T> { | |||
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Returns the number of occurrences of the given value. | 34 | * Returns the number of occurrences of the given value. |
35 | * | 35 | * |
36 | * @return the number of occurrences | 36 | * @return the number of occurrences |
37 | */ | 37 | */ |
38 | int getCount(T value); | 38 | int getCount(T value); |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Returns the number of occurrences of the given value (which may be of any type). | 41 | * Returns the number of occurrences of the given value (which may be of any type). |
42 | * | 42 | * |
43 | * @return the number of occurrences | 43 | * @return the number of occurrences |
44 | */ | 44 | */ |
45 | int getCountUnsafe(Object value); | 45 | int getCountUnsafe(Object value); |
@@ -53,14 +53,14 @@ public interface IMemoryView<T> extends Iterable<T> { | |||
53 | * @return true if the given value (which may be of any type) is contained with a nonzero multiplicity | 53 | * @return true if the given value (which may be of any type) is contained with a nonzero multiplicity |
54 | */ | 54 | */ |
55 | boolean containsNonZeroUnsafe(Object value); | 55 | boolean containsNonZeroUnsafe(Object value); |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * @return the number of distinct values | 58 | * @return the number of distinct values |
59 | */ | 59 | */ |
60 | int size(); | 60 | int size(); |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * | 63 | * |
64 | * @return iff contains at least one value with non-zero occurrences | 64 | * @return iff contains at least one value with non-zero occurrences |
65 | */ | 65 | */ |
66 | boolean isEmpty(); | 66 | boolean isEmpty(); |
@@ -69,14 +69,14 @@ public interface IMemoryView<T> extends Iterable<T> { | |||
69 | * The set of distinct values | 69 | * The set of distinct values |
70 | */ | 70 | */ |
71 | Set<T> distinctValues(); | 71 | Set<T> distinctValues(); |
72 | 72 | ||
73 | 73 | ||
74 | /** | 74 | /** |
75 | * Where supported, returns the stored element that is equal to the given value, or null if none. | 75 | * Where supported, returns the stored element that is equal to the given value, or null if none. |
76 | * Useful for canonicalization in case of non-identity equals(). | 76 | * Useful for canonicalization in case of non-identity equals(). |
77 | * | 77 | * |
78 | * <p> For collections that do not support canonicalization, simply returns the argument if contained, null if none. | 78 | * <p> For collections that do not support canonicalization, simply returns the argument if contained, null if none. |
79 | * | 79 | * |
80 | * @return a value equal to the argument if such a value is stored, or null if none | 80 | * @return a value equal to the argument if such a value is stored, or null if none |
81 | */ | 81 | */ |
82 | default T theContainedVersionOf(T value) { | 82 | default T theContainedVersionOf(T value) { |
@@ -84,10 +84,10 @@ public interface IMemoryView<T> extends Iterable<T> { | |||
84 | } | 84 | } |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Where supported, returns the stored element that is equal to the given value (of any type), | 87 | * Where supported, returns the stored element that is equal to the given value (of any type), |
88 | * or null if none. | 88 | * or null if none. |
89 | * Useful for canonicalization in case of non-identity equals(). | 89 | * Useful for canonicalization in case of non-identity equals(). |
90 | * | 90 | * |
91 | * <p> For collections that do not support canonicalization, simply returns the argument if contained, null if none. | 91 | * <p> For collections that do not support canonicalization, simply returns the argument if contained, null if none. |
92 | * | 92 | * |
93 | * @return a value equal to the argument if such a value is stored, or null if none | 93 | * @return a value equal to the argument if such a value is stored, or null if none |
@@ -96,7 +96,7 @@ public interface IMemoryView<T> extends Iterable<T> { | |||
96 | default T theContainedVersionOfUnsafe(Object value) { | 96 | default T theContainedVersionOfUnsafe(Object value) { |
97 | if (containsNonZeroUnsafe(value)) return (T) value; else return null; | 97 | if (containsNonZeroUnsafe(value)) return (T) value; else return null; |
98 | } | 98 | } |
99 | 99 | ||
100 | 100 | ||
101 | /** | 101 | /** |
102 | * @return an unmodifiable view of contained values with their multiplicities | 102 | * @return an unmodifiable view of contained values with their multiplicities |
@@ -129,19 +129,19 @@ public interface IMemoryView<T> extends Iterable<T> { | |||
129 | public Integer setValue(Integer value) { | 129 | public Integer setValue(Integer value) { |
130 | throw new UnsupportedOperationException(); | 130 | throw new UnsupportedOperationException(); |
131 | } | 131 | } |
132 | 132 | ||
133 | @Override | 133 | @Override |
134 | public String toString() { | 134 | public String toString() { |
135 | return String.format("%d of %s", count, key); | 135 | return String.format("%d of %s", count, key); |
136 | } | 136 | } |
137 | 137 | ||
138 | }; | 138 | }; |
139 | } | 139 | } |
140 | 140 | ||
141 | }; | 141 | }; |
142 | }; | 142 | }; |
143 | } | 143 | } |
144 | 144 | ||
145 | /** | 145 | /** |
146 | * Process contained values with their multiplicities | 146 | * Process contained values with their multiplicities |
147 | */ | 147 | */ |
@@ -150,24 +150,24 @@ public interface IMemoryView<T> extends Iterable<T> { | |||
150 | entryConsumer.accept(value, getCount(value)); | 150 | entryConsumer.accept(value, getCount(value)); |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | 154 | ||
155 | /** | 155 | /** |
156 | * For compatibility with legacy code relying on element-to-integer maps. | 156 | * For compatibility with legacy code relying on element-to-integer maps. |
157 | * @return an unmodifiable view of contained values with their multiplicities | 157 | * @return an unmodifiable view of contained values with their multiplicities |
158 | */ | 158 | */ |
159 | public default Map<T, Integer> asMap() { | 159 | public default Map<T, Integer> asMap() { |
160 | return new MemoryViewBackedMapView<>(this); | 160 | return new MemoryViewBackedMapView<>(this); |
161 | } | 161 | } |
162 | 162 | ||
163 | /** | 163 | /** |
164 | * For compatibility with legacy code relying on element-to-integer maps. | 164 | * For compatibility with legacy code relying on element-to-integer maps. |
165 | * @return an unmodifiable view of contained values with their multiplicities | 165 | * @return an unmodifiable view of contained values with their multiplicities |
166 | */ | 166 | */ |
167 | public static <T> IMemoryView<T> fromMap(Map<T, Integer> wrapped) { | 167 | public static <T> IMemoryView<T> fromMap(Map<T, Integer> wrapped) { |
168 | return new MapBackedMemoryView<>(wrapped); | 168 | return new MapBackedMemoryView<>(wrapped); |
169 | } | 169 | } |
170 | 170 | ||
171 | /** | 171 | /** |
172 | * @return a stream of values, iterable once | 172 | * @return a stream of values, iterable once |
173 | * @since 2.1 | 173 | * @since 2.1 |
@@ -175,7 +175,7 @@ public interface IMemoryView<T> extends Iterable<T> { | |||
175 | public default Stream<T> asStream() { | 175 | public default Stream<T> asStream() { |
176 | return StreamSupport.stream(spliterator(), false); | 176 | return StreamSupport.stream(spliterator(), false); |
177 | } | 177 | } |
178 | 178 | ||
179 | /** | 179 | /** |
180 | * Provides semantic equality comparison. | 180 | * Provides semantic equality comparison. |
181 | */ | 181 | */ |
@@ -191,7 +191,7 @@ public interface IMemoryView<T> extends Iterable<T> { | |||
191 | } | 191 | } |
192 | return false; | 192 | return false; |
193 | } | 193 | } |
194 | 194 | ||
195 | /** | 195 | /** |
196 | * Provides semantic hashCode() comparison. | 196 | * Provides semantic hashCode() comparison. |
197 | */ | 197 | */ |
@@ -202,4 +202,4 @@ public interface IMemoryView<T> extends Iterable<T> { | |||
202 | } | 202 | } |
203 | return hashCode; | 203 | return hashCode; |
204 | } | 204 | } |
205 | } \ No newline at end of file | 205 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMultiLookup.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMultiLookup.java index 1ce1d2c9..59876b7b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMultiLookup.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMultiLookup.java | |||
@@ -3,33 +3,33 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.stream.Stream; | 11 | import java.util.stream.Stream; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.util.CollectionsFactory.MemoryType; | 13 | import tools.refinery.interpreter.matchers.util.CollectionsFactory.MemoryType; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * A multi-map that associates sets / multisets / delta sets of values to each key. | 16 | * A multi-map that associates sets / multisets / delta sets of values to each key. |
17 | * | 17 | * |
18 | * <p> Implementors must provide semantic (not identity-based) hashCode() and equals() using the static helpers {@link #hashCode(IMultiLookup)} and {@link #equals(IMultiLookup, Object)} here. | 18 | * <p> Implementors must provide semantic (not identity-based) hashCode() and equals() using the static helpers {@link #hashCode(IMultiLookup)} and {@link #equals(IMultiLookup, Object)} here. |
19 | * | 19 | * |
20 | * @author Gabor Bergmann | 20 | * @author Gabor Bergmann |
21 | * @since 2.0 | 21 | * @since 2.0 |
22 | * @noimplement This interface is not intended to be implemented by clients. | 22 | * @noimplement This interface is not intended to be implemented by clients. |
23 | */ | 23 | */ |
24 | public interface IMultiLookup<Key, Value> { | 24 | public interface IMultiLookup<Key, Value> { |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * Returns true if this collection is empty, false otherwise. | 27 | * Returns true if this collection is empty, false otherwise. |
28 | * @since 2.2 | 28 | * @since 2.2 |
29 | */ | 29 | */ |
30 | boolean isEmpty(); | 30 | boolean isEmpty(); |
31 | 31 | ||
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Returns true if there are any values associated with the given key. | 34 | * Returns true if there are any values associated with the given key. |
35 | * @param key a key for which associated values are sought | 35 | * @param key a key for which associated values are sought |
@@ -44,7 +44,7 @@ public interface IMultiLookup<Key, Value> { | |||
44 | * @return null if key not found, a bucket of values otherwise | 44 | * @return null if key not found, a bucket of values otherwise |
45 | */ | 45 | */ |
46 | IMemoryView<Value> lookup(Key key); | 46 | IMemoryView<Value> lookup(Key key); |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Returns a (read-only) bucket of values associated with the given key. | 49 | * Returns a (read-only) bucket of values associated with the given key. |
50 | * Clients must not modify the returned bucket. | 50 | * Clients must not modify the returned bucket. |
@@ -55,7 +55,7 @@ public interface IMultiLookup<Key, Value> { | |||
55 | IMemoryView<Value> bucket = lookup(key); | 55 | IMemoryView<Value> bucket = lookup(key); |
56 | return bucket == null ? EmptyMemory.instance() : bucket; | 56 | return bucket == null ? EmptyMemory.instance() : bucket; |
57 | } | 57 | } |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * Returns a (read-only) bucket of values associated with the given key, while simultaneously removing them. | 60 | * Returns a (read-only) bucket of values associated with the given key, while simultaneously removing them. |
61 | * Clients must not modify the returned bucket. | 61 | * Clients must not modify the returned bucket. |
@@ -64,7 +64,7 @@ public interface IMultiLookup<Key, Value> { | |||
64 | * @since 2.3 | 64 | * @since 2.3 |
65 | */ | 65 | */ |
66 | IMemoryView<Value> lookupAndRemoveAll(Key key); | 66 | IMemoryView<Value> lookupAndRemoveAll(Key key); |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Returns a (read-only) bucket of values associated with the given key, which can be of any type. | 69 | * Returns a (read-only) bucket of values associated with the given key, which can be of any type. |
70 | * Clients must not modify the returned bucket. | 70 | * Clients must not modify the returned bucket. |
@@ -72,7 +72,7 @@ public interface IMultiLookup<Key, Value> { | |||
72 | * @return null if key not found, a bucket of values otherwise | 72 | * @return null if key not found, a bucket of values otherwise |
73 | */ | 73 | */ |
74 | IMemoryView<Value> lookupUnsafe(Object key); | 74 | IMemoryView<Value> lookupUnsafe(Object key); |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Returns a (read-only) bucket of values associated with the given key. | 77 | * Returns a (read-only) bucket of values associated with the given key. |
78 | * Clients must not modify the returned bucket. | 78 | * Clients must not modify the returned bucket. |
@@ -83,40 +83,40 @@ public interface IMultiLookup<Key, Value> { | |||
83 | IMemoryView<Value> bucket = lookupUnsafe(key); | 83 | IMemoryView<Value> bucket = lookupUnsafe(key); |
84 | return bucket == null ? EmptyMemory.instance() : bucket; | 84 | return bucket == null ? EmptyMemory.instance() : bucket; |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | /** | 89 | /** |
90 | * @return the set of distinct keys that have values associated. | 90 | * @return the set of distinct keys that have values associated. |
91 | */ | 91 | */ |
92 | Iterable<Key> distinctKeys(); | 92 | Iterable<Key> distinctKeys(); |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * @return the set of distinct keys that have values associated. | 95 | * @return the set of distinct keys that have values associated. |
96 | * @since 2.3 | 96 | * @since 2.3 |
97 | */ | 97 | */ |
98 | Stream<Key> distinctKeysStream(); | 98 | Stream<Key> distinctKeysStream(); |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * @return the number of distinct keys that have values associated. | 101 | * @return the number of distinct keys that have values associated. |
102 | */ | 102 | */ |
103 | int countKeys(); | 103 | int countKeys(); |
104 | 104 | ||
105 | /** | 105 | /** |
106 | * Iterates once over each distinct value. | 106 | * Iterates once over each distinct value. |
107 | */ | 107 | */ |
108 | Iterable<Value> distinctValues(); | 108 | Iterable<Value> distinctValues(); |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * Iterates once over each distinct value. | 111 | * Iterates once over each distinct value. |
112 | * @since 2.3 | 112 | * @since 2.3 |
113 | */ | 113 | */ |
114 | Stream<Value> distinctValuesStream(); | 114 | Stream<Value> distinctValuesStream(); |
115 | 115 | ||
116 | 116 | ||
117 | 117 | ||
118 | /** | 118 | /** |
119 | * How significant was the change? * | 119 | * How significant was the change? * |
120 | * @author Gabor Bergmann | 120 | * @author Gabor Bergmann |
121 | */ | 121 | */ |
122 | public enum ChangeGranularity { | 122 | public enum ChangeGranularity { |
@@ -124,29 +124,29 @@ public interface IMultiLookup<Key, Value> { | |||
124 | * First key-value pair with given key inserted, or last pair with given key deleted. | 124 | * First key-value pair with given key inserted, or last pair with given key deleted. |
125 | * (In case of delta maps, also if last negative key-value pair with given key neutralized.) | 125 | * (In case of delta maps, also if last negative key-value pair with given key neutralized.) |
126 | */ | 126 | */ |
127 | KEY, | 127 | KEY, |
128 | /** | 128 | /** |
129 | * First occurrence of given key-value pair inserted, or last occurrence of the pair deleted, while key still has values associated. | 129 | * First occurrence of given key-value pair inserted, or last occurrence of the pair deleted, while key still has values associated. |
130 | * (In case of delta maps, also if last negative occurrence of key-value pair neutralized.) | 130 | * (In case of delta maps, also if last negative occurrence of key-value pair neutralized.) |
131 | */ | 131 | */ |
132 | VALUE, | 132 | VALUE, |
133 | /** | 133 | /** |
134 | * Duplicate key-value pair inserted or deleted. | 134 | * Duplicate key-value pair inserted or deleted. |
135 | */ | 135 | */ |
136 | DUPLICATE | 136 | DUPLICATE |
137 | } | 137 | } |
138 | 138 | ||
139 | /** | 139 | /** |
140 | * Adds key-value pair to the lookup structure, or fails if not possible. | 140 | * Adds key-value pair to the lookup structure, or fails if not possible. |
141 | * <p> If the addition would cause duplicates but the bucket type does not allow it ({@link MemoryType#SETS}), | 141 | * <p> If the addition would cause duplicates but the bucket type does not allow it ({@link MemoryType#SETS}), |
142 | * the operation throws an {@link IllegalStateException}. | 142 | * the operation throws an {@link IllegalStateException}. |
143 | * @return the granularity of the change | 143 | * @return the granularity of the change |
144 | * @throws IllegalStateException if addition would cause duplication that is not permitted | 144 | * @throws IllegalStateException if addition would cause duplication that is not permitted |
145 | */ | 145 | */ |
146 | public ChangeGranularity addPair(Key key, Value value); | 146 | public ChangeGranularity addPair(Key key, Value value); |
147 | /** | 147 | /** |
148 | * Adds key-value pair to the lookup structure. | 148 | * Adds key-value pair to the lookup structure. |
149 | * <p> If the addition would cause duplicates but the bucket type does not allow it ({@link MemoryType#SETS}), | 149 | * <p> If the addition would cause duplicates but the bucket type does not allow it ({@link MemoryType#SETS}), |
150 | * the operation is silently ignored and {@link ChangeGranularity#DUPLICATE} is returned. | 150 | * the operation is silently ignored and {@link ChangeGranularity#DUPLICATE} is returned. |
151 | * @return the granularity of the change, or {@link ChangeGranularity#DUPLICATE} if addition would result in a duplicate and therefore ignored | 151 | * @return the granularity of the change, or {@link ChangeGranularity#DUPLICATE} if addition would result in a duplicate and therefore ignored |
152 | * @since 2.3 | 152 | * @since 2.3 |
@@ -154,38 +154,38 @@ public interface IMultiLookup<Key, Value> { | |||
154 | public ChangeGranularity addPairOrNop(Key key, Value value); | 154 | public ChangeGranularity addPairOrNop(Key key, Value value); |
155 | /** | 155 | /** |
156 | * Removes key-value pair from the lookup structure, or fails if not possible. | 156 | * Removes key-value pair from the lookup structure, or fails if not possible. |
157 | * <p> When attempting to remove a key-value pair with zero multiplicity from a non-delta bucket type | 157 | * <p> When attempting to remove a key-value pair with zero multiplicity from a non-delta bucket type |
158 | * ({@link MemoryType#SETS} or {@link MemoryType#MULTISETS}}), an {@link IllegalStateException} is thrown. | 158 | * ({@link MemoryType#SETS} or {@link MemoryType#MULTISETS}}), an {@link IllegalStateException} is thrown. |
159 | * @return the granularity of the change | 159 | * @return the granularity of the change |
160 | * @throws IllegalStateException if removing non-existing element that is not permitted | 160 | * @throws IllegalStateException if removing non-existing element that is not permitted |
161 | */ | 161 | */ |
162 | public ChangeGranularity removePair(Key key, Value value); | 162 | public ChangeGranularity removePair(Key key, Value value); |
163 | /** | 163 | /** |
164 | * Removes key-value pair from the lookup structure. | 164 | * Removes key-value pair from the lookup structure. |
165 | * <p> When attempting to remove a key-value pair with zero multiplicity from a non-delta bucket type | 165 | * <p> When attempting to remove a key-value pair with zero multiplicity from a non-delta bucket type |
166 | * ({@link MemoryType#SETS} or {@link MemoryType#MULTISETS}}), | 166 | * ({@link MemoryType#SETS} or {@link MemoryType#MULTISETS}}), |
167 | * the operation is silently ignored and {@link ChangeGranularity#DUPLICATE} is returned. | 167 | * the operation is silently ignored and {@link ChangeGranularity#DUPLICATE} is returned. |
168 | * @return the granularity of the change | 168 | * @return the granularity of the change |
169 | * @throws IllegalStateException if removing non-existing element that is not permitted | 169 | * @throws IllegalStateException if removing non-existing element that is not permitted |
170 | * @since 2.3 | 170 | * @since 2.3 |
171 | */ | 171 | */ |
172 | public ChangeGranularity removePairOrNop(Key key, Value value); | 172 | public ChangeGranularity removePairOrNop(Key key, Value value); |
173 | 173 | ||
174 | /** | 174 | /** |
175 | * Updates multiplicity of key-value pair by a positive amount. | 175 | * Updates multiplicity of key-value pair by a positive amount. |
176 | * | 176 | * |
177 | * <p> PRE: count > 0 | 177 | * <p> PRE: count > 0 |
178 | * | 178 | * |
179 | * @return the granularity of the change | 179 | * @return the granularity of the change |
180 | * @throws IllegalStateException if addition would cause duplication that is not permitted | 180 | * @throws IllegalStateException if addition would cause duplication that is not permitted |
181 | */ | 181 | */ |
182 | public ChangeGranularity addPairPositiveMultiplicity(Key key, Value value, int count); | 182 | public ChangeGranularity addPairPositiveMultiplicity(Key key, Value value, int count); |
183 | 183 | ||
184 | /** | 184 | /** |
185 | * Empties out the lookup structure. | 185 | * Empties out the lookup structure. |
186 | */ | 186 | */ |
187 | public void clear(); | 187 | public void clear(); |
188 | 188 | ||
189 | /** | 189 | /** |
190 | * Provides semantic equality comparison. | 190 | * Provides semantic equality comparison. |
191 | */ | 191 | */ |
@@ -201,7 +201,7 @@ public interface IMultiLookup<Key, Value> { | |||
201 | } | 201 | } |
202 | return false; | 202 | return false; |
203 | } | 203 | } |
204 | 204 | ||
205 | /** | 205 | /** |
206 | * Provides semantic hashCode() comparison. | 206 | * Provides semantic hashCode() comparison. |
207 | */ | 207 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMultiLookupAbstract.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMultiLookupAbstract.java index 8b1944c1..d7477a5a 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMultiLookupAbstract.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMultiLookupAbstract.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
@@ -15,37 +15,35 @@ import java.util.Objects; | |||
15 | import java.util.stream.Stream; | 15 | import java.util.stream.Stream; |
16 | import java.util.stream.StreamSupport; | 16 | import java.util.stream.StreamSupport; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.matchers.util.MarkedMemory.MarkedSet; | ||
19 | |||
20 | /** | 18 | /** |
21 | * Specialized multimap implementation that saves memory | 19 | * Specialized multimap implementation that saves memory |
22 | * by storing singleton value objects (multiplicity 1) instead of multiset buckets | 20 | * by storing singleton value objects (multiplicity 1) instead of multiset buckets |
23 | * whenever there is only one value associated with a key. | 21 | * whenever there is only one value associated with a key. |
24 | * | 22 | * |
25 | * <p> See specialized {@link ToSetsAbstract}, {@link ToMultisetsAbstract} for various bucket types. | 23 | * <p> See specialized {@link ToSetsAbstract}, {@link ToMultisetsAbstract} for various bucket types. |
26 | * | 24 | * |
27 | * <p> Implemented as a Key->Object map with invariant: <ul> | 25 | * <p> Implemented as a Key->Object map with invariant: <ul> |
28 | * <li> key maps to null if associated with no values; | 26 | * <li> key maps to null if associated with no values; |
29 | * <li> key maps to a single Value iff it is associated with a single value of multiplicity +1; | 27 | * <li> key maps to a single Value iff it is associated with a single value of multiplicity +1; |
30 | * <li> key maps to Bucket otherwise | 28 | * <li> key maps to Bucket otherwise |
31 | * </ul> | 29 | * </ul> |
32 | * | 30 | * |
33 | * Note that due to the above invariant, handling +1 and -1 are asymmetric in case of delta maps. | 31 | * Note that due to the above invariant, handling +1 and -1 are asymmetric in case of delta maps. |
34 | * | 32 | * |
35 | * <p> Not intended as an API, but rather as a 'base class' for implementors. | 33 | * <p> Not intended as an API, but rather as a 'base class' for implementors. |
36 | * Realized as an interface with default implementations, instead of an abstract class, | 34 | * Realized as an interface with default implementations, instead of an abstract class, |
37 | * to ensure that implementors can easily choose a base class such as UnifiedMap to augment. | 35 | * to ensure that implementors can easily choose a base class such as UnifiedMap to augment. |
38 | * | 36 | * |
39 | * <p> Implementor should inherit from a Map<Key, Object>-like class (primitive map possible) | 37 | * <p> Implementor should inherit from a Map<Key, Object>-like class (primitive map possible) |
40 | * and bind the lowLevel* methods accordingly. | 38 | * and bind the lowLevel* methods accordingly. |
41 | * | 39 | * |
42 | * @noreference This interface is not intended to be referenced by clients. | 40 | * @noreference This interface is not intended to be referenced by clients. |
43 | * @noimplement This interface is not intended to be implemented by clients. | 41 | * @noimplement This interface is not intended to be implemented by clients. |
44 | * | 42 | * |
45 | * @author Gabor Bergmann | 43 | * @author Gabor Bergmann |
46 | * @since 2.0 | 44 | * @since 2.0 |
47 | * | 45 | * |
48 | * | 46 | * |
49 | */ | 47 | */ |
50 | public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Value>> extends IMultiLookup<Key, Value> { | 48 | public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Value>> extends IMultiLookup<Key, Value> { |
51 | 49 | ||
@@ -60,12 +58,12 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
60 | * Implementor shall bind to the low-level get() or equivalent of the underlying Key-to-Object map | 58 | * Implementor shall bind to the low-level get() or equivalent of the underlying Key-to-Object map |
61 | */ | 59 | */ |
62 | abstract Object lowLevelGetUnsafe(Object key); | 60 | abstract Object lowLevelGetUnsafe(Object key); |
63 | 61 | ||
64 | /** | 62 | /** |
65 | * Implementor shall bind to the low-level remove() or equivalent of the underlying Key-to-Object map | 63 | * Implementor shall bind to the low-level remove() or equivalent of the underlying Key-to-Object map |
66 | */ | 64 | */ |
67 | abstract Object lowLevelRemove(Key key); | 65 | abstract Object lowLevelRemove(Key key); |
68 | 66 | ||
69 | /** | 67 | /** |
70 | * Implementor shall bind to the low-level putIfAbsent() or equivalent of the underlying Key-to-Object map | 68 | * Implementor shall bind to the low-level putIfAbsent() or equivalent of the underlying Key-to-Object map |
71 | */ | 69 | */ |
@@ -75,31 +73,31 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
75 | * Implementor shall bind to the low-level put() or equivalent of the underlying Key-to-Object map | 73 | * Implementor shall bind to the low-level put() or equivalent of the underlying Key-to-Object map |
76 | */ | 74 | */ |
77 | abstract void lowLevelPut(Key key, Object valueOrBucket); | 75 | abstract void lowLevelPut(Key key, Object valueOrBucket); |
78 | 76 | ||
79 | /** | 77 | /** |
80 | * Implementor shall bind to the low-level values() or equivalent of the underlying Key-to-Object map | 78 | * Implementor shall bind to the low-level values() or equivalent of the underlying Key-to-Object map |
81 | */ | 79 | */ |
82 | abstract Iterable<Object> lowLevelValues(); | 80 | abstract Iterable<Object> lowLevelValues(); |
83 | 81 | ||
84 | /** | 82 | /** |
85 | * Implementor shall bind to the low-level keySet() or equivalent of the underlying Key-to-Object map | 83 | * Implementor shall bind to the low-level keySet() or equivalent of the underlying Key-to-Object map |
86 | */ | 84 | */ |
87 | abstract Iterable<Key> lowLevelKeySet(); | 85 | abstract Iterable<Key> lowLevelKeySet(); |
88 | 86 | ||
89 | /** | 87 | /** |
90 | * Implementor shall bind to the low-level size() or equivalent of the underlying Key-to-Object map | 88 | * Implementor shall bind to the low-level size() or equivalent of the underlying Key-to-Object map |
91 | */ | 89 | */ |
92 | abstract int lowLevelSize(); | 90 | abstract int lowLevelSize(); |
93 | 91 | ||
94 | 92 | ||
95 | // generic multi-lookup logic | 93 | // generic multi-lookup logic |
96 | 94 | ||
97 | @Override | 95 | @Override |
98 | default boolean lookupExists(Key key) { | 96 | default boolean lookupExists(Key key) { |
99 | Object object = lowLevelGet(key); | 97 | Object object = lowLevelGet(key); |
100 | return null != object; | 98 | return null != object; |
101 | } | 99 | } |
102 | 100 | ||
103 | @Override | 101 | @Override |
104 | public default IMemoryView<Value> lookup(Key key) { | 102 | public default IMemoryView<Value> lookup(Key key) { |
105 | Object object = lowLevelGet(key); | 103 | Object object = lowLevelGet(key); |
@@ -107,7 +105,7 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
107 | if (object instanceof MarkedMemory) return (Bucket) object; | 105 | if (object instanceof MarkedMemory) return (Bucket) object; |
108 | return yieldSingleton((Value)object); | 106 | return yieldSingleton((Value)object); |
109 | } | 107 | } |
110 | 108 | ||
111 | @Override | 109 | @Override |
112 | default IMemoryView<Value> lookupAndRemoveAll(Key key) { | 110 | default IMemoryView<Value> lookupAndRemoveAll(Key key) { |
113 | Object object = lowLevelRemove(key); | 111 | Object object = lowLevelRemove(key); |
@@ -115,7 +113,7 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
115 | if (object instanceof MarkedMemory) return (Bucket) object; | 113 | if (object instanceof MarkedMemory) return (Bucket) object; |
116 | return yieldSingleton((Value)object); | 114 | return yieldSingleton((Value)object); |
117 | } | 115 | } |
118 | 116 | ||
119 | @Override | 117 | @Override |
120 | public default IMemoryView<Value> lookupUnsafe(Object key) { | 118 | public default IMemoryView<Value> lookupUnsafe(Object key) { |
121 | Object object = lowLevelGetUnsafe(key); | 119 | Object object = lowLevelGetUnsafe(key); |
@@ -128,7 +126,7 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
128 | public default ChangeGranularity addPair(Key key, Value value) { | 126 | public default ChangeGranularity addPair(Key key, Value value) { |
129 | return addPairInternal(key, value, true); | 127 | return addPairInternal(key, value, true); |
130 | } | 128 | } |
131 | 129 | ||
132 | @Override | 130 | @Override |
133 | default ChangeGranularity addPairOrNop(Key key, Value value) { | 131 | default ChangeGranularity addPairOrNop(Key key, Value value) { |
134 | return addPairInternal(key, value, false); | 132 | return addPairInternal(key, value, false); |
@@ -146,9 +144,9 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
146 | bucket = (Bucket) old; | 144 | bucket = (Bucket) old; |
147 | } else { // ... as singleton | 145 | } else { // ... as singleton |
148 | if (!this.duplicatesAllowed() && Objects.equals(value, old)) { | 146 | if (!this.duplicatesAllowed() && Objects.equals(value, old)) { |
149 | if (throwIfImpossible) | 147 | if (throwIfImpossible) |
150 | throw new IllegalStateException(); | 148 | throw new IllegalStateException(); |
151 | else | 149 | else |
152 | return ChangeGranularity.DUPLICATE; | 150 | return ChangeGranularity.DUPLICATE; |
153 | } | 151 | } |
154 | bucket = createSingletonBucket((Value) old); | 152 | bucket = createSingletonBucket((Value) old); |
@@ -158,27 +156,27 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
158 | if (addToBucket(bucket, value, throwIfImpossible)) { | 156 | if (addToBucket(bucket, value, throwIfImpossible)) { |
159 | // deltas may become empty or a singleton after addition! | 157 | // deltas may become empty or a singleton after addition! |
160 | if (negativesAllowed()) { | 158 | if (negativesAllowed()) { |
161 | if (bucket.isEmpty()) { | 159 | if (bucket.isEmpty()) { |
162 | lowLevelRemove(key); | 160 | lowLevelRemove(key); |
163 | return ChangeGranularity.KEY; | 161 | return ChangeGranularity.KEY; |
164 | } else { | 162 | } else { |
165 | handleSingleton(key, bucket); | 163 | handleSingleton(key, bucket); |
166 | return ChangeGranularity.VALUE; | 164 | return ChangeGranularity.VALUE; |
167 | } | 165 | } |
168 | } else return ChangeGranularity.VALUE; | 166 | } else return ChangeGranularity.VALUE; |
169 | } else return ChangeGranularity.DUPLICATE; | 167 | } else return ChangeGranularity.DUPLICATE; |
170 | } | 168 | } |
171 | } | 169 | } |
172 | 170 | ||
173 | @Override | 171 | @Override |
174 | // TODO deltas not supproted yet | 172 | // TODO deltas not supproted yet |
175 | default ChangeGranularity addPairPositiveMultiplicity(Key key, Value value, int count) { | 173 | default ChangeGranularity addPairPositiveMultiplicity(Key key, Value value, int count) { |
176 | if (count == 1) return addPair(key, value); | 174 | if (count == 1) return addPair(key, value); |
177 | // count > 1, always end up with non-singleton bucket | 175 | // count > 1, always end up with non-singleton bucket |
178 | 176 | ||
179 | Object old = lowLevelGet(key); | 177 | Object old = lowLevelGet(key); |
180 | boolean keyChange = (old == null); | 178 | boolean keyChange = (old == null); |
181 | 179 | ||
182 | Bucket bucket; | 180 | Bucket bucket; |
183 | if (keyChange) { // ... nothing associated to key yet | 181 | if (keyChange) { // ... nothing associated to key yet |
184 | bucket = createSingletonBucket(value); | 182 | bucket = createSingletonBucket(value); |
@@ -190,9 +188,9 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
190 | bucket = createSingletonBucket((Value) old); | 188 | bucket = createSingletonBucket((Value) old); |
191 | lowLevelPut(key, bucket); | 189 | lowLevelPut(key, bucket); |
192 | } | 190 | } |
193 | 191 | ||
194 | boolean newValue = bucket.addSigned(value, count); | 192 | boolean newValue = bucket.addSigned(value, count); |
195 | 193 | ||
196 | if (keyChange) return ChangeGranularity.KEY; | 194 | if (keyChange) return ChangeGranularity.KEY; |
197 | else if (newValue) return ChangeGranularity.VALUE; | 195 | else if (newValue) return ChangeGranularity.VALUE; |
198 | else return ChangeGranularity.DUPLICATE; | 196 | else return ChangeGranularity.DUPLICATE; |
@@ -202,7 +200,7 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
202 | public default ChangeGranularity removePair(Key key, Value value) { | 200 | public default ChangeGranularity removePair(Key key, Value value) { |
203 | return removePairInternal(key, value, true); | 201 | return removePairInternal(key, value, true); |
204 | } | 202 | } |
205 | 203 | ||
206 | @Override | 204 | @Override |
207 | default ChangeGranularity removePairOrNop(Key key, Value value) { | 205 | default ChangeGranularity removePairOrNop(Key key, Value value) { |
208 | return removePairInternal(key, value, false); | 206 | return removePairInternal(key, value, false); |
@@ -214,11 +212,11 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
214 | @SuppressWarnings("unchecked") | 212 | @SuppressWarnings("unchecked") |
215 | Bucket bucket = (Bucket) old; | 213 | Bucket bucket = (Bucket) old; |
216 | // will throw if removing non-existent, return false if removing duplicate | 214 | // will throw if removing non-existent, return false if removing duplicate |
217 | boolean valueChange = removeFromBucket(bucket, value, throwIfImpossible); | 215 | boolean valueChange = removeFromBucket(bucket, value, throwIfImpossible); |
218 | handleSingleton(key, bucket); | 216 | handleSingleton(key, bucket); |
219 | if (valueChange) | 217 | if (valueChange) |
220 | return ChangeGranularity.VALUE; | 218 | return ChangeGranularity.VALUE; |
221 | else | 219 | else |
222 | return ChangeGranularity.DUPLICATE; | 220 | return ChangeGranularity.DUPLICATE; |
223 | } else if (value.equals(old)) { // matching singleton | 221 | } else if (value.equals(old)) { // matching singleton |
224 | lowLevelRemove(key); | 222 | lowLevelRemove(key); |
@@ -227,11 +225,11 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
227 | if (negativesAllowed()) { | 225 | if (negativesAllowed()) { |
228 | Bucket deltaBucket = createDeltaBucket((Value) old, value); // will throw if no deltas supported | 226 | Bucket deltaBucket = createDeltaBucket((Value) old, value); // will throw if no deltas supported |
229 | lowLevelPut(key, deltaBucket); | 227 | lowLevelPut(key, deltaBucket); |
230 | return ChangeGranularity.VALUE; // no key change | 228 | return ChangeGranularity.VALUE; // no key change |
231 | } else { | 229 | } else { |
232 | if (throwIfImpossible) | 230 | if (throwIfImpossible) |
233 | throw new IllegalStateException(); | 231 | throw new IllegalStateException(); |
234 | else | 232 | else |
235 | return ChangeGranularity.DUPLICATE; | 233 | return ChangeGranularity.DUPLICATE; |
236 | } | 234 | } |
237 | } | 235 | } |
@@ -247,18 +245,18 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
247 | @Override | 245 | @Override |
248 | public default Iterable<Value> distinctValues() { | 246 | public default Iterable<Value> distinctValues() { |
249 | return new Iterable<Value>() { | 247 | return new Iterable<Value>() { |
250 | private final Iterator<Value> EMPTY_ITERATOR = Collections.<Value>emptySet().iterator(); | 248 | private final Iterator<Value> EMPTY_ITERATOR = Collections.<Value>emptySet().iterator(); |
251 | @Override | 249 | @Override |
252 | public Iterator<Value> iterator() { | 250 | public Iterator<Value> iterator() { |
253 | return new Iterator<Value>() { | 251 | return new Iterator<Value>() { |
254 | Iterator<Object> bucketIterator = lowLevelValues().iterator(); | 252 | Iterator<Object> bucketIterator = lowLevelValues().iterator(); |
255 | Iterator<Value> elementIterator = EMPTY_ITERATOR; | 253 | Iterator<Value> elementIterator = EMPTY_ITERATOR; |
256 | 254 | ||
257 | @Override | 255 | @Override |
258 | public boolean hasNext() { | 256 | public boolean hasNext() { |
259 | return (elementIterator.hasNext() || bucketIterator.hasNext()); | 257 | return (elementIterator.hasNext() || bucketIterator.hasNext()); |
260 | } | 258 | } |
261 | 259 | ||
262 | @Override | 260 | @Override |
263 | public Value next() { | 261 | public Value next() { |
264 | if (elementIterator.hasNext()) | 262 | if (elementIterator.hasNext()) |
@@ -266,7 +264,7 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
266 | else if (bucketIterator.hasNext()) { | 264 | else if (bucketIterator.hasNext()) { |
267 | Object bucket = bucketIterator.next(); | 265 | Object bucket = bucketIterator.next(); |
268 | if (bucket instanceof MarkedMemory) { | 266 | if (bucket instanceof MarkedMemory) { |
269 | elementIterator = | 267 | elementIterator = |
270 | ((MarkedMemory) bucket).distinctValues().iterator(); | 268 | ((MarkedMemory) bucket).distinctValues().iterator(); |
271 | return elementIterator.next(); | 269 | return elementIterator.next(); |
272 | } else { | 270 | } else { |
@@ -289,27 +287,27 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
289 | } | 287 | } |
290 | }; | 288 | }; |
291 | } | 289 | } |
292 | 290 | ||
293 | @Override | 291 | @Override |
294 | default Stream<Value> distinctValuesStream() { | 292 | default Stream<Value> distinctValuesStream() { |
295 | return StreamSupport.stream(distinctValues().spliterator(), false); | 293 | return StreamSupport.stream(distinctValues().spliterator(), false); |
296 | } | 294 | } |
297 | 295 | ||
298 | @Override | 296 | @Override |
299 | default Iterable<Key> distinctKeys() { | 297 | default Iterable<Key> distinctKeys() { |
300 | return lowLevelKeySet(); | 298 | return lowLevelKeySet(); |
301 | } | 299 | } |
302 | 300 | ||
303 | @Override | 301 | @Override |
304 | default Stream<Key> distinctKeysStream() { | 302 | default Stream<Key> distinctKeysStream() { |
305 | return StreamSupport.stream(distinctKeys().spliterator(), false); | 303 | return StreamSupport.stream(distinctKeys().spliterator(), false); |
306 | } | 304 | } |
307 | 305 | ||
308 | @Override | 306 | @Override |
309 | default int countKeys() { | 307 | default int countKeys() { |
310 | return lowLevelSize(); | 308 | return lowLevelSize(); |
311 | } | 309 | } |
312 | 310 | ||
313 | // the following methods are customized for bucket type | 311 | // the following methods are customized for bucket type |
314 | 312 | ||
315 | /** | 313 | /** |
@@ -322,11 +320,11 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
322 | * @since 2.3 | 320 | * @since 2.3 |
323 | */ | 321 | */ |
324 | abstract boolean duplicatesAllowed(); | 322 | abstract boolean duplicatesAllowed(); |
325 | 323 | ||
326 | /** | 324 | /** |
327 | * Increases the multiplicity of the value in the bucket. | 325 | * Increases the multiplicity of the value in the bucket. |
328 | * @return true iff non-duplicate | 326 | * @return true iff non-duplicate |
329 | * @throws IllegalStateException if disallowed duplication and throwIfImpossible is specified | 327 | * @throws IllegalStateException if disallowed duplication and throwIfImpossible is specified |
330 | */ | 328 | */ |
331 | abstract boolean addToBucket(Bucket bucket, Value value, boolean throwIfImpossible); | 329 | abstract boolean addToBucket(Bucket bucket, Value value, boolean throwIfImpossible); |
332 | 330 | ||
@@ -360,17 +358,17 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
360 | * @throws IllegalStateException if deltas not supported | 358 | * @throws IllegalStateException if deltas not supported |
361 | */ | 359 | */ |
362 | abstract Bucket createDeltaBucket(Value positive, Value negative); | 360 | abstract Bucket createDeltaBucket(Value positive, Value negative); |
363 | 361 | ||
364 | /** | 362 | /** |
365 | * A multi-lookup whose buckets are sets. | 363 | * A multi-lookup whose buckets are sets. |
366 | * | 364 | * |
367 | * <p> Not intended as an API, but rather as a 'base class' for implementors. | 365 | * <p> Not intended as an API, but rather as a 'base class' for implementors. |
368 | * Realized as an interface with default implementations, instead of an abstract class, | 366 | * Realized as an interface with default implementations, instead of an abstract class, |
369 | * to ensure that implementors can easily choose a base class such as UnifiedMap to augment. | 367 | * to ensure that implementors can easily choose a base class such as UnifiedMap to augment. |
370 | * | 368 | * |
371 | * <p> Implementor should inherit from a Map<Key, Object>-like class (primitive map possible) | 369 | * <p> Implementor should inherit from a Map<Key, Object>-like class (primitive map possible) |
372 | * and bind the lowLevel* methods accordingly. | 370 | * and bind the lowLevel* methods accordingly. |
373 | * | 371 | * |
374 | * @noreference This interface is not intended to be referenced by clients. | 372 | * @noreference This interface is not intended to be referenced by clients. |
375 | * @noimplement This interface is not intended to be implemented by clients. | 373 | * @noimplement This interface is not intended to be implemented by clients. |
376 | * @author Gabor Bergmann | 374 | * @author Gabor Bergmann |
@@ -379,7 +377,7 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
379 | /** | 377 | /** |
380 | * @return a fresh, empty marked set | 378 | * @return a fresh, empty marked set |
381 | */ | 379 | */ |
382 | public MarkedSet<Value> createMarkedSet(); | 380 | public MarkedMemory.MarkedSet<Value> createMarkedSet(); |
383 | 381 | ||
384 | @Override | 382 | @Override |
385 | public default boolean negativesAllowed() { | 383 | public default boolean negativesAllowed() { |
@@ -391,45 +389,45 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
391 | } | 389 | } |
392 | 390 | ||
393 | @Override | 391 | @Override |
394 | public default boolean addToBucket(MarkedSet<Value> bucket, Value value, boolean throwIfImpossible) { | 392 | public default boolean addToBucket(MarkedMemory.MarkedSet<Value> bucket, Value value, boolean throwIfImpossible) { |
395 | if (bucket.addOne(value)) return true; | 393 | if (bucket.addOne(value)) return true; |
396 | else if (throwIfImpossible) throw new IllegalStateException(); | 394 | else if (throwIfImpossible) throw new IllegalStateException(); |
397 | else return false; | 395 | else return false; |
398 | } | 396 | } |
399 | 397 | ||
400 | @Override | 398 | @Override |
401 | public default boolean removeFromBucket(MarkedSet<Value> bucket, Value value, boolean throwIfImpossible) { | 399 | public default boolean removeFromBucket(MarkedMemory.MarkedSet<Value> bucket, Value value, boolean throwIfImpossible) { |
402 | return throwIfImpossible ? bucket.removeOne(value) : bucket.removeOneOrNop(value); | 400 | return throwIfImpossible ? bucket.removeOne(value) : bucket.removeOneOrNop(value); |
403 | } | 401 | } |
404 | 402 | ||
405 | @Override | 403 | @Override |
406 | public default Value asSingleton(MarkedSet<Value> bucket) { | 404 | public default Value asSingleton(MarkedMemory.MarkedSet<Value> bucket) { |
407 | return bucket.size() == 1 ? bucket.iterator().next() : null; | 405 | return bucket.size() == 1 ? bucket.iterator().next() : null; |
408 | } | 406 | } |
409 | 407 | ||
410 | @Override | 408 | @Override |
411 | public default MarkedSet<Value> createSingletonBucket(Value value) { | 409 | public default MarkedMemory.MarkedSet<Value> createSingletonBucket(Value value) { |
412 | MarkedSet<Value> result = createMarkedSet(); | 410 | MarkedMemory.MarkedSet<Value> result = createMarkedSet(); |
413 | result.addOne(value); | 411 | result.addOne(value); |
414 | return result; | 412 | return result; |
415 | } | 413 | } |
416 | 414 | ||
417 | @Override | 415 | @Override |
418 | public default MarkedSet<Value> createDeltaBucket(Value positive, Value negative) { | 416 | public default MarkedMemory.MarkedSet<Value> createDeltaBucket(Value positive, Value negative) { |
419 | throw new IllegalStateException(); | 417 | throw new IllegalStateException(); |
420 | } | 418 | } |
421 | } | 419 | } |
422 | 420 | ||
423 | /** | 421 | /** |
424 | * A multi-lookup whose buckets are multisets. | 422 | * A multi-lookup whose buckets are multisets. |
425 | * | 423 | * |
426 | * <p> Not intended as an API, but rather as a 'base class' for implementors. | 424 | * <p> Not intended as an API, but rather as a 'base class' for implementors. |
427 | * Realized as an interface with default implementations, instead of an abstract class, | 425 | * Realized as an interface with default implementations, instead of an abstract class, |
428 | * to ensure that implementors can easily choose a base class such as UnifiedMap to augment. | 426 | * to ensure that implementors can easily choose a base class such as UnifiedMap to augment. |
429 | * | 427 | * |
430 | * <p> Implementor should inherit from a Map<Key, Object>-like class (primitive map possible) | 428 | * <p> Implementor should inherit from a Map<Key, Object>-like class (primitive map possible) |
431 | * and bind the lowLevel* methods accordingly. | 429 | * and bind the lowLevel* methods accordingly. |
432 | * | 430 | * |
433 | * @noreference This interface is not intended to be referenced by clients. | 431 | * @noreference This interface is not intended to be referenced by clients. |
434 | * @noimplement This interface is not intended to be implemented by clients. | 432 | * @noimplement This interface is not intended to be implemented by clients. |
435 | * @author Gabor Bergmann | 433 | * @author Gabor Bergmann |
@@ -451,7 +449,7 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
451 | 449 | ||
452 | @Override | 450 | @Override |
453 | public default boolean addToBucket(MarkedMemory.MarkedMultiset<Value> bucket, Value value, boolean throwIfImpossible) { | 451 | public default boolean addToBucket(MarkedMemory.MarkedMultiset<Value> bucket, Value value, boolean throwIfImpossible) { |
454 | return bucket.addOne(value); | 452 | return bucket.addOne(value); |
455 | } | 453 | } |
456 | 454 | ||
457 | @Override | 455 | @Override |
@@ -476,10 +474,10 @@ public interface IMultiLookupAbstract<Key, Value, Bucket extends MarkedMemory<Va | |||
476 | @Override | 474 | @Override |
477 | public default MarkedMemory.MarkedMultiset<Value> createDeltaBucket(Value positive, Value negative) { | 475 | public default MarkedMemory.MarkedMultiset<Value> createDeltaBucket(Value positive, Value negative) { |
478 | throw new IllegalStateException(); | 476 | throw new IllegalStateException(); |
479 | } | 477 | } |
480 | } | 478 | } |
481 | 479 | ||
482 | 480 | ||
483 | // TODO add ToDeltaBagsAbstract | 481 | // TODO add ToDeltaBagsAbstract |
484 | 482 | ||
485 | } \ No newline at end of file | 483 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMultiset.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMultiset.java index bdd5d597..dfbb9d92 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IMultiset.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IMultiset.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * An {@link IMemory} that always contains values with a nonnegative multiplicity. | 12 | * An {@link IMemory} that always contains values with a nonnegative multiplicity. |
13 | * | 13 | * |
14 | * <p> In case a write operation caused underflow, an {@link IllegalStateException} is thrown. | 14 | * <p> In case a write operation caused underflow, an {@link IllegalStateException} is thrown. |
15 | * | 15 | * |
16 | * @author Gabor Bergmann | 16 | * @author Gabor Bergmann |
17 | * @since 1.7 | 17 | * @since 1.7 |
18 | */ | 18 | */ |
@@ -20,11 +20,11 @@ public interface IMultiset<T> extends IMemory<T> { | |||
20 | 20 | ||
21 | /** | 21 | /** |
22 | * Adds the given number of occurrences to the memory. The count value must be a positive number. | 22 | * Adds the given number of occurrences to the memory. The count value must be a positive number. |
23 | * | 23 | * |
24 | * @param count | 24 | * @param count |
25 | * the number of occurrences | 25 | * the number of occurrences |
26 | * @return true if the tuple was not present before in the memory | 26 | * @return true if the tuple was not present before in the memory |
27 | */ | 27 | */ |
28 | boolean addPositive(T value, int count); | 28 | boolean addPositive(T value, int count); |
29 | 29 | ||
30 | } \ No newline at end of file | 30 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IProvider.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IProvider.java index cd25dc95..5b26438c 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/IProvider.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/IProvider.java | |||
@@ -3,24 +3,24 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.function.Function; | 11 | import java.util.function.Function; |
12 | import java.util.function.Supplier; | 12 | import java.util.function.Supplier; |
13 | 13 | ||
14 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 14 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * A provider interface useful in various registry instances. | 17 | * A provider interface useful in various registry instances. |
18 | * | 18 | * |
19 | * @author Zoltan Ujhelyi | 19 | * @author Zoltan Ujhelyi |
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | public interface IProvider<T> extends Supplier<T>{ | 22 | public interface IProvider<T> extends Supplier<T>{ |
23 | 23 | ||
24 | public final class ProvidedValueFunction implements Function<IProvider<PQuery>, PQuery> { | 24 | public final class ProvidedValueFunction implements Function<IProvider<PQuery>, PQuery> { |
25 | @Override | 25 | @Override |
26 | public PQuery apply(IProvider<PQuery> input) { | 26 | public PQuery apply(IProvider<PQuery> input) { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/ISetMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/ISetMemory.java index 0c03da48..feb0dd5e 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/ISetMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/ISetMemory.java | |||
@@ -3,28 +3,28 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.function.BiConsumer; | 11 | import java.util.function.BiConsumer; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * An {@link IMemory} that always contains values with a 0 or +1 multiplicity. | 14 | * An {@link IMemory} that always contains values with a 0 or +1 multiplicity. |
15 | * | 15 | * |
16 | * <p> In case a write operation causes underflow or overflow, an {@link IllegalStateException} is thrown. | 16 | * <p> In case a write operation causes underflow or overflow, an {@link IllegalStateException} is thrown. |
17 | * | 17 | * |
18 | * @author Gabor Bergmann | 18 | * @author Gabor Bergmann |
19 | * @since 2.0 | 19 | * @since 2.0 |
20 | */ | 20 | */ |
21 | public interface ISetMemory<T> extends IMemory<T> { | 21 | public interface ISetMemory<T> extends IMemory<T> { |
22 | 22 | ||
23 | @Override | 23 | @Override |
24 | default void forEachEntryWithMultiplicities(BiConsumer<T, Integer> entryConsumer) { | 24 | default void forEachEntryWithMultiplicities(BiConsumer<T, Integer> entryConsumer) { |
25 | for (T t : this.distinctValues()) entryConsumer.accept(t, 1); | 25 | for (T t : this.distinctValues()) entryConsumer.accept(t, 1); |
26 | } | 26 | } |
27 | 27 | ||
28 | 28 | ||
29 | @Override | 29 | @Override |
30 | default boolean removeOne(T value) { | 30 | default boolean removeOne(T value) { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/MapBackedMemoryView.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/MapBackedMemoryView.java index 3be078bd..d11e6807 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/MapBackedMemoryView.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/MapBackedMemoryView.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.Iterator; | 11 | import java.util.Iterator; |
12 | import java.util.Map; | 12 | import java.util.Map; |
@@ -16,7 +16,7 @@ import java.util.function.BiConsumer; | |||
16 | 16 | ||
17 | /** | 17 | /** |
18 | * Wraps a Map<T, Integer> (mapping elements to non-zero multiplicities) into an {@link IMemoryView}. | 18 | * Wraps a Map<T, Integer> (mapping elements to non-zero multiplicities) into an {@link IMemoryView}. |
19 | * | 19 | * |
20 | * @author Gabor Bergmann | 20 | * @author Gabor Bergmann |
21 | * @since 2.0 | 21 | * @since 2.0 |
22 | */ | 22 | */ |
@@ -72,20 +72,20 @@ public class MapBackedMemoryView<T> implements IMemoryView<T> { | |||
72 | public Set<T> distinctValues() { | 72 | public Set<T> distinctValues() { |
73 | return wrapped.keySet(); | 73 | return wrapped.keySet(); |
74 | } | 74 | } |
75 | 75 | ||
76 | 76 | ||
77 | @Override | 77 | @Override |
78 | public void forEachEntryWithMultiplicities(BiConsumer<T, Integer> entryConsumer) { | 78 | public void forEachEntryWithMultiplicities(BiConsumer<T, Integer> entryConsumer) { |
79 | for (Entry<T, Integer> entry : wrapped.entrySet()) { | 79 | for (Entry<T, Integer> entry : wrapped.entrySet()) { |
80 | entryConsumer.accept(entry.getKey(), entry.getValue()); | 80 | entryConsumer.accept(entry.getKey(), entry.getValue()); |
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
84 | @Override | 84 | @Override |
85 | public Iterable<Entry<T, Integer>> entriesWithMultiplicities() { | 85 | public Iterable<Entry<T, Integer>> entriesWithMultiplicities() { |
86 | return wrapped.entrySet(); | 86 | return wrapped.entrySet(); |
87 | } | 87 | } |
88 | 88 | ||
89 | @Override | 89 | @Override |
90 | public int hashCode() { | 90 | public int hashCode() { |
91 | return IMemoryView.hashCode(this); | 91 | return IMemoryView.hashCode(this); |
@@ -94,7 +94,7 @@ public class MapBackedMemoryView<T> implements IMemoryView<T> { | |||
94 | public boolean equals(Object obj) { | 94 | public boolean equals(Object obj) { |
95 | return IMemoryView.equals(this, obj); | 95 | return IMemoryView.equals(this, obj); |
96 | } | 96 | } |
97 | 97 | ||
98 | @Override | 98 | @Override |
99 | public String toString() { | 99 | public String toString() { |
100 | return wrapped.toString(); | 100 | return wrapped.toString(); |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/MarkedMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/MarkedMemory.java index d22dcbe7..5c76c28b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/MarkedMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/MarkedMemory.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * Internal marker type, must only be instantiated inside implementors of IMultiLookupImpl | 12 | * Internal marker type, must only be instantiated inside implementors of IMultiLookupImpl |
@@ -14,8 +14,8 @@ package tools.refinery.viatra.runtime.matchers.util; | |||
14 | * @since 2.0 | 14 | * @since 2.0 |
15 | */ | 15 | */ |
16 | public interface MarkedMemory<Value> extends IMemory<Value> { | 16 | public interface MarkedMemory<Value> extends IMemory<Value> { |
17 | 17 | ||
18 | static interface MarkedSet<Value> extends MarkedMemory<Value> {} | 18 | static interface MarkedSet<Value> extends MarkedMemory<Value> {} |
19 | static interface MarkedMultiset<Value> extends MarkedMemory<Value> {} | 19 | static interface MarkedMultiset<Value> extends MarkedMemory<Value> {} |
20 | static interface MarkedDeltaBag<Value> extends MarkedMemory<Value> {} | 20 | static interface MarkedDeltaBag<Value> extends MarkedMemory<Value> {} |
21 | } \ No newline at end of file | 21 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/MemoryViewBackedMapView.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/MemoryViewBackedMapView.java index 49711a89..ba36d630 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/MemoryViewBackedMapView.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/MemoryViewBackedMapView.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Collection; | 12 | import java.util.Collection; |
@@ -16,19 +16,19 @@ import java.util.Set; | |||
16 | 16 | ||
17 | /** | 17 | /** |
18 | * A partial and read-only Map implementation, mapping elements to multiplicities backed by an {@link IMemoryView}. | 18 | * A partial and read-only Map implementation, mapping elements to multiplicities backed by an {@link IMemoryView}. |
19 | * | 19 | * |
20 | * <p> Not implemented: write methods. | 20 | * <p> Not implemented: write methods. |
21 | * | 21 | * |
22 | * <p> Inefficiently implemented: {@link #containsValue(Object)}, {@link #values()}, {@link #entrySet()}. | 22 | * <p> Inefficiently implemented: {@link #containsValue(Object)}, {@link #values()}, {@link #entrySet()}. |
23 | * | 23 | * |
24 | * @author Gabor Bergmann | 24 | * @author Gabor Bergmann |
25 | * @since 2.0 | 25 | * @since 2.0 |
26 | */ | 26 | */ |
27 | public class MemoryViewBackedMapView<T> implements Map<T, Integer> { | 27 | public class MemoryViewBackedMapView<T> implements Map<T, Integer> { |
28 | 28 | ||
29 | private static final String READ_ONLY = "Read only"; | 29 | private static final String READ_ONLY = "Read only"; |
30 | private final IMemoryView<T> wrapped; | 30 | private final IMemoryView<T> wrapped; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * @param wrapped a memory view whose contents are to be exposed as an element-to-integer map. | 33 | * @param wrapped a memory view whose contents are to be exposed as an element-to-integer map. |
34 | */ | 34 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Preconditions.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Preconditions.java index e9e5e3a0..484ec07b 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Preconditions.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Preconditions.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.function.Supplier; | 11 | import java.util.function.Supplier; |
12 | 12 | ||
@@ -14,7 +14,7 @@ import java.util.function.Supplier; | |||
14 | * This class was motivated by the similar Preconditions class from Guava to provide simple precondition checking | 14 | * This class was motivated by the similar Preconditions class from Guava to provide simple precondition checking |
15 | * functionality. However, as starting with version 2.0 the runtime of VIATRA Query should not depend on Guava, the | 15 | * functionality. However, as starting with version 2.0 the runtime of VIATRA Query should not depend on Guava, the |
16 | * relevant functionality of the Preconditions checking functionality will be implemented here. | 16 | * relevant functionality of the Preconditions checking functionality will be implemented here. |
17 | * | 17 | * |
18 | * @author Zoltan Ujhelyi | 18 | * @author Zoltan Ujhelyi |
19 | * @since 2.0 | 19 | * @since 2.0 |
20 | * | 20 | * |
@@ -37,7 +37,7 @@ public final class Preconditions { | |||
37 | throw new IllegalArgumentException(); | 37 | throw new IllegalArgumentException(); |
38 | } | 38 | } |
39 | } | 39 | } |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * Ensures the truth of an expression involving one or more parameters to the calling method. | 42 | * Ensures the truth of an expression involving one or more parameters to the calling method. |
43 | * | 43 | * |
@@ -75,7 +75,7 @@ public final class Preconditions { | |||
75 | throw new IllegalArgumentException(String.format(errorMessageTemplate, errorMessageArgs)); | 75 | throw new IllegalArgumentException(String.format(errorMessageTemplate, errorMessageArgs)); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Ensures the truth of an expression involving one or more parameters to the calling method. | 80 | * Ensures the truth of an expression involving one or more parameters to the calling method. |
81 | * | 81 | * |
@@ -90,7 +90,7 @@ public final class Preconditions { | |||
90 | throw new IllegalArgumentException(messageSupplier.get()); | 90 | throw new IllegalArgumentException(messageSupplier.get()); |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * Ensures the truth of an expression involving one or more fields of a class. | 95 | * Ensures the truth of an expression involving one or more fields of a class. |
96 | * | 96 | * |
@@ -104,7 +104,7 @@ public final class Preconditions { | |||
104 | throw new IllegalStateException(); | 104 | throw new IllegalStateException(); |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Ensures the truth of an expression involving one or more fields of a class. | 109 | * Ensures the truth of an expression involving one or more fields of a class. |
110 | * | 110 | * |
@@ -142,7 +142,7 @@ public final class Preconditions { | |||
142 | throw new IllegalStateException(String.format(errorMessageTemplate, errorMessageArgs)); | 142 | throw new IllegalStateException(String.format(errorMessageTemplate, errorMessageArgs)); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | /** | 146 | /** |
147 | * Ensures the truth of an expression involving one or more fields of a class. | 147 | * Ensures the truth of an expression involving one or more fields of a class. |
148 | * | 148 | * |
@@ -157,10 +157,10 @@ public final class Preconditions { | |||
157 | throw new IllegalStateException(messageSupplier.get()); | 157 | throw new IllegalStateException(messageSupplier.get()); |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | /** | 161 | /** |
162 | * Ensures that an index is appropriate for a list or array of given size. | 162 | * Ensures that an index is appropriate for a list or array of given size. |
163 | * | 163 | * |
164 | * @param index | 164 | * @param index |
165 | * @param size | 165 | * @param size |
166 | * @throws IndexOutOfBoundsException | 166 | * @throws IndexOutOfBoundsException |
@@ -171,10 +171,10 @@ public final class Preconditions { | |||
171 | throw new IndexOutOfBoundsException(); | 171 | throw new IndexOutOfBoundsException(); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | /** | 175 | /** |
176 | * Ensures that an index is appropriate for a list or array of given size. | 176 | * Ensures that an index is appropriate for a list or array of given size. |
177 | * | 177 | * |
178 | * @param index | 178 | * @param index |
179 | * @param size | 179 | * @param size |
180 | * @param errorMessageTemplate | 180 | * @param errorMessageTemplate |
@@ -190,10 +190,10 @@ public final class Preconditions { | |||
190 | throw new IndexOutOfBoundsException(String.format(errorMessageTemplate, errorMessageArgs)); | 190 | throw new IndexOutOfBoundsException(String.format(errorMessageTemplate, errorMessageArgs)); |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | /** | 194 | /** |
195 | * Ensures that an index is appropriate for a list or array of given size. | 195 | * Ensures that an index is appropriate for a list or array of given size. |
196 | * | 196 | * |
197 | * @param index | 197 | * @param index |
198 | * @param size | 198 | * @param size |
199 | * @param messageSupplier a supplier that is called to calculate the error message if necessary | 199 | * @param messageSupplier a supplier that is called to calculate the error message if necessary |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/PurgableCache.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/PurgableCache.java index c4e6b5af..af969ba4 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/PurgableCache.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/PurgableCache.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.HashMap; | 11 | import java.util.HashMap; |
12 | import java.util.Map; | 12 | import java.util.Map; |
@@ -20,7 +20,7 @@ import java.util.function.Supplier; | |||
20 | public class PurgableCache implements ICache { | 20 | public class PurgableCache implements ICache { |
21 | 21 | ||
22 | Map<Object, Object> storage = new HashMap<>(); | 22 | Map<Object, Object> storage = new HashMap<>(); |
23 | 23 | ||
24 | @Override | 24 | @Override |
25 | @SuppressWarnings("unchecked") | 25 | @SuppressWarnings("unchecked") |
26 | public <T> T getValue(Object key, Class<? extends T> clazz, Supplier<T> valueProvider) { | 26 | public <T> T getValue(Object key, Class<? extends T> clazz, Supplier<T> valueProvider) { |
@@ -34,7 +34,7 @@ public class PurgableCache implements ICache { | |||
34 | return value; | 34 | return value; |
35 | } | 35 | } |
36 | } | 36 | } |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * Removes all values stored in the cache | 39 | * Removes all values stored in the cache |
40 | */ | 40 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Sets.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Sets.java index 3749fe06..6647b657 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Sets.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Sets.java | |||
@@ -3,13 +3,13 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | * | 8 | * |
9 | * Contributors: | 9 | * Contributors: |
10 | * Gabor Bergmann - initial API and implementation | 10 | * Gabor Bergmann - initial API and implementation |
11 | *******************************************************************************/ | 11 | *******************************************************************************/ |
12 | package tools.refinery.viatra.runtime.matchers.util; | 12 | package tools.refinery.interpreter.matchers.util; |
13 | 13 | ||
14 | import java.util.ArrayList; | 14 | import java.util.ArrayList; |
15 | import java.util.List; | 15 | import java.util.List; |
@@ -19,19 +19,19 @@ import java.util.stream.Stream; | |||
19 | 19 | ||
20 | /** | 20 | /** |
21 | * This class was motivated by the similar Sets class from Guava to provide simple set manipulation | 21 | * This class was motivated by the similar Sets class from Guava to provide simple set manipulation |
22 | * functionality. However, as starting with version 2.3 the runtime of VIATRA Query should not depend on Guava, | 22 | * functionality. However, as starting with version 2.3 the runtime of VIATRA Query should not depend on Guava, |
23 | * not even internally, the relevant subset of Sets methods will be reimplemented here. | 23 | * not even internally, the relevant subset of Sets methods will be reimplemented here. |
24 | * | 24 | * |
25 | * <p> The current approach is to delegate to Eclipse Collections wherever possible. | 25 | * <p> The current approach is to delegate to Eclipse Collections wherever possible. |
26 | * Such glue methods are useful so that downstream clients can avoid directly depending on Eclipse Collections. | 26 | * Such glue methods are useful so that downstream clients can avoid directly depending on Eclipse Collections. |
27 | * | 27 | * |
28 | * <p> Without an equivalent from Eclipse Collections, {@link #cartesianProduct(List)} is implemented here from scratch. | 28 | * <p> Without an equivalent from Eclipse Collections, {@link #cartesianProduct(List)} is implemented here from scratch. |
29 | * | 29 | * |
30 | * @author Gabor Bergmann | 30 | * @author Gabor Bergmann |
31 | * @since 2.3 | 31 | * @since 2.3 |
32 | */ | 32 | */ |
33 | public final class Sets { | 33 | public final class Sets { |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * @since 2.4 | 36 | * @since 2.4 |
37 | */ | 37 | */ |
@@ -50,13 +50,13 @@ public final class Sets { | |||
50 | public static <A> Set<A> union(Set<A> left, Set<A> right) { | 50 | public static <A> Set<A> union(Set<A> left, Set<A> right) { |
51 | return org.eclipse.collections.impl.factory.Sets.union(left, right); | 51 | return org.eclipse.collections.impl.factory.Sets.union(left, right); |
52 | } | 52 | } |
53 | 53 | ||
54 | public static <A> Set<? extends Set<A>> powerSet(Set<A> set) { | 54 | public static <A> Set<? extends Set<A>> powerSet(Set<A> set) { |
55 | return org.eclipse.collections.impl.factory.Sets.powerSet(set); | 55 | return org.eclipse.collections.impl.factory.Sets.powerSet(set); |
56 | } | 56 | } |
57 | 57 | ||
58 | public static <A> Set<List<A>> cartesianProduct(List<? extends Set<? extends A>> setsList) { | 58 | public static <A> Set<List<A>> cartesianProduct(List<? extends Set<? extends A>> setsList) { |
59 | 59 | ||
60 | class Suffix { // simple immutable linked list | 60 | class Suffix { // simple immutable linked list |
61 | private A head; | 61 | private A head; |
62 | private Suffix next; | 62 | private Suffix next; |
@@ -74,17 +74,17 @@ public final class Sets { | |||
74 | return result; | 74 | return result; |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | // build result lists from end to start, in the form of suffixes | 78 | // build result lists from end to start, in the form of suffixes |
79 | Stream<Suffix> suffixes = Stream.of((Suffix) null /* empty suffix*/); | 79 | Stream<Suffix> suffixes = Stream.of((Suffix) null /* empty suffix*/); |
80 | for (int i = setsList.size()-1; i>=0; --i) { // iterate sets in reverse order | 80 | for (int i = setsList.size()-1; i>=0; --i) { // iterate sets in reverse order |
81 | Set<? extends A> set = setsList.get(i); | 81 | Set<? extends A> set = setsList.get(i); |
82 | suffixes = suffixes.flatMap(suffix -> set.stream().map(newElement -> new Suffix(newElement, suffix))); | 82 | suffixes = suffixes.flatMap(suffix -> set.stream().map(newElement -> new Suffix(newElement, suffix))); |
83 | } | 83 | } |
84 | 84 | ||
85 | 85 | ||
86 | return suffixes.map(Suffix::toList).collect(Collectors.toSet()); | 86 | return suffixes.map(Suffix::toList).collect(Collectors.toSet()); |
87 | } | 87 | } |
88 | 88 | ||
89 | 89 | ||
90 | } | 90 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Signed.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Signed.java index 8f8bc228..47808dfd 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/Signed.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/Signed.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.Objects; | 11 | import java.util.Objects; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * A piece of data associated with a direction. | 14 | * A piece of data associated with a direction. |
15 | * | 15 | * |
16 | * @author Tamas Szabo | 16 | * @author Tamas Szabo |
17 | * @since 2.4 | 17 | * @since 2.4 |
18 | */ | 18 | */ |
@@ -57,4 +57,4 @@ public class Signed<Payload extends Comparable<Payload>> { | |||
57 | return this.direction.asSign() + this.payload.toString(); | 57 | return this.direction.asSign() + this.payload.toString(); |
58 | } | 58 | } |
59 | 59 | ||
60 | } \ No newline at end of file | 60 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/SingletonInstanceProvider.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/SingletonInstanceProvider.java index cc5963f7..6074adce 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/SingletonInstanceProvider.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/SingletonInstanceProvider.java | |||
@@ -3,13 +3,13 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * A provider implementation that always returns the same object instance. | 12 | * A provider implementation that always returns the same object instance. |
13 | * @author Zoltan Ujhelyi | 13 | * @author Zoltan Ujhelyi |
14 | */ | 14 | */ |
15 | public class SingletonInstanceProvider<T> implements IProvider<T>{ | 15 | public class SingletonInstanceProvider<T> implements IProvider<T>{ |
@@ -20,10 +20,10 @@ public class SingletonInstanceProvider<T> implements IProvider<T>{ | |||
20 | Preconditions.checkArgument(instance != null, "Instance parameter must not be null."); | 20 | Preconditions.checkArgument(instance != null, "Instance parameter must not be null."); |
21 | this.instance = instance; | 21 | this.instance = instance; |
22 | } | 22 | } |
23 | 23 | ||
24 | @Override | 24 | @Override |
25 | public T get() { | 25 | public T get() { |
26 | return instance; | 26 | return instance; |
27 | } | 27 | } |
28 | 28 | ||
29 | } \ No newline at end of file | 29 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/SingletonMemoryView.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/SingletonMemoryView.java index b303f9ad..d368f629 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/SingletonMemoryView.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/SingletonMemoryView.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
@@ -31,7 +31,7 @@ public final class SingletonMemoryView<Value> implements IMemoryView<Value> { | |||
31 | public Iterator<Value> iterator() { | 31 | public Iterator<Value> iterator() { |
32 | return new Iterator<Value>() { | 32 | return new Iterator<Value>() { |
33 | boolean hasNext = true; | 33 | boolean hasNext = true; |
34 | 34 | ||
35 | @Override | 35 | @Override |
36 | public boolean hasNext() { | 36 | public boolean hasNext() { |
37 | return hasNext; | 37 | return hasNext; |
@@ -81,7 +81,7 @@ public final class SingletonMemoryView<Value> implements IMemoryView<Value> { | |||
81 | public Set<Value> distinctValues() { | 81 | public Set<Value> distinctValues() { |
82 | return Collections.singleton(wrapped); | 82 | return Collections.singleton(wrapped); |
83 | } | 83 | } |
84 | 84 | ||
85 | @Override | 85 | @Override |
86 | public boolean equals(Object obj) { | 86 | public boolean equals(Object obj) { |
87 | if (obj instanceof IMemoryView<?>) { | 87 | if (obj instanceof IMemoryView<?>) { |
@@ -92,7 +92,7 @@ public final class SingletonMemoryView<Value> implements IMemoryView<Value> { | |||
92 | } | 92 | } |
93 | return false; | 93 | return false; |
94 | } | 94 | } |
95 | 95 | ||
96 | @Override | 96 | @Override |
97 | public int hashCode() { | 97 | public int hashCode() { |
98 | return wrapped.hashCode() ^ ONE_HASH; | 98 | return wrapped.hashCode() ^ ONE_HASH; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/TimelyMemory.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/TimelyMemory.java index 90fcad4d..4aebfa7a 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/TimelyMemory.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/TimelyMemory.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util; | 9 | package tools.refinery.interpreter.matchers.util; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | import java.util.Map; | 12 | import java.util.Map; |
@@ -15,18 +15,18 @@ import java.util.NavigableMap; | |||
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | import java.util.TreeMap; | 16 | import java.util.TreeMap; |
17 | 17 | ||
18 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 18 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
19 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 19 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
20 | import tools.refinery.viatra.runtime.matchers.util.resumable.Resumable; | 20 | import tools.refinery.interpreter.matchers.util.resumable.Resumable; |
21 | import tools.refinery.viatra.runtime.matchers.util.resumable.UnmaskedResumable; | 21 | import tools.refinery.interpreter.matchers.util.resumable.UnmaskedResumable; |
22 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 22 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
23 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timeline; | 23 | import tools.refinery.interpreter.matchers.util.timeline.Timeline; |
24 | import tools.refinery.viatra.runtime.matchers.util.timeline.Timelines; | 24 | import tools.refinery.interpreter.matchers.util.timeline.Timelines; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * A timely memory implementation that incrementally maintains the {@link Timeline}s of tuples. The memory is capable of | 27 | * A timely memory implementation that incrementally maintains the {@link Timeline}s of tuples. The memory is capable of |
28 | * lazy folding (see {@link Resumable}). | 28 | * lazy folding (see {@link Resumable}). |
29 | * | 29 | * |
30 | * @author Tamas Szabo | 30 | * @author Tamas Szabo |
31 | * @since 2.3 | 31 | * @since 2.3 |
32 | */ | 32 | */ |
@@ -192,7 +192,7 @@ public class TimelyMemory<Timestamp extends Comparable<Timestamp>> implements Cl | |||
192 | /** | 192 | /** |
193 | * Utility method that computes the timeline diffs in case of lazy memories. The diffs will be inserted into the | 193 | * Utility method that computes the timeline diffs in case of lazy memories. The diffs will be inserted into the |
194 | * input parameter. This method computes diffs for entire plateaus that spans from timestamp to nextTimestamp. | 194 | * input parameter. This method computes diffs for entire plateaus that spans from timestamp to nextTimestamp. |
195 | * | 195 | * |
196 | * Compared to the eager version of this method, the lazy version makes use of both the old and the new cumulative | 196 | * Compared to the eager version of this method, the lazy version makes use of both the old and the new cumulative |
197 | * values because it can happen that the cumulative is incremented by a value that is larger than 1 (as folding | 197 | * values because it can happen that the cumulative is incremented by a value that is larger than 1 (as folding |
198 | * states are merged together). This means that we cant decide whether the cumulative became positive by comparing | 198 | * states are merged together). This means that we cant decide whether the cumulative became positive by comparing |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/resumable/MaskedResumable.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/resumable/MaskedResumable.java index ea70e61d..f7d48536 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/resumable/MaskedResumable.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/resumable/MaskedResumable.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util.resumable; | 9 | package tools.refinery.interpreter.matchers.util.resumable; |
10 | 10 | ||
11 | import java.util.Map; | 11 | import java.util.Map; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 13 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
14 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 14 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * A masked {@link Resumable} implementation, which maintains lazy folding per tuple signature. | 17 | * A masked {@link Resumable} implementation, which maintains lazy folding per tuple signature. |
18 | * | 18 | * |
19 | * @author Tamas Szabo | 19 | * @author Tamas Szabo |
20 | * @since 2.4 | 20 | * @since 2.4 |
21 | */ | 21 | */ |
@@ -27,9 +27,9 @@ public interface MaskedResumable<Timestamp extends Comparable<Timestamp>> extend | |||
27 | * folding to do towards higher timestamps. | 27 | * folding to do towards higher timestamps. |
28 | */ | 28 | */ |
29 | public Map<Tuple, Map<Tuple, Diff<Timestamp>>> resumeAt(final Timestamp timestamp); | 29 | public Map<Tuple, Map<Tuple, Diff<Timestamp>>> resumeAt(final Timestamp timestamp); |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Returns the set of signatures for which lazy folding shall be resumed at the next timestamp. | 32 | * Returns the set of signatures for which lazy folding shall be resumed at the next timestamp. |
33 | */ | 33 | */ |
34 | public Iterable<Tuple> getResumableSignatures(); | 34 | public Iterable<Tuple> getResumableSignatures(); |
35 | 35 | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/resumable/Resumable.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/resumable/Resumable.java index 2861df20..f3d70834 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/resumable/Resumable.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/resumable/Resumable.java | |||
@@ -3,16 +3,16 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util.resumable; | 9 | package tools.refinery.interpreter.matchers.util.resumable; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * A resumable lazily folds its state towards higher timestamps. Folding shall be done in the increasing order of | 12 | * A resumable lazily folds its state towards higher timestamps. Folding shall be done in the increasing order of |
13 | * timestamps, and it shall be interrupted after each step. The resumable can then be instructed to resume the folding, | 13 | * timestamps, and it shall be interrupted after each step. The resumable can then be instructed to resume the folding, |
14 | * one step at a time. | 14 | * one step at a time. |
15 | * | 15 | * |
16 | * @author Tamas Szabo | 16 | * @author Tamas Szabo |
17 | * @since 2.4 | 17 | * @since 2.4 |
18 | */ | 18 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/resumable/UnmaskedResumable.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/resumable/UnmaskedResumable.java index 1671940b..ff97fe77 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/resumable/UnmaskedResumable.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/resumable/UnmaskedResumable.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util.resumable; | 9 | package tools.refinery.interpreter.matchers.util.resumable; |
10 | 10 | ||
11 | import java.util.Map; | 11 | import java.util.Map; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 13 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
14 | import tools.refinery.viatra.runtime.matchers.util.timeline.Diff; | 14 | import tools.refinery.interpreter.matchers.util.timeline.Diff; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * A unmasked {@link Resumable} implementation, which maintains lazy folding without caring about tuple signatures. | 17 | * A unmasked {@link Resumable} implementation, which maintains lazy folding without caring about tuple signatures. |
18 | * | 18 | * |
19 | * @author Tamas Szabo | 19 | * @author Tamas Szabo |
20 | * @since 2.4 | 20 | * @since 2.4 |
21 | */ | 21 | */ |
@@ -29,8 +29,8 @@ public interface UnmaskedResumable<Timestamp extends Comparable<Timestamp>> exte | |||
29 | public Map<Tuple, Diff<Timestamp>> resumeAt(final Timestamp timestamp); | 29 | public Map<Tuple, Diff<Timestamp>> resumeAt(final Timestamp timestamp); |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Returns the set of tuples for which lazy folding shall be resumed at the next timestamp. | 32 | * Returns the set of tuples for which lazy folding shall be resumed at the next timestamp. |
33 | */ | 33 | */ |
34 | public Iterable<Tuple> getResumableTuples(); | 34 | public Iterable<Tuple> getResumableTuples(); |
35 | 35 | ||
36 | } | 36 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/CompactTimeline.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/CompactTimeline.java index 0532d094..6406c387 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/CompactTimeline.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/CompactTimeline.java | |||
@@ -3,22 +3,22 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util.timeline; | 9 | package tools.refinery.interpreter.matchers.util.timeline; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
13 | import java.util.List; | 13 | import java.util.List; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 15 | import tools.refinery.interpreter.matchers.util.Direction; |
16 | import tools.refinery.viatra.runtime.matchers.util.Signed; | 16 | import tools.refinery.interpreter.matchers.util.Signed; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * A compact timeline may cosist of an arbitrary amount of moments. | 19 | * A compact timeline may cosist of an arbitrary amount of moments. |
20 | * It is backed by an {@link ArrayList}. | 20 | * It is backed by an {@link ArrayList}. |
21 | * | 21 | * |
22 | * @author Tamas Szabo | 22 | * @author Tamas Szabo |
23 | * @since 2.4 | 23 | * @since 2.4 |
24 | */ | 24 | */ |
@@ -29,12 +29,12 @@ public class CompactTimeline<Timestamp extends Comparable<Timestamp>> extends Ti | |||
29 | CompactTimeline() { | 29 | CompactTimeline() { |
30 | this.elements = new ArrayList<>(); | 30 | this.elements = new ArrayList<>(); |
31 | } | 31 | } |
32 | 32 | ||
33 | CompactTimeline(final Timestamp timestamp) { | 33 | CompactTimeline(final Timestamp timestamp) { |
34 | this(); | 34 | this(); |
35 | this.elements.add(timestamp); | 35 | this.elements.add(timestamp); |
36 | } | 36 | } |
37 | 37 | ||
38 | CompactTimeline(final List<Timestamp> timestamps) { | 38 | CompactTimeline(final List<Timestamp> timestamps) { |
39 | this.elements = new ArrayList<>(timestamps.size()); | 39 | this.elements = new ArrayList<>(timestamps.size()); |
40 | this.elements.addAll(timestamps); | 40 | this.elements.addAll(timestamps); |
@@ -52,7 +52,7 @@ public class CompactTimeline<Timestamp extends Comparable<Timestamp>> extends Ti | |||
52 | expected = expected.opposite(); | 52 | expected = expected.opposite(); |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | @Override | 56 | @Override |
57 | public Signed<Timestamp> getSigned(final int index) { | 57 | public Signed<Timestamp> getSigned(final int index) { |
58 | final Direction direction = index % 2 == 0 ? Direction.INSERT : Direction.DELETE; | 58 | final Direction direction = index % 2 == 0 ? Direction.INSERT : Direction.DELETE; |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/Diff.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/Diff.java index cec6049e..e70629f9 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/Diff.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/Diff.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util.timeline; | 9 | package tools.refinery.interpreter.matchers.util.timeline; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.util.Signed; | 13 | import tools.refinery.interpreter.matchers.util.Signed; |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * The description of a delta that specifies how a {@link Timeline} changes. It consists of {@link Signed} timestamps that | 16 | * The description of a delta that specifies how a {@link Timeline} changes. It consists of {@link Signed} timestamps that |
17 | * depict the moments of insertions and deletions on the timeline. | 17 | * depict the moments of insertions and deletions on the timeline. |
18 | * | 18 | * |
19 | * @author Tamas Szabo | 19 | * @author Tamas Szabo |
20 | * @since 2.4 | 20 | * @since 2.4 |
21 | * @param <Timestamp> | 21 | * @param <Timestamp> |
@@ -52,4 +52,4 @@ public class Diff<Timestamp extends Comparable<Timestamp>> extends ArrayList<Sig | |||
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
55 | } \ No newline at end of file | 55 | } |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/SingletonTimeline.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/SingletonTimeline.java index 526a95f5..4a08d22e 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/SingletonTimeline.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/SingletonTimeline.java | |||
@@ -3,20 +3,20 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util.timeline; | 9 | package tools.refinery.interpreter.matchers.util.timeline; |
10 | 10 | ||
11 | import java.util.Collections; | 11 | import java.util.Collections; |
12 | 12 | ||
13 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 13 | import tools.refinery.interpreter.matchers.util.Direction; |
14 | import tools.refinery.viatra.runtime.matchers.util.Signed; | 14 | import tools.refinery.interpreter.matchers.util.Signed; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * A timeline which solely consists of one timestamp value, representing a single insertion. Intuitively, a singleton | 17 | * A timeline which solely consists of one timestamp value, representing a single insertion. Intuitively, a singleton |
18 | * timeline always represents a bump which starts at the given timestamp and lasts till plus infinity. | 18 | * timeline always represents a bump which starts at the given timestamp and lasts till plus infinity. |
19 | * | 19 | * |
20 | * @author Tamas Szabo | 20 | * @author Tamas Szabo |
21 | * @since 2.4 | 21 | * @since 2.4 |
22 | */ | 22 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/Timeline.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/Timeline.java index 9214536c..264a7dc8 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/Timeline.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/Timeline.java | |||
@@ -3,23 +3,23 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util.timeline; | 9 | package tools.refinery.interpreter.matchers.util.timeline; |
10 | 10 | ||
11 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
12 | import java.util.Iterator; | 12 | import java.util.Iterator; |
13 | import java.util.List; | 13 | import java.util.List; |
14 | 14 | ||
15 | import tools.refinery.viatra.runtime.matchers.util.Direction; | 15 | import tools.refinery.interpreter.matchers.util.Direction; |
16 | import tools.refinery.viatra.runtime.matchers.util.Signed; | 16 | import tools.refinery.interpreter.matchers.util.Signed; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * A timeline describes the life cycle of a piece of data (typically a tuple in a relation) as a sequence of moments. | 19 | * A timeline describes the life cycle of a piece of data (typically a tuple in a relation) as a sequence of moments. |
20 | * Even moments represent appearances, odd moments represent disappearances. A timeline is immutable, once created, it | 20 | * Even moments represent appearances, odd moments represent disappearances. A timeline is immutable, once created, it |
21 | * is not possible to extend it with further moments. | 21 | * is not possible to extend it with further moments. |
22 | * | 22 | * |
23 | * @author Tamas Szabo | 23 | * @author Tamas Szabo |
24 | * @since 2.4 | 24 | * @since 2.4 |
25 | */ | 25 | */ |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/Timelines.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/Timelines.java index 747fda15..ea37f4a9 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/util/timeline/Timelines.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/matchers/util/timeline/Timelines.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * This program and the accompanying materials are made available under the | 3 | * This program and the accompanying materials are made available under the |
4 | * terms of the Eclipse Public License v. 2.0 which is available at | 4 | * terms of the Eclipse Public License v. 2.0 which is available at |
5 | * http://www.eclipse.org/legal/epl-v20.html. | 5 | * http://www.eclipse.org/legal/epl-v20.html. |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.matchers.util.timeline; | 9 | package tools.refinery.interpreter.matchers.util.timeline; |
10 | 10 | ||
11 | import java.util.List; | 11 | import java.util.List; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * Utility class for creating {@link Timeline}s. | 14 | * Utility class for creating {@link Timeline}s. |
15 | * @author Tamas Szabo | 15 | * @author Tamas Szabo |
16 | * @since 2.4 | 16 | * @since 2.4 |
17 | */ | 17 | */ |
@@ -20,7 +20,7 @@ public final class Timelines<Timestamp extends Comparable<Timestamp>> { | |||
20 | public static <Timestamp extends Comparable<Timestamp>> Timeline<Timestamp> createEmpty() { | 20 | public static <Timestamp extends Comparable<Timestamp>> Timeline<Timestamp> createEmpty() { |
21 | return new CompactTimeline<Timestamp>(); | 21 | return new CompactTimeline<Timestamp>(); |
22 | } | 22 | } |
23 | 23 | ||
24 | public static <Timestamp extends Comparable<Timestamp>> Timeline<Timestamp> createFrom( | 24 | public static <Timestamp extends Comparable<Timestamp>> Timeline<Timestamp> createFrom( |
25 | final Diff<Timestamp> diffs) { | 25 | final Diff<Timestamp> diffs) { |
26 | if (diffs.size() == 1) { | 26 | if (diffs.size() == 1) { |
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/util/ViatraQueryLoggingUtil.java b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/util/InterpreterLoggingUtil.java index 229801f8..5bcfa892 100644 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/util/ViatraQueryLoggingUtil.java +++ b/subprojects/interpreter/src/main/java/tools/refinery/interpreter/util/InterpreterLoggingUtil.java | |||
@@ -6,39 +6,29 @@ | |||
6 | * | 6 | * |
7 | * SPDX-License-Identifier: EPL-2.0 | 7 | * SPDX-License-Identifier: EPL-2.0 |
8 | *******************************************************************************/ | 8 | *******************************************************************************/ |
9 | package tools.refinery.viatra.runtime.util; | 9 | package tools.refinery.interpreter.util; |
10 | 10 | ||
11 | import org.apache.log4j.Logger; | 11 | import org.apache.log4j.Logger; |
12 | import tools.refinery.viatra.runtime.matchers.util.Preconditions; | ||
13 | 12 | ||
14 | /** | 13 | /** |
15 | * Centralized logger of the VIATRA Query runtime. | 14 | * Centralized logger of the Refinery Interpreter runtime. |
16 | * @author Bergmann Gabor | 15 | * @author Bergmann Gabor |
17 | * | 16 | * |
18 | */ | 17 | */ |
19 | public class ViatraQueryLoggingUtil { | 18 | public class InterpreterLoggingUtil { |
20 | 19 | ||
21 | private ViatraQueryLoggingUtil() {/*Utility class constructor*/} | 20 | private InterpreterLoggingUtil() {/*Utility class constructor*/} |
22 | 21 | ||
23 | private static Logger externalLogger; | 22 | /* |
24 | 23 | * | |
25 | public static void setExternalLogger(Logger externalLogger) { | ||
26 | Preconditions.checkArgument(externalLogger != null, "Must not set up null logger"); | ||
27 | ViatraQueryLoggingUtil.externalLogger = externalLogger; | ||
28 | } | ||
29 | /** | ||
30 | * Provides a static default logger. | 24 | * Provides a static default logger. |
31 | */ | 25 | */ |
32 | public static Logger getDefaultLogger() { | 26 | public static Logger getDefaultLogger() { |
33 | if (defaultRuntimeLogger == null) { | 27 | if (defaultRuntimeLogger == null) { |
34 | Logger parentLogger = externalLogger; | 28 | defaultRuntimeLogger = Logger.getLogger("tools.refinery.interpreter"); |
35 | if (parentLogger == null) { | ||
36 | defaultRuntimeLogger = Logger.getLogger("org.eclipse.viatra"); | ||
37 | } else { | ||
38 | defaultRuntimeLogger = Logger.getLogger(parentLogger.getName() + ".runtime"); | ||
39 | } | ||
40 | if (defaultRuntimeLogger == null) | 29 | if (defaultRuntimeLogger == null) |
41 | throw new AssertionError("Configuration error: unable to create default VIATRA Query runtime logger."); | 30 | throw new AssertionError( |
31 | "Configuration error: unable to create default Refinery Interpreter runtime logger."); | ||
42 | } | 32 | } |
43 | 33 | ||
44 | return defaultRuntimeLogger; | 34 | return defaultRuntimeLogger; |
@@ -51,7 +41,7 @@ public class ViatraQueryLoggingUtil { | |||
51 | } | 41 | } |
52 | 42 | ||
53 | /** | 43 | /** |
54 | * Provides a class-specific logger that also stores the global logger settings of the VIATRA Query runtime | 44 | * Provides a class-specific logger that also stores the global logger settings of the Refinery Interpreter runtime |
55 | * @param clazz | 45 | * @param clazz |
56 | */ | 46 | */ |
57 | public static Logger getLogger(Class<?> clazz) { | 47 | public static Logger getLogger(Class<?> clazz) { |
@@ -59,7 +49,7 @@ public class ViatraQueryLoggingUtil { | |||
59 | } | 49 | } |
60 | 50 | ||
61 | /** | 51 | /** |
62 | * Provides a named logger that also stores the global logger settings of the VIATRA Query runtime | 52 | * Provides a named logger that also stores the global logger settings of the Refinery Interpreter runtime |
63 | * @param clazz | 53 | * @param clazz |
64 | * @param name a non-empty name to append to the class names | 54 | * @param name a non-empty name to append to the class names |
65 | * @since 2.5 | 55 | * @since 2.5 |
diff --git a/subprojects/language-semantics/build.gradle.kts b/subprojects/language-semantics/build.gradle.kts index 338ae345..689f621e 100644 --- a/subprojects/language-semantics/build.gradle.kts +++ b/subprojects/language-semantics/build.gradle.kts | |||
@@ -17,6 +17,6 @@ dependencies { | |||
17 | implementation(project(":refinery-store-reasoning-scope")) | 17 | implementation(project(":refinery-store-reasoning-scope")) |
18 | runtimeOnly(libs.eclipseCollections) | 18 | runtimeOnly(libs.eclipseCollections) |
19 | testImplementation(project(":refinery-store-dse-visualization")) | 19 | testImplementation(project(":refinery-store-dse-visualization")) |
20 | testImplementation(project(":refinery-store-query-viatra")) | 20 | testImplementation(project(":refinery-store-query-interpreter")) |
21 | testImplementation(testFixtures(project(":refinery-language"))) | 21 | testImplementation(testFixtures(project(":refinery-language"))) |
22 | } | 22 | } |
diff --git a/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/model/CountPropagationTest.java b/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/model/CountPropagationTest.java index eee2c4ae..6beae93a 100644 --- a/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/model/CountPropagationTest.java +++ b/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/model/CountPropagationTest.java | |||
@@ -10,7 +10,7 @@ import tools.refinery.store.dse.propagation.PropagationAdapter; | |||
10 | import tools.refinery.store.dse.propagation.PropagationResult; | 10 | import tools.refinery.store.dse.propagation.PropagationResult; |
11 | import tools.refinery.store.dse.transition.DesignSpaceExplorationAdapter; | 11 | import tools.refinery.store.dse.transition.DesignSpaceExplorationAdapter; |
12 | import tools.refinery.store.model.ModelStore; | 12 | import tools.refinery.store.model.ModelStore; |
13 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 13 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
14 | import tools.refinery.store.reasoning.ReasoningAdapter; | 14 | import tools.refinery.store.reasoning.ReasoningAdapter; |
15 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; | 15 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; |
16 | import tools.refinery.store.reasoning.representation.PartialRelation; | 16 | import tools.refinery.store.reasoning.representation.PartialRelation; |
@@ -40,7 +40,7 @@ class CountPropagationTest { | |||
40 | .build(); | 40 | .build(); |
41 | 41 | ||
42 | var store = ModelStore.builder() | 42 | var store = ModelStore.builder() |
43 | .with(ViatraModelQueryAdapter.builder()) | 43 | .with(QueryInterpreterAdapter.builder()) |
44 | .with(PropagationAdapter.builder()) | 44 | .with(PropagationAdapter.builder()) |
45 | .with(DesignSpaceExplorationAdapter.builder()) | 45 | .with(DesignSpaceExplorationAdapter.builder()) |
46 | .with(ReasoningAdapter.builder()) | 46 | .with(ReasoningAdapter.builder()) |
diff --git a/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/model/ModelGenerationTest.java b/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/model/ModelGenerationTest.java index d756099c..c8a79c37 100644 --- a/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/model/ModelGenerationTest.java +++ b/subprojects/language-semantics/src/test/java/tools/refinery/language/semantics/model/ModelGenerationTest.java | |||
@@ -18,7 +18,7 @@ import tools.refinery.store.dse.propagation.PropagationAdapter; | |||
18 | import tools.refinery.store.dse.strategy.BestFirstStoreManager; | 18 | import tools.refinery.store.dse.strategy.BestFirstStoreManager; |
19 | import tools.refinery.store.dse.transition.DesignSpaceExplorationAdapter; | 19 | import tools.refinery.store.dse.transition.DesignSpaceExplorationAdapter; |
20 | import tools.refinery.store.model.ModelStore; | 20 | import tools.refinery.store.model.ModelStore; |
21 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 21 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
22 | import tools.refinery.store.reasoning.ReasoningAdapter; | 22 | import tools.refinery.store.reasoning.ReasoningAdapter; |
23 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; | 23 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; |
24 | import tools.refinery.store.reasoning.literal.Concreteness; | 24 | import tools.refinery.store.reasoning.literal.Concreteness; |
@@ -81,7 +81,7 @@ class ModelGenerationTest { | |||
81 | var problem = parsedProblem.problem(); | 81 | var problem = parsedProblem.problem(); |
82 | 82 | ||
83 | var storeBuilder = ModelStore.builder() | 83 | var storeBuilder = ModelStore.builder() |
84 | .with(ViatraModelQueryAdapter.builder()) | 84 | .with(QueryInterpreterAdapter.builder()) |
85 | .with(ModelVisualizerAdapter.builder() | 85 | .with(ModelVisualizerAdapter.builder() |
86 | .withOutputPath("test_output") | 86 | .withOutputPath("test_output") |
87 | .withFormat(FileFormat.DOT) | 87 | .withFormat(FileFormat.DOT) |
@@ -215,7 +215,7 @@ class ModelGenerationTest { | |||
215 | var problem = parsedProblem.problem(); | 215 | var problem = parsedProblem.problem(); |
216 | 216 | ||
217 | var storeBuilder = ModelStore.builder() | 217 | var storeBuilder = ModelStore.builder() |
218 | .with(ViatraModelQueryAdapter.builder()) | 218 | .with(QueryInterpreterAdapter.builder()) |
219 | // .with(ModelVisualizerAdapter.builder() | 219 | // .with(ModelVisualizerAdapter.builder() |
220 | // .withOutputPath("test_output") | 220 | // .withOutputPath("test_output") |
221 | // .withFormat(FileFormat.DOT) | 221 | // .withFormat(FileFormat.DOT) |
@@ -282,7 +282,7 @@ class ModelGenerationTest { | |||
282 | var problem = parsedProblem.problem(); | 282 | var problem = parsedProblem.problem(); |
283 | 283 | ||
284 | var storeBuilder = ModelStore.builder() | 284 | var storeBuilder = ModelStore.builder() |
285 | .with(ViatraModelQueryAdapter.builder()) | 285 | .with(QueryInterpreterAdapter.builder()) |
286 | // .with(ModelVisualizerAdapter.builder() | 286 | // .with(ModelVisualizerAdapter.builder() |
287 | // .withOutputPath("test_output") | 287 | // .withOutputPath("test_output") |
288 | // .withFormat(FileFormat.DOT) | 288 | // .withFormat(FileFormat.DOT) |
diff --git a/subprojects/language-web/build.gradle.kts b/subprojects/language-web/build.gradle.kts index 88dccdf3..2370794d 100644 --- a/subprojects/language-web/build.gradle.kts +++ b/subprojects/language-web/build.gradle.kts | |||
@@ -18,7 +18,7 @@ dependencies { | |||
18 | implementation(project(":refinery-language")) | 18 | implementation(project(":refinery-language")) |
19 | implementation(project(":refinery-language-ide")) | 19 | implementation(project(":refinery-language-ide")) |
20 | implementation(project(":refinery-language-semantics")) | 20 | implementation(project(":refinery-language-semantics")) |
21 | implementation(project(":refinery-store-query-viatra")) | 21 | implementation(project(":refinery-store-query-interpreter")) |
22 | implementation(project(":refinery-store-reasoning-scope")) | 22 | implementation(project(":refinery-store-reasoning-scope")) |
23 | implementation(libs.gson) | 23 | implementation(libs.gson) |
24 | implementation(libs.jetty.server) | 24 | implementation(libs.jetty.server) |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/generator/ModelGenerationWorker.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/generator/ModelGenerationWorker.java index 9ee74207..1fce10a4 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/generator/ModelGenerationWorker.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/generator/ModelGenerationWorker.java | |||
@@ -27,7 +27,7 @@ import tools.refinery.store.dse.propagation.PropagationAdapter; | |||
27 | import tools.refinery.store.dse.strategy.BestFirstStoreManager; | 27 | import tools.refinery.store.dse.strategy.BestFirstStoreManager; |
28 | import tools.refinery.store.dse.transition.DesignSpaceExplorationAdapter; | 28 | import tools.refinery.store.dse.transition.DesignSpaceExplorationAdapter; |
29 | import tools.refinery.store.model.ModelStore; | 29 | import tools.refinery.store.model.ModelStore; |
30 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 30 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
31 | import tools.refinery.store.reasoning.ReasoningAdapter; | 31 | import tools.refinery.store.reasoning.ReasoningAdapter; |
32 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; | 32 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; |
33 | import tools.refinery.store.reasoning.literal.Concreteness; | 33 | import tools.refinery.store.reasoning.literal.Concreteness; |
@@ -177,7 +177,7 @@ public class ModelGenerationWorker implements Runnable { | |||
177 | cancellationToken.checkCancelled(); | 177 | cancellationToken.checkCancelled(); |
178 | var storeBuilder = ModelStore.builder() | 178 | var storeBuilder = ModelStore.builder() |
179 | .cancellationToken(cancellationToken) | 179 | .cancellationToken(cancellationToken) |
180 | .with(ViatraModelQueryAdapter.builder()) | 180 | .with(QueryInterpreterAdapter.builder()) |
181 | .with(PropagationAdapter.builder()) | 181 | .with(PropagationAdapter.builder()) |
182 | .with(StateCoderAdapter.builder()) | 182 | .with(StateCoderAdapter.builder()) |
183 | .with(DesignSpaceExplorationAdapter.builder()) | 183 | .with(DesignSpaceExplorationAdapter.builder()) |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/semantics/SemanticsWorker.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/semantics/SemanticsWorker.java index 512c2778..fb89bea6 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/semantics/SemanticsWorker.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/semantics/SemanticsWorker.java | |||
@@ -21,7 +21,7 @@ import tools.refinery.language.semantics.model.ModelInitializer; | |||
21 | import tools.refinery.language.semantics.model.TracedException; | 21 | import tools.refinery.language.semantics.model.TracedException; |
22 | import tools.refinery.store.dse.propagation.PropagationAdapter; | 22 | import tools.refinery.store.dse.propagation.PropagationAdapter; |
23 | import tools.refinery.store.model.ModelStore; | 23 | import tools.refinery.store.model.ModelStore; |
24 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 24 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
25 | import tools.refinery.store.reasoning.ReasoningAdapter; | 25 | import tools.refinery.store.reasoning.ReasoningAdapter; |
26 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; | 26 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; |
27 | import tools.refinery.store.reasoning.literal.Concreteness; | 27 | import tools.refinery.store.reasoning.literal.Concreteness; |
@@ -66,7 +66,7 @@ class SemanticsWorker implements Callable<SemanticsResult> { | |||
66 | public SemanticsResult call() { | 66 | public SemanticsResult call() { |
67 | var builder = ModelStore.builder() | 67 | var builder = ModelStore.builder() |
68 | .cancellationToken(cancellationToken) | 68 | .cancellationToken(cancellationToken) |
69 | .with(ViatraModelQueryAdapter.builder()) | 69 | .with(QueryInterpreterAdapter.builder()) |
70 | .with(PropagationAdapter.builder()) | 70 | .with(PropagationAdapter.builder()) |
71 | .with(ReasoningAdapter.builder() | 71 | .with(ReasoningAdapter.builder() |
72 | .requiredInterpretations(Concreteness.PARTIAL)); | 72 | .requiredInterpretations(Concreteness.PARTIAL)); |
diff --git a/subprojects/store-dse/build.gradle.kts b/subprojects/store-dse/build.gradle.kts index 5517e189..041adf70 100644 --- a/subprojects/store-dse/build.gradle.kts +++ b/subprojects/store-dse/build.gradle.kts | |||
@@ -13,5 +13,5 @@ dependencies { | |||
13 | implementation(project(":refinery-store-dse-visualization")) | 13 | implementation(project(":refinery-store-dse-visualization")) |
14 | implementation(libs.eclipseCollections.api) | 14 | implementation(libs.eclipseCollections.api) |
15 | runtimeOnly(libs.eclipseCollections) | 15 | runtimeOnly(libs.eclipseCollections) |
16 | testImplementation(project(":refinery-store-query-viatra")) | 16 | testImplementation(project(":refinery-store-query-interpreter")) |
17 | } | 17 | } |
diff --git a/subprojects/store-dse/src/test/java/tools/refinery/store/dse/CRAExamplesTest.java b/subprojects/store-dse/src/test/java/tools/refinery/store/dse/CRAExamplesTest.java index 63da6cc3..fa0b3c73 100644 --- a/subprojects/store-dse/src/test/java/tools/refinery/store/dse/CRAExamplesTest.java +++ b/subprojects/store-dse/src/test/java/tools/refinery/store/dse/CRAExamplesTest.java | |||
@@ -21,7 +21,7 @@ import tools.refinery.store.query.ModelQueryAdapter; | |||
21 | import tools.refinery.store.query.dnf.Query; | 21 | import tools.refinery.store.query.dnf.Query; |
22 | import tools.refinery.store.query.dnf.RelationalQuery; | 22 | import tools.refinery.store.query.dnf.RelationalQuery; |
23 | import tools.refinery.store.query.term.Variable; | 23 | import tools.refinery.store.query.term.Variable; |
24 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 24 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
25 | import tools.refinery.store.query.view.AnySymbolView; | 25 | import tools.refinery.store.query.view.AnySymbolView; |
26 | import tools.refinery.store.query.view.KeyOnlyView; | 26 | import tools.refinery.store.query.view.KeyOnlyView; |
27 | import tools.refinery.store.representation.Symbol; | 27 | import tools.refinery.store.representation.Symbol; |
@@ -115,7 +115,7 @@ class CRAExamplesTest { | |||
115 | void craTest() { | 115 | void craTest() { |
116 | var store = ModelStore.builder() | 116 | var store = ModelStore.builder() |
117 | .symbols(classElement, encapsulates, attribute, method, dataDependency, functionalDependency, name) | 117 | .symbols(classElement, encapsulates, attribute, method, dataDependency, functionalDependency, name) |
118 | .with(ViatraModelQueryAdapter.builder()) | 118 | .with(QueryInterpreterAdapter.builder()) |
119 | .with(ModelVisualizerAdapter.builder() | 119 | .with(ModelVisualizerAdapter.builder() |
120 | .withOutputPath("test_output") | 120 | .withOutputPath("test_output") |
121 | .withFormat(FileFormat.DOT) | 121 | .withFormat(FileFormat.DOT) |
diff --git a/subprojects/store-dse/src/test/java/tools/refinery/store/dse/DebugTest.java b/subprojects/store-dse/src/test/java/tools/refinery/store/dse/DebugTest.java index b912eba3..caead7be 100644 --- a/subprojects/store-dse/src/test/java/tools/refinery/store/dse/DebugTest.java +++ b/subprojects/store-dse/src/test/java/tools/refinery/store/dse/DebugTest.java | |||
@@ -15,7 +15,7 @@ import tools.refinery.store.dse.transition.DesignSpaceExplorationAdapter; | |||
15 | import tools.refinery.store.dse.transition.Rule; | 15 | import tools.refinery.store.dse.transition.Rule; |
16 | import tools.refinery.store.model.ModelStore; | 16 | import tools.refinery.store.model.ModelStore; |
17 | import tools.refinery.store.query.ModelQueryAdapter; | 17 | import tools.refinery.store.query.ModelQueryAdapter; |
18 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 18 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
19 | import tools.refinery.store.query.view.AnySymbolView; | 19 | import tools.refinery.store.query.view.AnySymbolView; |
20 | import tools.refinery.store.query.view.KeyOnlyView; | 20 | import tools.refinery.store.query.view.KeyOnlyView; |
21 | import tools.refinery.store.representation.Symbol; | 21 | import tools.refinery.store.representation.Symbol; |
@@ -62,7 +62,7 @@ class DebugTest { | |||
62 | 62 | ||
63 | var store = ModelStore.builder() | 63 | var store = ModelStore.builder() |
64 | .symbols(classModel, classElement, feature, classes, features) | 64 | .symbols(classModel, classElement, feature, classes, features) |
65 | .with(ViatraModelQueryAdapter.builder()) | 65 | .with(QueryInterpreterAdapter.builder()) |
66 | .with(ModelVisualizerAdapter.builder() | 66 | .with(ModelVisualizerAdapter.builder() |
67 | .withOutputPath("test_output") | 67 | .withOutputPath("test_output") |
68 | .withFormat(FileFormat.DOT) | 68 | .withFormat(FileFormat.DOT) |
diff --git a/subprojects/store-dse/src/test/java/tools/refinery/store/dse/transition/TransitionTests.java b/subprojects/store-dse/src/test/java/tools/refinery/store/dse/transition/TransitionTests.java index 42a0f89b..a79547ec 100644 --- a/subprojects/store-dse/src/test/java/tools/refinery/store/dse/transition/TransitionTests.java +++ b/subprojects/store-dse/src/test/java/tools/refinery/store/dse/transition/TransitionTests.java | |||
@@ -17,7 +17,7 @@ import tools.refinery.store.query.dnf.Query; | |||
17 | import tools.refinery.store.query.dnf.RelationalQuery; | 17 | import tools.refinery.store.query.dnf.RelationalQuery; |
18 | import tools.refinery.store.query.term.Variable; | 18 | import tools.refinery.store.query.term.Variable; |
19 | import tools.refinery.store.query.term.int_.IntTerms; | 19 | import tools.refinery.store.query.term.int_.IntTerms; |
20 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 20 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
21 | import tools.refinery.store.query.view.AnySymbolView; | 21 | import tools.refinery.store.query.view.AnySymbolView; |
22 | import tools.refinery.store.query.view.KeyOnlyView; | 22 | import tools.refinery.store.query.view.KeyOnlyView; |
23 | import tools.refinery.store.representation.Symbol; | 23 | import tools.refinery.store.representation.Symbol; |
@@ -135,7 +135,7 @@ class TransitionBuildTests { | |||
135 | private Model getModel() { | 135 | private Model getModel() { |
136 | var store = ModelStore.builder() | 136 | var store = ModelStore.builder() |
137 | .symbols(person, friend) | 137 | .symbols(person, friend) |
138 | .with(ViatraModelQueryAdapter.builder()) | 138 | .with(QueryInterpreterAdapter.builder()) |
139 | .with(StateCoderAdapter.builder()) | 139 | .with(StateCoderAdapter.builder()) |
140 | .with(ModificationAdapter.builder()) | 140 | .with(ModificationAdapter.builder()) |
141 | .with(DesignSpaceExplorationAdapter.builder() | 141 | .with(DesignSpaceExplorationAdapter.builder() |
diff --git a/subprojects/store-query-interpreter/NOTICE.md b/subprojects/store-query-interpreter/NOTICE.md new file mode 100644 index 00000000..94c1d803 --- /dev/null +++ b/subprojects/store-query-interpreter/NOTICE.md | |||
@@ -0,0 +1,94 @@ | |||
1 | <!-- | ||
2 | Copyright (c) 2018-2019, Zoltan Ujhelyi, IncQuery Labs Ltd. | ||
3 | Copyright (c) 2023 The Refinery Authors <https://refinery.tools/> | ||
4 | |||
5 | SPDX-License-Identifier: EPL-2.0 | ||
6 | --> | ||
7 | |||
8 | This module contains source code from the [Eclipse VIATRA™ project](https://projects.eclipse.org/projects/modeling.viatra), which is available under the terms of the [Eclipse Public License v 2.0](http://www.eclipse.org/legal/epl-v20.html). | ||
9 | |||
10 | Eclipse®, VIATRA™ and ‘Eclipse VIATRA™’ are trademarks of Eclipse Foundation, Inc. | ||
11 | |||
12 | To comply with the [Eclipse Foundation Trademark Usage Policy](https://www.eclipse.org/legal/logo_guidelines.php), we replaced the Eclipse VIATRA™ branding in this repository with the name _Refinery Interpreter_, since the [Eclipse Public License - v 2.0](https://www.eclipse.org/legal/epl-2.0/) does not grant trademark usage rights to derived projects. | ||
13 | _Refinery Interpreter_ is not endorsed or sponsored by Eclipse Foundation, Inc. or any other organizations using the Eclipse VIATRA™ trademark. | ||
14 | |||
15 | We publish our modifications to Eclipse VIATRA™ for use within the Refinery framework under the name _Refinery Interpreter_. When not using _Refinery Interpreter_ directly in the Refinery framework, users are strongly encouraged to rely on [Eclipse VIATRA™](https://eclipse.dev/viatra/) instead. In particular, _Refinery Interpreter_ does not provide any API stability guarantees that are provided by Eclipse VIATRA™. | ||
16 | |||
17 | We reproduce the [accompanying notices of Eclipse VIATRA™](https://github.com/viatra/org.eclipse.viatra/blob/d422bcc626a99c4640c0d13931f393ccea0d2326/NOTICE.md) in full below: | ||
18 | |||
19 | # Notices for Eclipse VIATRA™ | ||
20 | |||
21 | This content is produced and maintained by the Eclipse VIATRA project. | ||
22 | |||
23 | * Project home: https://projects.eclipse.org/projects/modeling.viatra | ||
24 | |||
25 | ## Trademarks | ||
26 | |||
27 | Eclipse VIATRA, and VIATRA are trademarks of the Eclipse Foundation. | ||
28 | |||
29 | ## Copyright | ||
30 | |||
31 | All content is the property of the respective authors or their employers. For | ||
32 | more information regarding authorship of content, please consult the listed | ||
33 | source code repository logs. | ||
34 | |||
35 | ## Declared Project Licenses | ||
36 | |||
37 | This program and the accompanying materials are made available under the terms | ||
38 | of the Eclipse Public License v. 2.0 which is available at | ||
39 | http://www.eclipse.org/legal/epl-v20.html. | ||
40 | |||
41 | SPDX-License-Identifier: EPL-2.0 | ||
42 | |||
43 | ## Source Code | ||
44 | |||
45 | The project maintains the following source code repositories: | ||
46 | |||
47 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra.git | ||
48 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra.modelobfuscator.git | ||
49 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra.examples.git | ||
50 | * http://git.eclipse.org/c/viatra/org.eclipse.viatra2.vpm.git | ||
51 | |||
52 | ## Third-party Content | ||
53 | |||
54 | This project leverages the following third party content. | ||
55 | |||
56 | ANTLR Runtime only: (3.2) | ||
57 | |||
58 | * License: New BSD license | ||
59 | |||
60 | Apache Commons Language Library (2.1) | ||
61 | |||
62 | * License: Apache License, 2.0 | ||
63 | |||
64 | Google Guice / Inject Core API (3.0.0) | ||
65 | |||
66 | * License: Apache License, 2.0 | ||
67 | |||
68 | Google Guice / Inject Core API (3.0.0) | ||
69 | |||
70 | * License: Apache License 2.0 | ||
71 | |||
72 | Guava (10.0.1) | ||
73 | |||
74 | * License: Apache License, 2.0 | ||
75 | |||
76 | Guice (2.0) | ||
77 | |||
78 | * License: Apache License, 2.0 | ||
79 | |||
80 | guice-multibindings (3.0.0) | ||
81 | |||
82 | * License: Apache License, 2.0 | ||
83 | |||
84 | log4j (1.2.15) | ||
85 | |||
86 | * License: Apache License 2.0 | ||
87 | |||
88 | LPG Java Runtime (lpgjavaruntime.jar) (1.1) | ||
89 | |||
90 | * License: Eclipse Public License | ||
91 | |||
92 | mockito (1.9.5) | ||
93 | |||
94 | * License: Apache License, 2.0, New BSD license, MIT license | ||
diff --git a/subprojects/store-query-interpreter/build.gradle.kts b/subprojects/store-query-interpreter/build.gradle.kts new file mode 100644 index 00000000..d463fac9 --- /dev/null +++ b/subprojects/store-query-interpreter/build.gradle.kts | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | plugins { | ||
8 | id("tools.refinery.gradle.java-library") | ||
9 | } | ||
10 | |||
11 | dependencies { | ||
12 | api(project(":refinery-interpreter")) | ||
13 | api(project(":refinery-interpreter-localsearch")) | ||
14 | api(project(":refinery-interpreter-rete")) | ||
15 | api(project(":refinery-interpreter-rete-recipes")) | ||
16 | api(project(":refinery-store-query")) | ||
17 | implementation(libs.ecore) | ||
18 | implementation(libs.slf4j.log4j) | ||
19 | } | ||
20 | |||
21 | tasks { | ||
22 | withType(Jar::class) { | ||
23 | // Make sure we include external project notices. | ||
24 | from(layout.projectDirectory.file("NOTICE.md")) | ||
25 | } | ||
26 | } | ||
diff --git a/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/QueryInterpreterAdapter.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/QueryInterpreterAdapter.java new file mode 100644 index 00000000..83e69ae8 --- /dev/null +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/QueryInterpreterAdapter.java | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | package tools.refinery.store.query.interpreter; | ||
7 | |||
8 | import tools.refinery.store.query.ModelQueryAdapter; | ||
9 | import tools.refinery.store.query.interpreter.internal.QueryInterpreterBuilderImpl; | ||
10 | |||
11 | public interface QueryInterpreterAdapter extends ModelQueryAdapter { | ||
12 | @Override | ||
13 | QueryInterpreterStoreAdapter getStoreAdapter(); | ||
14 | |||
15 | static QueryInterpreterBuilder builder() { | ||
16 | return new QueryInterpreterBuilderImpl(); | ||
17 | } | ||
18 | } | ||
diff --git a/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/QueryInterpreterBuilder.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/QueryInterpreterBuilder.java new file mode 100644 index 00000000..6e167d0d --- /dev/null +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/QueryInterpreterBuilder.java | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | package tools.refinery.store.query.interpreter; | ||
7 | |||
8 | import tools.refinery.store.model.ModelStore; | ||
9 | import tools.refinery.store.query.ModelQueryBuilder; | ||
10 | import tools.refinery.store.query.dnf.AnyQuery; | ||
11 | import tools.refinery.store.query.dnf.Dnf; | ||
12 | import tools.refinery.store.query.rewriter.DnfRewriter; | ||
13 | import tools.refinery.interpreter.api.InterpreterEngineOptions; | ||
14 | import tools.refinery.interpreter.matchers.backend.IQueryBackendFactory; | ||
15 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; | ||
16 | |||
17 | import java.util.Collection; | ||
18 | import java.util.function.Function; | ||
19 | |||
20 | @SuppressWarnings("UnusedReturnValue") | ||
21 | public interface QueryInterpreterBuilder extends ModelQueryBuilder { | ||
22 | QueryInterpreterBuilder engineOptions(InterpreterEngineOptions engineOptions); | ||
23 | |||
24 | QueryInterpreterBuilder defaultHint(QueryEvaluationHint queryEvaluationHint); | ||
25 | |||
26 | QueryInterpreterBuilder backend(IQueryBackendFactory queryBackendFactory); | ||
27 | |||
28 | QueryInterpreterBuilder cachingBackend(IQueryBackendFactory queryBackendFactory); | ||
29 | |||
30 | QueryInterpreterBuilder searchBackend(IQueryBackendFactory queryBackendFactory); | ||
31 | |||
32 | @Override | ||
33 | default QueryInterpreterBuilder queries(AnyQuery... queries) { | ||
34 | ModelQueryBuilder.super.queries(queries); | ||
35 | return this; | ||
36 | } | ||
37 | |||
38 | @Override | ||
39 | default QueryInterpreterBuilder queries(Collection<? extends AnyQuery> queries) { | ||
40 | ModelQueryBuilder.super.queries(queries); | ||
41 | return this; | ||
42 | } | ||
43 | |||
44 | @Override | ||
45 | QueryInterpreterBuilder query(AnyQuery query); | ||
46 | |||
47 | @Override | ||
48 | QueryInterpreterBuilder rewriter(DnfRewriter rewriter); | ||
49 | |||
50 | QueryInterpreterBuilder computeHint(Function<Dnf, QueryEvaluationHint> computeHint); | ||
51 | |||
52 | @Override | ||
53 | QueryInterpreterStoreAdapter build(ModelStore store); | ||
54 | } | ||
diff --git a/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/QueryInterpreterStoreAdapter.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/QueryInterpreterStoreAdapter.java new file mode 100644 index 00000000..9c55ecc2 --- /dev/null +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/QueryInterpreterStoreAdapter.java | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | package tools.refinery.store.query.interpreter; | ||
7 | |||
8 | import tools.refinery.interpreter.api.InterpreterEngineOptions; | ||
9 | import tools.refinery.store.model.Model; | ||
10 | import tools.refinery.store.query.ModelQueryStoreAdapter; | ||
11 | |||
12 | public interface QueryInterpreterStoreAdapter extends ModelQueryStoreAdapter { | ||
13 | InterpreterEngineOptions getEngineOptions(); | ||
14 | |||
15 | @Override | ||
16 | QueryInterpreterAdapter createModelAdapter(Model model); | ||
17 | } | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryAdapterImpl.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/QueryInterpreterAdapterImpl.java index ad754988..ee527fd3 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryAdapterImpl.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/QueryInterpreterAdapterImpl.java | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal; | 6 | package tools.refinery.store.query.interpreter.internal; |
7 | 7 | ||
8 | import tools.refinery.store.model.Model; | 8 | import tools.refinery.store.model.Model; |
9 | import tools.refinery.store.model.ModelListener; | 9 | import tools.refinery.store.model.ModelListener; |
@@ -14,31 +14,31 @@ import tools.refinery.store.query.dnf.RelationalQuery; | |||
14 | import tools.refinery.store.query.resultset.AnyResultSet; | 14 | import tools.refinery.store.query.resultset.AnyResultSet; |
15 | import tools.refinery.store.query.resultset.EmptyResultSet; | 15 | import tools.refinery.store.query.resultset.EmptyResultSet; |
16 | import tools.refinery.store.query.resultset.ResultSet; | 16 | import tools.refinery.store.query.resultset.ResultSet; |
17 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 17 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
18 | import tools.refinery.store.query.viatra.internal.matcher.FunctionalViatraMatcher; | 18 | import tools.refinery.store.query.interpreter.internal.matcher.InterpretedFunctionalMatcher; |
19 | import tools.refinery.store.query.viatra.internal.matcher.RawPatternMatcher; | 19 | import tools.refinery.store.query.interpreter.internal.matcher.RawPatternMatcher; |
20 | import tools.refinery.store.query.viatra.internal.matcher.RelationalViatraMatcher; | 20 | import tools.refinery.store.query.interpreter.internal.matcher.InterpretedRelationalMatcher; |
21 | import tools.refinery.viatra.runtime.CancellationToken; | 21 | import tools.refinery.interpreter.CancellationToken; |
22 | import tools.refinery.viatra.runtime.api.AdvancedViatraQueryEngine; | 22 | import tools.refinery.interpreter.api.AdvancedInterpreterEngine; |
23 | import tools.refinery.viatra.runtime.api.GenericQueryGroup; | 23 | import tools.refinery.interpreter.api.GenericQueryGroup; |
24 | import tools.refinery.viatra.runtime.api.IQuerySpecification; | 24 | import tools.refinery.interpreter.api.IQuerySpecification; |
25 | 25 | ||
26 | import java.util.Collections; | 26 | import java.util.Collections; |
27 | import java.util.LinkedHashMap; | 27 | import java.util.LinkedHashMap; |
28 | import java.util.Map; | 28 | import java.util.Map; |
29 | 29 | ||
30 | public class ViatraModelQueryAdapterImpl implements ViatraModelQueryAdapter, ModelListener { | 30 | public class QueryInterpreterAdapterImpl implements QueryInterpreterAdapter, ModelListener { |
31 | private final Model model; | 31 | private final Model model; |
32 | private final ViatraModelQueryStoreAdapterImpl storeAdapter; | 32 | private final QueryInterpreterStoreAdapterImpl storeAdapter; |
33 | private final AdvancedViatraQueryEngine queryEngine; | 33 | private final AdvancedInterpreterEngine queryEngine; |
34 | private final Map<AnyQuery, AnyResultSet> resultSets; | 34 | private final Map<AnyQuery, AnyResultSet> resultSets; |
35 | private boolean pendingChanges; | 35 | private boolean pendingChanges; |
36 | 36 | ||
37 | ViatraModelQueryAdapterImpl(Model model, ViatraModelQueryStoreAdapterImpl storeAdapter) { | 37 | QueryInterpreterAdapterImpl(Model model, QueryInterpreterStoreAdapterImpl storeAdapter) { |
38 | this.model = model; | 38 | this.model = model; |
39 | this.storeAdapter = storeAdapter; | 39 | this.storeAdapter = storeAdapter; |
40 | var scope = new RelationalScope(this); | 40 | var scope = new RelationalScope(this); |
41 | queryEngine = AdvancedViatraQueryEngine.createUnmanagedEngine(scope, | 41 | queryEngine = AdvancedInterpreterEngine.createUnmanagedEngine(scope, |
42 | storeAdapter.getEngineOptions()); | 42 | storeAdapter.getEngineOptions()); |
43 | 43 | ||
44 | var querySpecifications = storeAdapter.getQuerySpecifications(); | 44 | var querySpecifications = storeAdapter.getQuerySpecifications(); |
@@ -63,10 +63,10 @@ public class ViatraModelQueryAdapterImpl implements ViatraModelQueryAdapter, Mod | |||
63 | private <T> ResultSet<T> createResultSet(Query<T> query, RawPatternMatcher matcher) { | 63 | private <T> ResultSet<T> createResultSet(Query<T> query, RawPatternMatcher matcher) { |
64 | if (query instanceof RelationalQuery relationalQuery) { | 64 | if (query instanceof RelationalQuery relationalQuery) { |
65 | @SuppressWarnings("unchecked") | 65 | @SuppressWarnings("unchecked") |
66 | var resultSet = (ResultSet<T>) new RelationalViatraMatcher(this, relationalQuery, matcher); | 66 | var resultSet = (ResultSet<T>) new InterpretedRelationalMatcher(this, relationalQuery, matcher); |
67 | return resultSet; | 67 | return resultSet; |
68 | } else if (query instanceof FunctionalQuery<T> functionalQuery) { | 68 | } else if (query instanceof FunctionalQuery<T> functionalQuery) { |
69 | return new FunctionalViatraMatcher<>(this, functionalQuery, matcher); | 69 | return new InterpretedFunctionalMatcher<>(this, functionalQuery, matcher); |
70 | } else { | 70 | } else { |
71 | throw new IllegalArgumentException("Unknown query: " + query); | 71 | throw new IllegalArgumentException("Unknown query: " + query); |
72 | } | 72 | } |
@@ -78,7 +78,7 @@ public class ViatraModelQueryAdapterImpl implements ViatraModelQueryAdapter, Mod | |||
78 | } | 78 | } |
79 | 79 | ||
80 | @Override | 80 | @Override |
81 | public ViatraModelQueryStoreAdapterImpl getStoreAdapter() { | 81 | public QueryInterpreterStoreAdapterImpl getStoreAdapter() { |
82 | return storeAdapter; | 82 | return storeAdapter; |
83 | } | 83 | } |
84 | 84 | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryBuilderImpl.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/QueryInterpreterBuilderImpl.java index c68152e3..c0d802da 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryBuilderImpl.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/QueryInterpreterBuilderImpl.java | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal; | 6 | package tools.refinery.store.query.interpreter.internal; |
7 | 7 | ||
8 | import tools.refinery.store.adapter.AbstractModelAdapterBuilder; | 8 | import tools.refinery.store.adapter.AbstractModelAdapterBuilder; |
9 | import tools.refinery.store.model.ModelStore; | 9 | import tools.refinery.store.model.ModelStore; |
@@ -13,24 +13,24 @@ import tools.refinery.store.query.rewriter.CompositeRewriter; | |||
13 | import tools.refinery.store.query.rewriter.DnfRewriter; | 13 | import tools.refinery.store.query.rewriter.DnfRewriter; |
14 | import tools.refinery.store.query.rewriter.DuplicateDnfRemover; | 14 | import tools.refinery.store.query.rewriter.DuplicateDnfRemover; |
15 | import tools.refinery.store.query.rewriter.InputParameterResolver; | 15 | import tools.refinery.store.query.rewriter.InputParameterResolver; |
16 | import tools.refinery.store.query.viatra.ViatraModelQueryBuilder; | 16 | import tools.refinery.store.query.interpreter.QueryInterpreterBuilder; |
17 | import tools.refinery.store.query.viatra.internal.localsearch.FlatCostFunction; | 17 | import tools.refinery.store.query.interpreter.internal.localsearch.FlatCostFunction; |
18 | import tools.refinery.store.query.viatra.internal.matcher.RawPatternMatcher; | 18 | import tools.refinery.store.query.interpreter.internal.matcher.RawPatternMatcher; |
19 | import tools.refinery.store.query.viatra.internal.pquery.Dnf2PQuery; | 19 | import tools.refinery.store.query.interpreter.internal.pquery.Dnf2PQuery; |
20 | import tools.refinery.viatra.runtime.api.IQuerySpecification; | 20 | import tools.refinery.interpreter.api.IQuerySpecification; |
21 | import tools.refinery.viatra.runtime.api.ViatraQueryEngineOptions; | 21 | import tools.refinery.interpreter.api.InterpreterEngineOptions; |
22 | import tools.refinery.viatra.runtime.localsearch.matcher.integration.LocalSearchGenericBackendFactory; | 22 | import tools.refinery.interpreter.localsearch.matcher.integration.LocalSearchGenericBackendFactory; |
23 | import tools.refinery.viatra.runtime.localsearch.matcher.integration.LocalSearchHintOptions; | 23 | import tools.refinery.interpreter.localsearch.matcher.integration.LocalSearchHintOptions; |
24 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendFactory; | 24 | import tools.refinery.interpreter.matchers.backend.IQueryBackendFactory; |
25 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 25 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
26 | import tools.refinery.viatra.runtime.rete.matcher.ReteBackendFactory; | 26 | import tools.refinery.interpreter.rete.matcher.ReteBackendFactory; |
27 | 27 | ||
28 | import java.util.*; | 28 | import java.util.*; |
29 | import java.util.function.Function; | 29 | import java.util.function.Function; |
30 | 30 | ||
31 | public class ViatraModelQueryBuilderImpl extends AbstractModelAdapterBuilder<ViatraModelQueryStoreAdapterImpl> | 31 | public class QueryInterpreterBuilderImpl extends AbstractModelAdapterBuilder<QueryInterpreterStoreAdapterImpl> |
32 | implements ViatraModelQueryBuilder { | 32 | implements QueryInterpreterBuilder { |
33 | private ViatraQueryEngineOptions.Builder engineOptionsBuilder; | 33 | private InterpreterEngineOptions.Builder engineOptionsBuilder; |
34 | private QueryEvaluationHint defaultHint = new QueryEvaluationHint(Map.of( | 34 | private QueryEvaluationHint defaultHint = new QueryEvaluationHint(Map.of( |
35 | // Use a cost function that ignores the initial (empty) model but allows higher arity input keys. | 35 | // Use a cost function that ignores the initial (empty) model but allows higher arity input keys. |
36 | LocalSearchHintOptions.PLANNER_COST_FUNCTION, new FlatCostFunction() | 36 | LocalSearchHintOptions.PLANNER_COST_FUNCTION, new FlatCostFunction() |
@@ -39,8 +39,8 @@ public class ViatraModelQueryBuilderImpl extends AbstractModelAdapterBuilder<Via | |||
39 | private final Dnf2PQuery dnf2PQuery = new Dnf2PQuery(); | 39 | private final Dnf2PQuery dnf2PQuery = new Dnf2PQuery(); |
40 | private final Set<AnyQuery> queries = new LinkedHashSet<>(); | 40 | private final Set<AnyQuery> queries = new LinkedHashSet<>(); |
41 | 41 | ||
42 | public ViatraModelQueryBuilderImpl() { | 42 | public QueryInterpreterBuilderImpl() { |
43 | engineOptionsBuilder = new ViatraQueryEngineOptions.Builder() | 43 | engineOptionsBuilder = new InterpreterEngineOptions.Builder() |
44 | .withDefaultBackend(ReteBackendFactory.INSTANCE) | 44 | .withDefaultBackend(ReteBackendFactory.INSTANCE) |
45 | .withDefaultCachingBackend(ReteBackendFactory.INSTANCE) | 45 | .withDefaultCachingBackend(ReteBackendFactory.INSTANCE) |
46 | .withDefaultSearchBackend(LocalSearchGenericBackendFactory.INSTANCE); | 46 | .withDefaultSearchBackend(LocalSearchGenericBackendFactory.INSTANCE); |
@@ -50,69 +50,69 @@ public class ViatraModelQueryBuilderImpl extends AbstractModelAdapterBuilder<Via | |||
50 | } | 50 | } |
51 | 51 | ||
52 | @Override | 52 | @Override |
53 | public ViatraModelQueryBuilder engineOptions(ViatraQueryEngineOptions engineOptions) { | 53 | public QueryInterpreterBuilder engineOptions(InterpreterEngineOptions engineOptions) { |
54 | checkNotConfigured(); | 54 | checkNotConfigured(); |
55 | engineOptionsBuilder = new ViatraQueryEngineOptions.Builder(engineOptions); | 55 | engineOptionsBuilder = new InterpreterEngineOptions.Builder(engineOptions); |
56 | return this; | 56 | return this; |
57 | } | 57 | } |
58 | 58 | ||
59 | @Override | 59 | @Override |
60 | public ViatraModelQueryBuilder defaultHint(QueryEvaluationHint queryEvaluationHint) { | 60 | public QueryInterpreterBuilder defaultHint(QueryEvaluationHint queryEvaluationHint) { |
61 | checkNotConfigured(); | 61 | checkNotConfigured(); |
62 | defaultHint = defaultHint.overrideBy(queryEvaluationHint); | 62 | defaultHint = defaultHint.overrideBy(queryEvaluationHint); |
63 | return this; | 63 | return this; |
64 | } | 64 | } |
65 | 65 | ||
66 | @Override | 66 | @Override |
67 | public ViatraModelQueryBuilder backend(IQueryBackendFactory queryBackendFactory) { | 67 | public QueryInterpreterBuilder backend(IQueryBackendFactory queryBackendFactory) { |
68 | checkNotConfigured(); | 68 | checkNotConfigured(); |
69 | engineOptionsBuilder.withDefaultBackend(queryBackendFactory); | 69 | engineOptionsBuilder.withDefaultBackend(queryBackendFactory); |
70 | return this; | 70 | return this; |
71 | } | 71 | } |
72 | 72 | ||
73 | @Override | 73 | @Override |
74 | public ViatraModelQueryBuilder cachingBackend(IQueryBackendFactory queryBackendFactory) { | 74 | public QueryInterpreterBuilder cachingBackend(IQueryBackendFactory queryBackendFactory) { |
75 | checkNotConfigured(); | 75 | checkNotConfigured(); |
76 | engineOptionsBuilder.withDefaultCachingBackend(queryBackendFactory); | 76 | engineOptionsBuilder.withDefaultCachingBackend(queryBackendFactory); |
77 | return this; | 77 | return this; |
78 | } | 78 | } |
79 | 79 | ||
80 | @Override | 80 | @Override |
81 | public ViatraModelQueryBuilder searchBackend(IQueryBackendFactory queryBackendFactory) { | 81 | public QueryInterpreterBuilder searchBackend(IQueryBackendFactory queryBackendFactory) { |
82 | checkNotConfigured(); | 82 | checkNotConfigured(); |
83 | engineOptionsBuilder.withDefaultSearchBackend(queryBackendFactory); | 83 | engineOptionsBuilder.withDefaultSearchBackend(queryBackendFactory); |
84 | return this; | 84 | return this; |
85 | } | 85 | } |
86 | 86 | ||
87 | @Override | 87 | @Override |
88 | public ViatraModelQueryBuilder queries(Collection<? extends AnyQuery> queries) { | 88 | public QueryInterpreterBuilder queries(Collection<? extends AnyQuery> queries) { |
89 | checkNotConfigured(); | 89 | checkNotConfigured(); |
90 | this.queries.addAll(queries); | 90 | this.queries.addAll(queries); |
91 | return this; | 91 | return this; |
92 | } | 92 | } |
93 | 93 | ||
94 | @Override | 94 | @Override |
95 | public ViatraModelQueryBuilder query(AnyQuery query) { | 95 | public QueryInterpreterBuilder query(AnyQuery query) { |
96 | checkNotConfigured(); | 96 | checkNotConfigured(); |
97 | queries.add(query); | 97 | queries.add(query); |
98 | return this; | 98 | return this; |
99 | } | 99 | } |
100 | 100 | ||
101 | @Override | 101 | @Override |
102 | public ViatraModelQueryBuilder rewriter(DnfRewriter rewriter) { | 102 | public QueryInterpreterBuilder rewriter(DnfRewriter rewriter) { |
103 | this.rewriter.addFirst(rewriter); | 103 | this.rewriter.addFirst(rewriter); |
104 | return this; | 104 | return this; |
105 | } | 105 | } |
106 | 106 | ||
107 | @Override | 107 | @Override |
108 | public ViatraModelQueryBuilder computeHint(Function<Dnf, QueryEvaluationHint> computeHint) { | 108 | public QueryInterpreterBuilder computeHint(Function<Dnf, QueryEvaluationHint> computeHint) { |
109 | checkNotConfigured(); | 109 | checkNotConfigured(); |
110 | dnf2PQuery.setComputeHint(computeHint); | 110 | dnf2PQuery.setComputeHint(computeHint); |
111 | return this; | 111 | return this; |
112 | } | 112 | } |
113 | 113 | ||
114 | @Override | 114 | @Override |
115 | public ViatraModelQueryStoreAdapterImpl doBuild(ModelStore store) { | 115 | public QueryInterpreterStoreAdapterImpl doBuild(ModelStore store) { |
116 | var canonicalQueryMap = new HashMap<AnyQuery, AnyQuery>(); | 116 | var canonicalQueryMap = new HashMap<AnyQuery, AnyQuery>(); |
117 | var querySpecifications = new LinkedHashMap<AnyQuery, IQuerySpecification<RawPatternMatcher>>(); | 117 | var querySpecifications = new LinkedHashMap<AnyQuery, IQuerySpecification<RawPatternMatcher>>(); |
118 | var vacuousQueries = new LinkedHashSet<AnyQuery>(); | 118 | var vacuousQueries = new LinkedHashSet<AnyQuery>(); |
@@ -134,12 +134,12 @@ public class ViatraModelQueryBuilderImpl extends AbstractModelAdapterBuilder<Via | |||
134 | } | 134 | } |
135 | 135 | ||
136 | validateSymbols(store); | 136 | validateSymbols(store); |
137 | return new ViatraModelQueryStoreAdapterImpl(store, buildEngineOptions(), dnf2PQuery.getSymbolViews(), | 137 | return new QueryInterpreterStoreAdapterImpl(store, buildEngineOptions(), dnf2PQuery.getSymbolViews(), |
138 | Collections.unmodifiableMap(canonicalQueryMap), Collections.unmodifiableMap(querySpecifications), | 138 | Collections.unmodifiableMap(canonicalQueryMap), Collections.unmodifiableMap(querySpecifications), |
139 | Collections.unmodifiableSet(vacuousQueries), store::checkCancelled); | 139 | Collections.unmodifiableSet(vacuousQueries), store::checkCancelled); |
140 | } | 140 | } |
141 | 141 | ||
142 | private ViatraQueryEngineOptions buildEngineOptions() { | 142 | private InterpreterEngineOptions buildEngineOptions() { |
143 | // Workaround: manually override the default backend, because {@link ViatraQueryEngineOptions.Builder} | 143 | // Workaround: manually override the default backend, because {@link ViatraQueryEngineOptions.Builder} |
144 | // ignores all backend requirements except {@code SPECIFIC}. | 144 | // ignores all backend requirements except {@code SPECIFIC}. |
145 | switch (defaultHint.getQueryBackendRequirementType()) { | 145 | switch (defaultHint.getQueryBackendRequirementType()) { |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryStoreAdapterImpl.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/QueryInterpreterStoreAdapterImpl.java index f32e1cc6..10e7a402 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/ViatraModelQueryStoreAdapterImpl.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/QueryInterpreterStoreAdapterImpl.java | |||
@@ -3,25 +3,25 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal; | 6 | package tools.refinery.store.query.interpreter.internal; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.CancellationToken; | 8 | import tools.refinery.interpreter.CancellationToken; |
9 | import tools.refinery.viatra.runtime.api.IQuerySpecification; | 9 | import tools.refinery.interpreter.api.IQuerySpecification; |
10 | import tools.refinery.viatra.runtime.api.ViatraQueryEngineOptions; | 10 | import tools.refinery.interpreter.api.InterpreterEngineOptions; |
11 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 11 | import tools.refinery.interpreter.matchers.context.IInputKey; |
12 | import tools.refinery.store.model.Model; | 12 | import tools.refinery.store.model.Model; |
13 | import tools.refinery.store.model.ModelStore; | 13 | import tools.refinery.store.model.ModelStore; |
14 | import tools.refinery.store.query.dnf.AnyQuery; | 14 | import tools.refinery.store.query.dnf.AnyQuery; |
15 | import tools.refinery.store.query.dnf.Query; | 15 | import tools.refinery.store.query.dnf.Query; |
16 | import tools.refinery.store.query.viatra.ViatraModelQueryStoreAdapter; | 16 | import tools.refinery.store.query.interpreter.QueryInterpreterStoreAdapter; |
17 | import tools.refinery.store.query.viatra.internal.matcher.RawPatternMatcher; | 17 | import tools.refinery.store.query.interpreter.internal.matcher.RawPatternMatcher; |
18 | import tools.refinery.store.query.view.AnySymbolView; | 18 | import tools.refinery.store.query.view.AnySymbolView; |
19 | 19 | ||
20 | import java.util.*; | 20 | import java.util.*; |
21 | 21 | ||
22 | public class ViatraModelQueryStoreAdapterImpl implements ViatraModelQueryStoreAdapter { | 22 | public class QueryInterpreterStoreAdapterImpl implements QueryInterpreterStoreAdapter { |
23 | private final ModelStore store; | 23 | private final ModelStore store; |
24 | private final ViatraQueryEngineOptions engineOptions; | 24 | private final InterpreterEngineOptions engineOptions; |
25 | private final Map<AnySymbolView, IInputKey> inputKeys; | 25 | private final Map<AnySymbolView, IInputKey> inputKeys; |
26 | private final Map<AnyQuery, AnyQuery> canonicalQueryMap; | 26 | private final Map<AnyQuery, AnyQuery> canonicalQueryMap; |
27 | private final Map<AnyQuery, IQuerySpecification<RawPatternMatcher>> querySpecifications; | 27 | private final Map<AnyQuery, IQuerySpecification<RawPatternMatcher>> querySpecifications; |
@@ -29,7 +29,7 @@ public class ViatraModelQueryStoreAdapterImpl implements ViatraModelQueryStoreAd | |||
29 | private final Set<AnyQuery> allQueries; | 29 | private final Set<AnyQuery> allQueries; |
30 | private final CancellationToken cancellationToken; | 30 | private final CancellationToken cancellationToken; |
31 | 31 | ||
32 | ViatraModelQueryStoreAdapterImpl(ModelStore store, ViatraQueryEngineOptions engineOptions, | 32 | QueryInterpreterStoreAdapterImpl(ModelStore store, InterpreterEngineOptions engineOptions, |
33 | Map<AnySymbolView, IInputKey> inputKeys, | 33 | Map<AnySymbolView, IInputKey> inputKeys, |
34 | Map<AnyQuery, AnyQuery> canonicalQueryMap, | 34 | Map<AnyQuery, AnyQuery> canonicalQueryMap, |
35 | Map<AnyQuery, IQuerySpecification<RawPatternMatcher>> querySpecifications, | 35 | Map<AnyQuery, IQuerySpecification<RawPatternMatcher>> querySpecifications, |
@@ -89,12 +89,12 @@ public class ViatraModelQueryStoreAdapterImpl implements ViatraModelQueryStoreAd | |||
89 | } | 89 | } |
90 | 90 | ||
91 | @Override | 91 | @Override |
92 | public ViatraQueryEngineOptions getEngineOptions() { | 92 | public InterpreterEngineOptions getEngineOptions() { |
93 | return engineOptions; | 93 | return engineOptions; |
94 | } | 94 | } |
95 | 95 | ||
96 | @Override | 96 | @Override |
97 | public ViatraModelQueryAdapterImpl createModelAdapter(Model model) { | 97 | public QueryInterpreterAdapterImpl createModelAdapter(Model model) { |
98 | return new ViatraModelQueryAdapterImpl(model, this); | 98 | return new QueryInterpreterAdapterImpl(model, this); |
99 | } | 99 | } |
100 | } | 100 | } |
diff --git a/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/RelationalScope.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/RelationalScope.java new file mode 100644 index 00000000..7eef5b85 --- /dev/null +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/RelationalScope.java | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | package tools.refinery.store.query.interpreter.internal; | ||
7 | |||
8 | import org.apache.log4j.Logger; | ||
9 | import tools.refinery.interpreter.api.InterpreterEngine; | ||
10 | import tools.refinery.interpreter.api.scope.IEngineContext; | ||
11 | import tools.refinery.interpreter.api.scope.IIndexingErrorListener; | ||
12 | import tools.refinery.interpreter.api.scope.QueryScope; | ||
13 | import tools.refinery.store.query.interpreter.internal.context.RelationalEngineContext; | ||
14 | |||
15 | public class RelationalScope extends QueryScope { | ||
16 | private final QueryInterpreterAdapterImpl adapter; | ||
17 | |||
18 | public RelationalScope(QueryInterpreterAdapterImpl adapter) { | ||
19 | this.adapter = adapter; | ||
20 | } | ||
21 | |||
22 | @Override | ||
23 | protected IEngineContext createEngineContext(InterpreterEngine engine, IIndexingErrorListener errorListener, | ||
24 | Logger logger) { | ||
25 | return new RelationalEngineContext(adapter); | ||
26 | } | ||
27 | } | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/DummyBaseIndexer.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/context/DummyBaseIndexer.java index 64d98258..e9a05fe9 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/DummyBaseIndexer.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/context/DummyBaseIndexer.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.context; | 6 | package tools.refinery.store.query.interpreter.internal.context; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.api.scope.IBaseIndex; | 8 | import tools.refinery.interpreter.api.scope.IBaseIndex; |
9 | import tools.refinery.viatra.runtime.api.scope.IIndexingErrorListener; | 9 | import tools.refinery.interpreter.api.scope.IIndexingErrorListener; |
10 | import tools.refinery.viatra.runtime.api.scope.IInstanceObserver; | 10 | import tools.refinery.interpreter.api.scope.IInstanceObserver; |
11 | import tools.refinery.viatra.runtime.api.scope.ViatraBaseIndexChangeListener; | 11 | import tools.refinery.interpreter.api.scope.InterpreterBaseIndexChangeListener; |
12 | 12 | ||
13 | import java.lang.reflect.InvocationTargetException; | 13 | import java.lang.reflect.InvocationTargetException; |
14 | import java.util.concurrent.Callable; | 14 | import java.util.concurrent.Callable; |
@@ -30,12 +30,12 @@ public class DummyBaseIndexer implements IBaseIndex { | |||
30 | } | 30 | } |
31 | 31 | ||
32 | @Override | 32 | @Override |
33 | public void addBaseIndexChangeListener(ViatraBaseIndexChangeListener listener) { | 33 | public void addBaseIndexChangeListener(InterpreterBaseIndexChangeListener listener) { |
34 | // no notification support | 34 | // no notification support |
35 | } | 35 | } |
36 | 36 | ||
37 | @Override | 37 | @Override |
38 | public void removeBaseIndexChangeListener(ViatraBaseIndexChangeListener listener) { | 38 | public void removeBaseIndexChangeListener(InterpreterBaseIndexChangeListener listener) { |
39 | // no notification support | 39 | // no notification support |
40 | } | 40 | } |
41 | 41 | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalEngineContext.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/context/RelationalEngineContext.java index f7d323ff..f6e8b605 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalEngineContext.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/context/RelationalEngineContext.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.context; | 6 | package tools.refinery.store.query.interpreter.internal.context; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.api.scope.IBaseIndex; | 8 | import tools.refinery.interpreter.api.scope.IBaseIndex; |
9 | import tools.refinery.viatra.runtime.api.scope.IEngineContext; | 9 | import tools.refinery.interpreter.api.scope.IEngineContext; |
10 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext; | 10 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
11 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 11 | import tools.refinery.store.query.interpreter.internal.QueryInterpreterAdapterImpl; |
12 | 12 | ||
13 | public class RelationalEngineContext implements IEngineContext { | 13 | public class RelationalEngineContext implements IEngineContext { |
14 | private final IBaseIndex baseIndex = new DummyBaseIndexer(); | 14 | private final IBaseIndex baseIndex = new DummyBaseIndexer(); |
15 | private final RelationalRuntimeContext runtimeContext; | 15 | private final RelationalRuntimeContext runtimeContext; |
16 | 16 | ||
17 | public RelationalEngineContext(ViatraModelQueryAdapterImpl adapter) { | 17 | public RelationalEngineContext(QueryInterpreterAdapterImpl adapter) { |
18 | runtimeContext = new RelationalRuntimeContext(adapter); | 18 | runtimeContext = new RelationalRuntimeContext(adapter); |
19 | } | 19 | } |
20 | 20 | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalQueryMetaContext.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/context/RelationalQueryMetaContext.java index 77d86a1c..2b1ff2b4 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalQueryMetaContext.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/context/RelationalQueryMetaContext.java | |||
@@ -3,13 +3,13 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.context; | 6 | package tools.refinery.store.query.interpreter.internal.context; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.context.AbstractQueryMetaContext; | 8 | import tools.refinery.interpreter.matchers.context.AbstractQueryMetaContext; |
9 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 9 | import tools.refinery.interpreter.matchers.context.IInputKey; |
10 | import tools.refinery.viatra.runtime.matchers.context.InputKeyImplication; | 10 | import tools.refinery.interpreter.matchers.context.InputKeyImplication; |
11 | import tools.refinery.viatra.runtime.matchers.context.common.JavaTransitiveInstancesKey; | 11 | import tools.refinery.interpreter.matchers.context.common.JavaTransitiveInstancesKey; |
12 | import tools.refinery.store.query.viatra.internal.pquery.SymbolViewWrapper; | 12 | import tools.refinery.store.query.interpreter.internal.pquery.SymbolViewWrapper; |
13 | import tools.refinery.store.query.view.AnySymbolView; | 13 | import tools.refinery.store.query.view.AnySymbolView; |
14 | 14 | ||
15 | import java.util.*; | 15 | import java.util.*; |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalRuntimeContext.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/context/RelationalRuntimeContext.java index dadab5dd..5870b0c2 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/context/RelationalRuntimeContext.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/context/RelationalRuntimeContext.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.context; | 6 | package tools.refinery.store.query.interpreter.internal.context; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.CancellationToken; | 8 | import tools.refinery.interpreter.CancellationToken; |
9 | import tools.refinery.viatra.runtime.matchers.context.*; | 9 | import tools.refinery.interpreter.matchers.context.*; |
10 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 10 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
11 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 11 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
12 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 12 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
13 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 13 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
14 | import tools.refinery.viatra.runtime.matchers.util.Accuracy; | 14 | import tools.refinery.interpreter.matchers.util.Accuracy; |
15 | import tools.refinery.store.model.Model; | 15 | import tools.refinery.store.model.Model; |
16 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 16 | import tools.refinery.store.query.interpreter.internal.QueryInterpreterAdapterImpl; |
17 | import tools.refinery.store.query.viatra.internal.pquery.SymbolViewWrapper; | 17 | import tools.refinery.store.query.interpreter.internal.pquery.SymbolViewWrapper; |
18 | import tools.refinery.store.query.viatra.internal.update.ModelUpdateListener; | 18 | import tools.refinery.store.query.interpreter.internal.update.ModelUpdateListener; |
19 | import tools.refinery.store.query.view.AnySymbolView; | 19 | import tools.refinery.store.query.view.AnySymbolView; |
20 | 20 | ||
21 | import java.lang.reflect.InvocationTargetException; | 21 | import java.lang.reflect.InvocationTargetException; |
@@ -35,7 +35,7 @@ public class RelationalRuntimeContext implements IQueryRuntimeContext { | |||
35 | 35 | ||
36 | private final CancellationToken cancellationToken; | 36 | private final CancellationToken cancellationToken; |
37 | 37 | ||
38 | RelationalRuntimeContext(ViatraModelQueryAdapterImpl adapter) { | 38 | RelationalRuntimeContext(QueryInterpreterAdapterImpl adapter) { |
39 | model = adapter.getModel(); | 39 | model = adapter.getModel(); |
40 | metaContext = new RelationalQueryMetaContext(adapter.getStoreAdapter().getInputKeys()); | 40 | metaContext = new RelationalQueryMetaContext(adapter.getStoreAdapter().getInputKeys()); |
41 | modelUpdateListener = new ModelUpdateListener(adapter); | 41 | modelUpdateListener = new ModelUpdateListener(adapter); |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/FlatCostFunction.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/localsearch/FlatCostFunction.java index ce2a75bd..45fd9fbd 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/localsearch/FlatCostFunction.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/localsearch/FlatCostFunction.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.localsearch; | 6 | package tools.refinery.store.query.interpreter.internal.localsearch; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.localsearch.planner.cost.IConstraintEvaluationContext; | 8 | import tools.refinery.interpreter.localsearch.planner.cost.IConstraintEvaluationContext; |
9 | import tools.refinery.viatra.runtime.localsearch.planner.cost.impl.StatisticsBasedConstraintCostFunction; | 9 | import tools.refinery.interpreter.localsearch.planner.cost.impl.StatisticsBasedConstraintCostFunction; |
10 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 10 | import tools.refinery.interpreter.matchers.context.IInputKey; |
11 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 11 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.TypeConstraint; |
12 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 12 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
13 | import tools.refinery.viatra.runtime.matchers.util.Accuracy; | 13 | import tools.refinery.interpreter.matchers.util.Accuracy; |
14 | 14 | ||
15 | import java.util.Optional; | 15 | import java.util.Optional; |
16 | 16 | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/AbstractViatraMatcher.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/AbstractInterpretedMatcher.java index c4a5a236..8cec0bf6 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/AbstractViatraMatcher.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/AbstractInterpretedMatcher.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.matcher; | 6 | package tools.refinery.store.query.interpreter.internal.matcher; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 8 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
9 | import tools.refinery.viatra.runtime.matchers.backend.IUpdateable; | 9 | import tools.refinery.interpreter.matchers.backend.IUpdateable; |
10 | import tools.refinery.store.query.dnf.Query; | 10 | import tools.refinery.store.query.dnf.Query; |
11 | import tools.refinery.store.query.resultset.AbstractResultSet; | 11 | import tools.refinery.store.query.resultset.AbstractResultSet; |
12 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 12 | import tools.refinery.store.query.interpreter.internal.QueryInterpreterAdapterImpl; |
13 | 13 | ||
14 | public abstract class AbstractViatraMatcher<T> extends AbstractResultSet<T> implements IUpdateable { | 14 | public abstract class AbstractInterpretedMatcher<T> extends AbstractResultSet<T> implements IUpdateable { |
15 | protected final IQueryResultProvider backend; | 15 | protected final IQueryResultProvider backend; |
16 | 16 | ||
17 | protected AbstractViatraMatcher(ViatraModelQueryAdapterImpl adapter, Query<T> query, | 17 | protected AbstractInterpretedMatcher(QueryInterpreterAdapterImpl adapter, Query<T> query, |
18 | RawPatternMatcher rawPatternMatcher) { | 18 | RawPatternMatcher rawPatternMatcher) { |
19 | super(adapter, query); | 19 | super(adapter, query); |
20 | backend = rawPatternMatcher.getBackend(); | 20 | backend = rawPatternMatcher.getBackend(); |
21 | } | 21 | } |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/FunctionalCursor.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/FunctionalCursor.java index 44038669..e3b53f6b 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/FunctionalCursor.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/FunctionalCursor.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.matcher; | 6 | package tools.refinery.store.query.interpreter.internal.matcher; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.rete.index.IterableIndexer; | 8 | import tools.refinery.interpreter.rete.index.IterableIndexer; |
9 | import tools.refinery.store.map.Cursor; | 9 | import tools.refinery.store.map.Cursor; |
10 | import tools.refinery.store.tuple.Tuple; | 10 | import tools.refinery.store.tuple.Tuple; |
11 | 11 | ||
@@ -13,7 +13,7 @@ import java.util.Iterator; | |||
13 | 13 | ||
14 | class FunctionalCursor<T> implements Cursor<Tuple, T> { | 14 | class FunctionalCursor<T> implements Cursor<Tuple, T> { |
15 | private final IterableIndexer indexer; | 15 | private final IterableIndexer indexer; |
16 | private final Iterator<tools.refinery.viatra.runtime.matchers.tuple.Tuple> iterator; | 16 | private final Iterator<tools.refinery.interpreter.matchers.tuple.Tuple> iterator; |
17 | private boolean terminated; | 17 | private boolean terminated; |
18 | private Tuple key; | 18 | private Tuple key; |
19 | private T value; | 19 | private T value; |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/FunctionalViatraMatcher.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/InterpretedFunctionalMatcher.java index fb9e4df6..249664a4 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/FunctionalViatraMatcher.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/InterpretedFunctionalMatcher.java | |||
@@ -3,34 +3,35 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.matcher; | 6 | package tools.refinery.store.query.interpreter.internal.matcher; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 8 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
9 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 9 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
10 | import tools.refinery.viatra.runtime.rete.index.IterableIndexer; | 10 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
11 | import tools.refinery.viatra.runtime.rete.matcher.RetePatternMatcher; | 11 | import tools.refinery.interpreter.rete.index.IterableIndexer; |
12 | import tools.refinery.interpreter.rete.matcher.RetePatternMatcher; | ||
12 | import tools.refinery.store.map.Cursor; | 13 | import tools.refinery.store.map.Cursor; |
13 | import tools.refinery.store.query.dnf.FunctionalQuery; | 14 | import tools.refinery.store.query.dnf.FunctionalQuery; |
14 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 15 | import tools.refinery.store.query.interpreter.internal.QueryInterpreterAdapterImpl; |
15 | import tools.refinery.store.tuple.Tuple; | 16 | import tools.refinery.store.tuple.Tuple; |
16 | 17 | ||
17 | /** | 18 | /** |
18 | * Directly access the tuples inside a VIATRA pattern matcher.<p> | 19 | * Directly access the tuples inside a Refinery Interpreter pattern matcher.<p> |
19 | * This class neglects calling | 20 | * This class neglects calling |
20 | * {@link tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext#wrapTuple(org.eclipse.viatra.query.runtime.matchers.tuple.Tuple)} | 21 | * {@link IQueryRuntimeContext#wrapTuple(tools.refinery.interpreter.matchers.tuple.Tuple)} |
21 | * and | 22 | * and |
22 | * {@link tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext#unwrapTuple(org.eclipse.viatra.query.runtime.matchers.tuple.Tuple)}, | 23 | * {@link IQueryRuntimeContext#unwrapTuple(tools.refinery.interpreter.matchers.tuple.Tuple)}, |
23 | * because {@link tools.refinery.store.query.viatra.internal.context.RelationalRuntimeContext} provides a trivial | 24 | * because {@link tools.refinery.store.query.interpreter.internal.context.RelationalRuntimeContext} provides a trivial |
24 | * implementation for these methods. | 25 | * implementation for these methods. |
25 | * Using this class with any other runtime context may lead to undefined behavior. | 26 | * Using this class with any other runtime context may lead to undefined behavior. |
26 | */ | 27 | */ |
27 | public class FunctionalViatraMatcher<T> extends AbstractViatraMatcher<T> { | 28 | public class InterpretedFunctionalMatcher<T> extends AbstractInterpretedMatcher<T> { |
28 | private final TupleMask emptyMask; | 29 | private final TupleMask emptyMask; |
29 | private final TupleMask omitOutputMask; | 30 | private final TupleMask omitOutputMask; |
30 | private final IterableIndexer omitOutputIndexer; | 31 | private final IterableIndexer omitOutputIndexer; |
31 | 32 | ||
32 | public FunctionalViatraMatcher(ViatraModelQueryAdapterImpl adapter, FunctionalQuery<T> query, | 33 | public InterpretedFunctionalMatcher(QueryInterpreterAdapterImpl adapter, FunctionalQuery<T> query, |
33 | RawPatternMatcher rawPatternMatcher) { | 34 | RawPatternMatcher rawPatternMatcher) { |
34 | super(adapter, query, rawPatternMatcher); | 35 | super(adapter, query, rawPatternMatcher); |
35 | int arity = query.arity(); | 36 | int arity = query.arity(); |
36 | int arityWithOutput = arity + 1; | 37 | int arityWithOutput = arity + 1; |
@@ -76,7 +77,7 @@ public class FunctionalViatraMatcher<T> extends AbstractViatraMatcher<T> { | |||
76 | } | 77 | } |
77 | 78 | ||
78 | @Override | 79 | @Override |
79 | public void update(tools.refinery.viatra.runtime.matchers.tuple.Tuple updateElement, boolean isInsertion) { | 80 | public void update(tools.refinery.interpreter.matchers.tuple.Tuple updateElement, boolean isInsertion) { |
80 | var key = MatcherUtils.keyToRefineryTuple(updateElement); | 81 | var key = MatcherUtils.keyToRefineryTuple(updateElement); |
81 | var value = MatcherUtils.<T>getValue(updateElement); | 82 | var value = MatcherUtils.<T>getValue(updateElement); |
82 | if (isInsertion) { | 83 | if (isInsertion) { |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RelationalViatraMatcher.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/InterpretedRelationalMatcher.java index da75e864..9278b46d 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RelationalViatraMatcher.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/InterpretedRelationalMatcher.java | |||
@@ -3,35 +3,36 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.matcher; | 6 | package tools.refinery.store.query.interpreter.internal.matcher; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | 8 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContext; |
9 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 9 | import tools.refinery.interpreter.matchers.tuple.TupleMask; |
10 | import tools.refinery.viatra.runtime.rete.index.Indexer; | 10 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
11 | import tools.refinery.viatra.runtime.rete.matcher.RetePatternMatcher; | 11 | import tools.refinery.interpreter.rete.index.Indexer; |
12 | import tools.refinery.interpreter.rete.matcher.RetePatternMatcher; | ||
12 | import tools.refinery.store.map.Cursor; | 13 | import tools.refinery.store.map.Cursor; |
13 | import tools.refinery.store.map.Cursors; | 14 | import tools.refinery.store.map.Cursors; |
14 | import tools.refinery.store.query.dnf.RelationalQuery; | 15 | import tools.refinery.store.query.dnf.RelationalQuery; |
15 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 16 | import tools.refinery.store.query.interpreter.internal.QueryInterpreterAdapterImpl; |
16 | import tools.refinery.store.tuple.Tuple; | 17 | import tools.refinery.store.tuple.Tuple; |
17 | 18 | ||
18 | /** | 19 | /** |
19 | * Directly access the tuples inside a VIATRA pattern matcher.<p> | 20 | * Directly access the tuples inside a Refinery Interpreter pattern matcher.<p> |
20 | * This class neglects calling | 21 | * This class neglects calling |
21 | * {@link tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext#wrapTuple(org.eclipse.viatra.query.runtime.matchers.tuple.Tuple)} | 22 | * {@link IQueryRuntimeContext#wrapTuple(tools.refinery.interpreter.matchers.tuple.Tuple)} |
22 | * and | 23 | * and |
23 | * {@link tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContext#unwrapTuple(org.eclipse.viatra.query.runtime.matchers.tuple.Tuple)}, | 24 | * {@link IQueryRuntimeContext#unwrapTuple(tools.refinery.interpreter.matchers.tuple.Tuple)}, |
24 | * because {@link tools.refinery.store.query.viatra.internal.context.RelationalRuntimeContext} provides a trivial | 25 | * because {@link tools.refinery.store.query.interpreter.internal.context.RelationalRuntimeContext} provides a trivial |
25 | * implementation for these methods. | 26 | * implementation for these methods. |
26 | * Using this class with any other runtime context may lead to undefined behavior. | 27 | * Using this class with any other runtime context may lead to undefined behavior. |
27 | */ | 28 | */ |
28 | public class RelationalViatraMatcher extends AbstractViatraMatcher<Boolean> { | 29 | public class InterpretedRelationalMatcher extends AbstractInterpretedMatcher<Boolean> { |
29 | private final TupleMask emptyMask; | 30 | private final TupleMask emptyMask; |
30 | private final TupleMask identityMask; | 31 | private final TupleMask identityMask; |
31 | private final Indexer emptyMaskIndexer; | 32 | private final Indexer emptyMaskIndexer; |
32 | 33 | ||
33 | public RelationalViatraMatcher(ViatraModelQueryAdapterImpl adapter, RelationalQuery query, | 34 | public InterpretedRelationalMatcher(QueryInterpreterAdapterImpl adapter, RelationalQuery query, |
34 | RawPatternMatcher rawPatternMatcher) { | 35 | RawPatternMatcher rawPatternMatcher) { |
35 | super(adapter, query, rawPatternMatcher); | 36 | super(adapter, query, rawPatternMatcher); |
36 | int arity = query.arity(); | 37 | int arity = query.arity(); |
37 | emptyMask = TupleMask.empty(arity); | 38 | emptyMask = TupleMask.empty(arity); |
@@ -73,7 +74,7 @@ public class RelationalViatraMatcher extends AbstractViatraMatcher<Boolean> { | |||
73 | } | 74 | } |
74 | 75 | ||
75 | @Override | 76 | @Override |
76 | public void update(tools.refinery.viatra.runtime.matchers.tuple.Tuple updateElement, boolean isInsertion) { | 77 | public void update(tools.refinery.interpreter.matchers.tuple.Tuple updateElement, boolean isInsertion) { |
77 | var key = MatcherUtils.toRefineryTuple(updateElement); | 78 | var key = MatcherUtils.toRefineryTuple(updateElement); |
78 | notifyChange(key, !isInsertion, isInsertion); | 79 | notifyChange(key, !isInsertion, isInsertion); |
79 | } | 80 | } |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/MatcherUtils.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/MatcherUtils.java index 6cda23cd..b30b83b5 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/MatcherUtils.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/MatcherUtils.java | |||
@@ -3,10 +3,10 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.matcher; | 6 | package tools.refinery.store.query.interpreter.internal.matcher; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 8 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
9 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 9 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
10 | import org.jetbrains.annotations.Nullable; | 10 | import org.jetbrains.annotations.Nullable; |
11 | import tools.refinery.store.tuple.*; | 11 | import tools.refinery.store.tuple.*; |
12 | 12 | ||
@@ -17,7 +17,7 @@ final class MatcherUtils { | |||
17 | throw new IllegalStateException("This is a static utility class and should not be instantiated directly"); | 17 | throw new IllegalStateException("This is a static utility class and should not be instantiated directly"); |
18 | } | 18 | } |
19 | 19 | ||
20 | public static tools.refinery.viatra.runtime.matchers.tuple.Tuple toViatraTuple(Tuple refineryTuple) { | 20 | public static tools.refinery.interpreter.matchers.tuple.Tuple toViatraTuple(Tuple refineryTuple) { |
21 | if (refineryTuple instanceof Tuple0) { | 21 | if (refineryTuple instanceof Tuple0) { |
22 | return Tuples.staticArityFlatTupleOf(); | 22 | return Tuples.staticArityFlatTupleOf(); |
23 | } else if (refineryTuple instanceof Tuple1) { | 23 | } else if (refineryTuple instanceof Tuple1) { |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RawPatternMatcher.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/RawPatternMatcher.java index c0be70ba..fcd5a236 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RawPatternMatcher.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/RawPatternMatcher.java | |||
@@ -3,11 +3,11 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.matcher; | 6 | package tools.refinery.store.query.interpreter.internal.matcher; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.api.GenericPatternMatcher; | 8 | import tools.refinery.interpreter.api.GenericPatternMatcher; |
9 | import tools.refinery.viatra.runtime.api.GenericQuerySpecification; | 9 | import tools.refinery.interpreter.api.GenericQuerySpecification; |
10 | import tools.refinery.viatra.runtime.matchers.backend.IQueryResultProvider; | 10 | import tools.refinery.interpreter.matchers.backend.IQueryResultProvider; |
11 | 11 | ||
12 | public class RawPatternMatcher extends GenericPatternMatcher { | 12 | public class RawPatternMatcher extends GenericPatternMatcher { |
13 | public RawPatternMatcher(GenericQuerySpecification<? extends GenericPatternMatcher> specification) { | 13 | public RawPatternMatcher(GenericQuerySpecification<? extends GenericPatternMatcher> specification) { |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RelationalCursor.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/RelationalCursor.java index 53475218..45eb9fff 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/RelationalCursor.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/RelationalCursor.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.matcher; | 6 | package tools.refinery.store.query.interpreter.internal.matcher; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 8 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
9 | import tools.refinery.store.map.Cursor; | 9 | import tools.refinery.store.map.Cursor; |
10 | import tools.refinery.store.tuple.Tuple; | 10 | import tools.refinery.store.tuple.Tuple; |
11 | 11 | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/UnsafeFunctionalCursor.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/UnsafeFunctionalCursor.java index 093ade96..d3a7c743 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/matcher/UnsafeFunctionalCursor.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/matcher/UnsafeFunctionalCursor.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.matcher; | 6 | package tools.refinery.store.query.interpreter.internal.matcher; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 8 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
9 | import tools.refinery.store.map.Cursor; | 9 | import tools.refinery.store.map.Cursor; |
10 | import tools.refinery.store.tuple.Tuple; | 10 | import tools.refinery.store.tuple.Tuple; |
11 | 11 | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/CheckEvaluator.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/CheckEvaluator.java index ada154d4..4a71e879 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/CheckEvaluator.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/CheckEvaluator.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.pquery; | 6 | package tools.refinery.store.query.interpreter.internal.pquery; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.psystem.IValueProvider; | 8 | import tools.refinery.interpreter.matchers.psystem.IValueProvider; |
9 | import tools.refinery.store.query.term.Term; | 9 | import tools.refinery.store.query.term.Term; |
10 | 10 | ||
11 | class CheckEvaluator extends TermEvaluator<Boolean> { | 11 | class CheckEvaluator extends TermEvaluator<Boolean> { |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/Dnf2PQuery.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/Dnf2PQuery.java index 492bd054..73ce4043 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/Dnf2PQuery.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/Dnf2PQuery.java | |||
@@ -3,8 +3,11 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.pquery; | 6 | package tools.refinery.store.query.interpreter.internal.pquery; |
7 | 7 | ||
8 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.*; | ||
9 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.*; | ||
10 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.Connectivity; | ||
8 | import tools.refinery.store.query.Constraint; | 11 | import tools.refinery.store.query.Constraint; |
9 | import tools.refinery.store.query.dnf.Dnf; | 12 | import tools.refinery.store.query.dnf.Dnf; |
10 | import tools.refinery.store.query.dnf.DnfClause; | 13 | import tools.refinery.store.query.dnf.DnfClause; |
@@ -16,22 +19,19 @@ import tools.refinery.store.query.term.StatelessAggregator; | |||
16 | import tools.refinery.store.query.term.Variable; | 19 | import tools.refinery.store.query.term.Variable; |
17 | import tools.refinery.store.query.view.AnySymbolView; | 20 | import tools.refinery.store.query.view.AnySymbolView; |
18 | import tools.refinery.store.util.CycleDetectingMapper; | 21 | import tools.refinery.store.util.CycleDetectingMapper; |
19 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendFactory; | 22 | import tools.refinery.interpreter.matchers.backend.IQueryBackendFactory; |
20 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 23 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
21 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 24 | import tools.refinery.interpreter.matchers.context.IInputKey; |
22 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 25 | import tools.refinery.interpreter.matchers.psystem.PBody; |
23 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 26 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
24 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.BoundAggregator; | 27 | import tools.refinery.interpreter.matchers.psystem.aggregations.BoundAggregator; |
25 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 28 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
26 | import tools.refinery.viatra.runtime.matchers.psystem.annotations.PAnnotation; | 29 | import tools.refinery.interpreter.matchers.psystem.annotations.PAnnotation; |
27 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.*; | 30 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
28 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.*; | 31 | import tools.refinery.interpreter.matchers.psystem.queries.PParameterDirection; |
29 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.Connectivity; | 32 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
30 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 33 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
31 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameterDirection; | 34 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
32 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | ||
33 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | ||
34 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | ||
35 | 35 | ||
36 | import java.util.ArrayList; | 36 | import java.util.ArrayList; |
37 | import java.util.HashMap; | 37 | import java.util.HashMap; |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/QueryWrapperFactory.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/QueryWrapperFactory.java index d21131e5..a710dab3 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/QueryWrapperFactory.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/QueryWrapperFactory.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.pquery; | 6 | package tools.refinery.store.query.interpreter.internal.pquery; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 8 | import tools.refinery.interpreter.matchers.context.IInputKey; |
9 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 9 | import tools.refinery.interpreter.matchers.psystem.PBody; |
10 | import tools.refinery.viatra.runtime.matchers.psystem.PVariable; | 10 | import tools.refinery.interpreter.matchers.psystem.PVariable; |
11 | import tools.refinery.viatra.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 11 | import tools.refinery.interpreter.matchers.psystem.basicdeferred.ExportedParameter; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 12 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.PositivePatternCall; |
13 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 13 | import tools.refinery.interpreter.matchers.psystem.basicenumerables.TypeConstraint; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 14 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PQuery; | 15 | import tools.refinery.interpreter.matchers.psystem.queries.PQuery; |
16 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PVisibility; | 16 | import tools.refinery.interpreter.matchers.psystem.queries.PVisibility; |
17 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 17 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
18 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 18 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
19 | import tools.refinery.store.query.Constraint; | 19 | import tools.refinery.store.query.Constraint; |
20 | import tools.refinery.store.query.dnf.Dnf; | 20 | import tools.refinery.store.query.dnf.Dnf; |
21 | import tools.refinery.store.query.dnf.DnfUtils; | 21 | import tools.refinery.store.query.dnf.DnfUtils; |
@@ -55,7 +55,7 @@ class QueryWrapperFactory { | |||
55 | var appendVariable = new VariableAppender(); | 55 | var appendVariable = new VariableAppender(); |
56 | for (int i = 0; i < arity; i++) { | 56 | for (int i = 0; i < arity; i++) { |
57 | var variable = arguments.get(i); | 57 | var variable = arguments.get(i); |
58 | // Unify all variables to avoid VIATRA bugs, even if they're bound in the containing clause. | 58 | // Unify all variables to avoid Refinery Interpreter bugs, even if they're bound in the containing clause. |
59 | remappedParameters[i] = unboundVariableIndices.computeIfAbsent(variable, appendVariable::applyAsInt); | 59 | remappedParameters[i] = unboundVariableIndices.computeIfAbsent(variable, appendVariable::applyAsInt); |
60 | } | 60 | } |
61 | var pattern = maybeWrapConstraint(callLiteral.getTarget(), remappedParameters); | 61 | var pattern = maybeWrapConstraint(callLiteral.getTarget(), remappedParameters); |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/RawPQuery.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/RawPQuery.java index 06644bf2..bbb35f91 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/RawPQuery.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/RawPQuery.java | |||
@@ -3,18 +3,18 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.pquery; | 6 | package tools.refinery.store.query.interpreter.internal.pquery; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.api.GenericQuerySpecification; | 8 | import tools.refinery.interpreter.api.GenericQuerySpecification; |
9 | import tools.refinery.viatra.runtime.api.ViatraQueryEngine; | 9 | import tools.refinery.interpreter.api.InterpreterEngine; |
10 | import tools.refinery.viatra.runtime.api.scope.QueryScope; | 10 | import tools.refinery.interpreter.api.scope.QueryScope; |
11 | import tools.refinery.viatra.runtime.matchers.psystem.PBody; | 11 | import tools.refinery.interpreter.matchers.psystem.PBody; |
12 | import tools.refinery.viatra.runtime.matchers.psystem.annotations.PAnnotation; | 12 | import tools.refinery.interpreter.matchers.psystem.annotations.PAnnotation; |
13 | import tools.refinery.viatra.runtime.matchers.psystem.queries.BasePQuery; | 13 | import tools.refinery.interpreter.matchers.psystem.queries.BasePQuery; |
14 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PParameter; | 14 | import tools.refinery.interpreter.matchers.psystem.queries.PParameter; |
15 | import tools.refinery.viatra.runtime.matchers.psystem.queries.PVisibility; | 15 | import tools.refinery.interpreter.matchers.psystem.queries.PVisibility; |
16 | import tools.refinery.store.query.viatra.internal.RelationalScope; | 16 | import tools.refinery.store.query.interpreter.internal.RelationalScope; |
17 | import tools.refinery.store.query.viatra.internal.matcher.RawPatternMatcher; | 17 | import tools.refinery.store.query.interpreter.internal.matcher.RawPatternMatcher; |
18 | 18 | ||
19 | import java.util.LinkedHashSet; | 19 | import java.util.LinkedHashSet; |
20 | import java.util.List; | 20 | import java.util.List; |
@@ -70,7 +70,7 @@ public class RawPQuery extends BasePQuery { | |||
70 | } | 70 | } |
71 | 71 | ||
72 | @Override | 72 | @Override |
73 | protected RawPatternMatcher instantiate(ViatraQueryEngine engine) { | 73 | protected RawPatternMatcher instantiate(InterpreterEngine engine) { |
74 | RawPatternMatcher matcher = engine.getExistingMatcher(this); | 74 | RawPatternMatcher matcher = engine.getExistingMatcher(this); |
75 | if (matcher == null) { | 75 | if (matcher == null) { |
76 | matcher = engine.getMatcher(this); | 76 | matcher = engine.getMatcher(this); |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/StatefulMultisetAggregator.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/StatefulMultisetAggregator.java index ba99cf9a..7552117b 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/StatefulMultisetAggregator.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/StatefulMultisetAggregator.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.pquery; | 6 | package tools.refinery.store.query.interpreter.internal.pquery; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 8 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
9 | import tools.refinery.store.query.term.StatefulAggregate; | 9 | import tools.refinery.store.query.term.StatefulAggregate; |
10 | import tools.refinery.store.query.term.StatefulAggregator; | 10 | import tools.refinery.store.query.term.StatefulAggregator; |
11 | 11 | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/StatelessMultisetAggregator.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/StatelessMultisetAggregator.java index bf2c2f4f..2da7ba87 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/StatelessMultisetAggregator.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/StatelessMultisetAggregator.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.pquery; | 6 | package tools.refinery.store.query.interpreter.internal.pquery; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator; | 8 | import tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator; |
9 | import tools.refinery.store.query.term.StatelessAggregator; | 9 | import tools.refinery.store.query.term.StatelessAggregator; |
10 | 10 | ||
11 | import java.util.stream.Stream; | 11 | import java.util.stream.Stream; |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/SymbolViewWrapper.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/SymbolViewWrapper.java index a774404e..51795f4a 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/SymbolViewWrapper.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/SymbolViewWrapper.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.pquery; | 6 | package tools.refinery.store.query.interpreter.internal.pquery; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.context.common.BaseInputKeyWrapper; | 8 | import tools.refinery.interpreter.matchers.context.common.BaseInputKeyWrapper; |
9 | import tools.refinery.store.query.view.AnySymbolView; | 9 | import tools.refinery.store.query.view.AnySymbolView; |
10 | 10 | ||
11 | public class SymbolViewWrapper extends BaseInputKeyWrapper<AnySymbolView> { | 11 | public class SymbolViewWrapper extends BaseInputKeyWrapper<AnySymbolView> { |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/TermEvaluator.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/TermEvaluator.java index d064ff2c..ed991091 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/TermEvaluator.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/TermEvaluator.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.pquery; | 6 | package tools.refinery.store.query.interpreter.internal.pquery; |
7 | 7 | ||
8 | import tools.refinery.store.query.term.Term; | 8 | import tools.refinery.store.query.term.Term; |
9 | import tools.refinery.store.query.term.Variable; | 9 | import tools.refinery.store.query.term.Variable; |
10 | import tools.refinery.viatra.runtime.matchers.psystem.IExpressionEvaluator; | 10 | import tools.refinery.interpreter.matchers.psystem.IExpressionEvaluator; |
11 | import tools.refinery.viatra.runtime.matchers.psystem.IValueProvider; | 11 | import tools.refinery.interpreter.matchers.psystem.IValueProvider; |
12 | 12 | ||
13 | import java.util.stream.Collectors; | 13 | import java.util.stream.Collectors; |
14 | 14 | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/ValueProviderBasedValuation.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/ValueProviderBasedValuation.java index b9ae8ab2..4124c9bb 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/pquery/ValueProviderBasedValuation.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/pquery/ValueProviderBasedValuation.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.pquery; | 6 | package tools.refinery.store.query.interpreter.internal.pquery; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.psystem.IValueProvider; | 8 | import tools.refinery.interpreter.matchers.psystem.IValueProvider; |
9 | import tools.refinery.store.query.term.DataVariable; | 9 | import tools.refinery.store.query.term.DataVariable; |
10 | import tools.refinery.store.query.valuation.Valuation; | 10 | import tools.refinery.store.query.valuation.Valuation; |
11 | 11 | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/ModelUpdateListener.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/ModelUpdateListener.java index e1bc9efc..fad53675 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/ModelUpdateListener.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/ModelUpdateListener.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.update; | 6 | package tools.refinery.store.query.interpreter.internal.update; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 8 | import tools.refinery.interpreter.matchers.context.IInputKey; |
9 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContextListener; | 9 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContextListener; |
10 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 10 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
11 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 11 | import tools.refinery.store.query.interpreter.internal.QueryInterpreterAdapterImpl; |
12 | import tools.refinery.store.query.view.AnySymbolView; | 12 | import tools.refinery.store.query.view.AnySymbolView; |
13 | import tools.refinery.store.query.view.SymbolView; | 13 | import tools.refinery.store.query.view.SymbolView; |
14 | 14 | ||
@@ -18,7 +18,7 @@ import java.util.Map; | |||
18 | public class ModelUpdateListener { | 18 | public class ModelUpdateListener { |
19 | private final Map<AnySymbolView, SymbolViewUpdateListener<?>> symbolViewUpdateListeners; | 19 | private final Map<AnySymbolView, SymbolViewUpdateListener<?>> symbolViewUpdateListeners; |
20 | 20 | ||
21 | public ModelUpdateListener(ViatraModelQueryAdapterImpl adapter) { | 21 | public ModelUpdateListener(QueryInterpreterAdapterImpl adapter) { |
22 | var symbolViews = adapter.getStoreAdapter().getInputKeys().keySet(); | 22 | var symbolViews = adapter.getStoreAdapter().getInputKeys().keySet(); |
23 | symbolViewUpdateListeners = new HashMap<>(symbolViews.size()); | 23 | symbolViewUpdateListeners = new HashMap<>(symbolViews.size()); |
24 | for (var symbolView : symbolViews) { | 24 | for (var symbolView : symbolViews) { |
@@ -26,7 +26,7 @@ public class ModelUpdateListener { | |||
26 | } | 26 | } |
27 | } | 27 | } |
28 | 28 | ||
29 | private <T> void registerView(ViatraModelQueryAdapterImpl adapter, SymbolView<T> view) { | 29 | private <T> void registerView(QueryInterpreterAdapterImpl adapter, SymbolView<T> view) { |
30 | var model = adapter.getModel(); | 30 | var model = adapter.getModel(); |
31 | var interpretation = model.getInterpretation(view.getSymbol()); | 31 | var interpretation = model.getInterpretation(view.getSymbol()); |
32 | var listener = SymbolViewUpdateListener.of(adapter, view, interpretation); | 32 | var listener = SymbolViewUpdateListener.of(adapter, view, interpretation); |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/RelationViewFilter.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/RelationViewFilter.java index 73c4a3f9..4b4c73eb 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/RelationViewFilter.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/RelationViewFilter.java | |||
@@ -3,12 +3,12 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.update; | 6 | package tools.refinery.store.query.interpreter.internal.update; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 8 | import tools.refinery.interpreter.matchers.context.IInputKey; |
9 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContextListener; | 9 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContextListener; |
10 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 10 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
11 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 11 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
12 | 12 | ||
13 | import java.util.Arrays; | 13 | import java.util.Arrays; |
14 | import java.util.Objects; | 14 | import java.util.Objects; |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/SymbolViewUpdateListener.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/SymbolViewUpdateListener.java index d0cdda72..68020b11 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/SymbolViewUpdateListener.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/SymbolViewUpdateListener.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.update; | 6 | package tools.refinery.store.query.interpreter.internal.update; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.context.IInputKey; | 8 | import tools.refinery.interpreter.matchers.context.IInputKey; |
9 | import tools.refinery.viatra.runtime.matchers.context.IQueryRuntimeContextListener; | 9 | import tools.refinery.interpreter.matchers.context.IQueryRuntimeContextListener; |
10 | import tools.refinery.viatra.runtime.matchers.tuple.ITuple; | 10 | import tools.refinery.interpreter.matchers.tuple.ITuple; |
11 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | 11 | import tools.refinery.interpreter.matchers.tuple.Tuple; |
12 | import tools.refinery.store.model.Interpretation; | 12 | import tools.refinery.store.model.Interpretation; |
13 | import tools.refinery.store.model.InterpretationListener; | 13 | import tools.refinery.store.model.InterpretationListener; |
14 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 14 | import tools.refinery.store.query.interpreter.internal.QueryInterpreterAdapterImpl; |
15 | import tools.refinery.store.query.view.SymbolView; | 15 | import tools.refinery.store.query.view.SymbolView; |
16 | import tools.refinery.store.query.view.TuplePreservingView; | 16 | import tools.refinery.store.query.view.TuplePreservingView; |
17 | 17 | ||
@@ -19,11 +19,11 @@ import java.util.ArrayList; | |||
19 | import java.util.List; | 19 | import java.util.List; |
20 | 20 | ||
21 | public abstract class SymbolViewUpdateListener<T> implements InterpretationListener<T> { | 21 | public abstract class SymbolViewUpdateListener<T> implements InterpretationListener<T> { |
22 | private final ViatraModelQueryAdapterImpl adapter; | 22 | private final QueryInterpreterAdapterImpl adapter; |
23 | private final Interpretation<T> interpretation; | 23 | private final Interpretation<T> interpretation; |
24 | private final List<RelationViewFilter> filters = new ArrayList<>(); | 24 | private final List<RelationViewFilter> filters = new ArrayList<>(); |
25 | 25 | ||
26 | protected SymbolViewUpdateListener(ViatraModelQueryAdapterImpl adapter, Interpretation<T> interpretation) { | 26 | protected SymbolViewUpdateListener(QueryInterpreterAdapterImpl adapter, Interpretation<T> interpretation) { |
27 | this.adapter = adapter; | 27 | this.adapter = adapter; |
28 | this.interpretation = interpretation; | 28 | this.interpretation = interpretation; |
29 | } | 29 | } |
@@ -53,9 +53,9 @@ public abstract class SymbolViewUpdateListener<T> implements InterpretationListe | |||
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | public static <T> SymbolViewUpdateListener<T> of(ViatraModelQueryAdapterImpl adapter, | 56 | public static <T> SymbolViewUpdateListener<T> of(QueryInterpreterAdapterImpl adapter, |
57 | SymbolView<T> view, | 57 | SymbolView<T> view, |
58 | Interpretation<T> interpretation) { | 58 | Interpretation<T> interpretation) { |
59 | if (view instanceof TuplePreservingView<T> tuplePreservingRelationView) { | 59 | if (view instanceof TuplePreservingView<T> tuplePreservingRelationView) { |
60 | return new TuplePreservingViewUpdateListener<>(adapter, tuplePreservingRelationView, | 60 | return new TuplePreservingViewUpdateListener<>(adapter, tuplePreservingRelationView, |
61 | interpretation); | 61 | interpretation); |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingViewUpdateListener.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/TupleChangingViewUpdateListener.java index 5577faa3..13b4af80 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TupleChangingViewUpdateListener.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/TupleChangingViewUpdateListener.java | |||
@@ -3,21 +3,21 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.update; | 6 | package tools.refinery.store.query.interpreter.internal.update; |
7 | 7 | ||
8 | import tools.refinery.store.model.Interpretation; | 8 | import tools.refinery.store.model.Interpretation; |
9 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 9 | import tools.refinery.store.query.interpreter.internal.QueryInterpreterAdapterImpl; |
10 | import tools.refinery.store.query.view.SymbolView; | 10 | import tools.refinery.store.query.view.SymbolView; |
11 | import tools.refinery.store.tuple.Tuple; | 11 | import tools.refinery.store.tuple.Tuple; |
12 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 12 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
13 | 13 | ||
14 | import java.util.Arrays; | 14 | import java.util.Arrays; |
15 | 15 | ||
16 | public class TupleChangingViewUpdateListener<T> extends SymbolViewUpdateListener<T> { | 16 | public class TupleChangingViewUpdateListener<T> extends SymbolViewUpdateListener<T> { |
17 | private final SymbolView<T> view; | 17 | private final SymbolView<T> view; |
18 | 18 | ||
19 | TupleChangingViewUpdateListener(ViatraModelQueryAdapterImpl adapter, SymbolView<T> view, | 19 | TupleChangingViewUpdateListener(QueryInterpreterAdapterImpl adapter, SymbolView<T> view, |
20 | Interpretation<T> interpretation) { | 20 | Interpretation<T> interpretation) { |
21 | super(adapter, interpretation); | 21 | super(adapter, interpretation); |
22 | this.view = view; | 22 | this.view = view; |
23 | } | 23 | } |
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TuplePreservingViewUpdateListener.java b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/TuplePreservingViewUpdateListener.java index 7dbd50b3..c9f69145 100644 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/update/TuplePreservingViewUpdateListener.java +++ b/subprojects/store-query-interpreter/src/main/java/tools/refinery/store/query/interpreter/internal/update/TuplePreservingViewUpdateListener.java | |||
@@ -3,19 +3,19 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.update; | 6 | package tools.refinery.store.query.interpreter.internal.update; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.tuple.Tuples; | 8 | import tools.refinery.interpreter.matchers.tuple.Tuples; |
9 | import tools.refinery.store.model.Interpretation; | 9 | import tools.refinery.store.model.Interpretation; |
10 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryAdapterImpl; | 10 | import tools.refinery.store.query.interpreter.internal.QueryInterpreterAdapterImpl; |
11 | import tools.refinery.store.query.view.TuplePreservingView; | 11 | import tools.refinery.store.query.view.TuplePreservingView; |
12 | import tools.refinery.store.tuple.Tuple; | 12 | import tools.refinery.store.tuple.Tuple; |
13 | 13 | ||
14 | public class TuplePreservingViewUpdateListener<T> extends SymbolViewUpdateListener<T> { | 14 | public class TuplePreservingViewUpdateListener<T> extends SymbolViewUpdateListener<T> { |
15 | private final TuplePreservingView<T> view; | 15 | private final TuplePreservingView<T> view; |
16 | 16 | ||
17 | TuplePreservingViewUpdateListener(ViatraModelQueryAdapterImpl adapter, TuplePreservingView<T> view, | 17 | TuplePreservingViewUpdateListener(QueryInterpreterAdapterImpl adapter, TuplePreservingView<T> view, |
18 | Interpretation<T> interpretation) { | 18 | Interpretation<T> interpretation) { |
19 | super(adapter, interpretation); | 19 | super(adapter, interpretation); |
20 | this.view = view; | 20 | this.view = view; |
21 | } | 21 | } |
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/DiagonalQueryTest.java index 85bdc204..76de8679 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/DiagonalQueryTest.java +++ b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/DiagonalQueryTest.java | |||
@@ -3,14 +3,14 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra; | 6 | package tools.refinery.store.query.interpreter; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 8 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
9 | import tools.refinery.store.model.ModelStore; | 9 | import tools.refinery.store.model.ModelStore; |
10 | import tools.refinery.store.query.ModelQueryAdapter; | 10 | import tools.refinery.store.query.ModelQueryAdapter; |
11 | import tools.refinery.store.query.dnf.Dnf; | 11 | import tools.refinery.store.query.dnf.Dnf; |
12 | import tools.refinery.store.query.dnf.Query; | 12 | import tools.refinery.store.query.dnf.Query; |
13 | import tools.refinery.store.query.viatra.tests.QueryEngineTest; | 13 | import tools.refinery.store.query.interpreter.tests.QueryEngineTest; |
14 | import tools.refinery.store.query.view.AnySymbolView; | 14 | import tools.refinery.store.query.view.AnySymbolView; |
15 | import tools.refinery.store.query.view.FunctionView; | 15 | import tools.refinery.store.query.view.FunctionView; |
16 | import tools.refinery.store.query.view.KeyOnlyView; | 16 | import tools.refinery.store.query.view.KeyOnlyView; |
@@ -23,8 +23,8 @@ import java.util.Optional; | |||
23 | 23 | ||
24 | import static tools.refinery.store.query.literal.Literals.not; | 24 | import static tools.refinery.store.query.literal.Literals.not; |
25 | import static tools.refinery.store.query.term.int_.IntTerms.INT_SUM; | 25 | import static tools.refinery.store.query.term.int_.IntTerms.INT_SUM; |
26 | import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertNullableResults; | 26 | import static tools.refinery.store.query.interpreter.tests.QueryAssertions.assertNullableResults; |
27 | import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertResults; | 27 | import static tools.refinery.store.query.interpreter.tests.QueryAssertions.assertResults; |
28 | 28 | ||
29 | class DiagonalQueryTest { | 29 | class DiagonalQueryTest { |
30 | private static final Symbol<Boolean> person = Symbol.of("Person", 1); | 30 | private static final Symbol<Boolean> person = Symbol.of("Person", 1); |
@@ -45,7 +45,7 @@ class DiagonalQueryTest { | |||
45 | 45 | ||
46 | var store = ModelStore.builder() | 46 | var store = ModelStore.builder() |
47 | .symbols(person, symbol) | 47 | .symbols(person, symbol) |
48 | .with(ViatraModelQueryAdapter.builder() | 48 | .with(QueryInterpreterAdapter.builder() |
49 | .defaultHint(hint) | 49 | .defaultHint(hint) |
50 | .queries(query)) | 50 | .queries(query)) |
51 | .build(); | 51 | .build(); |
@@ -92,7 +92,7 @@ class DiagonalQueryTest { | |||
92 | 92 | ||
93 | var store = ModelStore.builder() | 93 | var store = ModelStore.builder() |
94 | .symbols(person, symbol) | 94 | .symbols(person, symbol) |
95 | .with(ViatraModelQueryAdapter.builder() | 95 | .with(QueryInterpreterAdapter.builder() |
96 | .defaultHint(hint) | 96 | .defaultHint(hint) |
97 | .queries(query)) | 97 | .queries(query)) |
98 | .build(); | 98 | .build(); |
@@ -131,7 +131,7 @@ class DiagonalQueryTest { | |||
131 | 131 | ||
132 | var store = ModelStore.builder() | 132 | var store = ModelStore.builder() |
133 | .symbols(person, symbol) | 133 | .symbols(person, symbol) |
134 | .with(ViatraModelQueryAdapter.builder() | 134 | .with(QueryInterpreterAdapter.builder() |
135 | .defaultHint(hint) | 135 | .defaultHint(hint) |
136 | .queries(query)) | 136 | .queries(query)) |
137 | .build(); | 137 | .build(); |
@@ -178,7 +178,7 @@ class DiagonalQueryTest { | |||
178 | 178 | ||
179 | var store = ModelStore.builder() | 179 | var store = ModelStore.builder() |
180 | .symbols(person, symbol) | 180 | .symbols(person, symbol) |
181 | .with(ViatraModelQueryAdapter.builder() | 181 | .with(QueryInterpreterAdapter.builder() |
182 | .defaultHint(hint) | 182 | .defaultHint(hint) |
183 | .queries(query)) | 183 | .queries(query)) |
184 | .build(); | 184 | .build(); |
@@ -218,7 +218,7 @@ class DiagonalQueryTest { | |||
218 | 218 | ||
219 | var store = ModelStore.builder() | 219 | var store = ModelStore.builder() |
220 | .symbols(person, intSymbol) | 220 | .symbols(person, intSymbol) |
221 | .with(ViatraModelQueryAdapter.builder() | 221 | .with(QueryInterpreterAdapter.builder() |
222 | .defaultHint(hint) | 222 | .defaultHint(hint) |
223 | .queries(query)) | 223 | .queries(query)) |
224 | .build(); | 224 | .build(); |
@@ -276,7 +276,7 @@ class DiagonalQueryTest { | |||
276 | 276 | ||
277 | var store = ModelStore.builder() | 277 | var store = ModelStore.builder() |
278 | .symbols(person, intSymbol) | 278 | .symbols(person, intSymbol) |
279 | .with(ViatraModelQueryAdapter.builder() | 279 | .with(QueryInterpreterAdapter.builder() |
280 | .defaultHint(hint) | 280 | .defaultHint(hint) |
281 | .queries(query)) | 281 | .queries(query)) |
282 | .build(); | 282 | .build(); |
@@ -315,7 +315,7 @@ class DiagonalQueryTest { | |||
315 | 315 | ||
316 | var store = ModelStore.builder() | 316 | var store = ModelStore.builder() |
317 | .symbols(person, friend) | 317 | .symbols(person, friend) |
318 | .with(ViatraModelQueryAdapter.builder() | 318 | .with(QueryInterpreterAdapter.builder() |
319 | .defaultHint(hint) | 319 | .defaultHint(hint) |
320 | .queries(query)) | 320 | .queries(query)) |
321 | .build(); | 321 | .build(); |
@@ -361,7 +361,7 @@ class DiagonalQueryTest { | |||
361 | 361 | ||
362 | var store = ModelStore.builder() | 362 | var store = ModelStore.builder() |
363 | .symbols(person, friend) | 363 | .symbols(person, friend) |
364 | .with(ViatraModelQueryAdapter.builder() | 364 | .with(QueryInterpreterAdapter.builder() |
365 | .defaultHint(hint) | 365 | .defaultHint(hint) |
366 | .queries(query)) | 366 | .queries(query)) |
367 | .build(); | 367 | .build(); |
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/FunctionalQueryTest.java index 7190d8f1..00721a34 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/FunctionalQueryTest.java +++ b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/FunctionalQueryTest.java | |||
@@ -3,15 +3,15 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra; | 6 | package tools.refinery.store.query.interpreter; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 8 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
9 | import tools.refinery.store.map.Cursor; | 9 | import tools.refinery.store.map.Cursor; |
10 | import tools.refinery.store.model.ModelStore; | 10 | import tools.refinery.store.model.ModelStore; |
11 | import tools.refinery.store.query.ModelQueryAdapter; | 11 | import tools.refinery.store.query.ModelQueryAdapter; |
12 | import tools.refinery.store.query.dnf.Query; | 12 | import tools.refinery.store.query.dnf.Query; |
13 | import tools.refinery.store.query.term.Variable; | 13 | import tools.refinery.store.query.term.Variable; |
14 | import tools.refinery.store.query.viatra.tests.QueryEngineTest; | 14 | import tools.refinery.store.query.interpreter.tests.QueryEngineTest; |
15 | import tools.refinery.store.query.view.AnySymbolView; | 15 | import tools.refinery.store.query.view.AnySymbolView; |
16 | import tools.refinery.store.query.view.FilteredView; | 16 | import tools.refinery.store.query.view.FilteredView; |
17 | import tools.refinery.store.query.view.FunctionView; | 17 | import tools.refinery.store.query.view.FunctionView; |
@@ -31,8 +31,8 @@ import static org.junit.jupiter.api.Assertions.assertAll; | |||
31 | import static org.junit.jupiter.api.Assertions.assertThrows; | 31 | import static org.junit.jupiter.api.Assertions.assertThrows; |
32 | import static tools.refinery.store.query.literal.Literals.check; | 32 | import static tools.refinery.store.query.literal.Literals.check; |
33 | import static tools.refinery.store.query.term.int_.IntTerms.*; | 33 | import static tools.refinery.store.query.term.int_.IntTerms.*; |
34 | import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertNullableResults; | 34 | import static tools.refinery.store.query.interpreter.tests.QueryAssertions.assertNullableResults; |
35 | import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertResults; | 35 | import static tools.refinery.store.query.interpreter.tests.QueryAssertions.assertResults; |
36 | 36 | ||
37 | class FunctionalQueryTest { | 37 | class FunctionalQueryTest { |
38 | private static final Symbol<Boolean> person = Symbol.of("Person", 1); | 38 | private static final Symbol<Boolean> person = Symbol.of("Person", 1); |
@@ -51,7 +51,7 @@ class FunctionalQueryTest { | |||
51 | 51 | ||
52 | var store = ModelStore.builder() | 52 | var store = ModelStore.builder() |
53 | .symbols(person, age) | 53 | .symbols(person, age) |
54 | .with(ViatraModelQueryAdapter.builder() | 54 | .with(QueryInterpreterAdapter.builder() |
55 | .defaultHint(hint) | 55 | .defaultHint(hint) |
56 | .queries(query)) | 56 | .queries(query)) |
57 | .build(); | 57 | .build(); |
@@ -90,7 +90,7 @@ class FunctionalQueryTest { | |||
90 | 90 | ||
91 | var store = ModelStore.builder() | 91 | var store = ModelStore.builder() |
92 | .symbols(person, age) | 92 | .symbols(person, age) |
93 | .with(ViatraModelQueryAdapter.builder() | 93 | .with(QueryInterpreterAdapter.builder() |
94 | .defaultHint(hint) | 94 | .defaultHint(hint) |
95 | .queries(query)) | 95 | .queries(query)) |
96 | .build(); | 96 | .build(); |
@@ -129,7 +129,7 @@ class FunctionalQueryTest { | |||
129 | 129 | ||
130 | var store = ModelStore.builder() | 130 | var store = ModelStore.builder() |
131 | .symbols(person, age) | 131 | .symbols(person, age) |
132 | .with(ViatraModelQueryAdapter.builder() | 132 | .with(QueryInterpreterAdapter.builder() |
133 | .defaultHint(hint) | 133 | .defaultHint(hint) |
134 | .queries(query)) | 134 | .queries(query)) |
135 | .build(); | 135 | .build(); |
@@ -163,7 +163,7 @@ class FunctionalQueryTest { | |||
163 | 163 | ||
164 | var store = ModelStore.builder() | 164 | var store = ModelStore.builder() |
165 | .symbols(person, friend) | 165 | .symbols(person, friend) |
166 | .with(ViatraModelQueryAdapter.builder() | 166 | .with(QueryInterpreterAdapter.builder() |
167 | .defaultHint(hint) | 167 | .defaultHint(hint) |
168 | .queries(query)) | 168 | .queries(query)) |
169 | .build(); | 169 | .build(); |
@@ -205,7 +205,7 @@ class FunctionalQueryTest { | |||
205 | 205 | ||
206 | var store = ModelStore.builder() | 206 | var store = ModelStore.builder() |
207 | .symbols(person, friend) | 207 | .symbols(person, friend) |
208 | .with(ViatraModelQueryAdapter.builder() | 208 | .with(QueryInterpreterAdapter.builder() |
209 | .defaultHint(hint) | 209 | .defaultHint(hint) |
210 | .queries(query)) | 210 | .queries(query)) |
211 | .build(); | 211 | .build(); |
@@ -241,7 +241,7 @@ class FunctionalQueryTest { | |||
241 | 241 | ||
242 | var store = ModelStore.builder() | 242 | var store = ModelStore.builder() |
243 | .symbols(age) | 243 | .symbols(age) |
244 | .with(ViatraModelQueryAdapter.builder() | 244 | .with(QueryInterpreterAdapter.builder() |
245 | .defaultHint(hint) | 245 | .defaultHint(hint) |
246 | .queries(query)) | 246 | .queries(query)) |
247 | .build(); | 247 | .build(); |
@@ -270,7 +270,7 @@ class FunctionalQueryTest { | |||
270 | 270 | ||
271 | var store = ModelStore.builder() | 271 | var store = ModelStore.builder() |
272 | .symbols(person, age) | 272 | .symbols(person, age) |
273 | .with(ViatraModelQueryAdapter.builder() | 273 | .with(QueryInterpreterAdapter.builder() |
274 | .defaultHint(hint) | 274 | .defaultHint(hint) |
275 | .queries(query)) | 275 | .queries(query)) |
276 | .build(); | 276 | .build(); |
@@ -306,7 +306,7 @@ class FunctionalQueryTest { | |||
306 | 306 | ||
307 | var store = ModelStore.builder() | 307 | var store = ModelStore.builder() |
308 | .symbols(person, friend) | 308 | .symbols(person, friend) |
309 | .with(ViatraModelQueryAdapter.builder() | 309 | .with(QueryInterpreterAdapter.builder() |
310 | .defaultHint(hint) | 310 | .defaultHint(hint) |
311 | .queries(minQuery, maxQuery)) | 311 | .queries(minQuery, maxQuery)) |
312 | .build(); | 312 | .build(); |
@@ -360,7 +360,7 @@ class FunctionalQueryTest { | |||
360 | 360 | ||
361 | var store = ModelStore.builder() | 361 | var store = ModelStore.builder() |
362 | .symbols(person, age) | 362 | .symbols(person, age) |
363 | .with(ViatraModelQueryAdapter.builder() | 363 | .with(QueryInterpreterAdapter.builder() |
364 | .defaultHint(hint) | 364 | .defaultHint(hint) |
365 | .queries(query)) | 365 | .queries(query)) |
366 | .build(); | 366 | .build(); |
@@ -395,7 +395,7 @@ class FunctionalQueryTest { | |||
395 | 395 | ||
396 | var store = ModelStore.builder() | 396 | var store = ModelStore.builder() |
397 | .symbols(person, age) | 397 | .symbols(person, age) |
398 | .with(ViatraModelQueryAdapter.builder() | 398 | .with(QueryInterpreterAdapter.builder() |
399 | .defaultHint(hint) | 399 | .defaultHint(hint) |
400 | .queries(query)) | 400 | .queries(query)) |
401 | .build(); | 401 | .build(); |
@@ -435,7 +435,7 @@ class FunctionalQueryTest { | |||
435 | 435 | ||
436 | var store = ModelStore.builder() | 436 | var store = ModelStore.builder() |
437 | .symbols(age) | 437 | .symbols(age) |
438 | .with(ViatraModelQueryAdapter.builder() | 438 | .with(QueryInterpreterAdapter.builder() |
439 | .defaultHint(hint) | 439 | .defaultHint(hint) |
440 | .queries(query)) | 440 | .queries(query)) |
441 | .build(); | 441 | .build(); |
@@ -469,7 +469,7 @@ class FunctionalQueryTest { | |||
469 | 469 | ||
470 | var store = ModelStore.builder() | 470 | var store = ModelStore.builder() |
471 | .symbols(person, age, friend) | 471 | .symbols(person, age, friend) |
472 | .with(ViatraModelQueryAdapter.builder() | 472 | .with(QueryInterpreterAdapter.builder() |
473 | .defaultHint(hint) | 473 | .defaultHint(hint) |
474 | .queries(query)) | 474 | .queries(query)) |
475 | .build(); | 475 | .build(); |
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/OrderedResultSetTest.java b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/OrderedResultSetTest.java index 8ede6c80..96d0f302 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/OrderedResultSetTest.java +++ b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/OrderedResultSetTest.java | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra; | 6 | package tools.refinery.store.query.interpreter; |
7 | 7 | ||
8 | import org.junit.jupiter.api.Test; | 8 | import org.junit.jupiter.api.Test; |
9 | import tools.refinery.store.model.ModelStore; | 9 | import tools.refinery.store.model.ModelStore; |
@@ -31,7 +31,7 @@ class OrderedResultSetTest { | |||
31 | 31 | ||
32 | var store = ModelStore.builder() | 32 | var store = ModelStore.builder() |
33 | .symbols(friend) | 33 | .symbols(friend) |
34 | .with(ViatraModelQueryAdapter.builder() | 34 | .with(QueryInterpreterAdapter.builder() |
35 | .queries(query)) | 35 | .queries(query)) |
36 | .build(); | 36 | .build(); |
37 | 37 | ||
@@ -71,7 +71,7 @@ class OrderedResultSetTest { | |||
71 | 71 | ||
72 | var store = ModelStore.builder() | 72 | var store = ModelStore.builder() |
73 | .symbols(friend) | 73 | .symbols(friend) |
74 | .with(ViatraModelQueryAdapter.builder() | 74 | .with(QueryInterpreterAdapter.builder() |
75 | .queries(query)) | 75 | .queries(query)) |
76 | .build(); | 76 | .build(); |
77 | 77 | ||
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/QueryTest.java index ce403e3a..72728dcd 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTest.java +++ b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/QueryTest.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra; | 6 | package tools.refinery.store.query.interpreter; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 8 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
9 | import org.junit.jupiter.api.Test; | 9 | import org.junit.jupiter.api.Test; |
10 | import tools.refinery.store.model.ModelStore; | 10 | import tools.refinery.store.model.ModelStore; |
11 | import tools.refinery.store.query.ModelQueryAdapter; | 11 | import tools.refinery.store.query.ModelQueryAdapter; |
@@ -13,7 +13,7 @@ import tools.refinery.store.query.dnf.Dnf; | |||
13 | import tools.refinery.store.query.dnf.Query; | 13 | import tools.refinery.store.query.dnf.Query; |
14 | import tools.refinery.store.query.term.ParameterDirection; | 14 | import tools.refinery.store.query.term.ParameterDirection; |
15 | import tools.refinery.store.query.term.Variable; | 15 | import tools.refinery.store.query.term.Variable; |
16 | import tools.refinery.store.query.viatra.tests.QueryEngineTest; | 16 | import tools.refinery.store.query.interpreter.tests.QueryEngineTest; |
17 | import tools.refinery.store.query.view.AnySymbolView; | 17 | import tools.refinery.store.query.view.AnySymbolView; |
18 | import tools.refinery.store.query.view.FilteredView; | 18 | import tools.refinery.store.query.view.FilteredView; |
19 | import tools.refinery.store.query.view.FunctionView; | 19 | import tools.refinery.store.query.view.FunctionView; |
@@ -29,7 +29,7 @@ import static tools.refinery.store.query.literal.Literals.check; | |||
29 | import static tools.refinery.store.query.literal.Literals.not; | 29 | import static tools.refinery.store.query.literal.Literals.not; |
30 | import static tools.refinery.store.query.term.int_.IntTerms.constant; | 30 | import static tools.refinery.store.query.term.int_.IntTerms.constant; |
31 | import static tools.refinery.store.query.term.int_.IntTerms.greaterEq; | 31 | import static tools.refinery.store.query.term.int_.IntTerms.greaterEq; |
32 | import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertResults; | 32 | import static tools.refinery.store.query.interpreter.tests.QueryAssertions.assertResults; |
33 | 33 | ||
34 | class QueryTest { | 34 | class QueryTest { |
35 | private static final Symbol<Boolean> person = Symbol.of("Person", 1); | 35 | private static final Symbol<Boolean> person = Symbol.of("Person", 1); |
@@ -45,7 +45,7 @@ class QueryTest { | |||
45 | 45 | ||
46 | var store = ModelStore.builder() | 46 | var store = ModelStore.builder() |
47 | .symbols(person, asset) | 47 | .symbols(person, asset) |
48 | .with(ViatraModelQueryAdapter.builder() | 48 | .with(QueryInterpreterAdapter.builder() |
49 | .defaultHint(hint) | 49 | .defaultHint(hint) |
50 | .queries(predicate)) | 50 | .queries(predicate)) |
51 | .build(); | 51 | .build(); |
@@ -80,7 +80,7 @@ class QueryTest { | |||
80 | 80 | ||
81 | var store = ModelStore.builder() | 81 | var store = ModelStore.builder() |
82 | .symbols(person, friend) | 82 | .symbols(person, friend) |
83 | .with(ViatraModelQueryAdapter.builder() | 83 | .with(QueryInterpreterAdapter.builder() |
84 | .defaultHint(hint) | 84 | .defaultHint(hint) |
85 | .queries(predicate)) | 85 | .queries(predicate)) |
86 | .build(); | 86 | .build(); |
@@ -119,7 +119,7 @@ class QueryTest { | |||
119 | 119 | ||
120 | var store = ModelStore.builder() | 120 | var store = ModelStore.builder() |
121 | .symbols(person, friend) | 121 | .symbols(person, friend) |
122 | .with(ViatraModelQueryAdapter.builder() | 122 | .with(QueryInterpreterAdapter.builder() |
123 | .defaultHint(hint) | 123 | .defaultHint(hint) |
124 | .queries(predicate)) | 124 | .queries(predicate)) |
125 | .build(); | 125 | .build(); |
@@ -157,7 +157,7 @@ class QueryTest { | |||
157 | 157 | ||
158 | var store = ModelStore.builder() | 158 | var store = ModelStore.builder() |
159 | .symbols(person, friend) | 159 | .symbols(person, friend) |
160 | .with(ViatraModelQueryAdapter.builder() | 160 | .with(QueryInterpreterAdapter.builder() |
161 | .defaultHint(hint) | 161 | .defaultHint(hint) |
162 | .queries(predicate)) | 162 | .queries(predicate)) |
163 | .build(); | 163 | .build(); |
@@ -203,7 +203,7 @@ class QueryTest { | |||
203 | 203 | ||
204 | var store = ModelStore.builder() | 204 | var store = ModelStore.builder() |
205 | .symbols(person, animal, friend) | 205 | .symbols(person, animal, friend) |
206 | .with(ViatraModelQueryAdapter.builder() | 206 | .with(QueryInterpreterAdapter.builder() |
207 | .defaultHint(hint) | 207 | .defaultHint(hint) |
208 | .queries(predicate)) | 208 | .queries(predicate)) |
209 | .build(); | 209 | .build(); |
@@ -246,7 +246,7 @@ class QueryTest { | |||
246 | 246 | ||
247 | var store = ModelStore.builder() | 247 | var store = ModelStore.builder() |
248 | .symbols(person) | 248 | .symbols(person) |
249 | .with(ViatraModelQueryAdapter.builder() | 249 | .with(QueryInterpreterAdapter.builder() |
250 | .defaultHint(hint) | 250 | .defaultHint(hint) |
251 | .queries(predicate)) | 251 | .queries(predicate)) |
252 | .build(); | 252 | .build(); |
@@ -282,7 +282,7 @@ class QueryTest { | |||
282 | 282 | ||
283 | var store = ModelStore.builder() | 283 | var store = ModelStore.builder() |
284 | .symbols(person, friend) | 284 | .symbols(person, friend) |
285 | .with(ViatraModelQueryAdapter.builder() | 285 | .with(QueryInterpreterAdapter.builder() |
286 | .defaultHint(hint) | 286 | .defaultHint(hint) |
287 | .queries(predicate)) | 287 | .queries(predicate)) |
288 | .build(); | 288 | .build(); |
@@ -323,7 +323,7 @@ class QueryTest { | |||
323 | 323 | ||
324 | var store = ModelStore.builder() | 324 | var store = ModelStore.builder() |
325 | .symbols(person, friend) | 325 | .symbols(person, friend) |
326 | .with(ViatraModelQueryAdapter.builder() | 326 | .with(QueryInterpreterAdapter.builder() |
327 | .defaultHint(hint) | 327 | .defaultHint(hint) |
328 | .queries(predicate)) | 328 | .queries(predicate)) |
329 | .build(); | 329 | .build(); |
@@ -370,7 +370,7 @@ class QueryTest { | |||
370 | 370 | ||
371 | var store = ModelStore.builder() | 371 | var store = ModelStore.builder() |
372 | .symbols(person, friend) | 372 | .symbols(person, friend) |
373 | .with(ViatraModelQueryAdapter.builder() | 373 | .with(QueryInterpreterAdapter.builder() |
374 | .defaultHint(hint) | 374 | .defaultHint(hint) |
375 | .queries(predicate)) | 375 | .queries(predicate)) |
376 | .build(); | 376 | .build(); |
@@ -408,7 +408,7 @@ class QueryTest { | |||
408 | 408 | ||
409 | var store = ModelStore.builder() | 409 | var store = ModelStore.builder() |
410 | .symbols(person, friend) | 410 | .symbols(person, friend) |
411 | .with(ViatraModelQueryAdapter.builder() | 411 | .with(QueryInterpreterAdapter.builder() |
412 | .defaultHint(hint) | 412 | .defaultHint(hint) |
413 | .queries(predicate)) | 413 | .queries(predicate)) |
414 | .build(); | 414 | .build(); |
@@ -457,7 +457,7 @@ class QueryTest { | |||
457 | 457 | ||
458 | var store = ModelStore.builder() | 458 | var store = ModelStore.builder() |
459 | .symbols(person, friend) | 459 | .symbols(person, friend) |
460 | .with(ViatraModelQueryAdapter.builder() | 460 | .with(QueryInterpreterAdapter.builder() |
461 | .defaultHint(hint) | 461 | .defaultHint(hint) |
462 | .queries(predicate)) | 462 | .queries(predicate)) |
463 | .build(); | 463 | .build(); |
@@ -500,7 +500,7 @@ class QueryTest { | |||
500 | 500 | ||
501 | var store = ModelStore.builder() | 501 | var store = ModelStore.builder() |
502 | .symbols(person, friend) | 502 | .symbols(person, friend) |
503 | .with(ViatraModelQueryAdapter.builder() | 503 | .with(QueryInterpreterAdapter.builder() |
504 | .defaultHint(hint) | 504 | .defaultHint(hint) |
505 | .queries(predicate)) | 505 | .queries(predicate)) |
506 | .build(); | 506 | .build(); |
@@ -541,7 +541,7 @@ class QueryTest { | |||
541 | 541 | ||
542 | var store = ModelStore.builder() | 542 | var store = ModelStore.builder() |
543 | .symbols(person, friend) | 543 | .symbols(person, friend) |
544 | .with(ViatraModelQueryAdapter.builder() | 544 | .with(QueryInterpreterAdapter.builder() |
545 | .defaultHint(hint) | 545 | .defaultHint(hint) |
546 | .queries(predicate)) | 546 | .queries(predicate)) |
547 | .build(); | 547 | .build(); |
@@ -578,7 +578,7 @@ class QueryTest { | |||
578 | 578 | ||
579 | var store = ModelStore.builder() | 579 | var store = ModelStore.builder() |
580 | .symbols(person, friend) | 580 | .symbols(person, friend) |
581 | .with(ViatraModelQueryAdapter.builder() | 581 | .with(QueryInterpreterAdapter.builder() |
582 | .defaultHint(hint) | 582 | .defaultHint(hint) |
583 | .queries(predicate)) | 583 | .queries(predicate)) |
584 | .build(); | 584 | .build(); |
@@ -626,7 +626,7 @@ class QueryTest { | |||
626 | 626 | ||
627 | var store = ModelStore.builder() | 627 | var store = ModelStore.builder() |
628 | .symbols(person, friend) | 628 | .symbols(person, friend) |
629 | .with(ViatraModelQueryAdapter.builder() | 629 | .with(QueryInterpreterAdapter.builder() |
630 | .defaultHint(hint) | 630 | .defaultHint(hint) |
631 | .queries(predicate)) | 631 | .queries(predicate)) |
632 | .build(); | 632 | .build(); |
@@ -672,7 +672,7 @@ class QueryTest { | |||
672 | ))); | 672 | ))); |
673 | var store = ModelStore.builder() | 673 | var store = ModelStore.builder() |
674 | .symbols(distance) | 674 | .symbols(distance) |
675 | .with(ViatraModelQueryAdapter.builder() | 675 | .with(QueryInterpreterAdapter.builder() |
676 | .queries(dangerQuery)) | 676 | .queries(dangerQuery)) |
677 | .build(); | 677 | .build(); |
678 | 678 | ||
@@ -708,7 +708,7 @@ class QueryTest { | |||
708 | ))); | 708 | ))); |
709 | var store = ModelStore.builder() | 709 | var store = ModelStore.builder() |
710 | .symbols(distance) | 710 | .symbols(distance) |
711 | .with(ViatraModelQueryAdapter.builder() | 711 | .with(QueryInterpreterAdapter.builder() |
712 | .queries(dangerQuery)) | 712 | .queries(dangerQuery)) |
713 | .build(); | 713 | .build(); |
714 | 714 | ||
@@ -744,7 +744,7 @@ class QueryTest { | |||
744 | 744 | ||
745 | var store = ModelStore.builder() | 745 | var store = ModelStore.builder() |
746 | .symbols(person, age) | 746 | .symbols(person, age) |
747 | .with(ViatraModelQueryAdapter.builder() | 747 | .with(QueryInterpreterAdapter.builder() |
748 | .defaultHint(hint) | 748 | .defaultHint(hint) |
749 | .queries(query)) | 749 | .queries(query)) |
750 | .build(); | 750 | .build(); |
@@ -775,7 +775,7 @@ class QueryTest { | |||
775 | 775 | ||
776 | var store = ModelStore.builder() | 776 | var store = ModelStore.builder() |
777 | .symbols(person) | 777 | .symbols(person) |
778 | .with(ViatraModelQueryAdapter.builder() | 778 | .with(QueryInterpreterAdapter.builder() |
779 | .queries(predicate)) | 779 | .queries(predicate)) |
780 | .build(); | 780 | .build(); |
781 | 781 | ||
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/QueryTransactionTest.java index 3f8c060a..1cd05d91 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/QueryTransactionTest.java +++ b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/QueryTransactionTest.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra; | 6 | package tools.refinery.store.query.interpreter; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 8 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
9 | import org.junit.jupiter.api.Test; | 9 | import org.junit.jupiter.api.Test; |
10 | import tools.refinery.store.model.ModelStore; | 10 | import tools.refinery.store.model.ModelStore; |
11 | import tools.refinery.store.query.ModelQueryAdapter; | 11 | import tools.refinery.store.query.ModelQueryAdapter; |
@@ -23,8 +23,8 @@ import java.util.Optional; | |||
23 | 23 | ||
24 | import static org.junit.jupiter.api.Assertions.assertFalse; | 24 | import static org.junit.jupiter.api.Assertions.assertFalse; |
25 | import static org.junit.jupiter.api.Assertions.assertTrue; | 25 | import static org.junit.jupiter.api.Assertions.assertTrue; |
26 | import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertNullableResults; | 26 | import static tools.refinery.store.query.interpreter.tests.QueryAssertions.assertNullableResults; |
27 | import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertResults; | 27 | import static tools.refinery.store.query.interpreter.tests.QueryAssertions.assertResults; |
28 | 28 | ||
29 | class QueryTransactionTest { | 29 | class QueryTransactionTest { |
30 | private static final Symbol<Boolean> person = Symbol.of("Person", 1); | 30 | private static final Symbol<Boolean> person = Symbol.of("Person", 1); |
@@ -38,7 +38,7 @@ class QueryTransactionTest { | |||
38 | void flushTest() { | 38 | void flushTest() { |
39 | var store = ModelStore.builder() | 39 | var store = ModelStore.builder() |
40 | .symbols(person) | 40 | .symbols(person) |
41 | .with(ViatraModelQueryAdapter.builder() | 41 | .with(QueryInterpreterAdapter.builder() |
42 | .queries(predicate)) | 42 | .queries(predicate)) |
43 | .build(); | 43 | .build(); |
44 | 44 | ||
@@ -100,7 +100,7 @@ class QueryTransactionTest { | |||
100 | void localSearchTest() { | 100 | void localSearchTest() { |
101 | var store = ModelStore.builder() | 101 | var store = ModelStore.builder() |
102 | .symbols(person) | 102 | .symbols(person) |
103 | .with(ViatraModelQueryAdapter.builder() | 103 | .with(QueryInterpreterAdapter.builder() |
104 | .defaultHint(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.DEFAULT_SEARCH)) | 104 | .defaultHint(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.DEFAULT_SEARCH)) |
105 | .queries(predicate)) | 105 | .queries(predicate)) |
106 | .build(); | 106 | .build(); |
@@ -147,7 +147,7 @@ class QueryTransactionTest { | |||
147 | 147 | ||
148 | var store = ModelStore.builder() | 148 | var store = ModelStore.builder() |
149 | .symbols(person, asset) | 149 | .symbols(person, asset) |
150 | .with(ViatraModelQueryAdapter.builder() | 150 | .with(QueryInterpreterAdapter.builder() |
151 | .queries(predicate)) | 151 | .queries(predicate)) |
152 | .build(); | 152 | .build(); |
153 | 153 | ||
@@ -215,7 +215,7 @@ class QueryTransactionTest { | |||
215 | 215 | ||
216 | var store = ModelStore.builder() | 216 | var store = ModelStore.builder() |
217 | .symbols(person, age) | 217 | .symbols(person, age) |
218 | .with(ViatraModelQueryAdapter.builder() | 218 | .with(QueryInterpreterAdapter.builder() |
219 | .queries(query)) | 219 | .queries(query)) |
220 | .build(); | 220 | .build(); |
221 | 221 | ||
@@ -254,7 +254,7 @@ class QueryTransactionTest { | |||
254 | 254 | ||
255 | var store = ModelStore.builder() | 255 | var store = ModelStore.builder() |
256 | .symbols(person, age) | 256 | .symbols(person, age) |
257 | .with(ViatraModelQueryAdapter.builder() | 257 | .with(QueryInterpreterAdapter.builder() |
258 | .queries(query)) | 258 | .queries(query)) |
259 | .build(); | 259 | .build(); |
260 | 260 | ||
@@ -286,7 +286,7 @@ class QueryTransactionTest { | |||
286 | void commitAfterFlushTest() { | 286 | void commitAfterFlushTest() { |
287 | var store = ModelStore.builder() | 287 | var store = ModelStore.builder() |
288 | .symbols(person) | 288 | .symbols(person) |
289 | .with(ViatraModelQueryAdapter.builder() | 289 | .with(QueryInterpreterAdapter.builder() |
290 | .queries(predicate)) | 290 | .queries(predicate)) |
291 | .build(); | 291 | .build(); |
292 | 292 | ||
@@ -334,7 +334,7 @@ class QueryTransactionTest { | |||
334 | void commitWithoutFlushTest() { | 334 | void commitWithoutFlushTest() { |
335 | var store = ModelStore.builder() | 335 | var store = ModelStore.builder() |
336 | .symbols(person) | 336 | .symbols(person) |
337 | .with(ViatraModelQueryAdapter.builder() | 337 | .with(QueryInterpreterAdapter.builder() |
338 | .queries(predicate)) | 338 | .queries(predicate)) |
339 | .build(); | 339 | .build(); |
340 | 340 | ||
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/StronglyConnectedComponentsTest.java b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/StronglyConnectedComponentsTest.java index 37795ff3..edbd9aff 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/StronglyConnectedComponentsTest.java +++ b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/StronglyConnectedComponentsTest.java | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra; | 6 | package tools.refinery.store.query.interpreter; |
7 | 7 | ||
8 | import org.junit.jupiter.api.Test; | 8 | import org.junit.jupiter.api.Test; |
9 | import tools.refinery.store.model.ModelStore; | 9 | import tools.refinery.store.model.ModelStore; |
@@ -21,7 +21,7 @@ import java.util.Map; | |||
21 | 21 | ||
22 | import static org.hamcrest.MatcherAssert.assertThat; | 22 | import static org.hamcrest.MatcherAssert.assertThat; |
23 | import static org.hamcrest.Matchers.is; | 23 | import static org.hamcrest.Matchers.is; |
24 | import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertResults; | 24 | import static tools.refinery.store.query.interpreter.tests.QueryAssertions.assertResults; |
25 | 25 | ||
26 | class StronglyConnectedComponentsTest { | 26 | class StronglyConnectedComponentsTest { |
27 | private static final Symbol<Boolean> friend = Symbol.of("friend", 2); | 27 | private static final Symbol<Boolean> friend = Symbol.of("friend", 2); |
@@ -37,7 +37,7 @@ class StronglyConnectedComponentsTest { | |||
37 | 37 | ||
38 | var store = ModelStore.builder() | 38 | var store = ModelStore.builder() |
39 | .symbols(friend) | 39 | .symbols(friend) |
40 | .with(ViatraModelQueryAdapter.builder() | 40 | .with(QueryInterpreterAdapter.builder() |
41 | .queries(query)) | 41 | .queries(query)) |
42 | .build(); | 42 | .build(); |
43 | 43 | ||
@@ -70,7 +70,7 @@ class StronglyConnectedComponentsTest { | |||
70 | 70 | ||
71 | var store = ModelStore.builder() | 71 | var store = ModelStore.builder() |
72 | .symbols(friend) | 72 | .symbols(friend) |
73 | .with(ViatraModelQueryAdapter.builder() | 73 | .with(QueryInterpreterAdapter.builder() |
74 | .queries(query)) | 74 | .queries(query)) |
75 | .build(); | 75 | .build(); |
76 | 76 | ||
@@ -112,7 +112,7 @@ class StronglyConnectedComponentsTest { | |||
112 | 112 | ||
113 | var store = ModelStore.builder() | 113 | var store = ModelStore.builder() |
114 | .symbols(friend) | 114 | .symbols(friend) |
115 | .with(ViatraModelQueryAdapter.builder() | 115 | .with(QueryInterpreterAdapter.builder() |
116 | .queries(query)) | 116 | .queries(query)) |
117 | .build(); | 117 | .build(); |
118 | 118 | ||
@@ -149,7 +149,7 @@ class StronglyConnectedComponentsTest { | |||
149 | 149 | ||
150 | var store = ModelStore.builder() | 150 | var store = ModelStore.builder() |
151 | .symbols(person, friend) | 151 | .symbols(person, friend) |
152 | .with(ViatraModelQueryAdapter.builder() | 152 | .with(QueryInterpreterAdapter.builder() |
153 | .queries(query)) | 153 | .queries(query)) |
154 | .build(); | 154 | .build(); |
155 | 155 | ||
@@ -192,7 +192,7 @@ class StronglyConnectedComponentsTest { | |||
192 | 192 | ||
193 | var store = ModelStore.builder() | 193 | var store = ModelStore.builder() |
194 | .symbols(person, friend) | 194 | .symbols(person, friend) |
195 | .with(ViatraModelQueryAdapter.builder() | 195 | .with(QueryInterpreterAdapter.builder() |
196 | .queries(query)) | 196 | .queries(query)) |
197 | .build(); | 197 | .build(); |
198 | 198 | ||
@@ -225,7 +225,7 @@ class StronglyConnectedComponentsTest { | |||
225 | 225 | ||
226 | var store = ModelStore.builder() | 226 | var store = ModelStore.builder() |
227 | .symbols(friend) | 227 | .symbols(friend) |
228 | .with(ViatraModelQueryAdapter.builder() | 228 | .with(QueryInterpreterAdapter.builder() |
229 | .queries(query)) | 229 | .queries(query)) |
230 | .build(); | 230 | .build(); |
231 | 231 | ||
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/WeaklyConnectedComponentsTest.java b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/WeaklyConnectedComponentsTest.java index 613d4284..3fc85480 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/WeaklyConnectedComponentsTest.java +++ b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/WeaklyConnectedComponentsTest.java | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra; | 6 | package tools.refinery.store.query.interpreter; |
7 | 7 | ||
8 | import org.junit.jupiter.api.Test; | 8 | import org.junit.jupiter.api.Test; |
9 | import tools.refinery.store.model.ModelStore; | 9 | import tools.refinery.store.model.ModelStore; |
@@ -21,7 +21,7 @@ import java.util.Map; | |||
21 | 21 | ||
22 | import static org.hamcrest.MatcherAssert.assertThat; | 22 | import static org.hamcrest.MatcherAssert.assertThat; |
23 | import static org.hamcrest.Matchers.is; | 23 | import static org.hamcrest.Matchers.is; |
24 | import static tools.refinery.store.query.viatra.tests.QueryAssertions.assertResults; | 24 | import static tools.refinery.store.query.interpreter.tests.QueryAssertions.assertResults; |
25 | 25 | ||
26 | class WeaklyConnectedComponentsTest { | 26 | class WeaklyConnectedComponentsTest { |
27 | private static final Symbol<Boolean> friend = Symbol.of("friend", 2); | 27 | private static final Symbol<Boolean> friend = Symbol.of("friend", 2); |
@@ -37,7 +37,7 @@ class WeaklyConnectedComponentsTest { | |||
37 | 37 | ||
38 | var store = ModelStore.builder() | 38 | var store = ModelStore.builder() |
39 | .symbols(friend) | 39 | .symbols(friend) |
40 | .with(ViatraModelQueryAdapter.builder() | 40 | .with(QueryInterpreterAdapter.builder() |
41 | .queries(query)) | 41 | .queries(query)) |
42 | .build(); | 42 | .build(); |
43 | 43 | ||
@@ -73,7 +73,7 @@ class WeaklyConnectedComponentsTest { | |||
73 | 73 | ||
74 | var store = ModelStore.builder() | 74 | var store = ModelStore.builder() |
75 | .symbols(friend) | 75 | .symbols(friend) |
76 | .with(ViatraModelQueryAdapter.builder() | 76 | .with(QueryInterpreterAdapter.builder() |
77 | .queries(query)) | 77 | .queries(query)) |
78 | .build(); | 78 | .build(); |
79 | 79 | ||
@@ -118,7 +118,7 @@ class WeaklyConnectedComponentsTest { | |||
118 | 118 | ||
119 | var store = ModelStore.builder() | 119 | var store = ModelStore.builder() |
120 | .symbols(person, friend) | 120 | .symbols(person, friend) |
121 | .with(ViatraModelQueryAdapter.builder() | 121 | .with(QueryInterpreterAdapter.builder() |
122 | .queries(query)) | 122 | .queries(query)) |
123 | .build(); | 123 | .build(); |
124 | 124 | ||
@@ -162,7 +162,7 @@ class WeaklyConnectedComponentsTest { | |||
162 | 162 | ||
163 | var store = ModelStore.builder() | 163 | var store = ModelStore.builder() |
164 | .symbols(person, friend) | 164 | .symbols(person, friend) |
165 | .with(ViatraModelQueryAdapter.builder() | 165 | .with(QueryInterpreterAdapter.builder() |
166 | .queries(query)) | 166 | .queries(query)) |
167 | .build(); | 167 | .build(); |
168 | 168 | ||
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/matcher/MatcherUtilsTest.java b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/internal/matcher/MatcherUtilsTest.java index 319797a0..1c8044ea 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/internal/matcher/MatcherUtilsTest.java +++ b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/internal/matcher/MatcherUtilsTest.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.internal.matcher; | 6 | package tools.refinery.store.query.interpreter.internal.matcher; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.tuple.*; | 8 | import tools.refinery.interpreter.matchers.tuple.*; |
9 | import org.junit.jupiter.api.Test; | 9 | import org.junit.jupiter.api.Test; |
10 | import tools.refinery.store.tuple.Tuple; | 10 | import tools.refinery.store.tuple.Tuple; |
11 | import tools.refinery.store.tuple.*; | 11 | import tools.refinery.store.tuple.*; |
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryAssertions.java b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/tests/QueryAssertions.java index 5c1c4fc1..c4659a98 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryAssertions.java +++ b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/tests/QueryAssertions.java | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.tests; | 6 | package tools.refinery.store.query.interpreter.tests; |
7 | 7 | ||
8 | import org.junit.jupiter.api.function.Executable; | 8 | import org.junit.jupiter.api.function.Executable; |
9 | import tools.refinery.store.query.resultset.ResultSet; | 9 | import tools.refinery.store.query.resultset.ResultSet; |
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryBackendHint.java b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/tests/QueryBackendHint.java index 5f88e04b..f9d5b219 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryBackendHint.java +++ b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/tests/QueryBackendHint.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.tests; | 6 | package tools.refinery.store.query.interpreter.tests; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 8 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
9 | 9 | ||
10 | /** | 10 | /** |
11 | * Overrides {@link QueryEvaluationHint#toString()} for pretty names in parametric test names. | 11 | * Overrides {@link QueryEvaluationHint#toString()} for pretty names in parametric test names. |
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryEngineTest.java b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/tests/QueryEngineTest.java index d4f16da7..a5cc7e9c 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryEngineTest.java +++ b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/tests/QueryEngineTest.java | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.tests; | 6 | package tools.refinery.store.query.interpreter.tests; |
7 | 7 | ||
8 | import org.junit.jupiter.params.ParameterizedTest; | 8 | import org.junit.jupiter.params.ParameterizedTest; |
9 | import org.junit.jupiter.params.provider.ArgumentsSource; | 9 | import org.junit.jupiter.params.provider.ArgumentsSource; |
diff --git a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryEvaluationHintSource.java b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/tests/QueryEvaluationHintSource.java index ed356eeb..6503ff2f 100644 --- a/subprojects/store-query-viatra/src/test/java/tools/refinery/store/query/viatra/tests/QueryEvaluationHintSource.java +++ b/subprojects/store-query-interpreter/src/test/java/tools/refinery/store/query/interpreter/tests/QueryEvaluationHintSource.java | |||
@@ -3,9 +3,9 @@ | |||
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
6 | package tools.refinery.store.query.viatra.tests; | 6 | package tools.refinery.store.query.interpreter.tests; |
7 | 7 | ||
8 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | 8 | import tools.refinery.interpreter.matchers.backend.QueryEvaluationHint; |
9 | import org.junit.jupiter.api.extension.ExtensionContext; | 9 | import org.junit.jupiter.api.extension.ExtensionContext; |
10 | import org.junit.jupiter.params.provider.Arguments; | 10 | import org.junit.jupiter.params.provider.Arguments; |
11 | import org.junit.jupiter.params.provider.ArgumentsProvider; | 11 | import org.junit.jupiter.params.provider.ArgumentsProvider; |
diff --git a/subprojects/store-query-viatra/build.gradle.kts b/subprojects/store-query-viatra/build.gradle.kts deleted file mode 100644 index fa1c1da3..00000000 --- a/subprojects/store-query-viatra/build.gradle.kts +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | plugins { | ||
8 | id("tools.refinery.gradle.java-library") | ||
9 | } | ||
10 | |||
11 | dependencies { | ||
12 | api(project(":refinery-viatra-runtime")) | ||
13 | api(project(":refinery-viatra-runtime-localsearch")) | ||
14 | api(project(":refinery-viatra-runtime-rete")) | ||
15 | api(project(":refinery-viatra-runtime-rete-recipes")) | ||
16 | api(project(":refinery-store-query")) | ||
17 | implementation(libs.ecore) | ||
18 | implementation(libs.slf4j.log4j) | ||
19 | } | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryAdapter.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryAdapter.java deleted file mode 100644 index 12c93f62..00000000 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryAdapter.java +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | package tools.refinery.store.query.viatra; | ||
7 | |||
8 | import tools.refinery.store.query.ModelQueryAdapter; | ||
9 | import tools.refinery.store.query.viatra.internal.ViatraModelQueryBuilderImpl; | ||
10 | |||
11 | public interface ViatraModelQueryAdapter extends ModelQueryAdapter { | ||
12 | @Override | ||
13 | ViatraModelQueryStoreAdapter getStoreAdapter(); | ||
14 | |||
15 | static ViatraModelQueryBuilder builder() { | ||
16 | return new ViatraModelQueryBuilderImpl(); | ||
17 | } | ||
18 | } | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryBuilder.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryBuilder.java deleted file mode 100644 index d19c3bb4..00000000 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryBuilder.java +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | package tools.refinery.store.query.viatra; | ||
7 | |||
8 | import tools.refinery.store.model.ModelStore; | ||
9 | import tools.refinery.store.query.ModelQueryBuilder; | ||
10 | import tools.refinery.store.query.dnf.AnyQuery; | ||
11 | import tools.refinery.store.query.dnf.Dnf; | ||
12 | import tools.refinery.store.query.rewriter.DnfRewriter; | ||
13 | import tools.refinery.viatra.runtime.api.ViatraQueryEngineOptions; | ||
14 | import tools.refinery.viatra.runtime.matchers.backend.IQueryBackendFactory; | ||
15 | import tools.refinery.viatra.runtime.matchers.backend.QueryEvaluationHint; | ||
16 | |||
17 | import java.util.Collection; | ||
18 | import java.util.function.Function; | ||
19 | |||
20 | @SuppressWarnings("UnusedReturnValue") | ||
21 | public interface ViatraModelQueryBuilder extends ModelQueryBuilder { | ||
22 | ViatraModelQueryBuilder engineOptions(ViatraQueryEngineOptions engineOptions); | ||
23 | |||
24 | ViatraModelQueryBuilder defaultHint(QueryEvaluationHint queryEvaluationHint); | ||
25 | |||
26 | ViatraModelQueryBuilder backend(IQueryBackendFactory queryBackendFactory); | ||
27 | |||
28 | ViatraModelQueryBuilder cachingBackend(IQueryBackendFactory queryBackendFactory); | ||
29 | |||
30 | ViatraModelQueryBuilder searchBackend(IQueryBackendFactory queryBackendFactory); | ||
31 | |||
32 | @Override | ||
33 | default ViatraModelQueryBuilder queries(AnyQuery... queries) { | ||
34 | ModelQueryBuilder.super.queries(queries); | ||
35 | return this; | ||
36 | } | ||
37 | |||
38 | @Override | ||
39 | default ViatraModelQueryBuilder queries(Collection<? extends AnyQuery> queries) { | ||
40 | ModelQueryBuilder.super.queries(queries); | ||
41 | return this; | ||
42 | } | ||
43 | |||
44 | @Override | ||
45 | ViatraModelQueryBuilder query(AnyQuery query); | ||
46 | |||
47 | @Override | ||
48 | ViatraModelQueryBuilder rewriter(DnfRewriter rewriter); | ||
49 | |||
50 | ViatraModelQueryBuilder computeHint(Function<Dnf, QueryEvaluationHint> computeHint); | ||
51 | |||
52 | @Override | ||
53 | ViatraModelQueryStoreAdapter build(ModelStore store); | ||
54 | } | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryStoreAdapter.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryStoreAdapter.java deleted file mode 100644 index 588c00d4..00000000 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/ViatraModelQueryStoreAdapter.java +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | package tools.refinery.store.query.viatra; | ||
7 | |||
8 | import tools.refinery.viatra.runtime.api.ViatraQueryEngineOptions; | ||
9 | import tools.refinery.store.model.Model; | ||
10 | import tools.refinery.store.query.ModelQueryStoreAdapter; | ||
11 | |||
12 | public interface ViatraModelQueryStoreAdapter extends ModelQueryStoreAdapter { | ||
13 | ViatraQueryEngineOptions getEngineOptions(); | ||
14 | |||
15 | @Override | ||
16 | ViatraModelQueryAdapter createModelAdapter(Model model); | ||
17 | } | ||
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/RelationalScope.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/RelationalScope.java deleted file mode 100644 index 9303cae6..00000000 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/RelationalScope.java +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | package tools.refinery.store.query.viatra.internal; | ||
7 | |||
8 | import org.apache.log4j.Logger; | ||
9 | import tools.refinery.viatra.runtime.api.ViatraQueryEngine; | ||
10 | import tools.refinery.viatra.runtime.api.scope.IEngineContext; | ||
11 | import tools.refinery.viatra.runtime.api.scope.IIndexingErrorListener; | ||
12 | import tools.refinery.viatra.runtime.api.scope.QueryScope; | ||
13 | import tools.refinery.store.query.viatra.internal.context.RelationalEngineContext; | ||
14 | |||
15 | public class RelationalScope extends QueryScope { | ||
16 | private final ViatraModelQueryAdapterImpl adapter; | ||
17 | |||
18 | public RelationalScope(ViatraModelQueryAdapterImpl adapter) { | ||
19 | this.adapter = adapter; | ||
20 | } | ||
21 | |||
22 | @Override | ||
23 | protected IEngineContext createEngineContext(ViatraQueryEngine engine, IIndexingErrorListener errorListener, | ||
24 | Logger logger) { | ||
25 | return new RelationalEngineContext(adapter); | ||
26 | } | ||
27 | } | ||
diff --git a/subprojects/store-reasoning-scope/build.gradle.kts b/subprojects/store-reasoning-scope/build.gradle.kts index 6e41dc8e..7e6cd58d 100644 --- a/subprojects/store-reasoning-scope/build.gradle.kts +++ b/subprojects/store-reasoning-scope/build.gradle.kts | |||
@@ -13,5 +13,5 @@ dependencies { | |||
13 | implementation(libs.eclipseCollections.api) | 13 | implementation(libs.eclipseCollections.api) |
14 | implementation(libs.ortools) | 14 | implementation(libs.ortools) |
15 | runtimeOnly(libs.eclipseCollections) | 15 | runtimeOnly(libs.eclipseCollections) |
16 | testImplementation(project(":refinery-store-query-viatra")) | 16 | testImplementation(project(":refinery-store-query-interpreter")) |
17 | } | 17 | } |
diff --git a/subprojects/store-reasoning-scope/src/test/java/tools/refinery/store/reasoning/scope/MultiObjectTest.java b/subprojects/store-reasoning-scope/src/test/java/tools/refinery/store/reasoning/scope/MultiObjectTest.java index 0132b3f9..97b9fa5e 100644 --- a/subprojects/store-reasoning-scope/src/test/java/tools/refinery/store/reasoning/scope/MultiObjectTest.java +++ b/subprojects/store-reasoning-scope/src/test/java/tools/refinery/store/reasoning/scope/MultiObjectTest.java | |||
@@ -12,7 +12,7 @@ import tools.refinery.store.dse.propagation.PropagationResult; | |||
12 | import tools.refinery.store.model.Interpretation; | 12 | import tools.refinery.store.model.Interpretation; |
13 | import tools.refinery.store.model.Model; | 13 | import tools.refinery.store.model.Model; |
14 | import tools.refinery.store.model.ModelStore; | 14 | import tools.refinery.store.model.ModelStore; |
15 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 15 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
16 | import tools.refinery.store.reasoning.ReasoningAdapter; | 16 | import tools.refinery.store.reasoning.ReasoningAdapter; |
17 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; | 17 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; |
18 | import tools.refinery.store.reasoning.representation.PartialRelation; | 18 | import tools.refinery.store.reasoning.representation.PartialRelation; |
@@ -40,7 +40,7 @@ class MultiObjectTest { | |||
40 | @BeforeEach | 40 | @BeforeEach |
41 | void beforeEach() { | 41 | void beforeEach() { |
42 | store = ModelStore.builder() | 42 | store = ModelStore.builder() |
43 | .with(ViatraModelQueryAdapter.builder()) | 43 | .with(QueryInterpreterAdapter.builder()) |
44 | .with(PropagationAdapter.builder()) | 44 | .with(PropagationAdapter.builder()) |
45 | .with(ReasoningAdapter.builder()) | 45 | .with(ReasoningAdapter.builder()) |
46 | .with(new MultiObjectTranslator()) | 46 | .with(new MultiObjectTranslator()) |
diff --git a/subprojects/store-reasoning/build.gradle.kts b/subprojects/store-reasoning/build.gradle.kts index ed8355f3..068256c2 100644 --- a/subprojects/store-reasoning/build.gradle.kts +++ b/subprojects/store-reasoning/build.gradle.kts | |||
@@ -11,5 +11,5 @@ plugins { | |||
11 | dependencies { | 11 | dependencies { |
12 | api(project(":refinery-store-dse")) | 12 | api(project(":refinery-store-dse")) |
13 | testImplementation(testFixtures(project(":refinery-store-query"))) | 13 | testImplementation(testFixtures(project(":refinery-store-query"))) |
14 | testImplementation(project(":refinery-store-query-viatra")) | 14 | testImplementation(project(":refinery-store-query-interpreter")) |
15 | } | 15 | } |
diff --git a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/PartialModelTest.java b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/PartialModelTest.java index 77560a68..f8135102 100644 --- a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/PartialModelTest.java +++ b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/PartialModelTest.java | |||
@@ -10,7 +10,7 @@ import tools.refinery.store.model.ModelStore; | |||
10 | import tools.refinery.store.query.ModelQueryAdapter; | 10 | import tools.refinery.store.query.ModelQueryAdapter; |
11 | import tools.refinery.store.query.dnf.Query; | 11 | import tools.refinery.store.query.dnf.Query; |
12 | import tools.refinery.store.query.term.Variable; | 12 | import tools.refinery.store.query.term.Variable; |
13 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 13 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
14 | import tools.refinery.store.query.view.ForbiddenView; | 14 | import tools.refinery.store.query.view.ForbiddenView; |
15 | import tools.refinery.store.reasoning.literal.Concreteness; | 15 | import tools.refinery.store.reasoning.literal.Concreteness; |
16 | import tools.refinery.store.reasoning.representation.PartialRelation; | 16 | import tools.refinery.store.reasoning.representation.PartialRelation; |
@@ -42,7 +42,7 @@ class PartialModelTest { | |||
42 | var friendStorage = Symbol.of("friend", 2, TruthValue.class, TruthValue.UNKNOWN); | 42 | var friendStorage = Symbol.of("friend", 2, TruthValue.class, TruthValue.UNKNOWN); |
43 | 43 | ||
44 | var store = ModelStore.builder() | 44 | var store = ModelStore.builder() |
45 | .with(ViatraModelQueryAdapter.builder()) | 45 | .with(QueryInterpreterAdapter.builder()) |
46 | .with(ReasoningAdapter.builder()) | 46 | .with(ReasoningAdapter.builder()) |
47 | .with(new MultiObjectTranslator()) | 47 | .with(new MultiObjectTranslator()) |
48 | .with(PartialRelationTranslator.of(person) | 48 | .with(PartialRelationTranslator.of(person) |
diff --git a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/containment/ContainmentHierarchyTranslatorTest.java b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/containment/ContainmentHierarchyTranslatorTest.java index bbfaff84..1d0ac02d 100644 --- a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/containment/ContainmentHierarchyTranslatorTest.java +++ b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/containment/ContainmentHierarchyTranslatorTest.java | |||
@@ -8,7 +8,7 @@ package tools.refinery.store.reasoning.translator.containment; | |||
8 | import org.junit.jupiter.api.BeforeEach; | 8 | import org.junit.jupiter.api.BeforeEach; |
9 | import org.junit.jupiter.api.Test; | 9 | import org.junit.jupiter.api.Test; |
10 | import tools.refinery.store.model.ModelStore; | 10 | import tools.refinery.store.model.ModelStore; |
11 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 11 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
12 | import tools.refinery.store.reasoning.ReasoningAdapter; | 12 | import tools.refinery.store.reasoning.ReasoningAdapter; |
13 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; | 13 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; |
14 | import tools.refinery.store.reasoning.literal.Concreteness; | 14 | import tools.refinery.store.reasoning.literal.Concreteness; |
@@ -52,7 +52,7 @@ class ContainmentHierarchyTranslatorTest { | |||
52 | ); | 52 | ); |
53 | 53 | ||
54 | store = ModelStore.builder() | 54 | store = ModelStore.builder() |
55 | .with(ViatraModelQueryAdapter.builder()) | 55 | .with(QueryInterpreterAdapter.builder()) |
56 | .with(ReasoningAdapter.builder()) | 56 | .with(ReasoningAdapter.builder()) |
57 | .with(new MultiObjectTranslator()) | 57 | .with(new MultiObjectTranslator()) |
58 | .with(new TypeHierarchyTranslator(typeHierarchy)) | 58 | .with(new TypeHierarchyTranslator(typeHierarchy)) |
diff --git a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/metamodel/MetamodelTest.java b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/metamodel/MetamodelTest.java index eabbdffe..6c2f55af 100644 --- a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/metamodel/MetamodelTest.java +++ b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/metamodel/MetamodelTest.java | |||
@@ -8,7 +8,7 @@ package tools.refinery.store.reasoning.translator.metamodel; | |||
8 | import org.junit.jupiter.api.Test; | 8 | import org.junit.jupiter.api.Test; |
9 | import tools.refinery.store.model.Model; | 9 | import tools.refinery.store.model.Model; |
10 | import tools.refinery.store.model.ModelStore; | 10 | import tools.refinery.store.model.ModelStore; |
11 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 11 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
12 | import tools.refinery.store.reasoning.ReasoningAdapter; | 12 | import tools.refinery.store.reasoning.ReasoningAdapter; |
13 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; | 13 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; |
14 | import tools.refinery.store.reasoning.literal.Concreteness; | 14 | import tools.refinery.store.reasoning.literal.Concreteness; |
@@ -141,7 +141,7 @@ class MetamodelTest { | |||
141 | 141 | ||
142 | private static Model createModel(Metamodel metamodel, ModelSeed seed) { | 142 | private static Model createModel(Metamodel metamodel, ModelSeed seed) { |
143 | var store = ModelStore.builder() | 143 | var store = ModelStore.builder() |
144 | .with(ViatraModelQueryAdapter.builder()) | 144 | .with(QueryInterpreterAdapter.builder()) |
145 | .with(ReasoningAdapter.builder()) | 145 | .with(ReasoningAdapter.builder()) |
146 | .with(new MultiObjectTranslator()) | 146 | .with(new MultiObjectTranslator()) |
147 | .with(new MetamodelTranslator(metamodel)) | 147 | .with(new MetamodelTranslator(metamodel)) |
diff --git a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/multiobject/PartialCountTest.java b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/multiobject/PartialCountTest.java index 64230cf6..48a046fc 100644 --- a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/multiobject/PartialCountTest.java +++ b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/multiobject/PartialCountTest.java | |||
@@ -11,7 +11,7 @@ import tools.refinery.store.query.ModelQueryAdapter; | |||
11 | import tools.refinery.store.query.dnf.Query; | 11 | import tools.refinery.store.query.dnf.Query; |
12 | import tools.refinery.store.query.resultset.ResultSet; | 12 | import tools.refinery.store.query.resultset.ResultSet; |
13 | import tools.refinery.store.query.term.Variable; | 13 | import tools.refinery.store.query.term.Variable; |
14 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 14 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
15 | import tools.refinery.store.reasoning.ReasoningAdapter; | 15 | import tools.refinery.store.reasoning.ReasoningAdapter; |
16 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; | 16 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; |
17 | import tools.refinery.store.reasoning.literal.CountLowerBoundLiteral; | 17 | import tools.refinery.store.reasoning.literal.CountLowerBoundLiteral; |
@@ -305,7 +305,7 @@ class PartialCountTest { | |||
305 | var friendStorage = Symbol.of("friend", 2, TruthValue.class, TruthValue.FALSE); | 305 | var friendStorage = Symbol.of("friend", 2, TruthValue.class, TruthValue.FALSE); |
306 | 306 | ||
307 | var store = ModelStore.builder() | 307 | var store = ModelStore.builder() |
308 | .with(ViatraModelQueryAdapter.builder() | 308 | .with(QueryInterpreterAdapter.builder() |
309 | .query(query)) | 309 | .query(query)) |
310 | .with(ReasoningAdapter.builder()) | 310 | .with(ReasoningAdapter.builder()) |
311 | .with(new MultiObjectTranslator()) | 311 | .with(new MultiObjectTranslator()) |
diff --git a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/ConcreteSupertypeTest.java b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/ConcreteSupertypeTest.java index 3658d603..4bef9d8e 100644 --- a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/ConcreteSupertypeTest.java +++ b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/ConcreteSupertypeTest.java | |||
@@ -8,7 +8,7 @@ package tools.refinery.store.reasoning.translator.typehierarchy; | |||
8 | import org.junit.jupiter.api.BeforeEach; | 8 | import org.junit.jupiter.api.BeforeEach; |
9 | import org.junit.jupiter.api.Test; | 9 | import org.junit.jupiter.api.Test; |
10 | import tools.refinery.store.model.ModelStore; | 10 | import tools.refinery.store.model.ModelStore; |
11 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 11 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
12 | import tools.refinery.store.reasoning.ReasoningAdapter; | 12 | import tools.refinery.store.reasoning.ReasoningAdapter; |
13 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; | 13 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; |
14 | import tools.refinery.store.reasoning.literal.Concreteness; | 14 | import tools.refinery.store.reasoning.literal.Concreteness; |
@@ -34,7 +34,7 @@ class ConcreteSupertypeTest { | |||
34 | .build(); | 34 | .build(); |
35 | 35 | ||
36 | store = ModelStore.builder() | 36 | store = ModelStore.builder() |
37 | .with(ViatraModelQueryAdapter.builder()) | 37 | .with(QueryInterpreterAdapter.builder()) |
38 | .with(ReasoningAdapter.builder()) | 38 | .with(ReasoningAdapter.builder()) |
39 | .with(new TypeHierarchyTranslator(typeHierarchy)) | 39 | .with(new TypeHierarchyTranslator(typeHierarchy)) |
40 | .build(); | 40 | .build(); |
diff --git a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyPartialModelTest.java b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyPartialModelTest.java index cd9df19a..5af725bb 100644 --- a/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyPartialModelTest.java +++ b/subprojects/store-reasoning/src/test/java/tools/refinery/store/reasoning/translator/typehierarchy/TypeHierarchyPartialModelTest.java | |||
@@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test; | |||
10 | import tools.refinery.store.model.Model; | 10 | import tools.refinery.store.model.Model; |
11 | import tools.refinery.store.model.ModelStore; | 11 | import tools.refinery.store.model.ModelStore; |
12 | import tools.refinery.store.query.ModelQueryAdapter; | 12 | import tools.refinery.store.query.ModelQueryAdapter; |
13 | import tools.refinery.store.query.viatra.ViatraModelQueryAdapter; | 13 | import tools.refinery.store.query.interpreter.QueryInterpreterAdapter; |
14 | import tools.refinery.store.reasoning.ReasoningAdapter; | 14 | import tools.refinery.store.reasoning.ReasoningAdapter; |
15 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; | 15 | import tools.refinery.store.reasoning.ReasoningStoreAdapter; |
16 | import tools.refinery.store.reasoning.literal.Concreteness; | 16 | import tools.refinery.store.reasoning.literal.Concreteness; |
@@ -42,7 +42,7 @@ class TypeHierarchyPartialModelTest { | |||
42 | .build(); | 42 | .build(); |
43 | 43 | ||
44 | var store = ModelStore.builder() | 44 | var store = ModelStore.builder() |
45 | .with(ViatraModelQueryAdapter.builder()) | 45 | .with(QueryInterpreterAdapter.builder()) |
46 | .with(ReasoningAdapter.builder()) | 46 | .with(ReasoningAdapter.builder()) |
47 | .with(new TypeHierarchyTranslator(typeHierarchy)) | 47 | .with(new TypeHierarchyTranslator(typeHierarchy)) |
48 | .build(); | 48 | .build(); |
diff --git a/subprojects/viatra-runtime-localsearch/build.gradle.kts b/subprojects/viatra-runtime-localsearch/build.gradle.kts deleted file mode 100644 index d0259d95..00000000 --- a/subprojects/viatra-runtime-localsearch/build.gradle.kts +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | plugins { | ||
8 | id("tools.refinery.gradle.java-library") | ||
9 | // Vendor code from Eclipse VIATRA is maintained by the VIATRA project, | ||
10 | // so we don't need to keep track of coverage ourselves. | ||
11 | // Our own modifications are covered by tests in the `store-query-viatra` subproject. | ||
12 | id("tools.refinery.gradle.skip-coverage") | ||
13 | } | ||
14 | |||
15 | dependencies { | ||
16 | implementation(project(":refinery-viatra-runtime")) | ||
17 | implementation(libs.slf4j.log4j) | ||
18 | } | ||
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/IPlanProvider.java b/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/IPlanProvider.java deleted file mode 100644 index b74282ca..00000000 --- a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/plan/IPlanProvider.java +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2016, Grill Balázs, IncQuery Labs Ltd. | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | package tools.refinery.viatra.runtime.localsearch.plan; | ||
10 | |||
11 | import tools.refinery.viatra.runtime.localsearch.matcher.MatcherReference; | ||
12 | import tools.refinery.viatra.runtime.localsearch.matcher.integration.LocalSearchHints; | ||
13 | import tools.refinery.viatra.runtime.localsearch.planner.compiler.IOperationCompiler; | ||
14 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | ||
15 | import tools.refinery.viatra.runtime.matchers.backend.ResultProviderRequestor; | ||
16 | import tools.refinery.viatra.runtime.matchers.context.IQueryBackendContext; | ||
17 | |||
18 | /** | ||
19 | * @author Grill Balázs | ||
20 | * @since 1.4 | ||
21 | * @noreference This interface is not intended to be referenced by clients. | ||
22 | */ | ||
23 | public interface IPlanProvider { | ||
24 | |||
25 | /** | ||
26 | * @throws ViatraQueryRuntimeException | ||
27 | * @since 2.1 | ||
28 | */ | ||
29 | public IPlanDescriptor getPlan(IQueryBackendContext backend, IOperationCompiler compiler, | ||
30 | ResultProviderRequestor resultProviderRequestor, | ||
31 | LocalSearchHints configuration, MatcherReference key); | ||
32 | |||
33 | } | ||
diff --git a/subprojects/viatra-runtime-rete/build.gradle.kts b/subprojects/viatra-runtime-rete/build.gradle.kts deleted file mode 100644 index 560e8854..00000000 --- a/subprojects/viatra-runtime-rete/build.gradle.kts +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | plugins { | ||
8 | id("tools.refinery.gradle.java-library") | ||
9 | // Vendor code from Eclipse VIATRA is maintained by the VIATRA project, | ||
10 | // so we don't need to keep track of coverage ourselves. | ||
11 | // Our own modifications are covered by tests in the `store-query-viatra` subproject. | ||
12 | id("tools.refinery.gradle.skip-coverage") | ||
13 | } | ||
14 | |||
15 | dependencies { | ||
16 | implementation(project(":refinery-viatra-runtime")) | ||
17 | implementation(project(":refinery-viatra-runtime-rete-recipes")) | ||
18 | implementation(libs.slf4j.log4j) | ||
19 | } | ||
diff --git a/subprojects/viatra-runtime/build.gradle.kts b/subprojects/viatra-runtime/build.gradle.kts deleted file mode 100644 index 05c2b754..00000000 --- a/subprojects/viatra-runtime/build.gradle.kts +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | plugins { | ||
8 | id("tools.refinery.gradle.java-library") | ||
9 | // Vendor code from Eclipse VIATRA is maintained by the VIATRA project, | ||
10 | // so we don't need to keep track of coverage ourselves. | ||
11 | // Our own modifications are covered by tests in the `store-query-viatra` subproject. | ||
12 | id("tools.refinery.gradle.skip-coverage") | ||
13 | } | ||
14 | |||
15 | dependencies { | ||
16 | implementation(libs.slf4j.log4j) | ||
17 | implementation(libs.eclipseCollections) | ||
18 | implementation(libs.eclipseCollections.api) | ||
19 | } | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngineManager.java b/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngineManager.java deleted file mode 100644 index 4a256aea..00000000 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/api/ViatraQueryEngineManager.java +++ /dev/null | |||
@@ -1,191 +0,0 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2004-2008 Gabor Bergmann and Daniel Varro | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | |||
10 | package tools.refinery.viatra.runtime.api; | ||
11 | |||
12 | import tools.refinery.viatra.runtime.api.scope.QueryScope; | ||
13 | import tools.refinery.viatra.runtime.internal.apiimpl.ViatraQueryEngineImpl; | ||
14 | import tools.refinery.viatra.runtime.util.ViatraQueryLoggingUtil; | ||
15 | |||
16 | import java.lang.ref.WeakReference; | ||
17 | import java.util.*; | ||
18 | |||
19 | import static tools.refinery.viatra.runtime.matchers.util.Preconditions.checkArgument; | ||
20 | |||
21 | /** | ||
22 | * Global registry of active VIATRA Query Engines. | ||
23 | * | ||
24 | * <p> | ||
25 | * Manages an {@link ViatraQueryEngine} for each model (more precisely scope), that is created on demand. Managed engines are shared between | ||
26 | * clients querying the same model. | ||
27 | * | ||
28 | * <p> | ||
29 | * It is also possible to create private, unmanaged engines that are not shared between clients. | ||
30 | * | ||
31 | * <p> | ||
32 | * Only weak references are retained on the managed engines. So if there are no other references to the matchers or the | ||
33 | * engine, they can eventually be GC'ed, and they won't block the model from being GC'ed either. | ||
34 | * | ||
35 | * | ||
36 | * @author Bergmann Gabor | ||
37 | * | ||
38 | */ | ||
39 | public class ViatraQueryEngineManager { | ||
40 | private static ViatraQueryEngineManager instance = new ViatraQueryEngineManager(); | ||
41 | |||
42 | |||
43 | /** | ||
44 | * @return the singleton instance | ||
45 | */ | ||
46 | public static ViatraQueryEngineManager getInstance() { | ||
47 | return instance; | ||
48 | } | ||
49 | |||
50 | /** | ||
51 | * The engine manager keeps track of the managed engines via weak references only, so it will not keep unused | ||
52 | * managed engines from being garbage collected. Still, as long as the user keeps the model in memory, the | ||
53 | * associated managed engine will not be garbage collected, as it is expected to be strongly reachable from the | ||
54 | * model via the scope-specific base index or change notification listeners (see | ||
55 | * {@link BaseIndexListener#iqEngine}). | ||
56 | */ | ||
57 | Map<QueryScope, WeakReference<ViatraQueryEngineImpl>> engines; | ||
58 | |||
59 | ViatraQueryEngineManager() { | ||
60 | super(); | ||
61 | engines = new WeakHashMap<QueryScope, WeakReference<ViatraQueryEngineImpl>>(); | ||
62 | initializationListeners = new HashSet<ViatraQueryEngineInitializationListener>(); | ||
63 | } | ||
64 | |||
65 | /** | ||
66 | * Creates a managed VIATRA Query Engine at a given scope (e.g. an EMF Resource or ResourceSet, as in {@link EMFScope}) | ||
67 | * or retrieves an already existing one. Repeated invocations for a single model root will return the same engine. | ||
68 | * Consequently, the engine will be reused between different clients querying the same model, providing performance benefits. | ||
69 | * | ||
70 | * <p> | ||
71 | * The match set of any patterns will be incrementally refreshed upon updates from this scope. | ||
72 | * | ||
73 | * @param scope | ||
74 | * the scope of query evaluation; the definition of the set of model elements that this engine is operates on. | ||
75 | * Provide e.g. a {@link EMFScope} for evaluating queries on an EMF model. | ||
76 | * @return a new or previously existing engine | ||
77 | */ | ||
78 | public ViatraQueryEngine getQueryEngine(QueryScope scope) { | ||
79 | return getQueryEngine(scope, ViatraQueryEngineOptions.getDefault()); | ||
80 | } | ||
81 | |||
82 | /** | ||
83 | * Creates a managed VIATRA Query Engine at a given scope (e.g. an EMF Resource or ResourceSet, as in {@link EMFScope}) | ||
84 | * or retrieves an already existing one. Repeated invocations for a single model root will return the same engine. | ||
85 | * Consequently, the engine will be reused between different clients querying the same model, providing performance benefits. | ||
86 | * | ||
87 | * <p> | ||
88 | * The match set of any patterns will be incrementally refreshed upon updates from this scope. | ||
89 | * | ||
90 | * @param scope | ||
91 | * the scope of query evaluation; the definition of the set of model elements that this engine is operates on. | ||
92 | * Provide e.g. a {@link EMFScope} for evaluating queries on an EMF model. | ||
93 | * @return a new or previously existing engine | ||
94 | * @since 1.4 | ||
95 | */ | ||
96 | public ViatraQueryEngine getQueryEngine(QueryScope scope, ViatraQueryEngineOptions options) { | ||
97 | ViatraQueryEngineImpl engine = getEngineInternal(scope); | ||
98 | if (engine == null) { | ||
99 | engine = new ViatraQueryEngineImpl(this, scope, options); | ||
100 | engines.put(scope, new WeakReference<ViatraQueryEngineImpl>(engine)); | ||
101 | notifyInitializationListeners(engine); | ||
102 | } | ||
103 | return engine; | ||
104 | } | ||
105 | |||
106 | /** | ||
107 | * Retrieves an already existing managed VIATRA Query Engine. | ||
108 | * | ||
109 | * @param scope | ||
110 | * the scope of query evaluation; the definition of the set of model elements that this engine is operates on. | ||
111 | * Provide e.g. a {@link EMFScope} for evaluating queries on an EMF model. | ||
112 | * @return a previously existing engine, or null if no engine is active for the given EMF model root | ||
113 | */ | ||
114 | public ViatraQueryEngine getQueryEngineIfExists(QueryScope scope) { | ||
115 | return getEngineInternal(scope); | ||
116 | } | ||
117 | |||
118 | /** | ||
119 | * Collects all {@link ViatraQueryEngine} instances that still exist. | ||
120 | * | ||
121 | * @return set of engines if there is any, otherwise EMTPY_SET | ||
122 | */ | ||
123 | public Set<ViatraQueryEngine> getExistingQueryEngines(){ | ||
124 | Set<ViatraQueryEngine> existingEngines = null; | ||
125 | for (WeakReference<ViatraQueryEngineImpl> engineRef : engines.values()) { | ||
126 | AdvancedViatraQueryEngine engine = engineRef == null ? null : engineRef.get(); | ||
127 | if(existingEngines == null) { | ||
128 | existingEngines = new HashSet<>(); | ||
129 | } | ||
130 | existingEngines.add(engine); | ||
131 | } | ||
132 | if(existingEngines == null) { | ||
133 | existingEngines = Collections.emptySet(); | ||
134 | } | ||
135 | return existingEngines; | ||
136 | } | ||
137 | |||
138 | private final Set<ViatraQueryEngineInitializationListener> initializationListeners; | ||
139 | |||
140 | /** | ||
141 | * Registers a listener for new engine initialization. | ||
142 | * | ||
143 | * <p/> For removal, use {@link #removeQueryEngineInitializationListener} | ||
144 | * | ||
145 | * @param listener the listener to register | ||
146 | */ | ||
147 | public void addQueryEngineInitializationListener(ViatraQueryEngineInitializationListener listener) { | ||
148 | checkArgument(listener != null, "Cannot add null listener!"); | ||
149 | initializationListeners.add(listener); | ||
150 | } | ||
151 | |||
152 | /** | ||
153 | * Removes a registered listener added with {@link #addQueryEngineInitializationListener} | ||
154 | * | ||
155 | * @param listener | ||
156 | */ | ||
157 | public void removeQueryEngineInitializationListener(ViatraQueryEngineInitializationListener listener) { | ||
158 | checkArgument(listener != null, "Cannot remove null listener!"); | ||
159 | initializationListeners.remove(listener); | ||
160 | } | ||
161 | |||
162 | /** | ||
163 | * Notifies listeners that a new engine has been initialized. | ||
164 | * | ||
165 | * @param engine the initialized engine | ||
166 | */ | ||
167 | protected void notifyInitializationListeners(AdvancedViatraQueryEngine engine) { | ||
168 | try { | ||
169 | if (!initializationListeners.isEmpty()) { | ||
170 | for (ViatraQueryEngineInitializationListener listener : new HashSet<>(initializationListeners)) { | ||
171 | listener.engineInitialized(engine); | ||
172 | } | ||
173 | } | ||
174 | } catch (Exception ex) { | ||
175 | ViatraQueryLoggingUtil.getLogger(getClass()).fatal( | ||
176 | "VIATRA Query Engine Manager encountered an error in delivering notifications" | ||
177 | + " about engine initialization. ", ex); | ||
178 | } | ||
179 | } | ||
180 | |||
181 | /** | ||
182 | * @param emfRoot | ||
183 | * @return | ||
184 | */ | ||
185 | private ViatraQueryEngineImpl getEngineInternal(QueryScope scope) { | ||
186 | final WeakReference<ViatraQueryEngineImpl> engineRef = engines.get(scope); | ||
187 | ViatraQueryEngineImpl engine = engineRef == null ? null : engineRef.get(); | ||
188 | return engine; | ||
189 | } | ||
190 | |||
191 | } | ||
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/exception/ViatraQueryException.java b/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/exception/ViatraQueryException.java deleted file mode 100644 index fec547a6..00000000 --- a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/exception/ViatraQueryException.java +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2004-2010 Akos Horvath and Daniel Varro | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | package tools.refinery.viatra.runtime.exception; | ||
10 | |||
11 | import tools.refinery.viatra.runtime.matchers.ViatraQueryRuntimeException; | ||
12 | import tools.refinery.viatra.runtime.matchers.planning.QueryProcessingException; | ||
13 | import tools.refinery.viatra.runtime.matchers.psystem.queries.QueryInitializationException; | ||
14 | |||
15 | /** | ||
16 | * A general VIATRA Query-related problem during the operation of the VIATRA Query | ||
17 | * engine, or the loading, manipulation and evaluation of queries. | ||
18 | * | ||
19 | * @author Bergmann Gabor | ||
20 | * @since 0.9 | ||
21 | * | ||
22 | */ | ||
23 | public class ViatraQueryException extends ViatraQueryRuntimeException { | ||
24 | |||
25 | private static final long serialVersionUID = -74252748358355750L; | ||
26 | |||
27 | public static final String PARAM_NOT_SUITABLE_WITH_NO = "The type of the parameters are not suitable for the operation. Parameter number: "; | ||
28 | public static final String CONVERSION_FAILED = "Could not convert the term to the designated type"; | ||
29 | public static final String CONVERT_NULL_PARAMETER = "Could not convert null to the designated type"; | ||
30 | public static final String RELATIONAL_PARAM_UNSUITABLE = "The parameters are not acceptable by the operation"; | ||
31 | /** | ||
32 | * @since 0.9 | ||
33 | */ | ||
34 | public static final String PROCESSING_PROBLEM = "The following error occurred during the processing of a query (e.g. for the preparation of a VIATRA pattern matcher)"; | ||
35 | /** | ||
36 | * @since 0.9 | ||
37 | */ | ||
38 | public static final String QUERY_INIT_PROBLEM = "The following error occurred during the initialization of a VIATRA query specification"; | ||
39 | public static final String GETNAME_FAILED = "Could not get 'name' attribute of the result"; | ||
40 | |||
41 | public static final String INVALID_EMFROOT = "Incremental EMF query engine can only be attached on the contents of an EMF EObject, Resource, ResourceSet or multiple ResourceSets. Received instead: "; | ||
42 | public static final String INVALID_EMFROOT_SHORT = "Invalid EMF model root"; | ||
43 | // public static final String EMF_MODEL_PROCESSING_ERROR = "Error while processing the EMF model"; | ||
44 | |||
45 | private final String shortMessage; | ||
46 | |||
47 | public ViatraQueryException(String s, String shortMessage) { | ||
48 | super(s); | ||
49 | this.shortMessage = shortMessage; | ||
50 | } | ||
51 | |||
52 | public ViatraQueryException(QueryProcessingException e) { | ||
53 | super(PROCESSING_PROBLEM + ": " + e.getMessage(), e); | ||
54 | this.shortMessage = e.getShortMessage(); | ||
55 | } | ||
56 | |||
57 | public ViatraQueryException(QueryInitializationException e) { | ||
58 | super(QUERY_INIT_PROBLEM + ": " + e.getMessage(), e); | ||
59 | this.shortMessage = e.getShortMessage(); | ||
60 | } | ||
61 | |||
62 | public ViatraQueryException(String s, String shortMessage, Throwable e) { | ||
63 | super(s + ": " + e.getMessage(), e); | ||
64 | this.shortMessage = shortMessage; | ||
65 | } | ||
66 | |||
67 | public String getShortMessage() { | ||
68 | return shortMessage; | ||
69 | } | ||
70 | |||
71 | } | ||