diff options
author | 2020-08-28 18:58:37 +0200 | |
---|---|---|
committer | 2020-08-28 18:58:37 +0200 | |
commit | 4fe7fce97aedbd516109ef81afc33e00112b7b68 (patch) | |
tree | 7eaa7c4e9b31b2a1488e49de48721b4dbad31fae /Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run | |
parent | MoDeS3 unit propagation WIP (diff) | |
download | VIATRA-Generator-4fe7fce97aedbd516109ef81afc33e00112b7b68.tar.gz VIATRA-Generator-4fe7fce97aedbd516109ef81afc33e00112b7b68.tar.zst VIATRA-Generator-4fe7fce97aedbd516109ef81afc33e00112b7b68.zip |
Must unit propagation
Diffstat (limited to 'Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run')
7 files changed, 975 insertions, 240 deletions
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3ModelGenerator.xtendbin b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3ModelGenerator.xtendbin index 4f542a67..77f1ea6e 100644 --- a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3ModelGenerator.xtendbin +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3ModelGenerator.xtendbin | |||
Binary files differ | |||
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3TypeScopeHint.xtendbin b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3TypeScopeHint.xtendbin new file mode 100644 index 00000000..4fdbb71b --- /dev/null +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3TypeScopeHint.xtendbin | |||
Binary files differ | |||
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3UnitPropagationGenerator.xtendbin b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3UnitPropagationGenerator.xtendbin index 28e763b9..e5e1b63e 100644 --- a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3UnitPropagationGenerator.xtendbin +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3UnitPropagationGenerator.xtendbin | |||
Binary files differ | |||
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.gitignore b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.gitignore index 53dcf60f..fb94df96 100644 --- a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.gitignore +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.gitignore | |||
@@ -1,2 +1,3 @@ | |||
1 | /.Modes3ModelGenerator.java._trace | 1 | /.Modes3ModelGenerator.java._trace |
2 | /.Modes3UnitPropagationGenerator.java._trace | 2 | /.Modes3UnitPropagationGenerator.java._trace |
3 | /.Modes3TypeScopeHint.java._trace | ||
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java index c7364257..f32a7172 100644 --- a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java | |||
@@ -12,7 +12,9 @@ import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; | |||
12 | import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsFactory; | 12 | import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsFactory; |
13 | import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsPackage; | 13 | import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsPackage; |
14 | import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.InverseRelationAssertion; | 14 | import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.InverseRelationAssertion; |
15 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel; | ||
15 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder; | 16 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder; |
17 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.SolutionScope; | ||
16 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput; | 18 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput; |
17 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes; | 19 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes; |
18 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.VariableContext; | 20 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.VariableContext; |
@@ -48,6 +50,7 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.par | |||
48 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RelationLink; | 50 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RelationLink; |
49 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml; | 51 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml; |
50 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationVisualisation; | 52 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationVisualisation; |
53 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DebugConfiguration; | ||
51 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy; | 54 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy; |
52 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner; | 55 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner; |
53 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration; | 56 | import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration; |
@@ -57,12 +60,13 @@ import java.util.Collections; | |||
57 | import java.util.List; | 60 | import java.util.List; |
58 | import java.util.Map; | 61 | import java.util.Map; |
59 | import java.util.Set; | 62 | import java.util.Set; |
60 | import java.util.function.Consumer; | ||
61 | import java.util.function.Predicate; | 63 | import java.util.function.Predicate; |
62 | import modes3.Modes3Factory; | 64 | import modes3.Modes3Factory; |
63 | import modes3.Modes3ModelRoot; | 65 | import modes3.Modes3ModelRoot; |
64 | import modes3.Modes3Package; | 66 | import modes3.Modes3Package; |
65 | import modes3.queries.Modes3Queries; | 67 | import modes3.queries.Modes3Queries; |
68 | import modes3.run.Modes3TypeScopeHint; | ||
69 | import modes3.run.Modes3UnitPropagationGenerator; | ||
66 | import org.eclipse.emf.common.util.EList; | 70 | import org.eclipse.emf.common.util.EList; |
67 | import org.eclipse.emf.common.util.URI; | 71 | import org.eclipse.emf.common.util.URI; |
68 | import org.eclipse.emf.ecore.EAttribute; | 72 | import org.eclipse.emf.ecore.EAttribute; |
@@ -175,29 +179,47 @@ public class Modes3ModelGenerator { | |||
175 | it_1.minNewElements = this.modelSize; | 179 | it_1.minNewElements = this.modelSize; |
176 | it_1.maxNewElements = this.modelSize; | 180 | it_1.maxNewElements = this.modelSize; |
177 | final Procedure1<Map<Type, Integer>> _function_4 = (Map<Type, Integer> it_2) -> { | 181 | final Procedure1<Map<Type, Integer>> _function_4 = (Map<Type, Integer> it_2) -> { |
178 | it_2.put(this.ecore2Logic.TypeofEClass(metamodelLogic.getTrace(), Modes3Package.eINSTANCE.getTurnout()), Integer.valueOf(1)); | ||
179 | }; | 182 | }; |
180 | ObjectExtensions.<Map<Type, Integer>>operator_doubleArrow( | 183 | ObjectExtensions.<Map<Type, Integer>>operator_doubleArrow( |
181 | it_1.minNewElementsByType, _function_4); | 184 | it_1.minNewElementsByType, _function_4); |
182 | final Procedure1<Map<Type, Integer>> _function_5 = (Map<Type, Integer> it_2) -> { | 185 | final Procedure1<Map<Type, Integer>> _function_5 = (Map<Type, Integer> it_2) -> { |
183 | it_2.put(this.ecore2Logic.TypeofEClass(metamodelLogic.getTrace(), Modes3Package.eINSTANCE.getTrain()), Integer.valueOf(5)); | 186 | it_2.put(this.ecore2Logic.TypeofEClass(metamodelLogic.getTrace(), Modes3Package.eINSTANCE.getTrain()), Integer.valueOf(5)); |
187 | it_2.put(this.ecore2Logic.TypeofEClass(metamodelLogic.getTrace(), Modes3Package.eINSTANCE.getTurnout()), Integer.valueOf(5)); | ||
184 | }; | 188 | }; |
185 | ObjectExtensions.<Map<Type, Integer>>operator_doubleArrow( | 189 | ObjectExtensions.<Map<Type, Integer>>operator_doubleArrow( |
186 | it_1.maxNewElementsByType, _function_5); | 190 | it_1.maxNewElementsByType, _function_5); |
187 | }; | 191 | }; |
188 | ObjectExtensions.<TypeScopes>operator_doubleArrow( | 192 | ObjectExtensions.<TypeScopes>operator_doubleArrow( |
189 | it.typeScopes, _function_3); | 193 | it.typeScopes, _function_3); |
190 | it.solutionScope.numberOfRequiredSolutions = 1; | 194 | final Procedure1<SolutionScope> _function_4 = (SolutionScope it_1) -> { |
195 | it_1.numberOfRequiredSolutions = 1; | ||
196 | }; | ||
197 | ObjectExtensions.<SolutionScope>operator_doubleArrow( | ||
198 | it.solutionScope, _function_4); | ||
199 | it.scopeWeight = 5; | ||
191 | it.nameNewElements = false; | 200 | it.nameNewElements = false; |
192 | it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis; | 201 | it.typeInferenceMethod = TypeInferenceMethod.PreliminaryAnalysis; |
193 | it.stateCoderStrategy = StateCoderStrategy.Neighbourhood; | 202 | it.stateCoderStrategy = StateCoderStrategy.PairwiseNeighbourhood; |
194 | ScopePropagatorStrategy.Polyhedral _polyhedral = new ScopePropagatorStrategy.Polyhedral( | 203 | ScopePropagatorStrategy.Polyhedral _polyhedral = new ScopePropagatorStrategy.Polyhedral( |
195 | PolyhedralScopePropagatorConstraints.Relational, PolyhedralScopePropagatorSolver.Clp); | 204 | PolyhedralScopePropagatorConstraints.Relational, PolyhedralScopePropagatorSolver.Clp); |
196 | it.scopePropagatorStrategy = _polyhedral; | 205 | it.scopePropagatorStrategy = _polyhedral; |
197 | it.debugConfiguration.partialInterpretatioVisualiser = null; | 206 | Ecore2Logic_Trace _trace = metamodelLogic.getTrace(); |
207 | Modes3TypeScopeHint _modes3TypeScopeHint = new Modes3TypeScopeHint(this.ecore2Logic, _trace); | ||
208 | it.hints.add(_modes3TypeScopeHint); | ||
209 | Ecore2Logic_Trace _trace_1 = metamodelLogic.getTrace(); | ||
210 | Modes3UnitPropagationGenerator _modes3UnitPropagationGenerator = new Modes3UnitPropagationGenerator(this.ecore2Logic, _trace_1); | ||
211 | it.unitPropagationPatternGenerators.add(_modes3UnitPropagationGenerator); | ||
212 | final Procedure1<DebugConfiguration> _function_5 = (DebugConfiguration it_1) -> { | ||
213 | GraphvizVisualiser _graphvizVisualiser = new GraphvizVisualiser(); | ||
214 | it_1.partialInterpretatioVisualiser = _graphvizVisualiser; | ||
215 | }; | ||
216 | ObjectExtensions.<DebugConfiguration>operator_doubleArrow( | ||
217 | it.debugConfiguration, _function_5); | ||
218 | it.documentationLevel = DocumentationLevel.NORMAL; | ||
198 | }; | 219 | }; |
199 | final ViatraReasonerConfiguration config = ObjectExtensions.<ViatraReasonerConfiguration>operator_doubleArrow(_viatraReasonerConfiguration, _function_2); | 220 | final ViatraReasonerConfiguration config = ObjectExtensions.<ViatraReasonerConfiguration>operator_doubleArrow(_viatraReasonerConfiguration, _function_2); |
200 | final FileSystemWorkspace workspace = new FileSystemWorkspace("output/", ""); | 221 | final FileSystemWorkspace workspace = new FileSystemWorkspace("output/", ""); |
222 | workspace.writeModel(logic.getOutput(), "problem.logicproblem"); | ||
201 | final LogicResult solution = this.solver.solve(logic.getOutput(), config, workspace); | 223 | final LogicResult solution = this.solver.solve(logic.getOutput(), config, workspace); |
202 | URI _xifexpression = null; | 224 | URI _xifexpression = null; |
203 | if ((solution instanceof ModelResult)) { | 225 | if ((solution instanceof ModelResult)) { |
@@ -226,27 +248,23 @@ public class Modes3ModelGenerator { | |||
226 | boolean _lessThan = (_size_1 < 160); | 248 | boolean _lessThan = (_size_1 < 160); |
227 | if (_lessThan) { | 249 | if (_lessThan) { |
228 | if ((representation instanceof PartialInterpretation)) { | 250 | if ((representation instanceof PartialInterpretation)) { |
229 | final Consumer<Type> _function_3 = (Type it) -> { | 251 | final Function1<Type, Boolean> _function_3 = (Type it) -> { |
230 | InputOutput.<String>println(it.getName()); | ||
231 | }; | ||
232 | ((PartialInterpretation)representation).getProblem().getTypes().forEach(_function_3); | ||
233 | final Function1<Type, Boolean> _function_4 = (Type it) -> { | ||
234 | String _name_2 = it.getName(); | 252 | String _name_2 = it.getName(); |
235 | return Boolean.valueOf(Objects.equal(_name_2, "Modes3ModelRoot class DefinedPart")); | 253 | return Boolean.valueOf(Objects.equal(_name_2, "Modes3ModelRoot class DefinedPart")); |
236 | }; | 254 | }; |
237 | Type _findFirst = IterableExtensions.<Type>findFirst(((PartialInterpretation)representation).getProblem().getTypes(), _function_4); | 255 | Type _findFirst = IterableExtensions.<Type>findFirst(((PartialInterpretation)representation).getProblem().getTypes(), _function_3); |
238 | final TypeDefinition rootType = ((TypeDefinition) _findFirst); | 256 | final TypeDefinition rootType = ((TypeDefinition) _findFirst); |
239 | final Function1<PartialComplexTypeInterpretation, Boolean> _function_5 = (PartialComplexTypeInterpretation it) -> { | 257 | final Function1<PartialComplexTypeInterpretation, Boolean> _function_4 = (PartialComplexTypeInterpretation it) -> { |
240 | String _name_2 = it.getInterpretationOf().getName(); | 258 | String _name_2 = it.getInterpretationOf().getName(); |
241 | return Boolean.valueOf(Objects.equal(_name_2, "Modes3ModelRoot class")); | 259 | return Boolean.valueOf(Objects.equal(_name_2, "Modes3ModelRoot class")); |
242 | }; | 260 | }; |
243 | final PartialComplexTypeInterpretation rootIntepretation = IterableExtensions.<PartialComplexTypeInterpretation>findFirst(Iterables.<PartialComplexTypeInterpretation>filter(((PartialInterpretation)representation).getPartialtypeinterpratation(), | 261 | final PartialComplexTypeInterpretation rootIntepretation = IterableExtensions.<PartialComplexTypeInterpretation>findFirst(Iterables.<PartialComplexTypeInterpretation>filter(((PartialInterpretation)representation).getPartialtypeinterpratation(), |
244 | PartialComplexTypeInterpretation.class), _function_5); | 262 | PartialComplexTypeInterpretation.class), _function_4); |
245 | rootIntepretation.getElements().removeAll(rootType.getElements()); | 263 | rootIntepretation.getElements().removeAll(rootType.getElements()); |
246 | ((PartialInterpretation)representation).getProblem().getElements().removeAll(rootType.getElements()); | 264 | ((PartialInterpretation)representation).getProblem().getElements().removeAll(rootType.getElements()); |
247 | EList<PartialRelationInterpretation> _partialrelationinterpretation = ((PartialInterpretation)representation).getPartialrelationinterpretation(); | 265 | EList<PartialRelationInterpretation> _partialrelationinterpretation = ((PartialInterpretation)representation).getPartialrelationinterpretation(); |
248 | for (final PartialRelationInterpretation relationInterpretation : _partialrelationinterpretation) { | 266 | for (final PartialRelationInterpretation relationInterpretation : _partialrelationinterpretation) { |
249 | final Predicate<RelationLink> _function_6 = (RelationLink link) -> { | 267 | final Predicate<RelationLink> _function_5 = (RelationLink link) -> { |
250 | boolean _xifexpression_1 = false; | 268 | boolean _xifexpression_1 = false; |
251 | if ((link instanceof BinaryElementRelationLink)) { | 269 | if ((link instanceof BinaryElementRelationLink)) { |
252 | _xifexpression_1 = (rootType.getElements().contains(((BinaryElementRelationLink)link).getParam1()) || rootType.getElements().contains(((BinaryElementRelationLink)link).getParam2())); | 270 | _xifexpression_1 = (rootType.getElements().contains(((BinaryElementRelationLink)link).getParam1()) || rootType.getElements().contains(((BinaryElementRelationLink)link).getParam2())); |
@@ -255,7 +273,7 @@ public class Modes3ModelGenerator { | |||
255 | } | 273 | } |
256 | return _xifexpression_1; | 274 | return _xifexpression_1; |
257 | }; | 275 | }; |
258 | relationInterpretation.getRelationlinks().removeIf(_function_6); | 276 | relationInterpretation.getRelationlinks().removeIf(_function_5); |
259 | } | 277 | } |
260 | rootType.getElements().clear(); | 278 | rootType.getElements().clear(); |
261 | } | 279 | } |
@@ -349,13 +367,7 @@ public class Modes3ModelGenerator { | |||
349 | Viatra2LogicAnnotationsPackage.eINSTANCE.getClass(); | 367 | Viatra2LogicAnnotationsPackage.eINSTANCE.getClass(); |
350 | Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); | 368 | Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); |
351 | XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); | 369 | XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); |
352 | _extensionToFactoryMap.put("ecore", _xMIResourceFactoryImpl); | 370 | _xblockexpression = _extensionToFactoryMap.put("*", _xMIResourceFactoryImpl); |
353 | Map<String, Object> _extensionToFactoryMap_1 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); | ||
354 | XMIResourceFactoryImpl _xMIResourceFactoryImpl_1 = new XMIResourceFactoryImpl(); | ||
355 | _extensionToFactoryMap_1.put("logicproblem", _xMIResourceFactoryImpl_1); | ||
356 | Map<String, Object> _extensionToFactoryMap_2 = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); | ||
357 | XMIResourceFactoryImpl _xMIResourceFactoryImpl_2 = new XMIResourceFactoryImpl(); | ||
358 | _xblockexpression = _extensionToFactoryMap_2.put("partialinterpretation", _xMIResourceFactoryImpl_2); | ||
359 | } | 371 | } |
360 | return _xblockexpression; | 372 | return _xblockexpression; |
361 | } | 373 | } |
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3TypeScopeHint.java b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3TypeScopeHint.java new file mode 100644 index 00000000..adb69760 --- /dev/null +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3TypeScopeHint.java | |||
@@ -0,0 +1,133 @@ | |||
1 | package modes3.run; | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic; | ||
4 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace; | ||
5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type; | ||
6 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.Modality; | ||
7 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearBoundedExpression; | ||
8 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeConstraintHint; | ||
9 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.LinearTypeExpressionBuilderFactory; | ||
10 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.cardinality.RelationConstraintUpdater; | ||
11 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.PatternGenerator; | ||
12 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation; | ||
13 | import java.util.Iterator; | ||
14 | import java.util.Map; | ||
15 | import modes3.Modes3Package; | ||
16 | import modes3.queries.Adjacent; | ||
17 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
18 | import org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher; | ||
19 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery; | ||
20 | import org.eclipse.xtend2.lib.StringConcatenation; | ||
21 | import org.eclipse.xtext.xbase.lib.Extension; | ||
22 | |||
23 | @SuppressWarnings("all") | ||
24 | public class Modes3TypeScopeHint implements LinearTypeConstraintHint { | ||
25 | private static final String TURNOUT_NEIGHBOR_COUNT = "turnoutNeighborCount"; | ||
26 | |||
27 | private final Type segmentType; | ||
28 | |||
29 | private final Type turnoutType; | ||
30 | |||
31 | public Modes3TypeScopeHint(@Extension final Ecore2Logic ecore2Logic, final Ecore2Logic_Trace ecore2LogicTrace) { | ||
32 | @Extension | ||
33 | final Modes3Package Modes3Package = modes3.Modes3Package.eINSTANCE; | ||
34 | this.segmentType = ecore2Logic.TypeofEClass(ecore2LogicTrace, Modes3Package.getSegment()); | ||
35 | this.turnoutType = ecore2Logic.TypeofEClass(ecore2LogicTrace, Modes3Package.getTurnout()); | ||
36 | } | ||
37 | |||
38 | @Override | ||
39 | public CharSequence getAdditionalPatterns(@Extension final PatternGenerator patternGenerator, final Map<String, PQuery> fqnToPQuery) { | ||
40 | StringConcatenation _builder = new StringConcatenation(); | ||
41 | _builder.append("\t"); | ||
42 | _builder.append("pattern "); | ||
43 | _builder.append(Modes3TypeScopeHint.TURNOUT_NEIGHBOR_COUNT, "\t"); | ||
44 | _builder.append("_helper(problem: LogicProblem, interpretation: PartialInterpretation, source: DefinedElement, target: DefinedElement) {"); | ||
45 | _builder.newLineIfNotEmpty(); | ||
46 | _builder.append("\t\t"); | ||
47 | _builder.append("find interpretation(problem, interpretation);"); | ||
48 | _builder.newLine(); | ||
49 | _builder.append("\t\t"); | ||
50 | _builder.append("find mustExist(problem, interpretation, source);"); | ||
51 | _builder.newLine(); | ||
52 | _builder.append("\t\t"); | ||
53 | _builder.append("find mustExist(problem, interpretation, target);"); | ||
54 | _builder.newLine(); | ||
55 | _builder.append("\t\t"); | ||
56 | CharSequence _referInstanceOf = patternGenerator.getTypeIndexer().referInstanceOf(this.turnoutType, Modality.MUST, "source"); | ||
57 | _builder.append(_referInstanceOf, "\t\t"); | ||
58 | _builder.newLineIfNotEmpty(); | ||
59 | _builder.append("\t\t"); | ||
60 | CharSequence _referInstanceOf_1 = patternGenerator.getTypeIndexer().referInstanceOf(this.segmentType, Modality.MUST, "target"); | ||
61 | _builder.append(_referInstanceOf_1, "\t\t"); | ||
62 | _builder.newLineIfNotEmpty(); | ||
63 | _builder.append("\t\t"); | ||
64 | CharSequence _referPattern = patternGenerator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Adjacent.instance().getFullyQualifiedName()), new String[] { "source", "target" }, Modality.MUST, true, false); | ||
65 | _builder.append(_referPattern, "\t\t"); | ||
66 | _builder.newLineIfNotEmpty(); | ||
67 | _builder.append("\t"); | ||
68 | _builder.append("}"); | ||
69 | _builder.newLine(); | ||
70 | _builder.newLine(); | ||
71 | _builder.append("\t"); | ||
72 | _builder.append("pattern "); | ||
73 | _builder.append(Modes3TypeScopeHint.TURNOUT_NEIGHBOR_COUNT, "\t"); | ||
74 | _builder.append("(problem: LogicProblem, interpretation: PartialInterpretation, element: DefinedElement, N) {"); | ||
75 | _builder.newLineIfNotEmpty(); | ||
76 | _builder.append("\t\t"); | ||
77 | _builder.append("find interpretation(problem, interpretation);"); | ||
78 | _builder.newLine(); | ||
79 | _builder.append("\t\t"); | ||
80 | _builder.append("find mustExist(problem, interpretation, element);"); | ||
81 | _builder.newLine(); | ||
82 | _builder.append("\t\t"); | ||
83 | CharSequence _referInstanceOf_2 = patternGenerator.getTypeIndexer().referInstanceOf(this.turnoutType, Modality.MUST, "element"); | ||
84 | _builder.append(_referInstanceOf_2, "\t\t"); | ||
85 | _builder.newLineIfNotEmpty(); | ||
86 | _builder.append("\t\t"); | ||
87 | _builder.append("N == count find "); | ||
88 | _builder.append(Modes3TypeScopeHint.TURNOUT_NEIGHBOR_COUNT, "\t\t"); | ||
89 | _builder.append("_helper(problem, interpretation, element, _);"); | ||
90 | _builder.newLineIfNotEmpty(); | ||
91 | _builder.append("\t"); | ||
92 | _builder.append("}"); | ||
93 | _builder.newLine(); | ||
94 | return _builder; | ||
95 | } | ||
96 | |||
97 | @Override | ||
98 | public RelationConstraintUpdater createConstraintUpdater(final LinearTypeExpressionBuilderFactory builderFactory) { | ||
99 | final ViatraQueryMatcher<? extends IPatternMatch> turnoutNeighborCountMatcher = builderFactory.createMatcher(Modes3TypeScopeHint.TURNOUT_NEIGHBOR_COUNT); | ||
100 | final LinearBoundedExpression newNeighbors = builderFactory.createBuilder().add(1, this.segmentType).build(); | ||
101 | final RelationConstraintUpdater _function = (PartialInterpretation partialInterpretation) -> { | ||
102 | final int requiredNeighbbors = Modes3TypeScopeHint.getRemainingCount(turnoutNeighborCountMatcher, partialInterpretation, 3); | ||
103 | newNeighbors.tightenLowerBound(Integer.valueOf(requiredNeighbbors)); | ||
104 | }; | ||
105 | return _function; | ||
106 | } | ||
107 | |||
108 | private static <T extends IPatternMatch> int getRemainingCount(final ViatraQueryMatcher<T> matcher, final PartialInterpretation partialInterpretation, final int capacity) { | ||
109 | int _xblockexpression = (int) 0; | ||
110 | { | ||
111 | final T partialMatch = matcher.newEmptyMatch(); | ||
112 | partialMatch.set(0, partialInterpretation.getProblem()); | ||
113 | partialMatch.set(1, partialInterpretation); | ||
114 | final Iterator<T> iterator = matcher.streamAllMatches(partialMatch).iterator(); | ||
115 | int max = 0; | ||
116 | while (iterator.hasNext()) { | ||
117 | { | ||
118 | final T match = iterator.next(); | ||
119 | Object _get = match.get(3); | ||
120 | final int n = ((Integer) _get).intValue(); | ||
121 | if ((n < capacity)) { | ||
122 | final int required = (capacity - n); | ||
123 | if ((max < required)) { | ||
124 | max = required; | ||
125 | } | ||
126 | } | ||
127 | } | ||
128 | } | ||
129 | _xblockexpression = max; | ||
130 | } | ||
131 | return _xblockexpression; | ||
132 | } | ||
133 | } | ||
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3UnitPropagationGenerator.java b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3UnitPropagationGenerator.java index 91adaaaa..5c5f82c5 100644 --- a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3UnitPropagationGenerator.java +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3UnitPropagationGenerator.java | |||
@@ -10,9 +10,8 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.patterns.UnitPropaga | |||
10 | import java.util.Collections; | 10 | import java.util.Collections; |
11 | import java.util.Map; | 11 | import java.util.Map; |
12 | import modes3.Modes3Package; | 12 | import modes3.Modes3Package; |
13 | import modes3.queries.ExtraInputOfTurnout; | 13 | import modes3.queries.Adjacent; |
14 | import modes3.queries.Output; | 14 | import modes3.queries.Output; |
15 | import modes3.queries.TurnoutOutput; | ||
16 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery; | 15 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQuery; |
17 | import org.eclipse.xtend2.lib.StringConcatenationClient; | 16 | import org.eclipse.xtend2.lib.StringConcatenationClient; |
18 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; | 17 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; |
@@ -23,16 +22,20 @@ import org.eclipse.xtext.xbase.lib.Pair; | |||
23 | public class Modes3UnitPropagationGenerator implements UnitPropagationPatternGenerator { | 22 | public class Modes3UnitPropagationGenerator implements UnitPropagationPatternGenerator { |
24 | private static final String MUST_NOT_CONNECTED_TO = "mustNotConnectedTo"; | 23 | private static final String MUST_NOT_CONNECTED_TO = "mustNotConnectedTo"; |
25 | 24 | ||
26 | private static final String MUST_NOT_CONNECTED_TO_HELPER = "mustNotConnectedTo_helper"; | ||
27 | |||
28 | private static final String MUST_NOT_TURNOUT_OUTPUT = "mustNotTurnoutOutput"; | ||
29 | |||
30 | private static final String MUST_NOT_STRAIGHT = "mustNotStraight"; | 25 | private static final String MUST_NOT_STRAIGHT = "mustNotStraight"; |
31 | 26 | ||
32 | private static final String MUST_NOT_DIVERGENT = "mustNotDivergent"; | 27 | private static final String MUST_NOT_DIVERGENT = "mustNotDivergent"; |
33 | 28 | ||
29 | private static final String MUST_CONNECTED_TO = "mustConnectedTo"; | ||
30 | |||
31 | private static final String MUST_STRAIGHT = "mustStraight"; | ||
32 | |||
33 | private static final String MUST_DIVERGENT = "mustDivergent"; | ||
34 | |||
34 | private final Type segmentType; | 35 | private final Type segmentType; |
35 | 36 | ||
37 | private final Type simpleSegmentType; | ||
38 | |||
36 | private final Type turnoutType; | 39 | private final Type turnoutType; |
37 | 40 | ||
38 | private final Relation connectedToRelation; | 41 | private final Relation connectedToRelation; |
@@ -45,6 +48,7 @@ public class Modes3UnitPropagationGenerator implements UnitPropagationPatternGen | |||
45 | @Extension | 48 | @Extension |
46 | final Modes3Package Modes3Package = modes3.Modes3Package.eINSTANCE; | 49 | final Modes3Package Modes3Package = modes3.Modes3Package.eINSTANCE; |
47 | this.segmentType = ecore2Logic.TypeofEClass(ecore2LogicTrace, Modes3Package.getSegment()); | 50 | this.segmentType = ecore2Logic.TypeofEClass(ecore2LogicTrace, Modes3Package.getSegment()); |
51 | this.simpleSegmentType = ecore2Logic.TypeofEClass(ecore2LogicTrace, Modes3Package.getSimpleSegment()); | ||
48 | this.turnoutType = ecore2Logic.TypeofEClass(ecore2LogicTrace, Modes3Package.getTurnout()); | 52 | this.turnoutType = ecore2Logic.TypeofEClass(ecore2LogicTrace, Modes3Package.getTurnout()); |
49 | this.connectedToRelation = ecore2Logic.relationOfReference(ecore2LogicTrace, Modes3Package.getSegment_ConnectedTo()); | 53 | this.connectedToRelation = ecore2Logic.relationOfReference(ecore2LogicTrace, Modes3Package.getSegment_ConnectedTo()); |
50 | this.straightRelation = ecore2Logic.relationOfReference(ecore2LogicTrace, Modes3Package.getTurnout_Straight()); | 54 | this.straightRelation = ecore2Logic.relationOfReference(ecore2LogicTrace, Modes3Package.getTurnout_Straight()); |
@@ -53,7 +57,10 @@ public class Modes3UnitPropagationGenerator implements UnitPropagationPatternGen | |||
53 | 57 | ||
54 | @Override | 58 | @Override |
55 | public Map<Relation, String> getMustPatterns() { | 59 | public Map<Relation, String> getMustPatterns() { |
56 | return CollectionLiterals.<Relation, String>emptyMap(); | 60 | Pair<Relation, String> _mappedTo = Pair.<Relation, String>of(this.connectedToRelation, Modes3UnitPropagationGenerator.MUST_CONNECTED_TO); |
61 | Pair<Relation, String> _mappedTo_1 = Pair.<Relation, String>of(this.straightRelation, Modes3UnitPropagationGenerator.MUST_STRAIGHT); | ||
62 | Pair<Relation, String> _mappedTo_2 = Pair.<Relation, String>of(this.divergentRelation, Modes3UnitPropagationGenerator.MUST_DIVERGENT); | ||
63 | return Collections.<Relation, String>unmodifiableMap(CollectionLiterals.<Relation, String>newHashMap(_mappedTo, _mappedTo_1, _mappedTo_2)); | ||
57 | } | 64 | } |
58 | 65 | ||
59 | @Override | 66 | @Override |
@@ -89,496 +96,1078 @@ public class Modes3UnitPropagationGenerator implements UnitPropagationPatternGen | |||
89 | _builder.newLine(); | 96 | _builder.newLine(); |
90 | } | 97 | } |
91 | }; | 98 | }; |
92 | final StringConcatenationClient commonParameterConstraints = _client_1; | 99 | final StringConcatenationClient commonMustParameterConstraints = _client_1; |
93 | StringConcatenationClient _client_2 = new StringConcatenationClient() { | 100 | StringConcatenationClient _client_2 = new StringConcatenationClient() { |
94 | @Override | 101 | @Override |
95 | protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { | 102 | protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { |
103 | _builder.append("find interpretation(problem, interpretation);"); | ||
104 | _builder.newLine(); | ||
105 | _builder.append("find mayExist(problem, interpretation, source);"); | ||
106 | _builder.newLine(); | ||
107 | _builder.append("find mayExist(problem, interpretation, target);"); | ||
108 | _builder.newLine(); | ||
109 | } | ||
110 | }; | ||
111 | final StringConcatenationClient commonMayParameterConstraints = _client_2; | ||
112 | StringConcatenationClient _client_3 = new StringConcatenationClient() { | ||
113 | @Override | ||
114 | protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { | ||
115 | _builder.append("pattern mayInput("); | ||
116 | _builder.append(parameters); | ||
117 | _builder.append(") {"); | ||
118 | _builder.newLineIfNotEmpty(); | ||
119 | _builder.append("\t"); | ||
120 | _builder.append(commonMayParameterConstraints, "\t"); | ||
121 | _builder.newLineIfNotEmpty(); | ||
122 | _builder.append("\t"); | ||
123 | CharSequence _referInstanceOf = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MAY, "target"); | ||
124 | _builder.append(_referInstanceOf, "\t"); | ||
125 | _builder.newLineIfNotEmpty(); | ||
126 | _builder.append("\t"); | ||
127 | CharSequence _referPattern = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Adjacent.instance().getFullyQualifiedName()), new String[] { "target", "source" }, Modality.MAY, true, false); | ||
128 | _builder.append(_referPattern, "\t"); | ||
129 | _builder.newLineIfNotEmpty(); | ||
130 | _builder.append("\t"); | ||
131 | _builder.append("neg "); | ||
132 | CharSequence _referRelation = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "target", "source", Modality.MUST, fqnToPQuery); | ||
133 | _builder.append(_referRelation, "\t"); | ||
134 | _builder.newLineIfNotEmpty(); | ||
135 | _builder.append("\t"); | ||
136 | _builder.append("neg "); | ||
137 | CharSequence _referRelation_1 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "target", "source", Modality.MUST, fqnToPQuery); | ||
138 | _builder.append(_referRelation_1, "\t"); | ||
139 | _builder.newLineIfNotEmpty(); | ||
140 | _builder.append("}"); | ||
141 | _builder.newLine(); | ||
142 | _builder.newLine(); | ||
143 | _builder.append("pattern multipleMayInput(problem: LogicProblem, interpretation: PartialInterpretation,"); | ||
144 | _builder.newLine(); | ||
145 | _builder.append("\t\t\t"); | ||
146 | _builder.append("target: DefinedElement) {"); | ||
147 | _builder.newLine(); | ||
148 | _builder.append("\t"); | ||
149 | _builder.append("find interpretation(problem, interpretation);"); | ||
150 | _builder.newLine(); | ||
151 | _builder.append("\t"); | ||
152 | _builder.append("find mustExist(problem, interpretation, target);"); | ||
153 | _builder.newLine(); | ||
154 | _builder.append("\t"); | ||
155 | _builder.append("find mayInput(problem, interpretaton, source1, target);"); | ||
156 | _builder.newLine(); | ||
157 | _builder.append("\t"); | ||
158 | _builder.append("find mayInput(problem, interpretaton, source2, target);"); | ||
159 | _builder.newLine(); | ||
160 | _builder.append("\t"); | ||
161 | _builder.append("neg find mustEquivalent(problem, interpretation, source1, source2);"); | ||
162 | _builder.newLine(); | ||
163 | _builder.append("}"); | ||
164 | _builder.newLine(); | ||
165 | _builder.newLine(); | ||
166 | _builder.append("pattern multipleMayStraight(problem: LogicProblem, interpretation: PartialInterpretation,"); | ||
167 | _builder.newLine(); | ||
168 | _builder.append("\t\t\t"); | ||
169 | _builder.append("source: DefinedElement) {"); | ||
170 | _builder.newLine(); | ||
171 | _builder.append("\t"); | ||
172 | _builder.append("find interpretation(problem, interpretation);"); | ||
173 | _builder.newLine(); | ||
174 | _builder.append("\t"); | ||
175 | _builder.append("find mustExist(problem, interpretation, source);"); | ||
176 | _builder.newLine(); | ||
177 | _builder.append("\t"); | ||
178 | CharSequence _referInstanceOf_1 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MAY, "source"); | ||
179 | _builder.append(_referInstanceOf_1, "\t"); | ||
180 | _builder.newLineIfNotEmpty(); | ||
181 | _builder.append("\t"); | ||
182 | CharSequence _referRelation_2 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "source", "target1", Modality.MAY, fqnToPQuery); | ||
183 | _builder.append(_referRelation_2, "\t"); | ||
184 | _builder.newLineIfNotEmpty(); | ||
185 | _builder.append("\t"); | ||
186 | CharSequence _referRelation_3 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "source", "target2", Modality.MAY, fqnToPQuery); | ||
187 | _builder.append(_referRelation_3, "\t"); | ||
188 | _builder.newLineIfNotEmpty(); | ||
189 | _builder.append("\t"); | ||
190 | _builder.append("neg find mustEquivalent(problem, interpretation, target1, target2);"); | ||
191 | _builder.newLine(); | ||
192 | _builder.append("}"); | ||
193 | _builder.newLine(); | ||
194 | _builder.newLine(); | ||
195 | _builder.append("pattern multipleMayDivergent(problem: LogicProblem, interpretation: PartialInterpretation,"); | ||
196 | _builder.newLine(); | ||
197 | _builder.append("\t\t\t"); | ||
198 | _builder.append("source: DefinedElement) {"); | ||
199 | _builder.newLine(); | ||
200 | _builder.append("\t"); | ||
201 | _builder.append("find interpretation(problem, interpretation);"); | ||
202 | _builder.newLine(); | ||
203 | _builder.append("\t"); | ||
204 | _builder.append("find mustExist(problem, interpretation, source);"); | ||
205 | _builder.newLine(); | ||
206 | _builder.append("\t"); | ||
207 | CharSequence _referInstanceOf_2 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MAY, "source"); | ||
208 | _builder.append(_referInstanceOf_2, "\t"); | ||
209 | _builder.newLineIfNotEmpty(); | ||
210 | _builder.append("\t"); | ||
211 | CharSequence _referRelation_4 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "source", "target1", Modality.MAY, fqnToPQuery); | ||
212 | _builder.append(_referRelation_4, "\t"); | ||
213 | _builder.newLineIfNotEmpty(); | ||
214 | _builder.append("\t"); | ||
215 | CharSequence _referRelation_5 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "source", "target2", Modality.MAY, fqnToPQuery); | ||
216 | _builder.append(_referRelation_5, "\t"); | ||
217 | _builder.newLineIfNotEmpty(); | ||
218 | _builder.append("\t"); | ||
219 | _builder.append("neg find mustEquivalent(problem, interpretation, target1, target2);"); | ||
220 | _builder.newLine(); | ||
221 | _builder.append("}"); | ||
222 | _builder.newLine(); | ||
223 | _builder.newLine(); | ||
96 | _builder.append("pattern "); | 224 | _builder.append("pattern "); |
97 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_CONNECTED_TO_HELPER); | 225 | _builder.append(Modes3UnitPropagationGenerator.MUST_CONNECTED_TO); |
98 | _builder.append("("); | 226 | _builder.append("("); |
99 | _builder.append(parameters); | 227 | _builder.append(parameters); |
100 | _builder.append(") {"); | 228 | _builder.append(") {"); |
101 | _builder.newLineIfNotEmpty(); | 229 | _builder.newLineIfNotEmpty(); |
102 | _builder.append("\t"); | 230 | _builder.append("\t"); |
103 | _builder.append("// connectedToReflexive unit propagation"); | 231 | _builder.append(commonMustParameterConstraints, "\t"); |
232 | _builder.newLineIfNotEmpty(); | ||
233 | _builder.append("\t"); | ||
234 | CharSequence _referInstanceOf_3 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MAY, "target"); | ||
235 | _builder.append(_referInstanceOf_3, "\t"); | ||
236 | _builder.newLineIfNotEmpty(); | ||
237 | _builder.append("\t"); | ||
238 | _builder.append("find mayInput(problem, interpretaton, source, target);"); | ||
239 | _builder.newLine(); | ||
240 | _builder.append("\t"); | ||
241 | _builder.append("neg find multipleMayInput(problem, interpretaton, target);"); | ||
104 | _builder.newLine(); | 242 | _builder.newLine(); |
105 | _builder.append("\t"); | 243 | _builder.append("\t"); |
106 | _builder.append(commonParameterConstraints, "\t"); | 244 | CharSequence _referRelation_6 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "source", "target", Modality.MAY, fqnToPQuery); |
245 | _builder.append(_referRelation_6, "\t"); | ||
107 | _builder.newLineIfNotEmpty(); | 246 | _builder.newLineIfNotEmpty(); |
108 | _builder.append("\t"); | 247 | _builder.append("\t"); |
109 | CharSequence _referInstanceOf = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "source"); | 248 | _builder.append("neg "); |
110 | _builder.append(_referInstanceOf, "\t"); | 249 | CharSequence _referRelation_7 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "source", "target", Modality.MUST, fqnToPQuery); |
250 | _builder.append(_referRelation_7, "\t"); | ||
111 | _builder.newLineIfNotEmpty(); | 251 | _builder.newLineIfNotEmpty(); |
112 | _builder.append("\t"); | 252 | _builder.append("\t"); |
113 | CharSequence _referInstanceOf_1 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "target"); | 253 | _builder.append("neg "); |
114 | _builder.append(_referInstanceOf_1, "\t"); | 254 | CharSequence _referRelation_8 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "source", "target", Modality.MAY, fqnToPQuery); |
255 | _builder.append(_referRelation_8, "\t"); | ||
115 | _builder.newLineIfNotEmpty(); | 256 | _builder.newLineIfNotEmpty(); |
116 | _builder.append("\t"); | 257 | _builder.append("\t"); |
117 | _builder.append("source == target;"); | 258 | _builder.append("neg "); |
259 | CharSequence _referRelation_9 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "source", "target", Modality.MAY, fqnToPQuery); | ||
260 | _builder.append(_referRelation_9, "\t"); | ||
261 | _builder.newLineIfNotEmpty(); | ||
262 | _builder.append("}"); | ||
118 | _builder.newLine(); | 263 | _builder.newLine(); |
119 | _builder.append("} or {"); | ||
120 | _builder.newLine(); | 264 | _builder.newLine(); |
265 | _builder.append("pattern "); | ||
266 | _builder.append(Modes3UnitPropagationGenerator.MUST_STRAIGHT); | ||
267 | _builder.append("("); | ||
268 | _builder.append(parameters); | ||
269 | _builder.append(") {"); | ||
270 | _builder.newLineIfNotEmpty(); | ||
271 | _builder.append("\t"); | ||
272 | _builder.append(commonMustParameterConstraints, "\t"); | ||
273 | _builder.newLineIfNotEmpty(); | ||
274 | _builder.append("\t"); | ||
275 | _builder.append("neg "); | ||
276 | CharSequence _referRelation_10 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "source", "_", Modality.MUST, fqnToPQuery); | ||
277 | _builder.append(_referRelation_10, "\t"); | ||
278 | _builder.newLineIfNotEmpty(); | ||
121 | _builder.append("\t"); | 279 | _builder.append("\t"); |
122 | _builder.append("// tooManyInputsOfSegment unit propagation"); | 280 | _builder.append("neg find multipleMayStraight(problem, interpretation, source);"); |
123 | _builder.newLine(); | 281 | _builder.newLine(); |
124 | _builder.append("\t"); | 282 | _builder.append("\t"); |
125 | _builder.append(commonParameterConstraints, "\t"); | 283 | CharSequence _referRelation_11 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "source", "target", Modality.MAY, fqnToPQuery); |
284 | _builder.append(_referRelation_11, "\t"); | ||
126 | _builder.newLineIfNotEmpty(); | 285 | _builder.newLineIfNotEmpty(); |
127 | _builder.append("\t"); | 286 | _builder.append("\t"); |
128 | CharSequence _referInstanceOf_2 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "source"); | 287 | _builder.append("neg "); |
129 | _builder.append(_referInstanceOf_2, "\t"); | 288 | CharSequence _referRelation_12 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "source", "target", Modality.MUST, fqnToPQuery); |
289 | _builder.append(_referRelation_12, "\t"); | ||
130 | _builder.newLineIfNotEmpty(); | 290 | _builder.newLineIfNotEmpty(); |
291 | _builder.append("} or {"); | ||
292 | _builder.newLine(); | ||
131 | _builder.append("\t"); | 293 | _builder.append("\t"); |
132 | CharSequence _referInstanceOf_3 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "target"); | 294 | _builder.append(commonMustParameterConstraints, "\t"); |
133 | _builder.append(_referInstanceOf_3, "\t"); | ||
134 | _builder.newLineIfNotEmpty(); | 295 | _builder.newLineIfNotEmpty(); |
135 | _builder.append("\t"); | 296 | _builder.append("\t"); |
136 | CharSequence _referInstanceOf_4 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "input1"); | 297 | CharSequence _referInstanceOf_4 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MAY, "target"); |
137 | _builder.append(_referInstanceOf_4, "\t"); | 298 | _builder.append(_referInstanceOf_4, "\t"); |
138 | _builder.newLineIfNotEmpty(); | 299 | _builder.newLineIfNotEmpty(); |
139 | _builder.append("\t"); | 300 | _builder.append("\t"); |
140 | CharSequence _referInstanceOf_5 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "input2"); | 301 | _builder.append("find mayInput(problem, interpretaton, source, target);"); |
141 | _builder.append(_referInstanceOf_5, "\t"); | 302 | _builder.newLine(); |
303 | _builder.append("\t"); | ||
304 | _builder.append("neg find multipleMayInput(problem, interpretaton, target);"); | ||
305 | _builder.newLine(); | ||
306 | _builder.append("\t"); | ||
307 | _builder.append("neg "); | ||
308 | CharSequence _referRelation_13 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "source", "target", Modality.MAY, fqnToPQuery); | ||
309 | _builder.append(_referRelation_13, "\t"); | ||
310 | _builder.newLineIfNotEmpty(); | ||
311 | _builder.append("\t"); | ||
312 | CharSequence _referRelation_14 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "source", "target", Modality.MAY, fqnToPQuery); | ||
313 | _builder.append(_referRelation_14, "\t"); | ||
142 | _builder.newLineIfNotEmpty(); | 314 | _builder.newLineIfNotEmpty(); |
143 | _builder.append("\t"); | 315 | _builder.append("\t"); |
144 | _builder.append("neg "); | 316 | _builder.append("neg "); |
145 | CharSequence _referInstanceOf_6 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MAY, "source"); | 317 | CharSequence _referRelation_15 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "source", "target", Modality.MUST, fqnToPQuery); |
146 | _builder.append(_referInstanceOf_6, "\t"); | 318 | _builder.append(_referRelation_15, "\t"); |
147 | _builder.newLineIfNotEmpty(); | 319 | _builder.newLineIfNotEmpty(); |
148 | _builder.append("\t"); | 320 | _builder.append("\t"); |
149 | CharSequence _referPattern = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Output.instance().getFullyQualifiedName()), new String[] { "input1", "source" }, Modality.MUST, true, false); | 321 | _builder.append("neg "); |
150 | _builder.append(_referPattern, "\t"); | 322 | CharSequence _referRelation_16 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "source", "target", Modality.MAY, fqnToPQuery); |
323 | _builder.append(_referRelation_16, "\t"); | ||
324 | _builder.newLineIfNotEmpty(); | ||
325 | _builder.append("}"); | ||
326 | _builder.newLine(); | ||
327 | _builder.newLine(); | ||
328 | _builder.append("pattern "); | ||
329 | _builder.append(Modes3UnitPropagationGenerator.MUST_DIVERGENT); | ||
330 | _builder.append("("); | ||
331 | _builder.append(parameters); | ||
332 | _builder.append(") {"); | ||
151 | _builder.newLineIfNotEmpty(); | 333 | _builder.newLineIfNotEmpty(); |
152 | _builder.append("\t"); | 334 | _builder.append("\t"); |
153 | CharSequence _referPattern_1 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Output.instance().getFullyQualifiedName()), new String[] { "input2", "source" }, Modality.MUST, true, false); | 335 | _builder.append(commonMustParameterConstraints, "\t"); |
154 | _builder.append(_referPattern_1, "\t"); | 336 | _builder.newLineIfNotEmpty(); |
337 | _builder.append("\t"); | ||
338 | _builder.append("neg "); | ||
339 | CharSequence _referRelation_17 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "source", "_", Modality.MUST, fqnToPQuery); | ||
340 | _builder.append(_referRelation_17, "\t"); | ||
155 | _builder.newLineIfNotEmpty(); | 341 | _builder.newLineIfNotEmpty(); |
156 | _builder.append("\t"); | 342 | _builder.append("\t"); |
157 | _builder.append("input1 != input2;"); | 343 | _builder.append("neg find multipleMayDivergent(problem, interpretation, source);"); |
158 | _builder.newLine(); | 344 | _builder.newLine(); |
159 | _builder.append("\t"); | 345 | _builder.append("\t"); |
160 | _builder.append("input1 != target;"); | 346 | CharSequence _referRelation_18 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "source", "target", Modality.MAY, fqnToPQuery); |
347 | _builder.append(_referRelation_18, "\t"); | ||
348 | _builder.newLineIfNotEmpty(); | ||
349 | _builder.append("\t"); | ||
350 | _builder.append("neg "); | ||
351 | CharSequence _referRelation_19 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "source", "target", Modality.MUST, fqnToPQuery); | ||
352 | _builder.append(_referRelation_19, "\t"); | ||
353 | _builder.newLineIfNotEmpty(); | ||
354 | _builder.append("} or {"); | ||
161 | _builder.newLine(); | 355 | _builder.newLine(); |
162 | _builder.append("\t"); | 356 | _builder.append("\t"); |
163 | _builder.append("input2 != target;"); | 357 | _builder.append(commonMustParameterConstraints, "\t"); |
358 | _builder.newLineIfNotEmpty(); | ||
359 | _builder.append("\t"); | ||
360 | CharSequence _referInstanceOf_5 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MAY, "target"); | ||
361 | _builder.append(_referInstanceOf_5, "\t"); | ||
362 | _builder.newLineIfNotEmpty(); | ||
363 | _builder.append("\t"); | ||
364 | _builder.append("find mayInput(problem, interpretaton, source, target);"); | ||
164 | _builder.newLine(); | 365 | _builder.newLine(); |
165 | _builder.append("} or {"); | 366 | _builder.append("\t"); |
367 | _builder.append("neg find multipleMayInput(problem, interpretaton, target);"); | ||
166 | _builder.newLine(); | 368 | _builder.newLine(); |
167 | _builder.append("\t"); | 369 | _builder.append("\t"); |
168 | _builder.append("// turnoutConnectedToBothOutputs unit propagation 1"); | 370 | _builder.append("neg "); |
371 | CharSequence _referRelation_20 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "source", "target", Modality.MAY, fqnToPQuery); | ||
372 | _builder.append(_referRelation_20, "\t"); | ||
373 | _builder.newLineIfNotEmpty(); | ||
374 | _builder.append("\t"); | ||
375 | _builder.append("neg "); | ||
376 | CharSequence _referRelation_21 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "source", "target", Modality.MAY, fqnToPQuery); | ||
377 | _builder.append(_referRelation_21, "\t"); | ||
378 | _builder.newLineIfNotEmpty(); | ||
379 | _builder.append("\t"); | ||
380 | CharSequence _referRelation_22 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "source", "target", Modality.MAY, fqnToPQuery); | ||
381 | _builder.append(_referRelation_22, "\t"); | ||
382 | _builder.newLineIfNotEmpty(); | ||
383 | _builder.append("\t"); | ||
384 | _builder.append("neg "); | ||
385 | CharSequence _referRelation_23 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "source", "target", Modality.MUST, fqnToPQuery); | ||
386 | _builder.append(_referRelation_23, "\t"); | ||
387 | _builder.newLineIfNotEmpty(); | ||
388 | _builder.append("}"); | ||
169 | _builder.newLine(); | 389 | _builder.newLine(); |
390 | _builder.newLine(); | ||
391 | _builder.append("pattern turnoutOutput_must_to_true_by_straight("); | ||
392 | _builder.append(parameters); | ||
393 | _builder.append(", T : DefinedElement, S : DefinedElement) {"); | ||
394 | _builder.newLineIfNotEmpty(); | ||
170 | _builder.append("\t"); | 395 | _builder.append("\t"); |
171 | _builder.append(commonParameterConstraints, "\t"); | 396 | _builder.append(commonMayParameterConstraints, "\t"); |
172 | _builder.newLineIfNotEmpty(); | 397 | _builder.newLineIfNotEmpty(); |
173 | _builder.append("\t"); | 398 | _builder.append("\t"); |
174 | CharSequence _referInstanceOf_7 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "source"); | 399 | CharSequence _referInstanceOf_6 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MAY, "source"); |
175 | _builder.append(_referInstanceOf_7, "\t"); | 400 | _builder.append(_referInstanceOf_6, "\t"); |
176 | _builder.newLineIfNotEmpty(); | 401 | _builder.newLineIfNotEmpty(); |
177 | _builder.append("\t"); | 402 | _builder.append("\t"); |
178 | CharSequence _referInstanceOf_8 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "target"); | 403 | CharSequence _referInstanceOf_7 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MAY, "target"); |
179 | _builder.append(_referInstanceOf_8, "\t"); | 404 | _builder.append(_referInstanceOf_7, "\t"); |
180 | _builder.newLineIfNotEmpty(); | 405 | _builder.newLineIfNotEmpty(); |
181 | _builder.append("\t"); | 406 | _builder.append("\t"); |
182 | CharSequence _referInstanceOf_9 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "divergent"); | 407 | _builder.append("T == source;"); |
183 | _builder.append(_referInstanceOf_9, "\t"); | 408 | _builder.newLine(); |
409 | _builder.append("\t"); | ||
410 | _builder.append("S == target;"); | ||
411 | _builder.newLine(); | ||
412 | _builder.append("}"); | ||
413 | _builder.newLine(); | ||
414 | _builder.newLine(); | ||
415 | _builder.append("pattern turnoutOutput_must_to_true_by_divergent("); | ||
416 | _builder.append(parameters); | ||
417 | _builder.append(", T : DefinedElement, S : DefinedElement) {"); | ||
184 | _builder.newLineIfNotEmpty(); | 418 | _builder.newLineIfNotEmpty(); |
185 | _builder.append("\t"); | 419 | _builder.append("\t"); |
186 | CharSequence _referRelation = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "source", "target", Modality.MUST, fqnToPQuery); | 420 | _builder.append(commonMayParameterConstraints, "\t"); |
187 | _builder.append(_referRelation, "\t"); | ||
188 | _builder.newLineIfNotEmpty(); | 421 | _builder.newLineIfNotEmpty(); |
189 | _builder.append("\t"); | 422 | _builder.append("\t"); |
190 | CharSequence _referRelation_1 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "source", "divergent", Modality.MUST, fqnToPQuery); | 423 | CharSequence _referInstanceOf_8 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MAY, "source"); |
191 | _builder.append(_referRelation_1, "\t"); | 424 | _builder.append(_referInstanceOf_8, "\t"); |
192 | _builder.newLineIfNotEmpty(); | 425 | _builder.newLineIfNotEmpty(); |
193 | _builder.append("\t"); | 426 | _builder.append("\t"); |
194 | CharSequence _referRelation_2 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "source", "divergent", Modality.MUST, fqnToPQuery); | 427 | CharSequence _referInstanceOf_9 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MAY, "target"); |
195 | _builder.append(_referRelation_2, "\t"); | 428 | _builder.append(_referInstanceOf_9, "\t"); |
196 | _builder.newLineIfNotEmpty(); | 429 | _builder.newLineIfNotEmpty(); |
197 | _builder.append("} or {"); | 430 | _builder.append("\t"); |
431 | _builder.append("T == source;"); | ||
198 | _builder.newLine(); | 432 | _builder.newLine(); |
199 | _builder.append("\t"); | 433 | _builder.append("\t"); |
200 | _builder.append("// turnoutConnectedToBothOutputs unit propagation 2"); | 434 | _builder.append("S == target;"); |
201 | _builder.newLine(); | 435 | _builder.newLine(); |
436 | _builder.append("}"); | ||
437 | _builder.newLine(); | ||
438 | _builder.newLine(); | ||
439 | _builder.append("pattern output_must_to_true_by_connectedTo("); | ||
440 | _builder.append(parameters); | ||
441 | _builder.append(", S1 : DefinedElement, S2 : DefinedElement) {"); | ||
442 | _builder.newLineIfNotEmpty(); | ||
202 | _builder.append("\t"); | 443 | _builder.append("\t"); |
203 | _builder.append(commonParameterConstraints, "\t"); | 444 | _builder.append(commonMayParameterConstraints, "\t"); |
204 | _builder.newLineIfNotEmpty(); | 445 | _builder.newLineIfNotEmpty(); |
205 | _builder.append("\t"); | 446 | _builder.append("\t"); |
206 | CharSequence _referInstanceOf_10 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "source"); | 447 | CharSequence _referInstanceOf_10 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MAY, "source"); |
207 | _builder.append(_referInstanceOf_10, "\t"); | 448 | _builder.append(_referInstanceOf_10, "\t"); |
208 | _builder.newLineIfNotEmpty(); | 449 | _builder.newLineIfNotEmpty(); |
209 | _builder.append("\t"); | 450 | _builder.append("\t"); |
210 | CharSequence _referInstanceOf_11 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "target"); | 451 | CharSequence _referInstanceOf_11 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MAY, "target"); |
211 | _builder.append(_referInstanceOf_11, "\t"); | 452 | _builder.append(_referInstanceOf_11, "\t"); |
212 | _builder.newLineIfNotEmpty(); | 453 | _builder.newLineIfNotEmpty(); |
213 | _builder.append("\t"); | 454 | _builder.append("\t"); |
214 | CharSequence _referInstanceOf_12 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "straight"); | 455 | _builder.append("S1 == source;"); |
215 | _builder.append(_referInstanceOf_12, "\t"); | 456 | _builder.newLine(); |
457 | _builder.append("\t"); | ||
458 | _builder.append("S2 == target;"); | ||
459 | _builder.newLine(); | ||
460 | _builder.append("}"); | ||
461 | _builder.newLine(); | ||
462 | _builder.newLine(); | ||
463 | _builder.append("pattern output_must_to_true_by_straight("); | ||
464 | _builder.append(parameters); | ||
465 | _builder.append(", S1 : DefinedElement, S2 : DefinedElement) {"); | ||
216 | _builder.newLineIfNotEmpty(); | 466 | _builder.newLineIfNotEmpty(); |
217 | _builder.append("\t"); | 467 | _builder.append("\t"); |
218 | CharSequence _referRelation_3 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "source", "straight", Modality.MUST, fqnToPQuery); | 468 | _builder.append("find turnoutOutput_must_to_true_by_straight(problem, interpretation, source, target, S1, S2);"); |
219 | _builder.append(_referRelation_3, "\t"); | 469 | _builder.newLine(); |
470 | _builder.append("}"); | ||
471 | _builder.newLine(); | ||
472 | _builder.newLine(); | ||
473 | _builder.append("pattern output_must_to_true_by_divergent("); | ||
474 | _builder.append(parameters); | ||
475 | _builder.append(", S1 : DefinedElement, S2 : DefinedElement) {"); | ||
220 | _builder.newLineIfNotEmpty(); | 476 | _builder.newLineIfNotEmpty(); |
221 | _builder.append("\t"); | 477 | _builder.append("\t"); |
222 | CharSequence _referRelation_4 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "source", "target", Modality.MUST, fqnToPQuery); | 478 | _builder.append("find turnoutOutput_must_to_true_by_divergent(problem, interpretation, source, target, S1, S2);"); |
223 | _builder.append(_referRelation_4, "\t"); | 479 | _builder.newLine(); |
480 | _builder.append("}"); | ||
481 | _builder.newLine(); | ||
482 | _builder.newLine(); | ||
483 | _builder.append("pattern adjacent_must_to_true_by_connectedTo("); | ||
484 | _builder.append(parameters); | ||
485 | _builder.append(", S1 : DefinedElement, S2 : DefinedElement) {"); | ||
224 | _builder.newLineIfNotEmpty(); | 486 | _builder.newLineIfNotEmpty(); |
225 | _builder.append("\t"); | 487 | _builder.append("\t"); |
226 | CharSequence _referRelation_5 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "source", "straight", Modality.MUST, fqnToPQuery); | 488 | _builder.append("find output_must_to_true_by_connectedTo(problem, interpretation, source, target, S1, S2);"); |
227 | _builder.append(_referRelation_5, "\t"); | 489 | _builder.newLine(); |
490 | _builder.append("}"); | ||
491 | _builder.newLine(); | ||
492 | _builder.newLine(); | ||
493 | _builder.append("pattern adjacent_must_to_true_by_straight("); | ||
494 | _builder.append(parameters); | ||
495 | _builder.append(", S1 : DefinedElement, S2 : DefinedElement) {"); | ||
228 | _builder.newLineIfNotEmpty(); | 496 | _builder.newLineIfNotEmpty(); |
497 | _builder.append("\t"); | ||
498 | _builder.append("find output_must_to_true_by_straight(problem, interpretation, source, target, S1, S2);"); | ||
499 | _builder.newLine(); | ||
229 | _builder.append("} or {"); | 500 | _builder.append("} or {"); |
230 | _builder.newLine(); | 501 | _builder.newLine(); |
231 | _builder.append("\t"); | 502 | _builder.append("\t"); |
232 | _builder.append("// tooManyExtraInputsOfTurnout unit propagation"); | 503 | _builder.append("find turnoutOutput_must_to_true_by_straight(problem, interpretation, source, target, S2, S1);"); |
233 | _builder.newLine(); | 504 | _builder.newLine(); |
234 | _builder.append("\t"); | 505 | _builder.append("}"); |
235 | _builder.append(commonParameterConstraints, "\t"); | 506 | _builder.newLine(); |
507 | _builder.newLine(); | ||
508 | _builder.append("pattern adjacent_must_to_true_by_divergent("); | ||
509 | _builder.append(parameters); | ||
510 | _builder.append(", S1 : DefinedElement, S2 : DefinedElement) {"); | ||
236 | _builder.newLineIfNotEmpty(); | 511 | _builder.newLineIfNotEmpty(); |
237 | _builder.append("\t"); | 512 | _builder.append("\t"); |
238 | CharSequence _referInstanceOf_13 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "source"); | 513 | _builder.append("find output_must_to_true_by_divergent(problem, interpretation, source, target, S1, S2);"); |
239 | _builder.append(_referInstanceOf_13, "\t"); | 514 | _builder.newLine(); |
240 | _builder.newLineIfNotEmpty(); | 515 | _builder.append("} or {"); |
516 | _builder.newLine(); | ||
241 | _builder.append("\t"); | 517 | _builder.append("\t"); |
242 | CharSequence _referInstanceOf_14 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "target"); | 518 | _builder.append("find turnoutOutput_must_to_true_by_divergent(problem, interpretation, source, target, S2, S1);"); |
243 | _builder.append(_referInstanceOf_14, "\t"); | 519 | _builder.newLine(); |
520 | _builder.append("}"); | ||
521 | _builder.newLine(); | ||
522 | _builder.newLine(); | ||
523 | _builder.append("pattern connectedToReflexive_must_to_true_by_connectedTo("); | ||
524 | _builder.append(parameters); | ||
525 | _builder.append(", S : DefinedElement) {"); | ||
244 | _builder.newLineIfNotEmpty(); | 526 | _builder.newLineIfNotEmpty(); |
245 | _builder.append("\t"); | 527 | _builder.append("\t"); |
246 | CharSequence _referInstanceOf_15 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "extraInput"); | 528 | _builder.append("find mustExist(problem, interpretation, source);"); |
247 | _builder.append(_referInstanceOf_15, "\t"); | 529 | _builder.newLine(); |
530 | _builder.append("\t"); | ||
531 | CharSequence _referInstanceOf_12 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "source"); | ||
532 | _builder.append(_referInstanceOf_12, "\t"); | ||
248 | _builder.newLineIfNotEmpty(); | 533 | _builder.newLineIfNotEmpty(); |
249 | _builder.append("\t"); | 534 | _builder.append("\t"); |
250 | CharSequence _referPattern_2 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(TurnoutOutput.instance().getFullyQualifiedName()), new String[] { "source", "target" }, Modality.MAY, false, false); | 535 | _builder.append("S == source;"); |
251 | _builder.append(_referPattern_2, "\t"); | 536 | _builder.newLine(); |
537 | _builder.append("\t"); | ||
538 | _builder.append("S == target;"); | ||
539 | _builder.newLine(); | ||
540 | _builder.append("}"); | ||
541 | _builder.newLine(); | ||
542 | _builder.newLine(); | ||
543 | _builder.append("pattern outputReflexive_must_to_true_by_straight("); | ||
544 | _builder.append(parameters); | ||
545 | _builder.append(", T : DefinedElement) {"); | ||
252 | _builder.newLineIfNotEmpty(); | 546 | _builder.newLineIfNotEmpty(); |
253 | _builder.append("\t"); | 547 | _builder.append("\t"); |
254 | CharSequence _referPattern_3 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(ExtraInputOfTurnout.instance().getFullyQualifiedName()), new String[] { "source", "extraInput" }, Modality.MUST, true, false); | 548 | _builder.append("find turnoutOutput_must_to_true_by_straight(problem, interpretation, source, target, T, T);"); |
255 | _builder.append(_referPattern_3, "\t"); | 549 | _builder.newLine(); |
550 | _builder.append("}"); | ||
551 | _builder.newLine(); | ||
552 | _builder.newLine(); | ||
553 | _builder.append("pattern outputReflexive_must_to_true_by_divergent("); | ||
554 | _builder.append(parameters); | ||
555 | _builder.append(", T : DefinedElement) {"); | ||
256 | _builder.newLineIfNotEmpty(); | 556 | _builder.newLineIfNotEmpty(); |
257 | _builder.append("\t"); | 557 | _builder.append("\t"); |
258 | _builder.append("target != extraInput;"); | 558 | _builder.append("find turnoutOutput_must_to_true_by_divergent(problem, interpretation, source, target, T, T);"); |
259 | _builder.newLine(); | 559 | _builder.newLine(); |
260 | _builder.append("}"); | 560 | _builder.append("}"); |
261 | _builder.newLine(); | 561 | _builder.newLine(); |
262 | _builder.newLine(); | 562 | _builder.newLine(); |
263 | _builder.append("pattern "); | 563 | _builder.append("pattern turnoutOutputsAreSame_must_to_true_by_straight("); |
264 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_CONNECTED_TO); | ||
265 | _builder.append("("); | ||
266 | _builder.append(parameters); | 564 | _builder.append(parameters); |
267 | _builder.append(") {"); | 565 | _builder.append(", T : DefinedElement) {"); |
268 | _builder.newLineIfNotEmpty(); | 566 | _builder.newLineIfNotEmpty(); |
269 | _builder.append("\t"); | 567 | _builder.append("\t"); |
270 | _builder.append("find "); | 568 | _builder.append(commonMayParameterConstraints, "\t"); |
271 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_CONNECTED_TO_HELPER, "\t"); | ||
272 | _builder.append("(problem, interpretation, source, target);"); | ||
273 | _builder.newLineIfNotEmpty(); | 569 | _builder.newLineIfNotEmpty(); |
274 | _builder.append("} or {"); | 570 | _builder.append("\t"); |
571 | CharSequence _referInstanceOf_13 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MAY, "source"); | ||
572 | _builder.append(_referInstanceOf_13, "\t"); | ||
573 | _builder.newLineIfNotEmpty(); | ||
574 | _builder.append("\t"); | ||
575 | CharSequence _referInstanceOf_14 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MAY, "target"); | ||
576 | _builder.append(_referInstanceOf_14, "\t"); | ||
577 | _builder.newLineIfNotEmpty(); | ||
578 | _builder.append("\t"); | ||
579 | _builder.append("T == source;"); | ||
275 | _builder.newLine(); | 580 | _builder.newLine(); |
276 | _builder.append("\t"); | 581 | _builder.append("\t"); |
277 | _builder.append("find "); | 582 | _builder.append("S == target;"); |
278 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_CONNECTED_TO_HELPER, "\t"); | 583 | _builder.newLine(); |
279 | _builder.append("(problem, interpretation, target, source);"); | 584 | _builder.append("\t"); |
585 | CharSequence _referRelation_24 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "T", "S", Modality.MUST, fqnToPQuery); | ||
586 | _builder.append(_referRelation_24, "\t"); | ||
280 | _builder.newLineIfNotEmpty(); | 587 | _builder.newLineIfNotEmpty(); |
281 | _builder.append("}"); | 588 | _builder.append("}"); |
282 | _builder.newLine(); | 589 | _builder.newLine(); |
283 | _builder.newLine(); | 590 | _builder.newLine(); |
284 | _builder.append("pattern "); | 591 | _builder.append("pattern turnoutOutputsAreSame_must_to_true_by_divergent("); |
285 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_TURNOUT_OUTPUT); | ||
286 | _builder.append("("); | ||
287 | _builder.append(parameters); | 592 | _builder.append(parameters); |
288 | _builder.append(") {"); | 593 | _builder.append(", T : DefinedElement) {"); |
289 | _builder.newLineIfNotEmpty(); | 594 | _builder.newLineIfNotEmpty(); |
290 | _builder.append("\t"); | 595 | _builder.append("\t"); |
291 | _builder.append("// outputReflexive unit propagation"); | 596 | _builder.append(commonMayParameterConstraints, "\t"); |
292 | _builder.newLine(); | 597 | _builder.newLineIfNotEmpty(); |
293 | _builder.append("\t"); | 598 | _builder.append("\t"); |
294 | _builder.append(commonParameterConstraints, "\t"); | 599 | CharSequence _referInstanceOf_15 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MAY, "source"); |
600 | _builder.append(_referInstanceOf_15, "\t"); | ||
295 | _builder.newLineIfNotEmpty(); | 601 | _builder.newLineIfNotEmpty(); |
296 | _builder.append("\t"); | 602 | _builder.append("\t"); |
297 | CharSequence _referInstanceOf_16 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "source"); | 603 | CharSequence _referInstanceOf_16 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MAY, "target"); |
298 | _builder.append(_referInstanceOf_16, "\t"); | 604 | _builder.append(_referInstanceOf_16, "\t"); |
299 | _builder.newLineIfNotEmpty(); | 605 | _builder.newLineIfNotEmpty(); |
300 | _builder.append("\t"); | 606 | _builder.append("\t"); |
301 | CharSequence _referInstanceOf_17 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "target"); | 607 | _builder.append("T == source;"); |
608 | _builder.newLine(); | ||
609 | _builder.append("\t"); | ||
610 | _builder.append("S == target;"); | ||
611 | _builder.newLine(); | ||
612 | _builder.append("\t"); | ||
613 | CharSequence _referRelation_25 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "T", "S", Modality.MUST, fqnToPQuery); | ||
614 | _builder.append(_referRelation_25, "\t"); | ||
615 | _builder.newLineIfNotEmpty(); | ||
616 | _builder.append("}"); | ||
617 | _builder.newLine(); | ||
618 | _builder.newLine(); | ||
619 | _builder.append("pattern tooManyInputsOfSegment_must_to_true_by_connectedTo("); | ||
620 | _builder.append(parameters); | ||
621 | _builder.append(", S : DefinedElement) {"); | ||
622 | _builder.newLineIfNotEmpty(); | ||
623 | _builder.append("\t"); | ||
624 | _builder.append("find mustExist(problem, interpretation, S);"); | ||
625 | _builder.newLine(); | ||
626 | _builder.append("\t"); | ||
627 | CharSequence _referInstanceOf_17 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.simpleSegmentType, Modality.MUST, "S"); | ||
302 | _builder.append(_referInstanceOf_17, "\t"); | 628 | _builder.append(_referInstanceOf_17, "\t"); |
303 | _builder.newLineIfNotEmpty(); | 629 | _builder.newLineIfNotEmpty(); |
304 | _builder.append("\t"); | 630 | _builder.append("\t"); |
305 | _builder.append("source == target;"); | 631 | _builder.append("find output_must_to_true_by_connectedTo(problem, interpretation, source, target, I1, S);"); |
306 | _builder.newLine(); | 632 | _builder.newLine(); |
307 | _builder.append("} or {"); | 633 | _builder.append("\t"); |
634 | CharSequence _referPattern_1 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Output.instance().getFullyQualifiedName()), new String[] { "I2", "S" }, Modality.MUST, true, false); | ||
635 | _builder.append(_referPattern_1, "\t"); | ||
636 | _builder.newLineIfNotEmpty(); | ||
637 | _builder.append("\t"); | ||
638 | CharSequence _referPattern_2 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Output.instance().getFullyQualifiedName()), new String[] { "I3", "S" }, Modality.MUST, true, false); | ||
639 | _builder.append(_referPattern_2, "\t"); | ||
640 | _builder.newLineIfNotEmpty(); | ||
641 | _builder.append("\t"); | ||
642 | _builder.append("I1 != I2;"); | ||
308 | _builder.newLine(); | 643 | _builder.newLine(); |
309 | _builder.append("\t"); | 644 | _builder.append("\t"); |
310 | _builder.append("// tooManyInputsOfSegment unit propagation"); | 645 | _builder.append("I1 != I3;"); |
311 | _builder.newLine(); | 646 | _builder.newLine(); |
312 | _builder.append("\t"); | 647 | _builder.append("\t"); |
313 | _builder.append(commonParameterConstraints, "\t"); | 648 | _builder.append("I2 != I3;"); |
649 | _builder.newLine(); | ||
650 | _builder.append("}"); | ||
651 | _builder.newLine(); | ||
652 | _builder.newLine(); | ||
653 | _builder.append("pattern tooManyInputsOfSegment_must_to_true_by_straight("); | ||
654 | _builder.append(parameters); | ||
655 | _builder.append(", S : DefinedElement) {"); | ||
314 | _builder.newLineIfNotEmpty(); | 656 | _builder.newLineIfNotEmpty(); |
315 | _builder.append("\t"); | 657 | _builder.append("\t"); |
316 | CharSequence _referInstanceOf_18 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "source"); | 658 | _builder.append("find mustExist(problem, interpretation, S);"); |
659 | _builder.newLine(); | ||
660 | _builder.append("\t"); | ||
661 | CharSequence _referInstanceOf_18 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.simpleSegmentType, Modality.MUST, "S"); | ||
317 | _builder.append(_referInstanceOf_18, "\t"); | 662 | _builder.append(_referInstanceOf_18, "\t"); |
318 | _builder.newLineIfNotEmpty(); | 663 | _builder.newLineIfNotEmpty(); |
319 | _builder.append("\t"); | 664 | _builder.append("\t"); |
320 | CharSequence _referInstanceOf_19 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "target"); | 665 | _builder.append("find output_must_to_true_by_straight(problem, interpretation, source, target, I1, S);"); |
321 | _builder.append(_referInstanceOf_19, "\t"); | 666 | _builder.newLine(); |
322 | _builder.newLineIfNotEmpty(); | ||
323 | _builder.append("\t"); | 667 | _builder.append("\t"); |
324 | CharSequence _referInstanceOf_20 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "input1"); | 668 | CharSequence _referPattern_3 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Output.instance().getFullyQualifiedName()), new String[] { "I2", "S" }, Modality.MUST, true, false); |
325 | _builder.append(_referInstanceOf_20, "\t"); | 669 | _builder.append(_referPattern_3, "\t"); |
326 | _builder.newLineIfNotEmpty(); | 670 | _builder.newLineIfNotEmpty(); |
327 | _builder.append("\t"); | 671 | _builder.append("\t"); |
328 | CharSequence _referInstanceOf_21 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "input2"); | 672 | CharSequence _referPattern_4 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Output.instance().getFullyQualifiedName()), new String[] { "I3", "S" }, Modality.MUST, true, false); |
329 | _builder.append(_referInstanceOf_21, "\t"); | 673 | _builder.append(_referPattern_4, "\t"); |
330 | _builder.newLineIfNotEmpty(); | 674 | _builder.newLineIfNotEmpty(); |
331 | _builder.append("\t"); | 675 | _builder.append("\t"); |
332 | _builder.append("neg "); | 676 | _builder.append("I1 != I2;"); |
333 | CharSequence _referInstanceOf_22 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MAY, "target"); | 677 | _builder.newLine(); |
334 | _builder.append(_referInstanceOf_22, "\t"); | 678 | _builder.append("\t"); |
679 | _builder.append("I1 != I3;"); | ||
680 | _builder.newLine(); | ||
681 | _builder.append("\t"); | ||
682 | _builder.append("I2 != I3;"); | ||
683 | _builder.newLine(); | ||
684 | _builder.append("}"); | ||
685 | _builder.newLine(); | ||
686 | _builder.newLine(); | ||
687 | _builder.append("pattern tooManyInputsOfSegment_must_to_true_by_divergent("); | ||
688 | _builder.append(parameters); | ||
689 | _builder.append(", S : DefinedElement) {"); | ||
335 | _builder.newLineIfNotEmpty(); | 690 | _builder.newLineIfNotEmpty(); |
336 | _builder.append("\t"); | 691 | _builder.append("\t"); |
337 | CharSequence _referPattern_4 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Output.instance().getFullyQualifiedName()), new String[] { "input1", "target" }, Modality.MUST, true, false); | 692 | _builder.append("find mustExist(problem, interpretation, S);"); |
338 | _builder.append(_referPattern_4, "\t"); | 693 | _builder.newLine(); |
694 | _builder.append("\t"); | ||
695 | CharSequence _referInstanceOf_19 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.simpleSegmentType, Modality.MUST, "S"); | ||
696 | _builder.append(_referInstanceOf_19, "\t"); | ||
339 | _builder.newLineIfNotEmpty(); | 697 | _builder.newLineIfNotEmpty(); |
340 | _builder.append("\t"); | 698 | _builder.append("\t"); |
341 | CharSequence _referPattern_5 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Output.instance().getFullyQualifiedName()), new String[] { "input2", "target" }, Modality.MUST, true, false); | 699 | _builder.append("find output_must_to_true_by_divergent(problem, interpretation, source, target, I1, S);"); |
700 | _builder.newLine(); | ||
701 | _builder.append("\t"); | ||
702 | CharSequence _referPattern_5 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Output.instance().getFullyQualifiedName()), new String[] { "I2", "S" }, Modality.MUST, true, false); | ||
342 | _builder.append(_referPattern_5, "\t"); | 703 | _builder.append(_referPattern_5, "\t"); |
343 | _builder.newLineIfNotEmpty(); | 704 | _builder.newLineIfNotEmpty(); |
344 | _builder.append("\t"); | 705 | _builder.append("\t"); |
345 | _builder.append("input1 != input2;"); | 706 | CharSequence _referPattern_6 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Output.instance().getFullyQualifiedName()), new String[] { "I3", "S" }, Modality.MUST, true, false); |
707 | _builder.append(_referPattern_6, "\t"); | ||
708 | _builder.newLineIfNotEmpty(); | ||
709 | _builder.append("\t"); | ||
710 | _builder.append("I1 != I2;"); | ||
346 | _builder.newLine(); | 711 | _builder.newLine(); |
347 | _builder.append("\t"); | 712 | _builder.append("\t"); |
348 | _builder.append("input1 != source;"); | 713 | _builder.append("I1 != I3;"); |
349 | _builder.newLine(); | 714 | _builder.newLine(); |
350 | _builder.append("\t"); | 715 | _builder.append("\t"); |
351 | _builder.append("input2 != source;"); | 716 | _builder.append("I2 != I3;"); |
352 | _builder.newLine(); | 717 | _builder.newLine(); |
353 | _builder.append("}"); | 718 | _builder.append("}"); |
354 | _builder.newLine(); | 719 | _builder.newLine(); |
355 | _builder.newLine(); | 720 | _builder.newLine(); |
356 | _builder.append("pattern "); | 721 | _builder.append("pattern turnoutConnectedToBothOutputs_must_to_true_by_connectedTo("); |
357 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_STRAIGHT); | ||
358 | _builder.append("("); | ||
359 | _builder.append(parameters); | 722 | _builder.append(parameters); |
360 | _builder.append(") {"); | 723 | _builder.append(", T : DefinedElement) {"); |
361 | _builder.newLineIfNotEmpty(); | 724 | _builder.newLineIfNotEmpty(); |
362 | _builder.append("\t"); | 725 | _builder.append("\t"); |
363 | _builder.append("find "); | 726 | _builder.append(commonMayParameterConstraints, "\t"); |
364 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_TURNOUT_OUTPUT, "\t"); | ||
365 | _builder.append("(problem, interpretation, source, target);"); | ||
366 | _builder.newLineIfNotEmpty(); | 727 | _builder.newLineIfNotEmpty(); |
367 | _builder.append("} or {"); | 728 | _builder.append("\t"); |
729 | _builder.append("find mustExist(problem, interpretation, Straight);"); | ||
368 | _builder.newLine(); | 730 | _builder.newLine(); |
369 | _builder.append("\t"); | 731 | _builder.append("\t"); |
370 | _builder.append("// turnoutOutputsAreSame unit propagation"); | 732 | _builder.append("find mustExist(problem, interpretation, Divergent);"); |
371 | _builder.newLine(); | 733 | _builder.newLine(); |
372 | _builder.append("\t"); | 734 | _builder.append("\t"); |
373 | _builder.append(commonParameterConstraints, "\t"); | 735 | CharSequence _referInstanceOf_20 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MAY, "source"); |
736 | _builder.append(_referInstanceOf_20, "\t"); | ||
737 | _builder.newLineIfNotEmpty(); | ||
738 | _builder.append("\t"); | ||
739 | CharSequence _referInstanceOf_21 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MAY, "target"); | ||
740 | _builder.append(_referInstanceOf_21, "\t"); | ||
374 | _builder.newLineIfNotEmpty(); | 741 | _builder.newLineIfNotEmpty(); |
375 | _builder.append("\t"); | 742 | _builder.append("\t"); |
376 | CharSequence _referInstanceOf_23 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "source"); | 743 | CharSequence _referInstanceOf_22 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "Straight"); |
744 | _builder.append(_referInstanceOf_22, "\t"); | ||
745 | _builder.newLineIfNotEmpty(); | ||
746 | _builder.append("\t"); | ||
747 | CharSequence _referInstanceOf_23 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "Divergent"); | ||
377 | _builder.append(_referInstanceOf_23, "\t"); | 748 | _builder.append(_referInstanceOf_23, "\t"); |
378 | _builder.newLineIfNotEmpty(); | 749 | _builder.newLineIfNotEmpty(); |
379 | _builder.append("\t"); | 750 | _builder.append("\t"); |
380 | CharSequence _referInstanceOf_24 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "target"); | 751 | CharSequence _referRelation_26 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "T", "Straight", Modality.MUST, fqnToPQuery); |
381 | _builder.append(_referInstanceOf_24, "\t"); | 752 | _builder.append(_referRelation_26, "\t"); |
382 | _builder.newLineIfNotEmpty(); | 753 | _builder.newLineIfNotEmpty(); |
383 | _builder.append("\t"); | 754 | _builder.append("\t"); |
384 | CharSequence _referRelation_6 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "source", "target", Modality.MUST, fqnToPQuery); | 755 | CharSequence _referRelation_27 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "T", "Divergent", Modality.MUST, fqnToPQuery); |
385 | _builder.append(_referRelation_6, "\t"); | 756 | _builder.append(_referRelation_27, "\t"); |
757 | _builder.newLineIfNotEmpty(); | ||
758 | _builder.append("\t"); | ||
759 | _builder.append("T == source;"); | ||
760 | _builder.newLine(); | ||
761 | _builder.append("\t"); | ||
762 | _builder.append("Straight == target;"); | ||
763 | _builder.newLine(); | ||
764 | _builder.append("\t"); | ||
765 | CharSequence _referRelation_28 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "T", "Divergent", Modality.MUST, fqnToPQuery); | ||
766 | _builder.append(_referRelation_28, "\t"); | ||
386 | _builder.newLineIfNotEmpty(); | 767 | _builder.newLineIfNotEmpty(); |
387 | _builder.append("} or {"); | 768 | _builder.append("} or {"); |
388 | _builder.newLine(); | 769 | _builder.newLine(); |
389 | _builder.append("\t"); | 770 | _builder.append("\t"); |
390 | _builder.append("// turnoutConnectedToBothOutputs unit propagation"); | 771 | _builder.append(commonMayParameterConstraints, "\t"); |
772 | _builder.newLineIfNotEmpty(); | ||
773 | _builder.append("\t"); | ||
774 | _builder.append("find mustExist(problem, interpretation, Straight);"); | ||
775 | _builder.newLine(); | ||
776 | _builder.append("\t"); | ||
777 | _builder.append("find mustExist(problem, interpretation, Divergent);"); | ||
391 | _builder.newLine(); | 778 | _builder.newLine(); |
392 | _builder.append("\t"); | 779 | _builder.append("\t"); |
393 | _builder.append(commonParameterConstraints, "\t"); | 780 | CharSequence _referInstanceOf_24 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MAY, "source"); |
781 | _builder.append(_referInstanceOf_24, "\t"); | ||
394 | _builder.newLineIfNotEmpty(); | 782 | _builder.newLineIfNotEmpty(); |
395 | _builder.append("\t"); | 783 | _builder.append("\t"); |
396 | CharSequence _referInstanceOf_25 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "source"); | 784 | CharSequence _referInstanceOf_25 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MAY, "target"); |
397 | _builder.append(_referInstanceOf_25, "\t"); | 785 | _builder.append(_referInstanceOf_25, "\t"); |
398 | _builder.newLineIfNotEmpty(); | 786 | _builder.newLineIfNotEmpty(); |
399 | _builder.append("\t"); | 787 | _builder.append("\t"); |
400 | CharSequence _referInstanceOf_26 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "target"); | 788 | CharSequence _referInstanceOf_26 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "Straight"); |
401 | _builder.append(_referInstanceOf_26, "\t"); | 789 | _builder.append(_referInstanceOf_26, "\t"); |
402 | _builder.newLineIfNotEmpty(); | 790 | _builder.newLineIfNotEmpty(); |
403 | _builder.append("\t"); | 791 | _builder.append("\t"); |
404 | CharSequence _referInstanceOf_27 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "divergent"); | 792 | CharSequence _referInstanceOf_27 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "Divergent"); |
405 | _builder.append(_referInstanceOf_27, "\t"); | 793 | _builder.append(_referInstanceOf_27, "\t"); |
406 | _builder.newLineIfNotEmpty(); | 794 | _builder.newLineIfNotEmpty(); |
407 | _builder.append("\t"); | 795 | _builder.append("\t"); |
408 | CharSequence _referRelation_7 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "source", "target", Modality.MUST, fqnToPQuery); | 796 | CharSequence _referRelation_29 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "T", "Straight", Modality.MUST, fqnToPQuery); |
409 | _builder.append(_referRelation_7, "\t"); | 797 | _builder.append(_referRelation_29, "\t"); |
410 | _builder.newLineIfNotEmpty(); | 798 | _builder.newLineIfNotEmpty(); |
411 | _builder.append("\t"); | 799 | _builder.append("\t"); |
412 | CharSequence _referRelation_8 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "source", "divergent", Modality.MUST, fqnToPQuery); | 800 | CharSequence _referRelation_30 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "T", "Divergent", Modality.MUST, fqnToPQuery); |
413 | _builder.append(_referRelation_8, "\t"); | 801 | _builder.append(_referRelation_30, "\t"); |
414 | _builder.newLineIfNotEmpty(); | 802 | _builder.newLineIfNotEmpty(); |
415 | _builder.append("\t"); | 803 | _builder.append("\t"); |
416 | CharSequence _referRelation_9 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "source", "divergent", Modality.MUST, fqnToPQuery); | 804 | CharSequence _referRelation_31 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "T", "Straight", Modality.MUST, fqnToPQuery); |
417 | _builder.append(_referRelation_9, "\t"); | 805 | _builder.append(_referRelation_31, "\t"); |
418 | _builder.newLineIfNotEmpty(); | 806 | _builder.newLineIfNotEmpty(); |
419 | _builder.append("} or {"); | 807 | _builder.append("\t"); |
808 | _builder.append("T == source;"); | ||
420 | _builder.newLine(); | 809 | _builder.newLine(); |
421 | _builder.append("\t"); | 810 | _builder.append("\t"); |
422 | _builder.append("// tooManyExtraInputsOfTurnout unit propagation"); | 811 | _builder.append("Straight == target;"); |
812 | _builder.newLine(); | ||
813 | _builder.append("}"); | ||
423 | _builder.newLine(); | 814 | _builder.newLine(); |
815 | _builder.newLine(); | ||
816 | _builder.append("pattern turnoutConnectedToBothOutputs_must_to_true_by_straight("); | ||
817 | _builder.append(parameters); | ||
818 | _builder.append(", T : DefinedElement) {"); | ||
819 | _builder.newLineIfNotEmpty(); | ||
424 | _builder.append("\t"); | 820 | _builder.append("\t"); |
425 | _builder.append(commonParameterConstraints, "\t"); | 821 | _builder.append(commonMayParameterConstraints, "\t"); |
426 | _builder.newLineIfNotEmpty(); | 822 | _builder.newLineIfNotEmpty(); |
427 | _builder.append("\t"); | 823 | _builder.append("\t"); |
428 | CharSequence _referInstanceOf_28 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "source"); | 824 | _builder.append("find mustExist(problem, interpretation, Straight);"); |
825 | _builder.newLine(); | ||
826 | _builder.append("\t"); | ||
827 | _builder.append("find mustExist(problem, interpretation, Divergent);"); | ||
828 | _builder.newLine(); | ||
829 | _builder.append("\t"); | ||
830 | CharSequence _referInstanceOf_28 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MAY, "source"); | ||
429 | _builder.append(_referInstanceOf_28, "\t"); | 831 | _builder.append(_referInstanceOf_28, "\t"); |
430 | _builder.newLineIfNotEmpty(); | 832 | _builder.newLineIfNotEmpty(); |
431 | _builder.append("\t"); | 833 | _builder.append("\t"); |
432 | CharSequence _referInstanceOf_29 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "target"); | 834 | CharSequence _referInstanceOf_29 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MAY, "target"); |
433 | _builder.append(_referInstanceOf_29, "\t"); | 835 | _builder.append(_referInstanceOf_29, "\t"); |
434 | _builder.newLineIfNotEmpty(); | 836 | _builder.newLineIfNotEmpty(); |
435 | _builder.append("\t"); | 837 | _builder.append("\t"); |
436 | CharSequence _referInstanceOf_30 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "extraInput"); | 838 | CharSequence _referInstanceOf_30 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "Straight"); |
437 | _builder.append(_referInstanceOf_30, "\t"); | 839 | _builder.append(_referInstanceOf_30, "\t"); |
438 | _builder.newLineIfNotEmpty(); | 840 | _builder.newLineIfNotEmpty(); |
439 | _builder.append("\t"); | 841 | _builder.append("\t"); |
440 | CharSequence _referInstanceOf_31 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "potentialExtraInput"); | 842 | CharSequence _referInstanceOf_31 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "Divergent"); |
441 | _builder.append(_referInstanceOf_31, "\t"); | 843 | _builder.append(_referInstanceOf_31, "\t"); |
442 | _builder.newLineIfNotEmpty(); | 844 | _builder.newLineIfNotEmpty(); |
443 | _builder.append("\t"); | 845 | _builder.append("\t"); |
444 | CharSequence _referPattern_6 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(ExtraInputOfTurnout.instance().getFullyQualifiedName()), new String[] { "source", "extraInput" }, Modality.MUST, true, false); | 846 | _builder.append("T == source;"); |
445 | _builder.append(_referPattern_6, "\t"); | 847 | _builder.newLine(); |
848 | _builder.append("\t"); | ||
849 | _builder.append("Straight == target;"); | ||
850 | _builder.newLine(); | ||
851 | _builder.append("\t"); | ||
852 | CharSequence _referRelation_32 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "T", "Divergent", Modality.MUST, fqnToPQuery); | ||
853 | _builder.append(_referRelation_32, "\t"); | ||
446 | _builder.newLineIfNotEmpty(); | 854 | _builder.newLineIfNotEmpty(); |
447 | _builder.append("\t"); | 855 | _builder.append("\t"); |
448 | CharSequence _referRelation_10 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "source", "potentialExtraInput", Modality.MUST, fqnToPQuery); | 856 | CharSequence _referRelation_33 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "T", "Straight", Modality.MUST, fqnToPQuery); |
449 | _builder.append(_referRelation_10, "\t"); | 857 | _builder.append(_referRelation_33, "\t"); |
450 | _builder.newLineIfNotEmpty(); | 858 | _builder.newLineIfNotEmpty(); |
451 | _builder.append("\t"); | 859 | _builder.append("\t"); |
452 | _builder.append("neg "); | 860 | CharSequence _referRelation_34 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "T", "Divergent", Modality.MUST, fqnToPQuery); |
453 | CharSequence _referRelation_11 = generator.referRelation(Modes3UnitPropagationGenerator.this.divergentRelation, "source", "potentialExtraInput", Modality.MAY, fqnToPQuery); | 861 | _builder.append(_referRelation_34, "\t"); |
454 | _builder.append(_referRelation_11, "\t"); | 862 | _builder.newLineIfNotEmpty(); |
863 | _builder.append("}"); | ||
864 | _builder.newLine(); | ||
865 | _builder.newLine(); | ||
866 | _builder.append("pattern turnoutConnectedToBothOutputs_must_to_true_by_divergent("); | ||
867 | _builder.append(parameters); | ||
868 | _builder.append(", T : DefinedElement) {"); | ||
869 | _builder.newLineIfNotEmpty(); | ||
870 | _builder.append("\t"); | ||
871 | _builder.append(commonMayParameterConstraints, "\t"); | ||
455 | _builder.newLineIfNotEmpty(); | 872 | _builder.newLineIfNotEmpty(); |
456 | _builder.append("\t"); | 873 | _builder.append("\t"); |
457 | _builder.append("extraInput != potentialExtraInput;"); | 874 | _builder.append("find mustExist(problem, interpretation, Straight);"); |
458 | _builder.newLine(); | 875 | _builder.newLine(); |
459 | _builder.append("\t"); | 876 | _builder.append("\t"); |
460 | _builder.append("extraInput != target;"); | 877 | _builder.append("find mustExist(problem, interpretation, Divergent);"); |
878 | _builder.newLine(); | ||
879 | _builder.append("\t"); | ||
880 | CharSequence _referInstanceOf_32 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MAY, "source"); | ||
881 | _builder.append(_referInstanceOf_32, "\t"); | ||
882 | _builder.newLineIfNotEmpty(); | ||
883 | _builder.append("\t"); | ||
884 | CharSequence _referInstanceOf_33 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MAY, "target"); | ||
885 | _builder.append(_referInstanceOf_33, "\t"); | ||
886 | _builder.newLineIfNotEmpty(); | ||
887 | _builder.append("\t"); | ||
888 | CharSequence _referInstanceOf_34 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "Straight"); | ||
889 | _builder.append(_referInstanceOf_34, "\t"); | ||
890 | _builder.newLineIfNotEmpty(); | ||
891 | _builder.append("\t"); | ||
892 | CharSequence _referInstanceOf_35 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "Divergent"); | ||
893 | _builder.append(_referInstanceOf_35, "\t"); | ||
894 | _builder.newLineIfNotEmpty(); | ||
895 | _builder.append("\t"); | ||
896 | CharSequence _referRelation_35 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "T", "Straight", Modality.MUST, fqnToPQuery); | ||
897 | _builder.append(_referRelation_35, "\t"); | ||
898 | _builder.newLineIfNotEmpty(); | ||
899 | _builder.append("\t"); | ||
900 | _builder.append("T == source;"); | ||
461 | _builder.newLine(); | 901 | _builder.newLine(); |
462 | _builder.append("\t"); | 902 | _builder.append("\t"); |
463 | _builder.append("potentialExtraInput != target;"); | 903 | _builder.append("Divergent == target;"); |
464 | _builder.newLine(); | 904 | _builder.newLine(); |
905 | _builder.append("\t"); | ||
906 | CharSequence _referRelation_36 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "T", "Straight", Modality.MUST, fqnToPQuery); | ||
907 | _builder.append(_referRelation_36, "\t"); | ||
908 | _builder.newLineIfNotEmpty(); | ||
909 | _builder.append("\t"); | ||
910 | CharSequence _referRelation_37 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "T", "Divergent", Modality.MUST, fqnToPQuery); | ||
911 | _builder.append(_referRelation_37, "\t"); | ||
912 | _builder.newLineIfNotEmpty(); | ||
465 | _builder.append("}"); | 913 | _builder.append("}"); |
466 | _builder.newLine(); | 914 | _builder.newLine(); |
467 | _builder.newLine(); | 915 | _builder.newLine(); |
468 | _builder.append("pattern "); | 916 | _builder.append("pattern tooManyInputsOfTurnout_must_to_true_by_connectedTo("); |
469 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_DIVERGENT); | ||
470 | _builder.append("("); | ||
471 | _builder.append(parameters); | 917 | _builder.append(parameters); |
472 | _builder.append(") {"); | 918 | _builder.append(", T : DefinedElement) {"); |
473 | _builder.newLineIfNotEmpty(); | 919 | _builder.newLineIfNotEmpty(); |
474 | _builder.append("\t"); | 920 | _builder.append("\t"); |
475 | _builder.append("find "); | 921 | _builder.append("find mustExist(problem, interpretation, S);"); |
476 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_TURNOUT_OUTPUT, "\t"); | ||
477 | _builder.append("(problem, interpretation, source, target);"); | ||
478 | _builder.newLineIfNotEmpty(); | ||
479 | _builder.append("} or {"); | ||
480 | _builder.newLine(); | 922 | _builder.newLine(); |
481 | _builder.append("\t"); | 923 | _builder.append("\t"); |
482 | _builder.append("// turnoutOutputsAreSame unit propagation"); | 924 | CharSequence _referInstanceOf_36 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "S"); |
925 | _builder.append(_referInstanceOf_36, "\t"); | ||
926 | _builder.newLineIfNotEmpty(); | ||
927 | _builder.append("\t"); | ||
928 | _builder.append("find adjacent_must_to_true_by_connectedTo(problem, interpretation, source, target, I1, S);"); | ||
483 | _builder.newLine(); | 929 | _builder.newLine(); |
484 | _builder.append("\t"); | 930 | _builder.append("\t"); |
485 | _builder.append(commonParameterConstraints, "\t"); | 931 | CharSequence _referPattern_7 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Adjacent.instance().getFullyQualifiedName()), new String[] { "I2", "S" }, Modality.MUST, true, false); |
932 | _builder.append(_referPattern_7, "\t"); | ||
486 | _builder.newLineIfNotEmpty(); | 933 | _builder.newLineIfNotEmpty(); |
487 | _builder.append("\t"); | 934 | _builder.append("\t"); |
488 | CharSequence _referInstanceOf_32 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "source"); | 935 | CharSequence _referPattern_8 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Adjacent.instance().getFullyQualifiedName()), new String[] { "I3", "S" }, Modality.MUST, true, false); |
489 | _builder.append(_referInstanceOf_32, "\t"); | 936 | _builder.append(_referPattern_8, "\t"); |
490 | _builder.newLineIfNotEmpty(); | 937 | _builder.newLineIfNotEmpty(); |
491 | _builder.append("\t"); | 938 | _builder.append("\t"); |
492 | CharSequence _referInstanceOf_33 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "target"); | 939 | CharSequence _referPattern_9 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Adjacent.instance().getFullyQualifiedName()), new String[] { "I4", "S" }, Modality.MUST, true, false); |
493 | _builder.append(_referInstanceOf_33, "\t"); | 940 | _builder.append(_referPattern_9, "\t"); |
494 | _builder.newLineIfNotEmpty(); | 941 | _builder.newLineIfNotEmpty(); |
495 | _builder.append("\t"); | 942 | _builder.append("\t"); |
496 | CharSequence _referRelation_12 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "source", "target", Modality.MUST, fqnToPQuery); | 943 | _builder.append("I1 != I2;"); |
497 | _builder.append(_referRelation_12, "\t"); | ||
498 | _builder.newLineIfNotEmpty(); | ||
499 | _builder.append("} or {"); | ||
500 | _builder.newLine(); | 944 | _builder.newLine(); |
501 | _builder.append("\t"); | 945 | _builder.append("\t"); |
502 | _builder.append("// turnoutConnectedToBothOutputs unit propagation"); | 946 | _builder.append("I1 != I3;"); |
503 | _builder.newLine(); | 947 | _builder.newLine(); |
504 | _builder.append("\t"); | 948 | _builder.append("\t"); |
505 | _builder.append(commonParameterConstraints, "\t"); | 949 | _builder.append("I1 != I4;"); |
506 | _builder.newLineIfNotEmpty(); | 950 | _builder.newLine(); |
507 | _builder.append("\t"); | 951 | _builder.append("\t"); |
508 | CharSequence _referInstanceOf_34 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "source"); | 952 | _builder.append("I2 != I3;"); |
509 | _builder.append(_referInstanceOf_34, "\t"); | 953 | _builder.newLine(); |
954 | _builder.append("\t"); | ||
955 | _builder.append("I2 != I4;"); | ||
956 | _builder.newLine(); | ||
957 | _builder.append("\t"); | ||
958 | _builder.append("I3 != I4;"); | ||
959 | _builder.newLine(); | ||
960 | _builder.append("}"); | ||
961 | _builder.newLine(); | ||
962 | _builder.newLine(); | ||
963 | _builder.append("pattern tooManyInputsOfTurnout_must_to_true_by_straight("); | ||
964 | _builder.append(parameters); | ||
965 | _builder.append(", T : DefinedElement) {"); | ||
510 | _builder.newLineIfNotEmpty(); | 966 | _builder.newLineIfNotEmpty(); |
511 | _builder.append("\t"); | 967 | _builder.append("\t"); |
512 | CharSequence _referInstanceOf_35 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "target"); | 968 | _builder.append("find mustExist(problem, interpretation, S);"); |
513 | _builder.append(_referInstanceOf_35, "\t"); | 969 | _builder.newLine(); |
970 | _builder.append("\t"); | ||
971 | CharSequence _referInstanceOf_37 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "S"); | ||
972 | _builder.append(_referInstanceOf_37, "\t"); | ||
514 | _builder.newLineIfNotEmpty(); | 973 | _builder.newLineIfNotEmpty(); |
515 | _builder.append("\t"); | 974 | _builder.append("\t"); |
516 | CharSequence _referInstanceOf_36 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "straight"); | 975 | _builder.append("find adjacent_must_to_true_by_straight(problem, interpretation, source, target, I1, S);"); |
517 | _builder.append(_referInstanceOf_36, "\t"); | 976 | _builder.newLine(); |
977 | _builder.append("\t"); | ||
978 | CharSequence _referPattern_10 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Adjacent.instance().getFullyQualifiedName()), new String[] { "I2", "S" }, Modality.MUST, true, false); | ||
979 | _builder.append(_referPattern_10, "\t"); | ||
518 | _builder.newLineIfNotEmpty(); | 980 | _builder.newLineIfNotEmpty(); |
519 | _builder.append("\t"); | 981 | _builder.append("\t"); |
520 | CharSequence _referRelation_13 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "source", "target", Modality.MUST, fqnToPQuery); | 982 | CharSequence _referPattern_11 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Adjacent.instance().getFullyQualifiedName()), new String[] { "I3", "S" }, Modality.MUST, true, false); |
521 | _builder.append(_referRelation_13, "\t"); | 983 | _builder.append(_referPattern_11, "\t"); |
522 | _builder.newLineIfNotEmpty(); | 984 | _builder.newLineIfNotEmpty(); |
523 | _builder.append("\t"); | 985 | _builder.append("\t"); |
524 | CharSequence _referRelation_14 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "source", "straight", Modality.MUST, fqnToPQuery); | 986 | CharSequence _referPattern_12 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Adjacent.instance().getFullyQualifiedName()), new String[] { "I4", "S" }, Modality.MUST, true, false); |
525 | _builder.append(_referRelation_14, "\t"); | 987 | _builder.append(_referPattern_12, "\t"); |
526 | _builder.newLineIfNotEmpty(); | 988 | _builder.newLineIfNotEmpty(); |
527 | _builder.append("\t"); | 989 | _builder.append("\t"); |
528 | CharSequence _referRelation_15 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "source", "straight", Modality.MUST, fqnToPQuery); | 990 | _builder.append("I1 != I2;"); |
529 | _builder.append(_referRelation_15, "\t"); | 991 | _builder.newLine(); |
992 | _builder.append("\t"); | ||
993 | _builder.append("I1 != I3;"); | ||
994 | _builder.newLine(); | ||
995 | _builder.append("\t"); | ||
996 | _builder.append("I1 != I4;"); | ||
997 | _builder.newLine(); | ||
998 | _builder.append("\t"); | ||
999 | _builder.append("I2 != I3;"); | ||
1000 | _builder.newLine(); | ||
1001 | _builder.append("\t"); | ||
1002 | _builder.append("I2 != I4;"); | ||
1003 | _builder.newLine(); | ||
1004 | _builder.append("\t"); | ||
1005 | _builder.append("I3 != I4;"); | ||
1006 | _builder.newLine(); | ||
1007 | _builder.append("}"); | ||
1008 | _builder.newLine(); | ||
1009 | _builder.newLine(); | ||
1010 | _builder.append("pattern tooManyInputsOfTurnout_must_to_true_by_divergent("); | ||
1011 | _builder.append(parameters); | ||
1012 | _builder.append(", T : DefinedElement) {"); | ||
530 | _builder.newLineIfNotEmpty(); | 1013 | _builder.newLineIfNotEmpty(); |
531 | _builder.append("} or {"); | 1014 | _builder.append("\t"); |
1015 | _builder.append("find mustExist(problem, interpretation, S);"); | ||
532 | _builder.newLine(); | 1016 | _builder.newLine(); |
533 | _builder.append("\t"); | 1017 | _builder.append("\t"); |
534 | _builder.append("// tooManyExtraInputsOfTurnout unit propagation"); | 1018 | CharSequence _referInstanceOf_38 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "S"); |
1019 | _builder.append(_referInstanceOf_38, "\t"); | ||
1020 | _builder.newLineIfNotEmpty(); | ||
1021 | _builder.append("\t"); | ||
1022 | _builder.append("find adjacent_must_to_true_by_divergent(problem, interpretation, source, target, I1, S);"); | ||
535 | _builder.newLine(); | 1023 | _builder.newLine(); |
536 | _builder.append("\t"); | 1024 | _builder.append("\t"); |
537 | _builder.append(commonParameterConstraints, "\t"); | 1025 | CharSequence _referPattern_13 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Adjacent.instance().getFullyQualifiedName()), new String[] { "I2", "S" }, Modality.MUST, true, false); |
1026 | _builder.append(_referPattern_13, "\t"); | ||
538 | _builder.newLineIfNotEmpty(); | 1027 | _builder.newLineIfNotEmpty(); |
539 | _builder.append("\t"); | 1028 | _builder.append("\t"); |
540 | CharSequence _referInstanceOf_37 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.turnoutType, Modality.MUST, "source"); | 1029 | CharSequence _referPattern_14 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Adjacent.instance().getFullyQualifiedName()), new String[] { "I3", "S" }, Modality.MUST, true, false); |
541 | _builder.append(_referInstanceOf_37, "\t"); | 1030 | _builder.append(_referPattern_14, "\t"); |
542 | _builder.newLineIfNotEmpty(); | 1031 | _builder.newLineIfNotEmpty(); |
543 | _builder.append("\t"); | 1032 | _builder.append("\t"); |
544 | CharSequence _referInstanceOf_38 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "target"); | 1033 | CharSequence _referPattern_15 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(Adjacent.instance().getFullyQualifiedName()), new String[] { "I4", "S" }, Modality.MUST, true, false); |
545 | _builder.append(_referInstanceOf_38, "\t"); | 1034 | _builder.append(_referPattern_15, "\t"); |
546 | _builder.newLineIfNotEmpty(); | 1035 | _builder.newLineIfNotEmpty(); |
547 | _builder.append("\t"); | 1036 | _builder.append("\t"); |
548 | CharSequence _referInstanceOf_39 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "extraInput"); | 1037 | _builder.append("I1 != I2;"); |
549 | _builder.append(_referInstanceOf_39, "\t"); | 1038 | _builder.newLine(); |
1039 | _builder.append("\t"); | ||
1040 | _builder.append("I1 != I3;"); | ||
1041 | _builder.newLine(); | ||
1042 | _builder.append("\t"); | ||
1043 | _builder.append("I1 != I4;"); | ||
1044 | _builder.newLine(); | ||
1045 | _builder.append("\t"); | ||
1046 | _builder.append("I2 != I3;"); | ||
1047 | _builder.newLine(); | ||
1048 | _builder.append("\t"); | ||
1049 | _builder.append("I2 != I4;"); | ||
1050 | _builder.newLine(); | ||
1051 | _builder.append("\t"); | ||
1052 | _builder.append("I3 != I4;"); | ||
1053 | _builder.newLine(); | ||
1054 | _builder.append("}"); | ||
1055 | _builder.newLine(); | ||
1056 | _builder.newLine(); | ||
1057 | _builder.append("pattern "); | ||
1058 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_CONNECTED_TO); | ||
1059 | _builder.append("_helper("); | ||
1060 | _builder.append(parameters); | ||
1061 | _builder.append(") {"); | ||
550 | _builder.newLineIfNotEmpty(); | 1062 | _builder.newLineIfNotEmpty(); |
551 | _builder.append("\t"); | 1063 | _builder.append("\t"); |
552 | CharSequence _referInstanceOf_40 = generator.getTypeIndexer().referInstanceOf(Modes3UnitPropagationGenerator.this.segmentType, Modality.MUST, "potentialExtraInput"); | 1064 | _builder.append("find connectedToReflexive_must_to_true_by_connectedTo(problem, interpretation, source, target, _);"); |
553 | _builder.append(_referInstanceOf_40, "\t"); | 1065 | _builder.newLine(); |
1066 | _builder.append("} or {"); | ||
1067 | _builder.newLine(); | ||
1068 | _builder.append("\t"); | ||
1069 | _builder.append("find tooManyInputsOfSegment_must_to_true_by_connectedTo(problem, interpretation, source, target, _);"); | ||
1070 | _builder.newLine(); | ||
1071 | _builder.append("} or {"); | ||
1072 | _builder.newLine(); | ||
1073 | _builder.append("\t"); | ||
1074 | _builder.append("find turnoutConnectedToBothOutputs_must_to_true_by_connectedTo(problem, interpretation, source, target, _);"); | ||
1075 | _builder.newLine(); | ||
1076 | _builder.append("} or {"); | ||
1077 | _builder.newLine(); | ||
1078 | _builder.append("\t"); | ||
1079 | _builder.append("find tooManyInputsOfTurnout_must_to_true_by_connectedTo(problem, interpretation, source, target, _);"); | ||
1080 | _builder.newLine(); | ||
1081 | _builder.append("}"); | ||
1082 | _builder.newLine(); | ||
1083 | _builder.newLine(); | ||
1084 | _builder.append("pattern "); | ||
1085 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_CONNECTED_TO); | ||
1086 | _builder.append("("); | ||
1087 | _builder.append(parameters); | ||
1088 | _builder.append(") {"); | ||
554 | _builder.newLineIfNotEmpty(); | 1089 | _builder.newLineIfNotEmpty(); |
555 | _builder.append("\t"); | 1090 | _builder.append("\t"); |
556 | CharSequence _referPattern_7 = generator.getRelationDefinitionIndexer().referPattern(fqnToPQuery.get(ExtraInputOfTurnout.instance().getFullyQualifiedName()), new String[] { "source", "extraInput" }, Modality.MUST, true, false); | 1091 | _builder.append("find "); |
557 | _builder.append(_referPattern_7, "\t"); | 1092 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_CONNECTED_TO, "\t"); |
1093 | _builder.append("_helper(problem, interpretation, source, target);"); | ||
558 | _builder.newLineIfNotEmpty(); | 1094 | _builder.newLineIfNotEmpty(); |
1095 | _builder.append("} or {"); | ||
1096 | _builder.newLine(); | ||
559 | _builder.append("\t"); | 1097 | _builder.append("\t"); |
560 | CharSequence _referRelation_16 = generator.referRelation(Modes3UnitPropagationGenerator.this.connectedToRelation, "source", "potentialExtraInput", Modality.MUST, fqnToPQuery); | 1098 | _builder.append("find "); |
561 | _builder.append(_referRelation_16, "\t"); | 1099 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_CONNECTED_TO, "\t"); |
1100 | _builder.append("_helper(problem, interpretation, target, source);"); | ||
1101 | _builder.newLineIfNotEmpty(); | ||
1102 | _builder.append("}"); | ||
1103 | _builder.newLine(); | ||
1104 | _builder.newLine(); | ||
1105 | _builder.append("pattern "); | ||
1106 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_STRAIGHT); | ||
1107 | _builder.append("("); | ||
1108 | _builder.append(parameters); | ||
1109 | _builder.append(") {"); | ||
562 | _builder.newLineIfNotEmpty(); | 1110 | _builder.newLineIfNotEmpty(); |
563 | _builder.append("\t"); | 1111 | _builder.append("\t"); |
564 | _builder.append("neg "); | 1112 | _builder.append("find outputReflexive_must_to_true_by_straight(problem, interpretation, source, target, _);"); |
565 | CharSequence _referRelation_17 = generator.referRelation(Modes3UnitPropagationGenerator.this.straightRelation, "source", "potentialExtraInput", Modality.MAY, fqnToPQuery); | 1113 | _builder.newLine(); |
566 | _builder.append(_referRelation_17, "\t"); | 1114 | _builder.append("} or {"); |
1115 | _builder.newLine(); | ||
1116 | _builder.append("\t"); | ||
1117 | _builder.append("find turnoutOutputsAreSame_must_to_true_by_straight(problem, interpretation, source, target, _);"); | ||
1118 | _builder.newLine(); | ||
1119 | _builder.append("} or {"); | ||
1120 | _builder.newLine(); | ||
1121 | _builder.append("\t"); | ||
1122 | _builder.append("find tooManyInputsOfSegment_must_to_true_by_straight(problem, interpretation, source, target, _);"); | ||
1123 | _builder.newLine(); | ||
1124 | _builder.append("} or {"); | ||
1125 | _builder.newLine(); | ||
1126 | _builder.append("\t"); | ||
1127 | _builder.append("find turnoutConnectedToBothOutputs_must_to_true_by_straight(problem, interpretation, source, target, _);"); | ||
1128 | _builder.newLine(); | ||
1129 | _builder.append("} or {"); | ||
1130 | _builder.newLine(); | ||
1131 | _builder.append("\t"); | ||
1132 | _builder.append("find tooManyInputsOfTurnout_must_to_true_by_straight(problem, interpretation, source, target, _);"); | ||
1133 | _builder.newLine(); | ||
1134 | _builder.append("}"); | ||
1135 | _builder.newLine(); | ||
1136 | _builder.newLine(); | ||
1137 | _builder.append("pattern "); | ||
1138 | _builder.append(Modes3UnitPropagationGenerator.MUST_NOT_DIVERGENT); | ||
1139 | _builder.append("("); | ||
1140 | _builder.append(parameters); | ||
1141 | _builder.append(") {"); | ||
567 | _builder.newLineIfNotEmpty(); | 1142 | _builder.newLineIfNotEmpty(); |
568 | _builder.append("\t"); | 1143 | _builder.append("\t"); |
569 | _builder.append("extraInput != potentialExtraInput;"); | 1144 | _builder.append("find outputReflexive_must_to_true_by_divergent(problem, interpretation, source, target, _);"); |
1145 | _builder.newLine(); | ||
1146 | _builder.append("} or {"); | ||
1147 | _builder.newLine(); | ||
1148 | _builder.append("\t"); | ||
1149 | _builder.append("find turnoutOutputsAreSame_must_to_true_by_divergent(problem, interpretation, source, target, _);"); | ||
1150 | _builder.newLine(); | ||
1151 | _builder.append("} or {"); | ||
570 | _builder.newLine(); | 1152 | _builder.newLine(); |
571 | _builder.append("\t"); | 1153 | _builder.append("\t"); |
572 | _builder.append("extraInput != target;"); | 1154 | _builder.append("find tooManyInputsOfSegment_must_to_true_by_divergent(problem, interpretation, source, target, _);"); |
1155 | _builder.newLine(); | ||
1156 | _builder.append("} or {"); | ||
1157 | _builder.newLine(); | ||
1158 | _builder.append("\t"); | ||
1159 | _builder.append("find turnoutConnectedToBothOutputs_must_to_true_by_divergent(problem, interpretation, source, target, _);"); | ||
1160 | _builder.newLine(); | ||
1161 | _builder.append("} or {"); | ||
573 | _builder.newLine(); | 1162 | _builder.newLine(); |
574 | _builder.append("\t"); | 1163 | _builder.append("\t"); |
575 | _builder.append("potentialExtraInput != target;"); | 1164 | _builder.append("find tooManyInputsOfTurnout_must_to_true_by_divergent(problem, interpretation, source, target, _);"); |
576 | _builder.newLine(); | 1165 | _builder.newLine(); |
577 | _builder.append("}"); | 1166 | _builder.append("}"); |
578 | _builder.newLine(); | 1167 | _builder.newLine(); |
579 | } | 1168 | } |
580 | }; | 1169 | }; |
581 | _xblockexpression = _client_2; | 1170 | _xblockexpression = _client_3; |
582 | } | 1171 | } |
583 | return _xblockexpression; | 1172 | return _xblockexpression; |
584 | } | 1173 | } |