From f00ce77fdc3a1417ddfd833f122b64ecef80d7d6 Mon Sep 17 00:00:00 2001 From: OszkarSemerath Date: Sun, 2 Jul 2017 23:34:27 +0200 Subject: Alloy implementation of multiple model generation --- .../dlsreasoner/alloy/reasoner/AlloySolver.xtend | 85 +++++++++------- .../alloy/reasoner/builder/Alloy2LogicMapper.xtend | 50 +++++++--- .../alloy/reasoner/builder/AlloyHandler.xtend | 111 +++++++++++++++++---- .../builder/Logic2AlloyLanguageMapper.xtend | 2 +- .../model/generated/AlloyLanguage.genmodel | 2 +- .../bme/mit/inf/dslreasoner/AlloyLanguage.xtextbin | Bin 9814 -> 9769 bytes .../serializer/AlloyLanguageSemanticSequencer.java | 2 +- .../AlloyLanguageSyntacticSequencer.java | 4 +- .../services/AlloyLanguageGrammarAccess.java | 86 ++++++++-------- 9 files changed, 225 insertions(+), 117 deletions(-) diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/AlloySolver.xtend b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/AlloySolver.xtend index 7dfc3161..d0c7d320 100644 --- a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/AlloySolver.xtend +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/AlloySolver.xtend @@ -3,8 +3,10 @@ package hu.bme.mit.inf.dlsreasoner.alloy.reasoner import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.builder.Alloy2LogicMapper import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.builder.AlloyHandler import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.builder.AlloyModelInterpretation +import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.builder.AlloyModelInterpretation_TypeInterpretation_FilteredTypes import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.builder.Logic2AlloyLanguageMapper import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.builder.Logic2AlloyLanguageMapperTrace +import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.builder.Logic2AlloyLanguageMapper_TypeMapper_FilteredTypes import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.builder.MonitoredAlloySolution import hu.bme.mit.inf.dslreasoner.AlloyLanguageStandaloneSetupGenerated import hu.bme.mit.inf.dslreasoner.alloyLanguage.AlloyLanguagePackage @@ -14,9 +16,6 @@ import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicSolverConfiguration import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.ModelResult import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace -import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.builder.Logic2AlloyLanguageMapper_TypeMapper_FilteredTypes -import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.builder.AlloyModelInterpretation_TypeInterpretation_FilteredTypes -import org.eclipse.emf.common.util.URI class AlloySolver extends LogicReasoner{ @@ -33,40 +32,56 @@ class AlloySolver extends LogicReasoner{ val fileName = "problem.als" override solve(LogicProblem problem, LogicSolverConfiguration configuration, ReasonerWorkspace workspace) throws LogicReasonerException { + val alloyConfig = configuration.asConfig + + // Start: Logic -> Alloy mapping + val transformationStart = System.currentTimeMillis + val result = forwardMapper.transformProblem(problem,alloyConfig) + val alloyProblem = result.output + val forwardTrace = result.trace + + var String fileURI = null; + var String alloyCode = null; + if(alloyConfig.writeToFile) { + fileURI = workspace.writeModel(alloyProblem,fileName).toFileString + } else { + alloyCode = workspace.writeModelToString(alloyProblem,fileName) + } + val transformationTime = System.currentTimeMillis - transformationStart + // Finish: Logic -> Alloy mapping + + + // Start: Solving Alloy problem + val solverStart = System.currentTimeMillis + val result2 = handler.callSolver(alloyProblem,workspace,alloyConfig,fileURI,alloyCode) + val logicResult = backwardMapper.transformOutput(problem,configuration.solutionScope.numberOfRequiredSolution,result2,forwardTrace,transformationTime) + val solverFinish = System.currentTimeMillis-solverStart + // Finish: Solving Alloy problem + + if(alloyConfig.writeToFile) workspace.deactivateModel(fileName) + + return logicResult + } + + def asConfig(LogicSolverConfiguration configuration) { if(configuration instanceof AlloySolverConfiguration) { - val transformationStart = System.currentTimeMillis - val result = forwardMapper.transformProblem(problem,configuration) - val alloyProblem = result.output - - /*val x = alloyProblem.eAllContents.filter(ALSFunctionCall).filter[it.referredDefinition == null].toList - println(x)*/ - val forwardTrace = result.trace - - var String fileURI = null; - var String alloyCode = null; - if(configuration.writeToFile) { - fileURI = workspace.writeModel(alloyProblem,fileName).toFileString - } else { - alloyCode = workspace.writeModelToString(alloyProblem,fileName) - } - - //val alloyCode = workspace.readText(fileName) - //val FunctionWithTimeout call = new FunctionWithTimeout[] - - val transformationTime = System.currentTimeMillis - transformationStart - val result2 = handler.callSolver(alloyProblem,workspace,configuration,fileURI,alloyCode) - workspace.deactivateModel(fileName) - val logicResult = backwardMapper.transformOutput(problem,result2,forwardTrace,transformationTime) - return logicResult - } else throw new IllegalArgumentException('''The configuration have to be an «AlloySolverConfiguration.simpleName»!''') + return configuration + } else { + throw new IllegalArgumentException('''The configuration have to be an «AlloySolverConfiguration.simpleName»!''') + } } - override getInterpretation(ModelResult modelResult) { - return new AlloyModelInterpretation( - new AlloyModelInterpretation_TypeInterpretation_FilteredTypes, - (modelResult.representation as MonitoredAlloySolution).solution, - forwardMapper, - modelResult.trace as Logic2AlloyLanguageMapperTrace - ); + override getInterpretations(ModelResult modelResult) { + val answers = (modelResult.representation as MonitoredAlloySolution).aswers.map[key] + val res = answers.map [ + new AlloyModelInterpretation( + new AlloyModelInterpretation_TypeInterpretation_FilteredTypes, + it, + forwardMapper, + modelResult.trace as Logic2AlloyLanguageMapperTrace + ) + ] + + return res } } \ No newline at end of file diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/Alloy2LogicMapper.xtend b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/Alloy2LogicMapper.xtend index 637752b0..7db9e0ea 100644 --- a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/Alloy2LogicMapper.xtend +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/Alloy2LogicMapper.xtend @@ -6,28 +6,30 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicresultFactory class Alloy2LogicMapper { val extension LogicresultFactory resultFactory = LogicresultFactory.eINSTANCE - public def transformOutput(LogicProblem problem, MonitoredAlloySolution solution, Logic2AlloyLanguageMapperTrace trace, long transformationTime) { - if(solution == null) { + public def transformOutput(LogicProblem problem, int requiredNumberOfSolution, MonitoredAlloySolution monitoredAlloySolution, Logic2AlloyLanguageMapperTrace trace, long transformationTime) { + val models = monitoredAlloySolution.aswers.map[it.key].toList + + if(monitoredAlloySolution.finishedBeforeTimeout) { return createInsuficientResourcesResult => [ it.problem = problem - it.statistics = transformStatistics(solution,transformationTime) + it.representation += models + it.trace = trace + it.statistics = transformStatistics(monitoredAlloySolution,transformationTime) ] } else { - val logicResult = solution.solution - if(logicResult.satisfiable) { + if(models.last.satisfiable || requiredNumberOfSolution == -1) { return createModelResult => [ it.problem = problem - it.representation += solution - it.maxInteger = logicResult.max - it.minInteger = logicResult.min + it.representation += models it.trace = trace - it.statistics = transformStatistics(solution,transformationTime) + it.statistics = transformStatistics(monitoredAlloySolution,transformationTime) ] } else { return createInconsistencyResult => [ it.problem = problem - //trace? - it.statistics = transformStatistics(solution,transformationTime) + it.representation += models + it.trace = trace + it.statistics = transformStatistics(monitoredAlloySolution,transformationTime) ] } } @@ -36,13 +38,29 @@ class Alloy2LogicMapper { def transformStatistics(MonitoredAlloySolution solution, long transformationTime) { createStatistics => [ it.transformationTime = transformationTime as int - if(solution != null) { - it.solverTime = solution.runtimeTime as int - it.entries += LogicresultFactory.eINSTANCE.createIntStatisticEntry => [ - it.name = "KoodkodToCNFTransformationTime" - it.value = solution.getKodkodTime as int + for(solutionIndex : 0.. [ + it.name = '''Answer«solutionIndex»Time''' + it.value = solutionTime.intValue ] } + it.entries+= createIntStatisticEntry => [ + it.name = "Alloy2KodKodTransformationTime" + it.value = solution.kodkodTime as int + ] + it.entries+= createIntStatisticEntry => [ + it.name = "Alloy2KodKodTransformationTime" + it.value = solution.kodkodTime as int + ] + it.entries+= createStringStatisticEntry => [ + it.name = "warnings" + it.value = '''[«FOR warning : solution.warnings SEPARATOR ","»«warning»«ENDFOR»]''' + ] ] } + + def sum(Iterable ints) { + ints.reduce[p1, p2|p1+p2] + } } \ No newline at end of file diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/AlloyHandler.xtend b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/AlloyHandler.xtend index 6bac4130..17220776 100644 --- a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/AlloyHandler.xtend +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/AlloyHandler.xtend @@ -21,6 +21,11 @@ import org.eclipse.emf.common.CommonPlugin import java.util.ArrayList import hu.bme.mit.inf.dslreasoner.alloyLanguage.ALSDocument import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.AlloySolverConfiguration +import com.google.common.util.concurrent.SimpleTimeLimiter +import java.util.concurrent.Callable +import java.util.concurrent.TimeUnit +import com.google.common.util.concurrent.UncheckedTimeoutException +import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicSolverConfiguration class AlloySolverException extends Exception{ new(String s) { super(s) } @@ -34,9 +39,8 @@ class AlloySolverException extends Exception{ List warnings List debugs long kodkodTime - long runtimeTime - - A4Solution solution + val List> aswers + val boolean finishedBeforeTimeout } class AlloyHandler { @@ -63,6 +67,7 @@ class AlloyHandler { if(configuration.solver.externalSolver) { it.solverDirectory = configuration.solverPath } + //it.inferPartialInstance it.tempDirectory = CommonPlugin.resolve(workspace.workspaceURI).toFileString ] @@ -70,8 +75,8 @@ class AlloyHandler { var Command command = null; var CompModule compModule = null + // Start: Alloy -> Kodkod val kodkodTransformStart = System.currentTimeMillis(); - try { if(configuration.writeToFile) { compModule = CompUtil.parseEverything_fromFile(reporter,null,path) @@ -85,23 +90,26 @@ class AlloyHandler { throw new AlloySolverException(e.message,warnings,e) } val kodkodTransformFinish = System.currentTimeMillis - kodkodTransformStart + // Finish: Alloy -> Kodkod - //Execute - var A4Solution answer = null; - try { - answer = TranslateAlloyToKodkod.execute_command(reporter,compModule.allSigs,command,options) - }catch(Exception e) { - warnings +=e.message - } - - var long runtimeFromAnswer; - if(runtime.empty) { - runtimeFromAnswer = System.currentTimeMillis - (kodkodTransformStart + kodkodTransformFinish) + val limiter = new SimpleTimeLimiter + val callable = new AlloyCallerWithTimeout(warnings,debugs,reporter,options,command,compModule,configuration.solutionScope.numberOfRequiredSolution) + var List> answers + var boolean finished + if(configuration.runtimeLimit == LogicSolverConfiguration::Unlimited) { + answers = callable.call + finished = true } else { - runtimeFromAnswer = runtime.head + try{ + answers = limiter.callWithTimeout(callable,configuration.runtimeLimit,TimeUnit.SECONDS,true) + finished = true + } catch (UncheckedTimeoutException e) { + answers = callable.partialAnswers + finished = false + } } - - return new MonitoredAlloySolution(warnings,debugs,kodkodTransformFinish,runtimeFromAnswer,answer) + + new MonitoredAlloySolution(warnings,debugs,kodkodTransformFinish,answers,finished) } val static Map previousSolverConfigurations = new HashMap @@ -138,6 +146,73 @@ class AlloyHandler { } } +class AlloyCallerWithTimeout implements Callable>>{ + + val List warnings + val List debugs + val A4Reporter reporter + val A4Options options + + val Command command + val CompModule compModule + val int numberOfRequiredSolution + + val List> answers = new LinkedList() + + new(List warnings, + List debugs, + A4Reporter reporter, + A4Options options, + Command command, + CompModule compModule, + int numberOfRequiredSolution) + { + this.warnings = warnings + this.debugs = debugs + this.reporter = reporter + this.options = options + this.command = command + this.compModule = compModule + this.numberOfRequiredSolution = numberOfRequiredSolution + } + + override call() throws Exception { + val startTime = System.currentTimeMillis + + // Start: Execute + var A4Solution lastAnswer = null + try { + do{ + if(lastAnswer == null) { + lastAnswer = TranslateAlloyToKodkod.execute_command(reporter,compModule.allSigs,command,options) + } else { + lastAnswer = lastAnswer.next + } + + val runtime = System.currentTimeMillis -startTime + synchronized(this) { + answers += lastAnswer->runtime + } + println( answers.size ) + } while(lastAnswer.satisfiable != false && hasEnoughSolution(answers)) + + }catch(Exception e) { + warnings +=e.message + } + // Finish: execute + return answers + } + + def hasEnoughSolution(List answers) { + if(numberOfRequiredSolution < 0) return false + else return answers.size < numberOfRequiredSolution + } + + public def getPartialAnswers() { + return answers + } +} + @Data class SolverConfiguration { AlloyBackendSolver backedSolver String path diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/Logic2AlloyLanguageMapper.xtend b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/Logic2AlloyLanguageMapper.xtend index 23b9027f..65fdcfdf 100644 --- a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/Logic2AlloyLanguageMapper.xtend +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/Logic2AlloyLanguageMapper.xtend @@ -277,7 +277,7 @@ class Logic2AlloyLanguageMapper { it.typeScopes+= createALSSigScope => [ it.type= typeMapper.getUndefinedSupertype(trace) it.number = typeMapper.getUndefinedSupertypeScope(config.typeScopes.maxNewElements,trace) - //it.exactly = (config.typeScopes.maxElements == config.typeScopes.minElements) + it.exactly = (config.typeScopes.maxNewElements == config.typeScopes.minNewElements) ] if(config.typeScopes.maxIntScope == LogicSolverConfiguration::Unlimited) throw new UnsupportedOperationException( '''An integer scope have to be specified for Alloy!''') diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/model/generated/AlloyLanguage.genmodel b/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/model/generated/AlloyLanguage.genmodel index dd1d46d2..97c59724 100644 --- a/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/model/generated/AlloyLanguage.genmodel +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/model/generated/AlloyLanguage.genmodel @@ -5,7 +5,7 @@ modelPluginID="hu.bme.mit.inf.dslreasoner.alloy.language" forceOverwrite="true" modelName="AlloyLanguage" updateClasspath="false" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" complianceLevel="6.0" copyrightFields="false" editPluginID="hu.bme.mit.inf.dslreasoner.alloy.language.edit" - editorPluginID="hu.bme.mit.inf.dslreasoner.alloy.language.editor" runtimeVersion="2.11"> + editorPluginID="hu.bme.mit.inf.dslreasoner.alloy.language.editor" runtimeVersion="2.12"> diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/AlloyLanguage.xtextbin b/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/AlloyLanguage.xtextbin index a9ec3da4..a1410bb7 100644 Binary files a/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/AlloyLanguage.xtextbin and b/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/AlloyLanguage.xtextbin differ diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/serializer/AlloyLanguageSemanticSequencer.java b/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/serializer/AlloyLanguageSemanticSequencer.java index b46c4575..9e973316 100644 --- a/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/serializer/AlloyLanguageSemanticSequencer.java +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/serializer/AlloyLanguageSemanticSequencer.java @@ -522,7 +522,7 @@ public class AlloyLanguageSemanticSequencer extends AbstractDelegatingSemanticSe errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, AlloyLanguagePackage.Literals.ALS_REFERENCE__REFERRED)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); - feeder.accept(grammarAccess.getALSBasicRelationTermAccess().getReferredALSRelationDeclarationIDTerminalRuleCall_4_1_0_1(), semanticObject.eGet(AlloyLanguagePackage.Literals.ALS_REFERENCE__REFERRED, false)); + feeder.accept(grammarAccess.getALSBasicRelationTermAccess().getReferredALSRelationDeclarationIDTerminalRuleCall_4_1_0_1(), semanticObject.getReferred()); feeder.finish(); } diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/serializer/AlloyLanguageSyntacticSequencer.java b/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/serializer/AlloyLanguageSyntacticSequencer.java index 4c1eaf02..cb2da160 100644 --- a/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/serializer/AlloyLanguageSyntacticSequencer.java +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/serializer/AlloyLanguageSyntacticSequencer.java @@ -73,7 +73,7 @@ public class AlloyLanguageSyntacticSequencer extends AbstractSyntacticSequencer /** * Ambiguous syntax: - * 'and' | '&&' + * '&&' | 'and' * * This ambiguous syntax occurs at: * {ALSAnd.leftOperand=} (ambiguity) rightOperand=ALSComparison @@ -168,7 +168,7 @@ public class AlloyLanguageSyntacticSequencer extends AbstractSyntacticSequencer /** * Ambiguous syntax: - * 'iff' | '<=>' + * '<=>' | 'iff' * * This ambiguous syntax occurs at: * {ALSIff.leftOperand=} (ambiguity) rightOperand=ALSImpl diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/services/AlloyLanguageGrammarAccess.java b/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/services/AlloyLanguageGrammarAccess.java index 1ccf8905..08dd554d 100644 --- a/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/services/AlloyLanguageGrammarAccess.java +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dslreasoner.alloy.language/src-gen/hu/bme/mit/inf/dslreasoner/services/AlloyLanguageGrammarAccess.java @@ -296,7 +296,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { //fields+=ALSFieldDeclaration)*)? '}' public Group getGroup() { return cGroup; } - //multiplicity=ALSMultiplicity? & abstract?='abstract'? + //(multiplicity=ALSMultiplicity? & abstract?='abstract'?) public UnorderedGroup getUnorderedGroup_0() { return cUnorderedGroup_0; } //multiplicity=ALSMultiplicity? @@ -712,7 +712,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { //ALSQuantified ALSTerm: // {ALSQuantifiedEx} type=ALSMultiplicity // disj?='disj'? variables+=ALSVariableDeclaration (',' variables+=ALSVariableDeclaration)* '{' expression=ALSTerm '}' | - // ALSOr; + // ALSOr @Override public ParserRule getRule() { return rule; } //{ALSQuantifiedEx} type=ALSMultiplicity disj?='disj'? variables+=ALSVariableDeclaration (',' @@ -785,7 +785,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { private final RuleCall cRightOperandALSIffParserRuleCall_1_2_0 = (RuleCall)cRightOperandAssignment_1_2.eContents().get(0); //ALSOr ALSTerm: - // ALSIff ({ALSOr.leftOperand=current} ("||" | "or") rightOperand=ALSIff)?; + // ALSIff ({ALSOr.leftOperand=current} ("||" | "or") rightOperand=ALSIff)? @Override public ParserRule getRule() { return rule; } //ALSIff ({ALSOr.leftOperand=current} ("||" | "or") rightOperand=ALSIff)? @@ -800,7 +800,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { //{ALSOr.leftOperand=current} public Action getALSOrLeftOperandAction_1_0() { return cALSOrLeftOperandAction_1_0; } - //"||" | "or" + //("||" | "or") public Alternatives getAlternatives_1_1() { return cAlternatives_1_1; } //"||" @@ -829,7 +829,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { private final RuleCall cRightOperandALSImplParserRuleCall_1_2_0 = (RuleCall)cRightOperandAssignment_1_2.eContents().get(0); //ALSIff ALSTerm: - // ALSImpl ({ALSIff.leftOperand=current} ("<=>" | "iff") rightOperand=ALSImpl)?; + // ALSImpl ({ALSIff.leftOperand=current} ("<=>" | "iff") rightOperand=ALSImpl)? @Override public ParserRule getRule() { return rule; } //ALSImpl ({ALSIff.leftOperand=current} ("<=>" | "iff") rightOperand=ALSImpl)? @@ -844,7 +844,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { //{ALSIff.leftOperand=current} public Action getALSIffLeftOperandAction_1_0() { return cALSIffLeftOperandAction_1_0; } - //"<=>" | "iff" + //("<=>" | "iff") public Alternatives getAlternatives_1_1() { return cAlternatives_1_1; } //"<=>" @@ -877,7 +877,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { private final RuleCall cElseOperandALSAndParserRuleCall_1_3_1_0 = (RuleCall)cElseOperandAssignment_1_3_1.eContents().get(0); //ALSImpl ALSTerm: - // ALSAnd ({ALSImpl.leftOperand=current} ("=>" | "implies") rightOperand=ALSAnd ('else' elseOperand=ALSAnd)?)?; + // ALSAnd ({ALSImpl.leftOperand=current} ("=>" | "implies") rightOperand=ALSAnd ('else' elseOperand=ALSAnd)?)? @Override public ParserRule getRule() { return rule; } //ALSAnd ({ALSImpl.leftOperand=current} ("=>" | "implies") rightOperand=ALSAnd ('else' elseOperand=ALSAnd)?)? @@ -892,7 +892,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { //{ALSImpl.leftOperand=current} public Action getALSImplLeftOperandAction_1_0() { return cALSImplLeftOperandAction_1_0; } - //"=>" | "implies" + //("=>" | "implies") public Alternatives getAlternatives_1_1() { return cAlternatives_1_1; } //"=>" @@ -933,7 +933,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { private final RuleCall cRightOperandALSComparisonParserRuleCall_1_2_0 = (RuleCall)cRightOperandAssignment_1_2.eContents().get(0); //ALSAnd ALSTerm: - // ALSComparison ({ALSAnd.leftOperand=current} ("&&" | "and") rightOperand=ALSComparison)?; + // ALSComparison ({ALSAnd.leftOperand=current} ("&&" | "and") rightOperand=ALSComparison)? @Override public ParserRule getRule() { return rule; } //ALSComparison ({ALSAnd.leftOperand=current} ("&&" | "and") rightOperand=ALSComparison)? @@ -948,7 +948,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { //{ALSAnd.leftOperand=current} public Action getALSAndLeftOperandAction_1_0() { return cALSAndLeftOperandAction_1_0; } - //"&&" | "and" + //("&&" | "and") public Alternatives getAlternatives_1_1() { return cAlternatives_1_1; } //"&&" @@ -997,7 +997,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { //ALSComparison ALSTerm: // ALSOverride (({ALSEquals.leftOperand=current} "=" | {ALSNotEquals.leftOperand=current} "!=" | // {ALSSubset.leftOperand=current} "in" | {ALSLess.leftOperand=current} ">" | {ALSLeq.leftOperand=current} ">=" | - // {ALSMore.leftOperand=current} "<" | {ALSMeq.leftOperand=current} "<=") rightOperand=ALSOverride)?; + // {ALSMore.leftOperand=current} "<" | {ALSMeq.leftOperand=current} "<=") rightOperand=ALSOverride)? @Override public ParserRule getRule() { return rule; } //ALSOverride (({ALSEquals.leftOperand=current} "=" | {ALSNotEquals.leftOperand=current} "!=" | @@ -1013,9 +1013,9 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { //{ALSMeq.leftOperand=current} "<=") rightOperand=ALSOverride)? public Group getGroup_1() { return cGroup_1; } - //{ALSEquals.leftOperand=current} "=" | {ALSNotEquals.leftOperand=current} "!=" | {ALSSubset.leftOperand=current} "in" | + //({ALSEquals.leftOperand=current} "=" | {ALSNotEquals.leftOperand=current} "!=" | {ALSSubset.leftOperand=current} "in" | //{ALSLess.leftOperand=current} ">" | {ALSLeq.leftOperand=current} ">=" | {ALSMore.leftOperand=current} "<" | - //{ALSMeq.leftOperand=current} "<=" + //{ALSMeq.leftOperand=current} "<=") public Alternatives getAlternatives_1_0() { return cAlternatives_1_0; } //{ALSEquals.leftOperand=current} "=" @@ -1099,7 +1099,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { private final RuleCall cRightOperandALSRangeRestrictionRightParserRuleCall_1_2_0 = (RuleCall)cRightOperandAssignment_1_2.eContents().get(0); //ALSOverride ALSTerm: - // ALSRangeRestrictionRight ({ALSOverride.leftOperand=current} '++' rightOperand=ALSRangeRestrictionRight)?; + // ALSRangeRestrictionRight ({ALSOverride.leftOperand=current} '++' rightOperand=ALSRangeRestrictionRight)? @Override public ParserRule getRule() { return rule; } //ALSRangeRestrictionRight ({ALSOverride.leftOperand=current} '++' rightOperand=ALSRangeRestrictionRight)? @@ -1135,7 +1135,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { private final RuleCall cFilterALSRangeRestrictionLeftParserRuleCall_1_2_0 = (RuleCall)cFilterAssignment_1_2.eContents().get(0); //ALSRangeRestrictionRight ALSTerm: - // ALSRangeRestrictionLeft ({ALSRangeRestrictionRight.relation=current} ':>' filter=ALSRangeRestrictionLeft)?; + // ALSRangeRestrictionLeft ({ALSRangeRestrictionRight.relation=current} ':>' filter=ALSRangeRestrictionLeft)? @Override public ParserRule getRule() { return rule; } //ALSRangeRestrictionLeft ({ALSRangeRestrictionRight.relation=current} ':>' filter=ALSRangeRestrictionLeft)? @@ -1171,7 +1171,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { private final RuleCall cRelationALSJoinParserRuleCall_1_2_0 = (RuleCall)cRelationAssignment_1_2.eContents().get(0); //ALSRangeRestrictionLeft ALSTerm: - // ALSJoin ({ALSRangeRestrictionLeft.filter=current} '<:' relation=ALSJoin)?; + // ALSJoin ({ALSRangeRestrictionLeft.filter=current} '<:' relation=ALSJoin)? @Override public ParserRule getRule() { return rule; } //ALSJoin ({ALSRangeRestrictionLeft.filter=current} '<:' relation=ALSJoin)? @@ -1207,7 +1207,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { private final RuleCall cRightOperandALSMinusParserRuleCall_1_2_0 = (RuleCall)cRightOperandAssignment_1_2.eContents().get(0); //ALSJoin ALSTerm: - // ALSMinus ({ALSJoin.leftOperand=current} '.' rightOperand=ALSMinus)*; + // ALSMinus ({ALSJoin.leftOperand=current} '.' rightOperand=ALSMinus)* @Override public ParserRule getRule() { return rule; } //ALSMinus ({ALSJoin.leftOperand=current} '.' rightOperand=ALSMinus)* @@ -1243,7 +1243,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { private final RuleCall cRightOperandALSPlusParserRuleCall_1_2_0 = (RuleCall)cRightOperandAssignment_1_2.eContents().get(0); //ALSMinus ALSTerm: - // ALSPlus ({ALSMinus.leftOperand=current} '-' rightOperand=ALSPlus)*; + // ALSPlus ({ALSMinus.leftOperand=current} '-' rightOperand=ALSPlus)* @Override public ParserRule getRule() { return rule; } //ALSPlus ({ALSMinus.leftOperand=current} '-' rightOperand=ALSPlus)* @@ -1279,7 +1279,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { private final RuleCall cRightOperandALSIntersectionParserRuleCall_1_2_0 = (RuleCall)cRightOperandAssignment_1_2.eContents().get(0); //ALSPlus ALSTerm: - // ALSIntersection ({ALSPlus.leftOperand=current} '+' rightOperand=ALSIntersection)*; + // ALSIntersection ({ALSPlus.leftOperand=current} '+' rightOperand=ALSIntersection)* @Override public ParserRule getRule() { return rule; } //ALSIntersection ({ALSPlus.leftOperand=current} '+' rightOperand=ALSIntersection)* @@ -1315,7 +1315,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { private final RuleCall cRightOperandALSDirectProductParserRuleCall_1_2_0 = (RuleCall)cRightOperandAssignment_1_2.eContents().get(0); //ALSIntersection ALSTerm: - // ALSDirectProduct ({ALSIntersection.leftOperand=current} '&' rightOperand=ALSDirectProduct)*; + // ALSDirectProduct ({ALSIntersection.leftOperand=current} '&' rightOperand=ALSDirectProduct)* @Override public ParserRule getRule() { return rule; } //ALSDirectProduct ({ALSIntersection.leftOperand=current} '&' rightOperand=ALSDirectProduct)* @@ -1359,7 +1359,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { // ALSPreficed ({ALSDirectProduct.leftOperand=current} leftMultiplicit=ALSMultiplicity? // '->' // rightMultiplicit=ALSMultiplicity? - // rightOperand=ALSPreficed)?; + // rightOperand=ALSPreficed)? @Override public ParserRule getRule() { return rule; } //ALSPreficed ({ALSDirectProduct.leftOperand=current} leftMultiplicit=ALSMultiplicity? '->' @@ -1472,7 +1472,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { // operand=ALSBasicRelationTerm | {ALSSum} 'sum' variables+=ALSVariableDeclaration (',' // variables+=ALSVariableDeclaration)* '{' expression=ALSTerm '}' | {ALSFunctionCall} // (referredDefinition=[ALSDefinition] | referredNumericOperator=ALSNumericOperator) '[' params+=ALSTerm (',' - // params+=ALSTerm)* ']' | ALSBasicRelationTerm; + // params+=ALSTerm)* ']' | ALSBasicRelationTerm @Override public ParserRule getRule() { return rule; } //{ALSNot} => ("!" | 'not') operand=ALSBasicRelationTerm | {ALSInverseRelation} => "~" operand=ALSBasicRelationTerm | @@ -1492,7 +1492,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { //=> ("!" | 'not') public Group getGroup_0_1() { return cGroup_0_1; } - //"!" | 'not' + //("!" | 'not') public Alternatives getAlternatives_0_1_0() { return cAlternatives_0_1_0; } //"!" @@ -1628,7 +1628,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { //{ALSFunctionCall} public Action getALSFunctionCallAction_7_0() { return cALSFunctionCallAction_7_0; } - //referredDefinition=[ALSDefinition] | referredNumericOperator=ALSNumericOperator + //(referredDefinition=[ALSDefinition] | referredNumericOperator=ALSNumericOperator) public Alternatives getAlternatives_7_1() { return cAlternatives_7_1; } //referredDefinition=[ALSDefinition] @@ -1739,7 +1739,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { //ALSBasicRelationTerm ALSTerm: // {ALSNone} 'none' | {ALSIden} 'iden' | {ALSUniv} 'univ' | {ALSInt} 'Int' | {ALSReference} // referred=[ALSRelationDeclaration] | {ALSNumberLiteral} value=INT | - // '(' ALSTerm ')'; + // '(' ALSTerm ')' @Override public ParserRule getRule() { return rule; } //{ALSNone} 'none' | {ALSIden} 'iden' | {ALSUniv} 'univ' | {ALSInt} 'Int' | {ALSReference} @@ -2210,7 +2210,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { return getALSDocumentAccess().getRule(); } - //@ Override terminal ID: + //terminal ID: // ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | "'" | '"' | '0'..'9')*; public TerminalRule getIDRule() { return tID; @@ -2374,7 +2374,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { //ALSQuantified ALSTerm: // {ALSQuantifiedEx} type=ALSMultiplicity // disj?='disj'? variables+=ALSVariableDeclaration (',' variables+=ALSVariableDeclaration)* '{' expression=ALSTerm '}' | - // ALSOr; + // ALSOr public ALSQuantifiedElements getALSQuantifiedAccess() { return pALSQuantified; } @@ -2384,7 +2384,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { } //ALSOr ALSTerm: - // ALSIff ({ALSOr.leftOperand=current} ("||" | "or") rightOperand=ALSIff)?; + // ALSIff ({ALSOr.leftOperand=current} ("||" | "or") rightOperand=ALSIff)? public ALSOrElements getALSOrAccess() { return pALSOr; } @@ -2394,7 +2394,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { } //ALSIff ALSTerm: - // ALSImpl ({ALSIff.leftOperand=current} ("<=>" | "iff") rightOperand=ALSImpl)?; + // ALSImpl ({ALSIff.leftOperand=current} ("<=>" | "iff") rightOperand=ALSImpl)? public ALSIffElements getALSIffAccess() { return pALSIff; } @@ -2404,7 +2404,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { } //ALSImpl ALSTerm: - // ALSAnd ({ALSImpl.leftOperand=current} ("=>" | "implies") rightOperand=ALSAnd ('else' elseOperand=ALSAnd)?)?; + // ALSAnd ({ALSImpl.leftOperand=current} ("=>" | "implies") rightOperand=ALSAnd ('else' elseOperand=ALSAnd)?)? public ALSImplElements getALSImplAccess() { return pALSImpl; } @@ -2414,7 +2414,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { } //ALSAnd ALSTerm: - // ALSComparison ({ALSAnd.leftOperand=current} ("&&" | "and") rightOperand=ALSComparison)?; + // ALSComparison ({ALSAnd.leftOperand=current} ("&&" | "and") rightOperand=ALSComparison)? public ALSAndElements getALSAndAccess() { return pALSAnd; } @@ -2426,7 +2426,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { //ALSComparison ALSTerm: // ALSOverride (({ALSEquals.leftOperand=current} "=" | {ALSNotEquals.leftOperand=current} "!=" | // {ALSSubset.leftOperand=current} "in" | {ALSLess.leftOperand=current} ">" | {ALSLeq.leftOperand=current} ">=" | - // {ALSMore.leftOperand=current} "<" | {ALSMeq.leftOperand=current} "<=") rightOperand=ALSOverride)?; + // {ALSMore.leftOperand=current} "<" | {ALSMeq.leftOperand=current} "<=") rightOperand=ALSOverride)? public ALSComparisonElements getALSComparisonAccess() { return pALSComparison; } @@ -2436,7 +2436,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { } //ALSOverride ALSTerm: - // ALSRangeRestrictionRight ({ALSOverride.leftOperand=current} '++' rightOperand=ALSRangeRestrictionRight)?; + // ALSRangeRestrictionRight ({ALSOverride.leftOperand=current} '++' rightOperand=ALSRangeRestrictionRight)? public ALSOverrideElements getALSOverrideAccess() { return pALSOverride; } @@ -2446,7 +2446,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { } //ALSRangeRestrictionRight ALSTerm: - // ALSRangeRestrictionLeft ({ALSRangeRestrictionRight.relation=current} ':>' filter=ALSRangeRestrictionLeft)?; + // ALSRangeRestrictionLeft ({ALSRangeRestrictionRight.relation=current} ':>' filter=ALSRangeRestrictionLeft)? public ALSRangeRestrictionRightElements getALSRangeRestrictionRightAccess() { return pALSRangeRestrictionRight; } @@ -2456,7 +2456,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { } //ALSRangeRestrictionLeft ALSTerm: - // ALSJoin ({ALSRangeRestrictionLeft.filter=current} '<:' relation=ALSJoin)?; + // ALSJoin ({ALSRangeRestrictionLeft.filter=current} '<:' relation=ALSJoin)? public ALSRangeRestrictionLeftElements getALSRangeRestrictionLeftAccess() { return pALSRangeRestrictionLeft; } @@ -2466,7 +2466,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { } //ALSJoin ALSTerm: - // ALSMinus ({ALSJoin.leftOperand=current} '.' rightOperand=ALSMinus)*; + // ALSMinus ({ALSJoin.leftOperand=current} '.' rightOperand=ALSMinus)* public ALSJoinElements getALSJoinAccess() { return pALSJoin; } @@ -2476,7 +2476,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { } //ALSMinus ALSTerm: - // ALSPlus ({ALSMinus.leftOperand=current} '-' rightOperand=ALSPlus)*; + // ALSPlus ({ALSMinus.leftOperand=current} '-' rightOperand=ALSPlus)* public ALSMinusElements getALSMinusAccess() { return pALSMinus; } @@ -2486,7 +2486,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { } //ALSPlus ALSTerm: - // ALSIntersection ({ALSPlus.leftOperand=current} '+' rightOperand=ALSIntersection)*; + // ALSIntersection ({ALSPlus.leftOperand=current} '+' rightOperand=ALSIntersection)* public ALSPlusElements getALSPlusAccess() { return pALSPlus; } @@ -2496,7 +2496,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { } //ALSIntersection ALSTerm: - // ALSDirectProduct ({ALSIntersection.leftOperand=current} '&' rightOperand=ALSDirectProduct)*; + // ALSDirectProduct ({ALSIntersection.leftOperand=current} '&' rightOperand=ALSDirectProduct)* public ALSIntersectionElements getALSIntersectionAccess() { return pALSIntersection; } @@ -2510,7 +2510,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { // ALSPreficed ({ALSDirectProduct.leftOperand=current} leftMultiplicit=ALSMultiplicity? // '->' // rightMultiplicit=ALSMultiplicity? - // rightOperand=ALSPreficed)?; + // rightOperand=ALSPreficed)? public ALSDirectProductElements getALSDirectProductAccess() { return pALSDirectProduct; } @@ -2526,7 +2526,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { // operand=ALSBasicRelationTerm | {ALSSum} 'sum' variables+=ALSVariableDeclaration (',' // variables+=ALSVariableDeclaration)* '{' expression=ALSTerm '}' | {ALSFunctionCall} // (referredDefinition=[ALSDefinition] | referredNumericOperator=ALSNumericOperator) '[' params+=ALSTerm (',' - // params+=ALSTerm)* ']' | ALSBasicRelationTerm; + // params+=ALSTerm)* ']' | ALSBasicRelationTerm public ALSPreficedElements getALSPreficedAccess() { return pALSPreficed; } @@ -2559,7 +2559,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { //ALSBasicRelationTerm ALSTerm: // {ALSNone} 'none' | {ALSIden} 'iden' | {ALSUniv} 'univ' | {ALSInt} 'Int' | {ALSReference} // referred=[ALSRelationDeclaration] | {ALSNumberLiteral} value=INT | - // '(' ALSTerm ')'; + // '(' ALSTerm ')' public ALSBasicRelationTermElements getALSBasicRelationTermAccess() { return pALSBasicRelationTerm; } @@ -2624,7 +2624,7 @@ public class AlloyLanguageGrammarAccess extends AbstractGrammarElementFinder { } //terminal ML_COMMENT: - // '/*'->'*/'; + // '/ *'->'* /'; public TerminalRule getML_COMMENTRule() { return gaTerminals.getML_COMMENTRule(); } -- cgit v1.2.3-54-g00ecf