diff options
author | Jan Belle | 2017-09-18 10:16:04 +0000 |
---|---|---|
committer | Jan Belle | 2017-09-18 11:00:05 +0000 |
commit | 7640cdbf80ac9305050137c4e91d2054216ea493 (patch) | |
tree | fa7a394dcb2cfd80b42d6f809aab6362578984ec /plugins/org.eclipse.etrice.core.fsm | |
parent | 0b210c2102ca514c50a26c3265005e1396659f1e (diff) | |
parent | 216b91e9103d80043239ecda7052fecb0999b085 (diff) | |
download | org.eclipse.etrice-7640cdbf80ac9305050137c4e91d2054216ea493.tar.gz org.eclipse.etrice-7640cdbf80ac9305050137c4e91d2054216ea493.tar.xz org.eclipse.etrice-7640cdbf80ac9305050137c4e91d2054216ea493.zip |
Merge branch 'newbuild'
Change-Id: Ieac59f3f505510f11482b70352b891b72461e6df
Diffstat (limited to 'plugins/org.eclipse.etrice.core.fsm')
8 files changed, 21 insertions, 1653 deletions
diff --git a/plugins/org.eclipse.etrice.core.fsm/build.gradle b/plugins/org.eclipse.etrice.core.fsm/build.gradle new file mode 100644 index 000000000..1d29137fe --- /dev/null +++ b/plugins/org.eclipse.etrice.core.fsm/build.gradle @@ -0,0 +1,21 @@ +plugins { + id 'java' +} + +dependencies { + compile project(':plugins:org.eclipse.etrice.core.common') + + compile "org.eclipse.xtext:org.eclipse.xtext:$xtext_version" +} + +sourceSets { + main { + java { + srcDirs = ['src', 'src-gen', 'xtend-gen'] + } + resources { + srcDirs = ['src', 'src-gen'] + include '**/*.xtextbin', '**/*.tokens' + } + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.core.fsm/pom.xml b/plugins/org.eclipse.etrice.core.fsm/pom.xml deleted file mode 100644 index 712b74627..000000000 --- a/plugins/org.eclipse.etrice.core.fsm/pom.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.eclipse.etrice</groupId> - <artifactId>java-generator</artifactId> - <version>1.1.1-SNAPSHOT</version> - <relativePath>../../releng/org.eclipse.etrice.parent/pom.xml</relativePath> - </parent> - - <artifactId>org.eclipse.etrice.core.fsm</artifactId> - <packaging>eclipse-plugin</packaging> -</project> diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/formatting2/FSMFormatter.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/formatting2/FSMFormatter.java deleted file mode 100644 index d492ec37b..000000000 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/formatting2/FSMFormatter.java +++ /dev/null @@ -1,335 +0,0 @@ -/** - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Juergen Haug (initial contribution) - */ -package org.eclipse.etrice.core.fsm.formatting2; - -import com.google.inject.Inject; -import java.util.Arrays; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.etrice.core.common.base.Annotation; -import org.eclipse.etrice.core.common.base.AnnotationType; -import org.eclipse.etrice.core.common.base.Documentation; -import org.eclipse.etrice.core.common.base.Import; -import org.eclipse.etrice.core.common.converter.BaseConverterService; -import org.eclipse.etrice.core.common.converter.CCStringConverter; -import org.eclipse.etrice.core.common.formatting2.BaseFormatter; -import org.eclipse.etrice.core.common.formatting2.CCStringReplacer; -import org.eclipse.etrice.core.fsm.fSM.DetailCode; -import org.eclipse.etrice.core.fsm.fSM.ProtocolSemantics; -import org.eclipse.etrice.core.fsm.fSM.SemanticsRule; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.fsm.fSM.Transition; -import org.eclipse.etrice.core.fsm.fSM.Trigger; -import org.eclipse.etrice.core.fsm.fSM.TriggeredTransition; -import org.eclipse.etrice.core.fsm.services.FSMGrammarAccess; -import org.eclipse.xtext.Assignment; -import org.eclipse.xtext.formatting2.IFormattableDocument; -import org.eclipse.xtext.formatting2.IHiddenRegionFormatter; -import org.eclipse.xtext.formatting2.regionaccess.IHiddenRegion; -import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion; -import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder; -import org.eclipse.xtext.resource.XtextResource; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.IterableExtensions; -import org.eclipse.xtext.xbase.lib.Pair; -import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; - -@SuppressWarnings("all") -public class FSMFormatter extends BaseFormatter { - @Inject - @Extension - private FSMGrammarAccess _fSMGrammarAccess; - - @Override - public void formatAllByKeywords(final EObject it, @Extension final IFormattableDocument document) { - super.formatAllByKeywords(it, document); - ISemanticRegionsFinder _allRegionsFor = this.textRegionExtensions.allRegionsFor(it); - List<ISemanticRegion> _keywords = _allRegionsFor.keywords("->", "extends", "=", "or", "|"); - final Procedure1<ISemanticRegion> _function = new Procedure1<ISemanticRegion>() { - @Override - public void apply(final ISemanticRegion it) { - final Procedure1<IHiddenRegionFormatter> _function = new Procedure1<IHiddenRegionFormatter>() { - @Override - public void apply(final IHiddenRegionFormatter it) { - it.oneSpace(); - } - }; - document.surround(it, _function); - } - }; - IterableExtensions.<ISemanticRegion>forEach(_keywords, _function); - } - - protected EObject prependDefaultNewLines(final EObject it, @Extension final IFormattableDocument document) { - EObject _xifexpression = null; - if (((this.textRegionExtensions.previousHiddenRegion(it) != null) && (this.textRegionExtensions.previousHiddenRegion(it).getLineCount() > 2))) { - final Procedure1<IHiddenRegionFormatter> _function = new Procedure1<IHiddenRegionFormatter>() { - @Override - public void apply(final IHiddenRegionFormatter it) { - it.setNewLines(2); - } - }; - _xifexpression = document.<EObject>prepend(it, _function); - } else { - final Procedure1<IHiddenRegionFormatter> _function_1 = new Procedure1<IHiddenRegionFormatter>() { - @Override - public void apply(final IHiddenRegionFormatter it) { - it.newLine(); - } - }; - _xifexpression = document.<EObject>prepend(it, _function_1); - } - return _xifexpression; - } - - protected ISemanticRegion prependDefaultNewLines(final ISemanticRegion it, @Extension final IFormattableDocument document) { - ISemanticRegion _xifexpression = null; - IHiddenRegion _previousHiddenRegion = it.getPreviousHiddenRegion(); - int _lineCount = _previousHiddenRegion.getLineCount(); - boolean _greaterThan = (_lineCount > 2); - if (_greaterThan) { - final Procedure1<IHiddenRegionFormatter> _function = new Procedure1<IHiddenRegionFormatter>() { - @Override - public void apply(final IHiddenRegionFormatter it) { - it.setNewLines(2); - } - }; - _xifexpression = document.prepend(it, _function); - } else { - final Procedure1<IHiddenRegionFormatter> _function_1 = new Procedure1<IHiddenRegionFormatter>() { - @Override - public void apply(final IHiddenRegionFormatter it) { - it.newLine(); - } - }; - _xifexpression = document.prepend(it, _function_1); - } - return _xifexpression; - } - - protected void _format(final StateGraph it, @Extension final IFormattableDocument document) { - EList<EObject> _eContents = it.eContents(); - final Procedure1<EObject> _function = new Procedure1<EObject>() { - @Override - public void apply(final EObject it) { - FSMFormatter.this.prependDefaultNewLines(it, document); - } - }; - IterableExtensions.<EObject>forEach(_eContents, _function); - } - - protected void _format(final State it, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(it); - List<ISemanticRegion> _keywords = _regionFor.keywords("entry", "exit", "do", "subgraph"); - final Procedure1<ISemanticRegion> _function = new Procedure1<ISemanticRegion>() { - @Override - public void apply(final ISemanticRegion it) { - FSMFormatter.this.prependDefaultNewLines(it, document); - final Procedure1<IHiddenRegionFormatter> _function = new Procedure1<IHiddenRegionFormatter>() { - @Override - public void apply(final IHiddenRegionFormatter it) { - it.oneSpace(); - } - }; - document.append(it, _function); - } - }; - IterableExtensions.<ISemanticRegion>forEach(_keywords, _function); - } - - protected void _format(final Transition it, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(it); - List<ISemanticRegion> _keywords = _regionFor.keywords("action", "guard", "cond"); - final Procedure1<ISemanticRegion> _function = new Procedure1<ISemanticRegion>() { - @Override - public void apply(final ISemanticRegion it) { - FSMFormatter.this.prependDefaultNewLines(it, document); - final Procedure1<IHiddenRegionFormatter> _function = new Procedure1<IHiddenRegionFormatter>() { - @Override - public void apply(final IHiddenRegionFormatter it) { - it.oneSpace(); - } - }; - document.append(it, _function); - } - }; - IterableExtensions.<ISemanticRegion>forEach(_keywords, _function); - } - - protected void _format(final TriggeredTransition it, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(it); - List<ISemanticRegion> _keywords = _regionFor.keywords("action", "guard", "cond", "triggers"); - final Procedure1<ISemanticRegion> _function = new Procedure1<ISemanticRegion>() { - @Override - public void apply(final ISemanticRegion it) { - FSMFormatter.this.prependDefaultNewLines(it, document); - final Procedure1<IHiddenRegionFormatter> _function = new Procedure1<IHiddenRegionFormatter>() { - @Override - public void apply(final IHiddenRegionFormatter it) { - it.oneSpace(); - } - }; - document.append(it, _function); - } - }; - IterableExtensions.<ISemanticRegion>forEach(_keywords, _function); - EList<Trigger> _triggers = it.getTriggers(); - Trigger _head = IterableExtensions.<Trigger>head(_triggers); - final Procedure1<IHiddenRegionFormatter> _function_1 = new Procedure1<IHiddenRegionFormatter>() { - @Override - public void apply(final IHiddenRegionFormatter it) { - it.newLine(); - } - }; - document.<Trigger>prepend(_head, _function_1); - EList<Trigger> _triggers_1 = it.getTriggers(); - Iterable<Trigger> _tail = IterableExtensions.<Trigger>tail(_triggers_1); - final Procedure1<Trigger> _function_2 = new Procedure1<Trigger>() { - @Override - public void apply(final Trigger it) { - final Procedure1<IHiddenRegionFormatter> _function = new Procedure1<IHiddenRegionFormatter>() { - @Override - public void apply(final IHiddenRegionFormatter it) { - it.oneSpace(); - } - }; - document.<Trigger>prepend(it, _function); - } - }; - IterableExtensions.<Trigger>forEach(_tail, _function_2); - } - - protected void _format(final Trigger it, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(it); - List<Pair<ISemanticRegion, ISemanticRegion>> _keywordPairs = _regionFor.keywordPairs("<", ">"); - final Procedure1<Pair<ISemanticRegion, ISemanticRegion>> _function = new Procedure1<Pair<ISemanticRegion, ISemanticRegion>>() { - @Override - public void apply(final Pair<ISemanticRegion, ISemanticRegion> it) { - final Procedure1<IHiddenRegionFormatter> _function = new Procedure1<IHiddenRegionFormatter>() { - @Override - public void apply(final IHiddenRegionFormatter it) { - it.noSpace(); - } - }; - document.<ISemanticRegion, ISemanticRegion>interior(it, _function); - } - }; - IterableExtensions.<Pair<ISemanticRegion, ISemanticRegion>>forEach(_keywordPairs, _function); - } - - protected void _format(final ProtocolSemantics it, @Extension final IFormattableDocument document) { - EList<SemanticsRule> _rules = it.getRules(); - final Procedure1<SemanticsRule> _function = new Procedure1<SemanticsRule>() { - @Override - public void apply(final SemanticsRule it) { - FSMFormatter.this.prependDefaultNewLines(it, document); - } - }; - IterableExtensions.<SemanticsRule>forEach(_rules, _function); - } - - @Inject - private BaseConverterService converterService; - - protected void _format(final DetailCode detailcode, @Extension final IFormattableDocument document) { - ISemanticRegionsFinder _regionFor = this.textRegionExtensions.regionFor(detailcode); - FSMGrammarAccess.DetailCodeElements _detailCodeAccess = this._fSMGrammarAccess.getDetailCodeAccess(); - Assignment _linesAssignment_0_1 = _detailCodeAccess.getLinesAssignment_0_1(); - final ISemanticRegion ccRegion = _regionFor.assignment(_linesAssignment_0_1); - if ((ccRegion != null)) { - final Procedure1<IHiddenRegionFormatter> _function = new Procedure1<IHiddenRegionFormatter>() { - @Override - public void apply(final IHiddenRegionFormatter it) { - it.oneSpace(); - } - }; - document.<DetailCode>prepend(detailcode, _function); - boolean _isMultiline = this.textRegionExtensions.isMultiline(detailcode); - if (_isMultiline) { - CCStringConverter _cC_StringConverter = this.converterService.getCC_StringConverter(); - CCStringReplacer _cCStringReplacer = new CCStringReplacer(document, ccRegion, _cC_StringConverter); - document.addReplacer(_cCStringReplacer); - } - } else { - ISemanticRegionsFinder _regionFor_1 = this.textRegionExtensions.regionFor(detailcode); - FSMGrammarAccess.DetailCodeElements _detailCodeAccess_1 = this._fSMGrammarAccess.getDetailCodeAccess(); - Assignment _linesAssignment_1_1 = _detailCodeAccess_1.getLinesAssignment_1_1(); - List<ISemanticRegion> _assignments = _regionFor_1.assignments(_linesAssignment_1_1); - final Procedure1<ISemanticRegion> _function_1 = new Procedure1<ISemanticRegion>() { - @Override - public void apply(final ISemanticRegion it) { - final Procedure1<IHiddenRegionFormatter> _function = new Procedure1<IHiddenRegionFormatter>() { - @Override - public void apply(final IHiddenRegionFormatter it) { - it.newLine(); - } - }; - document.prepend(it, _function); - } - }; - IterableExtensions.<ISemanticRegion>forEach(_assignments, _function_1); - } - } - - public void format(final Object it, final IFormattableDocument document) { - if (it instanceof TriggeredTransition) { - _format((TriggeredTransition)it, document); - return; - } else if (it instanceof State) { - _format((State)it, document); - return; - } else if (it instanceof XtextResource) { - _format((XtextResource)it, document); - return; - } else if (it instanceof Transition) { - _format((Transition)it, document); - return; - } else if (it instanceof Annotation) { - _format((Annotation)it, document); - return; - } else if (it instanceof AnnotationType) { - _format((AnnotationType)it, document); - return; - } else if (it instanceof Documentation) { - _format((Documentation)it, document); - return; - } else if (it instanceof Import) { - _format((Import)it, document); - return; - } else if (it instanceof DetailCode) { - _format((DetailCode)it, document); - return; - } else if (it instanceof ProtocolSemantics) { - _format((ProtocolSemantics)it, document); - return; - } else if (it instanceof StateGraph) { - _format((StateGraph)it, document); - return; - } else if (it instanceof Trigger) { - _format((Trigger)it, document); - return; - } else if (it instanceof EObject) { - _format((EObject)it, document); - return; - } else if (it == null) { - _format((Void)null, document); - return; - } else if (it != null) { - _format(it, document); - return; - } else { - throw new IllegalArgumentException("Unhandled parameter types: " + - Arrays.<Object>asList(it, document).toString()); - } - } -} diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/generator/FSMGenerator.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/generator/FSMGenerator.java deleted file mode 100644 index 5c2dbb93f..000000000 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/generator/FSMGenerator.java +++ /dev/null @@ -1,20 +0,0 @@ -/** - * generated by Xtext - */ -package org.eclipse.etrice.core.fsm.generator; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.xtext.generator.IFileSystemAccess; -import org.eclipse.xtext.generator.IGenerator; - -/** - * Generates code from your model files on save. - * - * see http://www.eclipse.org/Xtext/documentation.html#TutorialCodeGeneration - */ -@SuppressWarnings("all") -public class FSMGenerator implements IGenerator { - @Override - public void doGenerate(final Resource resource, final IFileSystemAccess fsa) { - } -} diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/DocuPostprocessor.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/DocuPostprocessor.java deleted file mode 100644 index 30c9ffec8..000000000 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/DocuPostprocessor.java +++ /dev/null @@ -1,697 +0,0 @@ -/** - * Copyright (c) 2014 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert - */ -package org.eclipse.etrice.core.fsm.postprocessing; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.etrice.core.common.postprocessing.PostprocessingHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.GeneratedMetamodel; - -/** - * This post processor adds documentation to the generated EMF model. - * By intention no {@code null} checks are performed. This way developers - * find easier if the referenced class, attribute or reference isn't found. - */ -@SuppressWarnings("all") -public class DocuPostprocessor { - public void process(final GeneratedMetamodel metamodel) { - final EPackage pckg = metamodel.getEPackage(); - EClass cls = PostprocessingHelpers.getClass(pckg, "AbstractInterfaceItem"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("An abstract interface item to be overridden in derived grammars."); - _builder.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder.toString()); - EAttribute _attribute = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("By this name the interface item is referred to in the model."); - _builder_1.newLine(); - PostprocessingHelpers.setDocumentation(_attribute, _builder_1.toString()); - EClass _class = PostprocessingHelpers.getClass(pckg, "StateGraphNode"); - cls = _class; - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("The super class of"); - _builder_2.newLine(); - _builder_2.append("<ul>"); - _builder_2.newLine(); - _builder_2.append(" "); - _builder_2.append("<li>{@link State}</li>"); - _builder_2.newLine(); - _builder_2.append(" "); - _builder_2.append("<li>{@link ChoicePoint}</li>"); - _builder_2.newLine(); - _builder_2.append(" "); - _builder_2.append("<li>{@link TrPoint}</li>"); - _builder_2.newLine(); - _builder_2.append("</ul>"); - _builder_2.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_2.toString()); - EClass _class_1 = PostprocessingHelpers.getClass(pckg, "StateGraphItem"); - cls = _class_1; - StringConcatenation _builder_3 = new StringConcatenation(); - _builder_3.append("The super class of"); - _builder_3.newLine(); - _builder_3.append("<ul>"); - _builder_3.newLine(); - _builder_3.append(" "); - _builder_3.append("<li>{@link StateGraphNode}</li>"); - _builder_3.newLine(); - _builder_3.append(" "); - _builder_3.append("<li>{@link Transition}</li>"); - _builder_3.newLine(); - _builder_3.append("</ul>"); - _builder_3.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_3.toString()); - EClass _class_2 = PostprocessingHelpers.getClass(pckg, "State"); - cls = _class_2; - StringConcatenation _builder_4 = new StringConcatenation(); - _builder_4.append("The super class of"); - _builder_4.newLine(); - _builder_4.append("<ul>"); - _builder_4.newLine(); - _builder_4.append(" "); - _builder_4.append("<li>{@link SimpleState}</li>"); - _builder_4.newLine(); - _builder_4.append(" "); - _builder_4.append("<li>{@link RefinedState}</li>"); - _builder_4.newLine(); - _builder_4.append("</ul>"); - _builder_4.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_4.toString()); - EReference _reference = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_5 = new StringConcatenation(); - _builder_5.append("This is an optional documentation."); - _builder_5.newLine(); - PostprocessingHelpers.setDocumentation(_reference, _builder_5.toString()); - EReference _reference_1 = PostprocessingHelpers.getReference(cls, "entryCode"); - StringConcatenation _builder_6 = new StringConcatenation(); - _builder_6.append("This is an optional entry code written in the code generator\'s target language."); - _builder_6.newLine(); - _builder_6.append("It is executed when the state is entered."); - _builder_6.newLine(); - PostprocessingHelpers.setDocumentation(_reference_1, _builder_6.toString()); - EReference _reference_2 = PostprocessingHelpers.getReference(cls, "exitCode"); - StringConcatenation _builder_7 = new StringConcatenation(); - _builder_7.append("This is an optional entry code written in the code generator\'s target language."); - _builder_7.newLine(); - _builder_7.append("It is executed when the state is left."); - _builder_7.newLine(); - PostprocessingHelpers.setDocumentation(_reference_2, _builder_7.toString()); - EReference _reference_3 = PostprocessingHelpers.getReference(cls, "doCode"); - StringConcatenation _builder_8 = new StringConcatenation(); - _builder_8.append("This is an optional do code written in the code generator\'s target language."); - _builder_8.newLine(); - _builder_8.append("It is executed whenever the actor instance is polled (applies only to"); - _builder_8.newLine(); - _builder_8.append("data driven and sync actor classes)."); - _builder_8.newLine(); - PostprocessingHelpers.setDocumentation(_reference_3, _builder_8.toString()); - EReference _reference_4 = PostprocessingHelpers.getReference(cls, "subgraph"); - StringConcatenation _builder_9 = new StringConcatenation(); - _builder_9.append("This is an optional sub state graph of this state."); - _builder_9.newLine(); - PostprocessingHelpers.setDocumentation(_reference_4, _builder_9.toString()); - EClass _class_3 = PostprocessingHelpers.getClass(pckg, "StateGraph"); - cls = _class_3; - StringConcatenation _builder_10 = new StringConcatenation(); - _builder_10.append("A state graph is a directed graph composed of"); - _builder_10.newLine(); - _builder_10.append("{@link StateGraphNode}s as nodes and {@link Transition}s as edges."); - _builder_10.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_10.toString()); - EReference _reference_5 = PostprocessingHelpers.getReference(cls, "states"); - StringConcatenation _builder_11 = new StringConcatenation(); - _builder_11.append("This is a list of all states of this state graph."); - _builder_11.newLine(); - PostprocessingHelpers.setDocumentation(_reference_5, _builder_11.toString()); - EReference _reference_6 = PostprocessingHelpers.getReference(cls, "trPoints"); - StringConcatenation _builder_12 = new StringConcatenation(); - _builder_12.append("This is a list of all transition, entry and exit points of this state graph."); - _builder_12.newLine(); - PostprocessingHelpers.setDocumentation(_reference_6, _builder_12.toString()); - EReference _reference_7 = PostprocessingHelpers.getReference(cls, "chPoints"); - StringConcatenation _builder_13 = new StringConcatenation(); - _builder_13.append("This is a list of all choice points of this state graph."); - _builder_13.newLine(); - PostprocessingHelpers.setDocumentation(_reference_7, _builder_13.toString()); - EReference _reference_8 = PostprocessingHelpers.getReference(cls, "transitions"); - StringConcatenation _builder_14 = new StringConcatenation(); - _builder_14.append("This is a list of all transitions of this state graph."); - _builder_14.newLine(); - PostprocessingHelpers.setDocumentation(_reference_8, _builder_14.toString()); - EReference _reference_9 = PostprocessingHelpers.getReference(cls, "refinedTransitions"); - StringConcatenation _builder_15 = new StringConcatenation(); - _builder_15.append("This is a list of all refined transitions of this state graph."); - _builder_15.newLine(); - PostprocessingHelpers.setDocumentation(_reference_9, _builder_15.toString()); - EClass _class_4 = PostprocessingHelpers.getClass(pckg, "SimpleState"); - cls = _class_4; - StringConcatenation _builder_16 = new StringConcatenation(); - _builder_16.append("A simple state is the standard case of a @link State}."); - _builder_16.newLine(); - _builder_16.append("It comprises and <em>entry</em>, <em>exit</em> and <em>do</em> code"); - _builder_16.newLine(); - _builder_16.append("and it can contain another {@link StateGraph} as sub state"); - _builder_16.newLine(); - _builder_16.append("graph."); - _builder_16.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_16.toString()); - EAttribute _attribute_1 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_17 = new StringConcatenation(); - _builder_17.append("By this name the state is referred to in the model."); - _builder_17.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_1, _builder_17.toString()); - EClass _class_5 = PostprocessingHelpers.getClass(pckg, "RefinedState"); - cls = _class_5; - StringConcatenation _builder_18 = new StringConcatenation(); - _builder_18.append("A refined state can be used only in a derived {@link ActorClass}."); - _builder_18.newLine(); - _builder_18.append("It refers to a {@link State} in the inherited state machine"); - _builder_18.newLine(); - _builder_18.append("which is refined by adding detail code and/or"); - _builder_18.newLine(); - _builder_18.append("{@link StateGraphItem}s in the sub state graph."); - _builder_18.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_18.toString()); - EReference _reference_10 = PostprocessingHelpers.getReference(cls, "target"); - StringConcatenation _builder_19 = new StringConcatenation(); - _builder_19.append("This is the referenced state in the base class state machine."); - _builder_19.newLine(); - PostprocessingHelpers.setDocumentation(_reference_10, _builder_19.toString()); - EClass _class_6 = PostprocessingHelpers.getClass(pckg, "DetailCode"); - cls = _class_6; - StringConcatenation _builder_20 = new StringConcatenation(); - _builder_20.append("The detail code is a string which represents the verbatim code"); - _builder_20.newLine(); - _builder_20.append("of the code generator target language."); - _builder_20.newLine(); - _builder_20.newLine(); - _builder_20.append("<p>"); - _builder_20.newLine(); - _builder_20.append("The detail code is parsed by the {@link org.eclipse.etrice.generator.base.DetailCodeTranslator}"); - _builder_20.newLine(); - _builder_20.append("which replaces certain frequent constructs like access of members"); - _builder_20.newLine(); - _builder_20.append("and sending a message via a port by target language specific code."); - _builder_20.newLine(); - _builder_20.append("</p>"); - _builder_20.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_20.toString()); - EAttribute _attribute_2 = PostprocessingHelpers.getAttribute(cls, "lines"); - StringConcatenation _builder_21 = new StringConcatenation(); - _builder_21.append("This is the program code in the code generator\'s target language."); - _builder_21.newLine(); - _builder_21.append("Due backward compability this is a list of strings. Actually the size of the list should be 0 or 1."); - _builder_21.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_2, _builder_21.toString()); - EClass _class_7 = PostprocessingHelpers.getClass(pckg, "TrPoint"); - cls = _class_7; - StringConcatenation _builder_22 = new StringConcatenation(); - _builder_22.append("The super class of"); - _builder_22.newLine(); - _builder_22.append("<ul>"); - _builder_22.newLine(); - _builder_22.append(" "); - _builder_22.append("<li>{@link TransitionPoint}</li>"); - _builder_22.newLine(); - _builder_22.append(" "); - _builder_22.append("<li>{@link EntryPoint}</li>"); - _builder_22.newLine(); - _builder_22.append(" "); - _builder_22.append("<li>{@link ExitPoint}</li>"); - _builder_22.newLine(); - _builder_22.append("</ul>"); - _builder_22.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_22.toString()); - EAttribute _attribute_3 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_23 = new StringConcatenation(); - _builder_23.append("By this name the transition, entry or exit point is referred to in the model."); - _builder_23.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_3, _builder_23.toString()); - EClass _class_8 = PostprocessingHelpers.getClass(pckg, "TransitionPoint"); - cls = _class_8; - StringConcatenation _builder_24 = new StringConcatenation(); - _builder_24.append("A transition point is located at the border of a {@link State}"); - _builder_24.newLine(); - _builder_24.append("and is not visible or accessible outside. It is used"); - _builder_24.newLine(); - _builder_24.append("to globally handle messages. If a {@link Transition} starting"); - _builder_24.newLine(); - _builder_24.append("at a transition point triggers then exit and entry codes"); - _builder_24.newLine(); - _builder_24.append("are executed as usual as long as the handler flag of the"); - _builder_24.newLine(); - _builder_24.append("transition point isn\'t set."); - _builder_24.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_24.toString()); - EAttribute _attribute_4 = PostprocessingHelpers.getAttribute(cls, "handler"); - StringConcatenation _builder_25 = new StringConcatenation(); - _builder_25.append("If this flag is {@code true} then for a transition triggerd from this point"); - _builder_25.newLine(); - _builder_25.append("no exit and entry codes of the states left and entered are executed."); - _builder_25.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_4, _builder_25.toString()); - EClass _class_9 = PostprocessingHelpers.getClass(pckg, "EntryPoint"); - cls = _class_9; - StringConcatenation _builder_26 = new StringConcatenation(); - _builder_26.append("An entry point is located at the border of a {@link State}"); - _builder_26.newLine(); - _builder_26.append("and is visible and accessible outside. Outside"); - _builder_26.newLine(); - _builder_26.append("it can be the target of a {@link Transition} and inside the source."); - _builder_26.newLine(); - _builder_26.append("If it is not connected in the interior then it is a"); - _builder_26.newLine(); - _builder_26.append("<em>transition to history</em>."); - _builder_26.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_26.toString()); - EClass _class_10 = PostprocessingHelpers.getClass(pckg, "ExitPoint"); - cls = _class_10; - StringConcatenation _builder_27 = new StringConcatenation(); - _builder_27.append("An exit point is located at the border of a {@link State}"); - _builder_27.newLine(); - _builder_27.append("and is visible and accessible outside. Outside"); - _builder_27.newLine(); - _builder_27.append("it can be the source of a {@link Transition} and inside the target."); - _builder_27.newLine(); - _builder_27.append("If it is not connected in the interior then it is a"); - _builder_27.newLine(); - _builder_27.append("<em>group transition</em>."); - _builder_27.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_27.toString()); - EClass _class_11 = PostprocessingHelpers.getClass(pckg, "ChoicePoint"); - cls = _class_11; - StringConcatenation _builder_28 = new StringConcatenation(); - _builder_28.append("A choice point corresponds to an {@code if else} construct."); - _builder_28.newLine(); - _builder_28.append("It is the target of one or more {@link Transition}s and the"); - _builder_28.newLine(); - _builder_28.append("source of several {@link Transition}s."); - _builder_28.newLine(); - _builder_28.append("One outgoing transitions must be a {@link ContinuationTransition}"); - _builder_28.newLine(); - _builder_28.append("and corresponds to the final else. It is called the"); - _builder_28.newLine(); - _builder_28.append("<em>default branch</em> of the choice point."); - _builder_28.newLine(); - _builder_28.append("All other outgoing transitions have to be {@link CPBranchTransition}s."); - _builder_28.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_28.toString()); - EAttribute _attribute_5 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_29 = new StringConcatenation(); - _builder_29.append("By this name the choice point is referred to in the model."); - _builder_29.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_5, _builder_29.toString()); - EReference _reference_11 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_30 = new StringConcatenation(); - _builder_30.append("This is an optional documentation."); - _builder_30.newLine(); - PostprocessingHelpers.setDocumentation(_reference_11, _builder_30.toString()); - EClass _class_12 = PostprocessingHelpers.getClass(pckg, "Transition"); - cls = _class_12; - StringConcatenation _builder_31 = new StringConcatenation(); - _builder_31.append("The super class of"); - _builder_31.newLine(); - _builder_31.append("<ul>"); - _builder_31.newLine(); - _builder_31.append(" "); - _builder_31.append("<li>{@link InitialTransition}</li>"); - _builder_31.newLine(); - _builder_31.append(" "); - _builder_31.append("<li>{@link NonInitialTransition}</li>"); - _builder_31.newLine(); - _builder_31.append("</ul>"); - _builder_31.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_31.toString()); - EAttribute _attribute_6 = PostprocessingHelpers.getAttribute(cls, "name"); - StringConcatenation _builder_32 = new StringConcatenation(); - _builder_32.append("This is an optional name of the transition."); - _builder_32.newLine(); - PostprocessingHelpers.setDocumentation(_attribute_6, _builder_32.toString()); - EReference _reference_12 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_33 = new StringConcatenation(); - _builder_33.append("This is an optional documentation."); - _builder_33.newLine(); - PostprocessingHelpers.setDocumentation(_reference_12, _builder_33.toString()); - EReference _reference_13 = PostprocessingHelpers.getReference(cls, "to"); - StringConcatenation _builder_34 = new StringConcatenation(); - _builder_34.append("This is the target node of the transition."); - _builder_34.newLine(); - PostprocessingHelpers.setDocumentation(_reference_13, _builder_34.toString()); - EReference _reference_14 = PostprocessingHelpers.getReference(cls, "action"); - StringConcatenation _builder_35 = new StringConcatenation(); - _builder_35.append("This is an optional code in the code generator\'s target language."); - _builder_35.newLine(); - _builder_35.append("It is execute when the transition fires."); - _builder_35.newLine(); - PostprocessingHelpers.setDocumentation(_reference_14, _builder_35.toString()); - EClass _class_13 = PostprocessingHelpers.getClass(pckg, "NonInitialTransition"); - cls = _class_13; - StringConcatenation _builder_36 = new StringConcatenation(); - _builder_36.append("The super class of"); - _builder_36.newLine(); - _builder_36.append("<ul>"); - _builder_36.newLine(); - _builder_36.append(" "); - _builder_36.append("<li>{@link TransitionChainStartTransition}</li>"); - _builder_36.newLine(); - _builder_36.append(" "); - _builder_36.append("<li>{@link ContinuationTransition}</li>"); - _builder_36.newLine(); - _builder_36.append(" "); - _builder_36.append("<li>{@link CPBranchTransition}</li>"); - _builder_36.newLine(); - _builder_36.append("</ul>"); - _builder_36.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_36.toString()); - EReference _reference_15 = PostprocessingHelpers.getReference(cls, "from"); - StringConcatenation _builder_37 = new StringConcatenation(); - _builder_37.append("This is the source node of the transition."); - _builder_37.newLine(); - PostprocessingHelpers.setDocumentation(_reference_15, _builder_37.toString()); - EClass _class_14 = PostprocessingHelpers.getClass(pckg, "TransitionChainStartTransition"); - cls = _class_14; - StringConcatenation _builder_38 = new StringConcatenation(); - _builder_38.append("The super class of"); - _builder_38.newLine(); - _builder_38.append("<ul>"); - _builder_38.newLine(); - _builder_38.append(" "); - _builder_38.append("<li>{@link TriggeredTransition}</li>"); - _builder_38.newLine(); - _builder_38.append(" "); - _builder_38.append("<li>{@link GuardedTransition}</li>"); - _builder_38.newLine(); - _builder_38.append("</ul>"); - _builder_38.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_38.toString()); - EClass _class_15 = PostprocessingHelpers.getClass(pckg, "InitialTransition"); - cls = _class_15; - StringConcatenation _builder_39 = new StringConcatenation(); - _builder_39.append("There can be at most one initial transition in a {@link StateGraph}."); - _builder_39.newLine(); - _builder_39.append("It defines the starting point of the state graph and is traversed"); - _builder_39.newLine(); - _builder_39.append("exactly once when the state graph is accessed for the first time."); - _builder_39.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_39.toString()); - EClass _class_16 = PostprocessingHelpers.getClass(pckg, "ContinuationTransition"); - cls = _class_16; - StringConcatenation _builder_40 = new StringConcatenation(); - _builder_40.append("Continuation transitions start at entry or exit points"); - _builder_40.newLine(); - _builder_40.append("({@link EntryPoint}s or {@link ExitPoint}s) or form"); - _builder_40.newLine(); - _builder_40.append("the default branch of a {@link ChoicePoint}."); - _builder_40.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_40.toString()); - EClass _class_17 = PostprocessingHelpers.getClass(pckg, "TriggeredTransition"); - cls = _class_17; - StringConcatenation _builder_41 = new StringConcatenation(); - _builder_41.append("Triggered transitions start at a {@link State} or a {@link TransitionPoint}."); - _builder_41.newLine(); - _builder_41.append("It defines a list of {@link Trigger}s that specify the conditions"); - _builder_41.newLine(); - _builder_41.append("when the transition fires and is traversed. This kind of"); - _builder_41.newLine(); - _builder_41.append("transition is only allowed in event driven and mixed (async) state"); - _builder_41.newLine(); - _builder_41.append("machines."); - _builder_41.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_41.toString()); - EReference _reference_16 = PostprocessingHelpers.getReference(cls, "triggers"); - StringConcatenation _builder_42 = new StringConcatenation(); - _builder_42.append("This is a list of all triggers of the transition."); - _builder_42.newLine(); - PostprocessingHelpers.setDocumentation(_reference_16, _builder_42.toString()); - EClass _class_18 = PostprocessingHelpers.getClass(pckg, "GuardedTransition"); - cls = _class_18; - StringConcatenation _builder_43 = new StringConcatenation(); - _builder_43.append("A guarded transition is very similar to a {@link CPBranchTransition}."); - _builder_43.newLine(); - _builder_43.append("It defines a guard condition which lets the transition fire if"); - _builder_43.newLine(); - _builder_43.append("evaluated to {@code true}. This kind of transition is only"); - _builder_43.newLine(); - _builder_43.append("allowed in data driven or moixed (async) state machines."); - _builder_43.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_43.toString()); - EReference _reference_17 = PostprocessingHelpers.getReference(cls, "guard"); - StringConcatenation _builder_44 = new StringConcatenation(); - _builder_44.append("This is the guard condition of the transition specified in the code generator\'s target language."); - _builder_44.newLine(); - _builder_44.append("It has to evaluate to a boolean value."); - _builder_44.newLine(); - PostprocessingHelpers.setDocumentation(_reference_17, _builder_44.toString()); - EClass _class_19 = PostprocessingHelpers.getClass(pckg, "CPBranchTransition"); - cls = _class_19; - StringConcatenation _builder_45 = new StringConcatenation(); - _builder_45.append("The choice point branch transitions is allowed only as outgoing"); - _builder_45.newLine(); - _builder_45.append("transition of {@link ChoicePoint}s."); - _builder_45.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_45.toString()); - EReference _reference_18 = PostprocessingHelpers.getReference(cls, "condition"); - StringConcatenation _builder_46 = new StringConcatenation(); - _builder_46.append("This is the condition of the choice point branch specified in the code generator\'s target language."); - _builder_46.newLine(); - _builder_46.append("It has to evaluate to a boolean value."); - _builder_46.newLine(); - PostprocessingHelpers.setDocumentation(_reference_18, _builder_46.toString()); - EClass _class_20 = PostprocessingHelpers.getClass(pckg, "RefinedTransition"); - cls = _class_20; - StringConcatenation _builder_47 = new StringConcatenation(); - _builder_47.append("The refined transition is only allowed in {@link StateGraph}s"); - _builder_47.newLine(); - _builder_47.append("of derived {@link ActorClass}es. It targets a {@link Transition}"); - _builder_47.newLine(); - _builder_47.append("of the base class state machine."); - _builder_47.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_47.toString()); - EReference _reference_19 = PostprocessingHelpers.getReference(cls, "action"); - StringConcatenation _builder_48 = new StringConcatenation(); - _builder_48.append("This is an optional code in the code generator\'s target language."); - _builder_48.newLine(); - _builder_48.append("It is execute when the transition fires."); - _builder_48.newLine(); - PostprocessingHelpers.setDocumentation(_reference_19, _builder_48.toString()); - EReference _reference_20 = PostprocessingHelpers.getReference(cls, "target"); - StringConcatenation _builder_49 = new StringConcatenation(); - _builder_49.append("This is the referenced transition in the base class state machine."); - _builder_49.newLine(); - PostprocessingHelpers.setDocumentation(_reference_20, _builder_49.toString()); - EReference _reference_21 = PostprocessingHelpers.getReference(cls, "docu"); - StringConcatenation _builder_50 = new StringConcatenation(); - _builder_50.append("This is an optional documentation."); - _builder_50.newLine(); - PostprocessingHelpers.setDocumentation(_reference_21, _builder_50.toString()); - EClass _class_21 = PostprocessingHelpers.getClass(pckg, "TransitionTerminal"); - cls = _class_21; - StringConcatenation _builder_51 = new StringConcatenation(); - _builder_51.append("The super class of"); - _builder_51.newLine(); - _builder_51.append("<ul>"); - _builder_51.newLine(); - _builder_51.append(" "); - _builder_51.append("<li>{@link StateTerminal}</li>"); - _builder_51.newLine(); - _builder_51.append(" "); - _builder_51.append("<li>{@link TrPointTerminal}</li>"); - _builder_51.newLine(); - _builder_51.append(" "); - _builder_51.append("<li>{@link SubStateTrPointTerminal}</li>"); - _builder_51.newLine(); - _builder_51.append(" "); - _builder_51.append("<li>{@link ChoicepointTerminal}</li>"); - _builder_51.newLine(); - _builder_51.append("</ul>"); - _builder_51.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_51.toString()); - EClass _class_22 = PostprocessingHelpers.getClass(pckg, "StateTerminal"); - cls = _class_22; - StringConcatenation _builder_52 = new StringConcatenation(); - _builder_52.append("The terminal point (source or target) of a transition ending"); - _builder_52.newLine(); - _builder_52.append("at a {@link State}."); - _builder_52.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_52.toString()); - EReference _reference_22 = PostprocessingHelpers.getReference(cls, "state"); - StringConcatenation _builder_53 = new StringConcatenation(); - _builder_53.append("This is the target state."); - _builder_53.newLine(); - PostprocessingHelpers.setDocumentation(_reference_22, _builder_53.toString()); - EClass _class_23 = PostprocessingHelpers.getClass(pckg, "TrPointTerminal"); - cls = _class_23; - StringConcatenation _builder_54 = new StringConcatenation(); - _builder_54.append("The terminal point (source or target) of a transition ending"); - _builder_54.newLine(); - _builder_54.append("at a local {@link TrPoint}."); - _builder_54.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_54.toString()); - EReference _reference_23 = PostprocessingHelpers.getReference(cls, "trPoint"); - StringConcatenation _builder_55 = new StringConcatenation(); - _builder_55.append("This is the target transition, entry or exit point."); - _builder_55.newLine(); - PostprocessingHelpers.setDocumentation(_reference_23, _builder_55.toString()); - EClass _class_24 = PostprocessingHelpers.getClass(pckg, "SubStateTrPointTerminal"); - cls = _class_24; - StringConcatenation _builder_56 = new StringConcatenation(); - _builder_56.append("The terminal point (source or target) of a transition ending"); - _builder_56.newLine(); - _builder_56.append("at a {@link TrPoint} of a sub {@link State}."); - _builder_56.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_56.toString()); - EReference _reference_24 = PostprocessingHelpers.getReference(cls, "state"); - StringConcatenation _builder_57 = new StringConcatenation(); - _builder_57.append("This is the target state."); - _builder_57.newLine(); - PostprocessingHelpers.setDocumentation(_reference_24, _builder_57.toString()); - EReference _reference_25 = PostprocessingHelpers.getReference(cls, "trPoint"); - StringConcatenation _builder_58 = new StringConcatenation(); - _builder_58.append("This is the target entry or exit point contained in the target state."); - _builder_58.newLine(); - PostprocessingHelpers.setDocumentation(_reference_25, _builder_58.toString()); - EClass _class_25 = PostprocessingHelpers.getClass(pckg, "ChoicepointTerminal"); - cls = _class_25; - StringConcatenation _builder_59 = new StringConcatenation(); - _builder_59.append("The terminal point (source or target) of a transition ending"); - _builder_59.newLine(); - _builder_59.append("at a {@link ChoicepointTerminal}."); - _builder_59.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_59.toString()); - EReference _reference_26 = PostprocessingHelpers.getReference(cls, "cp"); - StringConcatenation _builder_60 = new StringConcatenation(); - _builder_60.append("This is the target choice point."); - _builder_60.newLine(); - PostprocessingHelpers.setDocumentation(_reference_26, _builder_60.toString()); - EClass _class_26 = PostprocessingHelpers.getClass(pckg, "Trigger"); - cls = _class_26; - StringConcatenation _builder_61 = new StringConcatenation(); - _builder_61.append("A transition trigger is a list of {@link MessageFromIf} pairs"); - _builder_61.newLine(); - _builder_61.append("and an optional {@link Guard}."); - _builder_61.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_61.toString()); - EReference _reference_27 = PostprocessingHelpers.getReference(cls, "msgFromIfPairs"); - StringConcatenation _builder_62 = new StringConcatenation(); - _builder_62.append("This is a list of message/interface item pairs."); - _builder_62.newLine(); - PostprocessingHelpers.setDocumentation(_reference_27, _builder_62.toString()); - EReference _reference_28 = PostprocessingHelpers.getReference(cls, "guard"); - StringConcatenation _builder_63 = new StringConcatenation(); - _builder_63.append("This is an optional guard condition of the trigger specified in the code generator\'s target language."); - _builder_63.newLine(); - _builder_63.append("It has to evaluate to a boolean value."); - _builder_63.newLine(); - PostprocessingHelpers.setDocumentation(_reference_28, _builder_63.toString()); - EClass _class_27 = PostprocessingHelpers.getClass(pckg, "MessageFromIf"); - cls = _class_27; - StringConcatenation _builder_64 = new StringConcatenation(); - _builder_64.append("A pair consisting of a {@link Message} arising from an"); - _builder_64.newLine(); - _builder_64.append("{@link InterfaceItem}."); - _builder_64.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_64.toString()); - EReference _reference_29 = PostprocessingHelpers.getReference(cls, "message"); - StringConcatenation _builder_65 = new StringConcatenation(); - _builder_65.append("This is the triggerering message (or event)."); - _builder_65.newLine(); - PostprocessingHelpers.setDocumentation(_reference_29, _builder_65.toString()); - EReference _reference_30 = PostprocessingHelpers.getReference(cls, "from"); - StringConcatenation _builder_66 = new StringConcatenation(); - _builder_66.append("This is the interface item where the message occurred."); - _builder_66.newLine(); - PostprocessingHelpers.setDocumentation(_reference_30, _builder_66.toString()); - EClass _class_28 = PostprocessingHelpers.getClass(pckg, "Guard"); - cls = _class_28; - StringConcatenation _builder_67 = new StringConcatenation(); - _builder_67.append("A detail code that evaluates to a boolean in the target"); - _builder_67.newLine(); - _builder_67.append("language."); - _builder_67.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_67.toString()); - EReference _reference_31 = PostprocessingHelpers.getReference(cls, "guard"); - StringConcatenation _builder_68 = new StringConcatenation(); - _builder_68.append("This is a guard condition specified in the code generator\'s target language."); - _builder_68.newLine(); - _builder_68.append("It has to evaluate to a boolean value."); - _builder_68.newLine(); - PostprocessingHelpers.setDocumentation(_reference_31, _builder_68.toString()); - EClass _class_29 = PostprocessingHelpers.getClass(pckg, "ProtocolSemantics"); - cls = _class_29; - StringConcatenation _builder_69 = new StringConcatenation(); - _builder_69.append("An optional semantics specification as part of a {@link ProtocolClass}."); - _builder_69.newLine(); - _builder_69.append("The semantic is defined as a <em>legal execution tree</em>."); - _builder_69.newLine(); - _builder_69.append("This tree is composed of incoming and outgoing messages and each path through"); - _builder_69.newLine(); - _builder_69.append("this tree is a valid sequence of messages exchanged through a port instance."); - _builder_69.newLine(); - _builder_69.newLine(); - _builder_69.append("<p>"); - _builder_69.newLine(); - _builder_69.append("The semantics are composed using {@link SemanticsRule}s."); - _builder_69.newLine(); - _builder_69.append("</p>"); - _builder_69.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_69.toString()); - EReference _reference_32 = PostprocessingHelpers.getReference(cls, "rules"); - StringConcatenation _builder_70 = new StringConcatenation(); - _builder_70.append("This is a list of semantic rules."); - _builder_70.newLine(); - PostprocessingHelpers.setDocumentation(_reference_32, _builder_70.toString()); - EClass _class_30 = PostprocessingHelpers.getClass(pckg, "SemanticsRule"); - cls = _class_30; - StringConcatenation _builder_71 = new StringConcatenation(); - _builder_71.append("The super class of"); - _builder_71.newLine(); - _builder_71.append("<ul>"); - _builder_71.newLine(); - _builder_71.append(" "); - _builder_71.append("<li>{@link InSemanticsRule}</li>"); - _builder_71.newLine(); - _builder_71.append(" "); - _builder_71.append("<li>{@link OutSemanticsRule}</li>"); - _builder_71.newLine(); - _builder_71.append("</ul>"); - _builder_71.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_71.toString()); - EReference _reference_33 = PostprocessingHelpers.getReference(cls, "msg"); - StringConcatenation _builder_72 = new StringConcatenation(); - _builder_72.append("The message to which this rule applies."); - _builder_72.newLine(); - PostprocessingHelpers.setDocumentation(_reference_33, _builder_72.toString()); - EReference _reference_34 = PostprocessingHelpers.getReference(cls, "followUps"); - StringConcatenation _builder_73 = new StringConcatenation(); - _builder_73.append("The possible follow up rules."); - _builder_73.newLine(); - PostprocessingHelpers.setDocumentation(_reference_34, _builder_73.toString()); - EClass _class_31 = PostprocessingHelpers.getClass(pckg, "InSemanticsRule"); - cls = _class_31; - StringConcatenation _builder_74 = new StringConcatenation(); - _builder_74.append("A {@link SemanticsRule} for incoming messages."); - _builder_74.newLine(); - _builder_74.append("The rule points to an incoming messages and allows follow-up rules."); - _builder_74.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_74.toString()); - EClass _class_32 = PostprocessingHelpers.getClass(pckg, "OutSemanticsRule"); - cls = _class_32; - StringConcatenation _builder_75 = new StringConcatenation(); - _builder_75.append("A {@link SemanticsRule} for outgoing messages."); - _builder_75.newLine(); - _builder_75.append("The rule points to an outgoing messages and allows follow-up rules."); - _builder_75.newLine(); - PostprocessingHelpers.setDocumentation(cls, _builder_75.toString()); - } -} diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.java deleted file mode 100644 index 3c6306ffc..000000000 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (c) 2014 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Henrik Rentz-Reichert - */ -package org.eclipse.etrice.core.fsm.postprocessing; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.etrice.core.common.postprocessing.PostprocessingHelpers; -import org.eclipse.xtend2.lib.StringConcatenation; -import org.eclipse.xtext.GeneratedMetamodel; - -@SuppressWarnings("all") -public class ImplPostprocessor { - public boolean process(final GeneratedMetamodel metamodel) { - boolean _xblockexpression = false; - { - final EPackage fsmPackage = metamodel.getEPackage(); - final EClass state = PostprocessingHelpers.getClass(fsmPackage, "State"); - StringConcatenation _builder = new StringConcatenation(); - _builder.append("return (this instanceof <%org.eclipse.etrice.core.fsm.fSM.SimpleState%>)? ((SimpleState)this).getName() :(this instanceof <%org.eclipse.etrice.core.fsm.fSM.RefinedState%>)? (((RefinedState)this).getTarget()==null? \"\":((RefinedState)this).getTarget().getName()) :\"\";"); - PostprocessingHelpers.addOperation(state, "getName", EcorePackage.Literals.ESTRING, Integer.valueOf(1), _builder.toString()); - final EClass stateGraphItem = PostprocessingHelpers.getClass(fsmPackage, "StateGraphItem"); - EClassifier _eClassifier = EcorePackage.eINSTANCE.getEClassifier("EString"); - StringConcatenation _builder_1 = new StringConcatenation(); - _builder_1.append("if (this instanceof <%org.eclipse.etrice.core.fsm.fSM.State%>) "); - _builder_1.newLine(); - _builder_1.append("\t"); - _builder_1.append("return ((State)this).getName();"); - _builder_1.newLine(); - _builder_1.append("else if (this instanceof <%org.eclipse.etrice.core.fsm.fSM.TrPoint%>)"); - _builder_1.newLine(); - _builder_1.append("\t"); - _builder_1.append("return ((TrPoint)this).getName();"); - _builder_1.newLine(); - _builder_1.append("else if (this instanceof <%org.eclipse.etrice.core.fsm.fSM.ChoicePoint%>)"); - _builder_1.newLine(); - _builder_1.append("\t"); - _builder_1.append("return ((ChoicePoint)this).getName();"); - _builder_1.newLine(); - _builder_1.append("else if (this instanceof <%org.eclipse.etrice.core.fsm.fSM.Transition%>)"); - _builder_1.newLine(); - _builder_1.append("\t"); - _builder_1.append("return ((Transition)this).getName();"); - _builder_1.newLine(); - _builder_1.append("return \"\";"); - _builder_1.newLine(); - PostprocessingHelpers.addOperation(stateGraphItem, "getName", _eClassifier, Integer.valueOf(1), _builder_1.toString()); - final EClass ifItem = PostprocessingHelpers.getClass(fsmPackage, "AbstractInterfaceItem"); - EClassifier _eClassifier_1 = EcorePackage.eINSTANCE.getEClassifier("EString"); - StringConcatenation _builder_2 = new StringConcatenation(); - _builder_2.append("return getName();"); - _builder_2.newLine(); - PostprocessingHelpers.addOperation(ifItem, "getDisplayName", _eClassifier_1, Integer.valueOf(1), _builder_2.toString()); - EClassifier _eClassifier_2 = fsmPackage.getEClassifier("ProtocolSemantics"); - PostprocessingHelpers.addOperation(ifItem, "getSemantics", _eClassifier_2); - PostprocessingHelpers.addOperation(ifItem, "getAllIncomingAbstractMessages", EcorePackage.Literals.EOBJECT, Integer.valueOf((-1)), null); - PostprocessingHelpers.addOperation(ifItem, "getAllOutgoingAbstractMessages", EcorePackage.Literals.EOBJECT, Integer.valueOf((-1)), null); - PostprocessingHelpers.addOperation(ifItem, "isEventDriven", EcorePackage.Literals.EBOOLEAN, Integer.valueOf(1), "return true;"); - final EClass itemOwner = PostprocessingHelpers.addClass(fsmPackage, "IInterfaceItemOwner"); - itemOwner.setAbstract(true); - itemOwner.setInterface(true); - EClassifier _eClassifier_3 = fsmPackage.getEClassifier("AbstractInterfaceItem"); - PostprocessingHelpers.addOperation(itemOwner, "getAbstractInterfaceItems", _eClassifier_3, Integer.valueOf((-1)), null); - EClassifier _eClassifier_4 = fsmPackage.getEClassifier("AbstractInterfaceItem"); - PostprocessingHelpers.addOperation(itemOwner, "getAllAbstractInterfaceItems", _eClassifier_4, Integer.valueOf((-1)), null); - final EClass comp = PostprocessingHelpers.getClass(fsmPackage, "ModelComponent"); - EList<EClass> _eSuperTypes = comp.getESuperTypes(); - _xblockexpression = _eSuperTypes.add(itemOwner); - } - return _xblockexpression; - } -} diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.java deleted file mode 100644 index fe823650a..000000000 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.java +++ /dev/null @@ -1,341 +0,0 @@ -/** - * generated by Xtext - */ -package org.eclipse.etrice.core.fsm.scoping; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.etrice.core.fsm.fSM.ChoicePoint; -import org.eclipse.etrice.core.fsm.fSM.ChoicepointTerminal; -import org.eclipse.etrice.core.fsm.fSM.ModelComponent; -import org.eclipse.etrice.core.fsm.fSM.RefinedState; -import org.eclipse.etrice.core.fsm.fSM.RefinedTransition; -import org.eclipse.etrice.core.fsm.fSM.SimpleState; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.fsm.fSM.StateTerminal; -import org.eclipse.etrice.core.fsm.fSM.SubStateTrPointTerminal; -import org.eclipse.etrice.core.fsm.fSM.TrPoint; -import org.eclipse.etrice.core.fsm.fSM.TrPointTerminal; -import org.eclipse.etrice.core.fsm.fSM.Transition; -import org.eclipse.etrice.core.fsm.util.FSMHelpers; -import org.eclipse.xtext.naming.IQualifiedNameProvider; -import org.eclipse.xtext.naming.QualifiedName; -import org.eclipse.xtext.resource.EObjectDescription; -import org.eclipse.xtext.resource.IEObjectDescription; -import org.eclipse.xtext.scoping.IScope; -import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider; -import org.eclipse.xtext.scoping.impl.SimpleScope; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Extension; - -/** - * This class contains custom scoping description. - * - * see : http://www.eclipse.org/Xtext/documentation.html#scoping - * on how and when to use it - */ -@SuppressWarnings("all") -public class FSMScopeProvider extends AbstractDeclarativeScopeProvider { - @Inject - @Extension - private FSMHelpers _fSMHelpers; - - @Inject - @Extension - private IQualifiedNameProvider _iQualifiedNameProvider; - - /** - * returns a flat list of State scopes for a {@link StateTerminal} - * @param st - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_StateTerminal_state(final StateTerminal st, final EReference ref) { - final List<IEObjectDescription> scopes = CollectionLiterals.<IEObjectDescription>newArrayList(); - final StateGraph parent = this.getStateGraph(st); - this.getStateScopes(parent, scopes); - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of TransitionPoint scopes for a {@link TrPointTerminal} - * @param ep - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_TrPointTerminal_trPoint(final TrPointTerminal ep, final EReference ref) { - final List<IEObjectDescription> scopes = CollectionLiterals.<IEObjectDescription>newArrayList(); - final StateGraph parent = this.getStateGraph(ep); - final List<TrPoint> tps = this._fSMHelpers.getAllTrPoints(parent); - for (final TrPoint tp : tps) { - String _name = tp.getName(); - IEObjectDescription _create = EObjectDescription.create(_name, tp); - scopes.add(_create); - } - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of TransitionPoint scopes for a {@link SubStateTrPointTerminal} - * @param ep - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_SubStateTrPointTerminal_trPoint(final SubStateTrPointTerminal ep, final EReference ref) { - final List<IEObjectDescription> scopes = CollectionLiterals.<IEObjectDescription>newArrayList(); - final StateGraph parent = this.getStateGraph(ep); - State _state = ep.getState(); - boolean _notEquals = (!Objects.equal(_state, null)); - if (_notEquals) { - State epState = ep.getState(); - State _refinedStateFor = this._fSMHelpers.getRefinedStateFor(parent, epState); - epState = _refinedStateFor; - StateGraph _subgraph = epState.getSubgraph(); - boolean _notEquals_1 = (!Objects.equal(_subgraph, null)); - if (_notEquals_1) { - StateGraph _subgraph_1 = epState.getSubgraph(); - final List<TrPoint> tps = this._fSMHelpers.getAllTrPoints(_subgraph_1); - for (final TrPoint tp : tps) { - String _name = tp.getName(); - IEObjectDescription _create = EObjectDescription.create(_name, tp); - scopes.add(_create); - } - } - } - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of State scopes for a {@link SubStateTrPointTerminal} - * @param st - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_SubStateTrPointTerminal_state(final SubStateTrPointTerminal st, final EReference ref) { - final List<IEObjectDescription> scopes = CollectionLiterals.<IEObjectDescription>newArrayList(); - final StateGraph parent = this.getStateGraph(st); - this.getStateScopes(parent, scopes); - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of Choicepoint scopes for a {@link SubStateTrPointTerminal} - * @param ct - the transition endpoint or terminal - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_ChoicepointTerminal_cp(final ChoicepointTerminal ct, final EReference ref) { - final List<IEObjectDescription> scopes = CollectionLiterals.<IEObjectDescription>newArrayList(); - final StateGraph parent = this.getStateGraph(ct); - final List<ChoicePoint> choicePoints = this._fSMHelpers.getAllChoicePoints(parent); - for (final ChoicePoint cp : choicePoints) { - String _name = cp.getName(); - IEObjectDescription _create = EObjectDescription.create(_name, cp); - scopes.add(_create); - } - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of BaseState scopes for a {@link RefinedState} - * @param rs - the refined state - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_RefinedState_target(final RefinedState rs, final EReference ref) { - final List<IEObjectDescription> scopes = CollectionLiterals.<IEObjectDescription>newArrayList(); - StateGraph sg = this.getStateGraph(rs); - EObject _eContainer = sg.eContainer(); - if ((_eContainer instanceof ModelComponent)) { - EObject _eContainer_1 = sg.eContainer(); - ModelComponent comp = ((ModelComponent) _eContainer_1); - if (((!Objects.equal(comp.getBase(), null)) && (!this._fSMHelpers.isCircularClassHierarchy(comp)))) { - ModelComponent _base = comp.getBase(); - comp = _base; - final HashSet<State> covered = CollectionLiterals.<State>newHashSet(); - final ArrayList<State> states = CollectionLiterals.<State>newArrayList(); - while ((!Objects.equal(comp, null))) { - { - StateGraph _stateMachine = comp.getStateMachine(); - this.recursivelyAddStates(_stateMachine, covered, states); - ModelComponent _base_1 = comp.getBase(); - comp = _base_1; - } - } - for (final State s : states) { - QualifiedName _statePath = this.getStatePath(s); - IEObjectDescription _create = EObjectDescription.create(_statePath, s); - scopes.add(_create); - } - } - } else { - EObject _eContainer_2 = sg.eContainer(); - if ((_eContainer_2 instanceof RefinedState)) { - EObject _eContainer_3 = sg.eContainer(); - State _target = ((RefinedState) _eContainer_3).getTarget(); - StateGraph _subgraph = _target.getSubgraph(); - sg = _subgraph; - boolean _notEquals = (!Objects.equal(sg, null)); - if (_notEquals) { - EList<State> _states = sg.getStates(); - for (final State s_1 : _states) { - String _name = s_1.getName(); - IEObjectDescription _create_1 = EObjectDescription.create(_name, s_1); - scopes.add(_create_1); - } - } - } - } - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * returns a flat list of Transition scopes for a {@link RefinedTransition} - * @param trans - the refined transition - * @param ref - not used - * @return a list of scopes - */ - public IScope scope_RefinedTransition_target(final RefinedTransition trans, final EReference ref) { - final List<IEObjectDescription> scopes = CollectionLiterals.<IEObjectDescription>newArrayList(); - EObject _eContainer = trans.eContainer(); - EObject _eContainer_1 = _eContainer.eContainer(); - ModelComponent comp = ((ModelComponent) _eContainer_1); - boolean _isCircularClassHierarchy = this._fSMHelpers.isCircularClassHierarchy(comp); - boolean _not = (!_isCircularClassHierarchy); - if (_not) { - ModelComponent _base = comp.getBase(); - comp = _base; - while ((!Objects.equal(comp, null))) { - { - StateGraph _stateMachine = comp.getStateMachine(); - boolean _notEquals = (!Objects.equal(_stateMachine, null)); - if (_notEquals) { - QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(comp); - final int acNameSegments = _fullyQualifiedName.getSegmentCount(); - StateGraph _stateMachine_1 = comp.getStateMachine(); - final TreeIterator<EObject> iter = _stateMachine_1.eAllContents(); - while (iter.hasNext()) { - { - final EObject obj = iter.next(); - if ((obj instanceof Transition)) { - QualifiedName _fullyQualifiedName_1 = this._iQualifiedNameProvider.getFullyQualifiedName(obj); - QualifiedName _skipFirst = _fullyQualifiedName_1.skipFirst((acNameSegments + 1)); - IEObjectDescription _create = EObjectDescription.create(_skipFirst, obj); - scopes.add(_create); - } - } - } - } - ModelComponent _base_1 = comp.getBase(); - comp = _base_1; - } - } - } - return new SimpleScope(IScope.NULLSCOPE, scopes); - } - - /** - * @param sg - * @param covered - * @param states - */ - private void recursivelyAddStates(final StateGraph sg, final HashSet<State> covered, final ArrayList<State> states) { - EList<State> _states = sg.getStates(); - for (final State s : _states) { - if (((s instanceof SimpleState) && (!covered.contains(s)))) { - states.add(s); - } else { - if (((s instanceof RefinedState) && (!covered.contains(s)))) { - states.add(s); - State _target = ((RefinedState) s).getTarget(); - covered.add(_target); - } - } - } - EList<State> _states_1 = sg.getStates(); - for (final State s_1 : _states_1) { - StateGraph _subgraph = s_1.getSubgraph(); - boolean _notEquals = (!Objects.equal(_subgraph, null)); - if (_notEquals) { - StateGraph _subgraph_1 = s_1.getSubgraph(); - this.recursivelyAddStates(_subgraph_1, covered, states); - } - } - } - - /** - * first container of type {@link StateGraph} ({@link State}, {@link StateMachine}) - * @param obj - * @return StateGraph Container - */ - private StateGraph getStateGraph(final EObject obj) { - EObject ctx = obj.eContainer(); - while (((!(ctx instanceof StateGraph)) && (!Objects.equal(ctx.eContainer(), null)))) { - EObject _eContainer = ctx.eContainer(); - ctx = _eContainer; - } - if ((ctx instanceof StateGraph)) { - return ((StateGraph)ctx); - } - return null; - } - - /** - * compute the path of a {@link BaseState} - * @param bs - * @return the path - */ - private QualifiedName getStatePath(final State bs) { - EObject _eContainer = bs.eContainer(); - final EObject parent = _eContainer.eContainer(); - if ((parent instanceof SimpleState)) { - QualifiedName _statePath = this.getStatePath(((SimpleState) parent)); - String _name = bs.getName(); - return _statePath.append(_name); - } else { - if ((parent instanceof RefinedState)) { - final State target = ((RefinedState) parent).getTarget(); - boolean _notEquals = (!Objects.equal(target, null)); - if (_notEquals) { - QualifiedName _statePath_1 = this.getStatePath(target); - String _name_1 = bs.getName(); - return _statePath_1.append(_name_1); - } - } - } - String _name_2 = bs.getName(); - return QualifiedName.create(_name_2); - } - - /** - * @param parent - * @param scopes - */ - private void getStateScopes(final StateGraph parent, final List<IEObjectDescription> scopes) { - final List<State> states = this._fSMHelpers.getAllStates(parent); - final HashMap<String, SimpleState> name2state = CollectionLiterals.<String, SimpleState>newHashMap(); - for (final State s : states) { - String _name = s.getName(); - SimpleState _baseState = this._fSMHelpers.getBaseState(s); - name2state.put(_name, _baseState); - } - Set<Map.Entry<String, SimpleState>> _entrySet = name2state.entrySet(); - for (final Map.Entry<String, SimpleState> entry : _entrySet) { - String _key = entry.getKey(); - SimpleState _value = entry.getValue(); - IEObjectDescription _create = EObjectDescription.create(_key, _value); - scopes.add(_create); - } - } -} diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/validation/FSMValidationUtilXtend.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/validation/FSMValidationUtilXtend.java deleted file mode 100644 index aff4dbc9e..000000000 --- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/validation/FSMValidationUtilXtend.java +++ /dev/null @@ -1,163 +0,0 @@ -/** - * Copyright (c) 2014 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Mirza Klimenta (initial contribution) - */ -package org.eclipse.etrice.core.fsm.validation; - -import com.google.common.base.Objects; -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.HashMap; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.etrice.core.fsm.fSM.AbstractInterfaceItem; -import org.eclipse.etrice.core.fsm.fSM.FSMPackage; -import org.eclipse.etrice.core.fsm.fSM.Guard; -import org.eclipse.etrice.core.fsm.fSM.MessageFromIf; -import org.eclipse.etrice.core.fsm.fSM.State; -import org.eclipse.etrice.core.fsm.fSM.StateGraph; -import org.eclipse.etrice.core.fsm.fSM.StateTerminal; -import org.eclipse.etrice.core.fsm.fSM.Transition; -import org.eclipse.etrice.core.fsm.fSM.Trigger; -import org.eclipse.etrice.core.fsm.fSM.TriggeredTransition; -import org.eclipse.etrice.core.fsm.naming.FSMNameProvider; -import org.eclipse.xtext.xbase.lib.CollectionLiterals; -import org.eclipse.xtext.xbase.lib.Extension; -import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; - -@SuppressWarnings("all") -public class FSMValidationUtilXtend { - public static class Result { - private boolean ok; - - private String msg; - - private EObject source; - - private EStructuralFeature feature; - - private int index; - - public static FSMValidationUtilXtend.Result ok() { - return new FSMValidationUtilXtend.Result(true, "", null, null, 0); - } - - public static FSMValidationUtilXtend.Result error(final String msg) { - return new FSMValidationUtilXtend.Result(false, msg, null, null, (-1)); - } - - public static FSMValidationUtilXtend.Result error(final String msg, final EObject source, final EStructuralFeature feature) { - return new FSMValidationUtilXtend.Result(false, msg, source, feature, (-1)); - } - - public static FSMValidationUtilXtend.Result error(final String msg, final EObject source, final EStructuralFeature feature, final int index) { - return new FSMValidationUtilXtend.Result(false, msg, source, feature, index); - } - - public Result(final boolean ok, final String msg, final EObject source, final EStructuralFeature feature, final int index) { - this.ok = ok; - this.msg = msg; - this.source = source; - this.feature = feature; - this.index = index; - } - - public boolean isOk() { - return this.ok; - } - - public String getMsg() { - return this.msg; - } - - public EObject getSource() { - return this.source; - } - - public EStructuralFeature getFeature() { - return this.feature; - } - - public int getIndex() { - return this.index; - } - } - - @Inject - @Extension - private FSMNameProvider _fSMNameProvider; - - public ArrayList<FSMValidationUtilXtend.Result> uniqueOriginTriggers(final State myState) { - final StateGraph parent = this.getStateGraph(myState); - final HashMap<String, TriggeredTransition> trig2trans = CollectionLiterals.<String, TriggeredTransition>newHashMap(); - final ArrayList<FSMValidationUtilXtend.Result> result = CollectionLiterals.<FSMValidationUtilXtend.Result>newArrayList(); - EList<Transition> _transitions = parent.getTransitions(); - final Function1<Transition, Boolean> _function = new Function1<Transition, Boolean>() { - @Override - public Boolean apply(final Transition t) { - return Boolean.valueOf((((t instanceof TriggeredTransition) && (((TriggeredTransition) t).getFrom() instanceof StateTerminal)) && Objects.equal(myState, ((StateTerminal) ((TriggeredTransition) t).getFrom()).getState()))); - } - }; - Iterable<Transition> _filter = IterableExtensions.<Transition>filter(_transitions, _function); - for (final Transition t : _filter) { - EList<Trigger> _triggers = ((TriggeredTransition) t).getTriggers(); - final Function1<Trigger, Boolean> _function_1 = new Function1<Trigger, Boolean>() { - @Override - public Boolean apply(final Trigger k) { - Guard _guard = k.getGuard(); - return Boolean.valueOf(Objects.equal(_guard, null)); - } - }; - Iterable<Trigger> _filter_1 = IterableExtensions.<Trigger>filter(_triggers, _function_1); - for (final Trigger k : _filter_1) { - EList<MessageFromIf> _msgFromIfPairs = k.getMsgFromIfPairs(); - for (final MessageFromIf specMethod : _msgFromIfPairs) { - { - final String triggerName = this.getTriggerName(specMethod); - boolean _containsKey = trig2trans.containsKey(triggerName); - if (_containsKey) { - final TriggeredTransition ot = trig2trans.get(triggerName); - FSMValidationUtilXtend.Result _error = FSMValidationUtilXtend.Result.error("Triggers originating from a state should be unique.", t, FSMPackage.Literals.TRIGGERED_TRANSITION__TRIGGERS); - result.add(_error); - FSMValidationUtilXtend.Result _error_1 = FSMValidationUtilXtend.Result.error("Triggers originating from a state should be unique.", ot, FSMPackage.Literals.TRIGGERED_TRANSITION__TRIGGERS); - result.add(_error_1); - } - trig2trans.put(triggerName, ((TriggeredTransition) t)); - } - } - } - } - return result; - } - - private String getTriggerName(final MessageFromIf mif) { - AbstractInterfaceItem _from = mif.getFrom(); - String _name = _from.getName(); - String _plus = (_name + "#"); - EObject _message = mif.getMessage(); - String _messageName = this._fSMNameProvider.getMessageName(_message); - return (_plus + _messageName); - } - - public StateGraph getStateGraph(final EObject obj) { - EObject parent = obj.eContainer(); - while ((!Objects.equal(parent, null))) { - { - if ((parent instanceof StateGraph)) { - return ((StateGraph) parent); - } - EObject _eContainer = parent.eContainer(); - parent = _eContainer; - } - } - return null; - } -} |