diff options
Diffstat (limited to 'subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/DontFlattenDisjunctive.java')
-rw-r--r-- | subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/DontFlattenDisjunctive.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/DontFlattenDisjunctive.java b/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/DontFlattenDisjunctive.java new file mode 100644 index 00000000..bf1b61b5 --- /dev/null +++ b/subprojects/viatra-runtime-localsearch/src/main/java/tools/refinery/viatra/runtime/localsearch/matcher/integration/DontFlattenDisjunctive.java | |||
@@ -0,0 +1,29 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010-2018, Gabor Bergmann, 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.matcher.integration; | ||
10 | |||
11 | import tools.refinery.viatra.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
12 | import tools.refinery.viatra.runtime.matchers.psystem.rewriters.IFlattenCallPredicate; | ||
13 | |||
14 | /** | ||
15 | * Forbids flattening of patterns that have more than one body. | ||
16 | * | ||
17 | * @since 2.1 | ||
18 | |||
19 | * @author Gabor Bergmann | ||
20 | * | ||
21 | */ | ||
22 | public class DontFlattenDisjunctive implements IFlattenCallPredicate { | ||
23 | |||
24 | @Override | ||
25 | public boolean shouldFlatten(PositivePatternCall positivePatternCall) { | ||
26 | return 1 >= positivePatternCall.getReferredQuery().getDisjunctBodies().getBodies().size(); | ||
27 | } | ||
28 | |||
29 | } | ||