Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2014-11-28 18:07:04 +0000
committerHenrik Rentz-Reichert2014-12-05 07:13:42 +0000
commitdf24c8618ce1db71f02a1a809b0bf5bfd475edeb (patch)
treece01daaaa3fc4c0b18dd8b3617305e8bc5b235c9
parent08cf8a0ca0e76d0541b7141386bc71a6c2ceaf3e (diff)
downloadorg.eclipse.etrice-df24c8618ce1db71f02a1a809b0bf5bfd475edeb.tar.gz
org.eclipse.etrice-df24c8618ce1db71f02a1a809b0bf5bfd475edeb.tar.xz
org.eclipse.etrice-df24c8618ce1db71f02a1a809b0bf5bfd475edeb.zip
[core.fsm] validation : fixed circular recursion
-rw-r--r--plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.xtend27
-rw-r--r--plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/util/FSMHelpers.java4
-rw-r--r--plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.java96
3 files changed, 57 insertions, 70 deletions
diff --git a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.xtend b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.xtend
index 082742987..3db3dd11b 100644
--- a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.xtend
+++ b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/scoping/FSMScopeProvider.xtend
@@ -149,7 +149,7 @@ class FSMScopeProvider extends AbstractDeclarativeScopeProvider {
var sg = getStateGraph(rs)
if (sg.eContainer instanceof ModelComponent) {
var comp = sg.eContainer as ModelComponent
- if (comp.base!=null) {
+ if (comp.base != null && !comp.isCircularClassHierarchy) {
comp = comp.base
val HashSet<State> covered = newHashSet
val ArrayList<State> states = newArrayList
@@ -183,22 +183,23 @@ class FSMScopeProvider extends AbstractDeclarativeScopeProvider {
val List<IEObjectDescription> scopes = newArrayList
var comp = trans.eContainer.eContainer as ModelComponent
- comp = comp.base
- while (comp!=null) {
- if (comp.stateMachine!=null) {
- val acNameSegments = comp.fullyQualifiedName.segmentCount
- val iter = comp.stateMachine.eAllContents
- while (iter.hasNext) {
- val EObject obj = iter.next
- if (obj instanceof Transition) {
- // use qualified name but skip ac FQN and also omit state machine name 'sm'
- scopes.add(EObjectDescription.create(obj.fullyQualifiedName.skipFirst(acNameSegments+1), obj))
+ if(!comp.isCircularClassHierarchy){
+ comp = comp.base
+ while (comp!=null) {
+ if (comp.stateMachine!=null) {
+ val acNameSegments = comp.fullyQualifiedName.segmentCount
+ val iter = comp.stateMachine.eAllContents
+ while (iter.hasNext) {
+ val EObject obj = iter.next
+ if (obj instanceof Transition) {
+ // use qualified name but skip ac FQN and also omit state machine name 'sm'
+ scopes.add(EObjectDescription.create(obj.fullyQualifiedName.skipFirst(acNameSegments+1), obj))
+ }
}
}
+ comp = comp.base
}
- comp = comp.base
}
-
return new SimpleScope(IScope.NULLSCOPE, scopes)
}
diff --git a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/util/FSMHelpers.java b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/util/FSMHelpers.java
index 6bb8d82e6..67930eecd 100644
--- a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/util/FSMHelpers.java
+++ b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/util/FSMHelpers.java
@@ -655,6 +655,8 @@ public class FSMHelpers extends BaseHelpers {
}
else if (sg.eContainer() instanceof ModelComponent) {
ModelComponent base = ((ModelComponent)sg.eContainer()).getBase();
+ if(base != null && isCircularClassHierarchy(base))
+ break;
sg = base!=null? base.getStateMachine():null;
}
else {
@@ -716,6 +718,8 @@ public class FSMHelpers extends BaseHelpers {
}
else if (sg.eContainer() instanceof ModelComponent) {
ModelComponent base = ((ModelComponent)sg.eContainer()).getBase();
+ if(base != null && isCircularClassHierarchy(base))
+ break;
sg = base!=null? base.getStateMachine():null;
}
else {
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
index 903b7ec31..ea1e9d6de 100644
--- 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
@@ -160,24 +160,28 @@ public class FSMScopeProvider extends AbstractDeclarativeScopeProvider {
if ((_eContainer instanceof ModelComponent)) {
EObject _eContainer_1 = sg.eContainer();
ModelComponent comp = ((ModelComponent) _eContainer_1);
+ boolean _and = false;
ModelComponent _base = comp.getBase();
boolean _notEquals = (!Objects.equal(_base, null));
- if (_notEquals) {
+ if (!_notEquals) {
+ _and = false;
+ } else {
+ boolean _isCircularClassHierarchy = this._fSMHelpers.isCircularClassHierarchy(comp);
+ boolean _not = (!_isCircularClassHierarchy);
+ _and = _not;
+ }
+ if (_and) {
ModelComponent _base_1 = comp.getBase();
comp = _base_1;
final HashSet<State> covered = CollectionLiterals.<State>newHashSet();
final ArrayList<State> states = CollectionLiterals.<State>newArrayList();
- boolean _notEquals_1 = (!Objects.equal(comp, null));
- boolean _while = _notEquals_1;
- while (_while) {
+ while ((!Objects.equal(comp, null))) {
{
StateGraph _stateMachine = comp.getStateMachine();
this.recursivelyAddStates(_stateMachine, covered, states);
ModelComponent _base_2 = comp.getBase();
comp = _base_2;
}
- boolean _notEquals_2 = (!Objects.equal(comp, null));
- _while = _notEquals_2;
}
for (final State s : states) {
QualifiedName _statePath = this.getStatePath(s);
@@ -192,8 +196,8 @@ public class FSMScopeProvider extends AbstractDeclarativeScopeProvider {
State _target = ((RefinedState) _eContainer_3).getTarget();
StateGraph _subgraph = _target.getSubgraph();
sg = _subgraph;
- boolean _notEquals_2 = (!Objects.equal(sg, null));
- if (_notEquals_2) {
+ boolean _notEquals_1 = (!Objects.equal(sg, null));
+ if (_notEquals_1) {
EList<State> _states = sg.getStates();
for (final State s_1 : _states) {
String _name = s_1.getName();
@@ -217,40 +221,36 @@ public class FSMScopeProvider extends AbstractDeclarativeScopeProvider {
EObject _eContainer = trans.eContainer();
EObject _eContainer_1 = _eContainer.eContainer();
ModelComponent comp = ((ModelComponent) _eContainer_1);
- ModelComponent _base = comp.getBase();
- comp = _base;
- boolean _notEquals = (!Objects.equal(comp, null));
- boolean _while = _notEquals;
- while (_while) {
- {
- StateGraph _stateMachine = comp.getStateMachine();
- boolean _notEquals_1 = (!Objects.equal(_stateMachine, null));
- if (_notEquals_1) {
- QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(comp);
- final int acNameSegments = _fullyQualifiedName.getSegmentCount();
- StateGraph _stateMachine_1 = comp.getStateMachine();
- final TreeIterator<EObject> iter = _stateMachine_1.eAllContents();
- boolean _hasNext = iter.hasNext();
- boolean _while_1 = _hasNext;
- while (_while_1) {
- {
- 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);
+ 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);
+ }
}
}
- boolean _hasNext_1 = iter.hasNext();
- _while_1 = _hasNext_1;
}
+ ModelComponent _base_1 = comp.getBase();
+ comp = _base_1;
}
- ModelComponent _base_1 = comp.getBase();
- comp = _base_1;
}
- boolean _notEquals_1 = (!Objects.equal(comp, null));
- _while = _notEquals_1;
}
return new SimpleScope(IScope.NULLSCOPE, scopes);
}
@@ -307,27 +307,9 @@ public class FSMScopeProvider extends AbstractDeclarativeScopeProvider {
*/
private StateGraph getStateGraph(final EObject obj) {
EObject ctx = obj.eContainer();
- boolean _and = false;
- if (!(!(ctx instanceof StateGraph))) {
- _and = false;
- } else {
+ while (((!(ctx instanceof StateGraph)) && (!Objects.equal(ctx.eContainer(), null)))) {
EObject _eContainer = ctx.eContainer();
- boolean _notEquals = (!Objects.equal(_eContainer, null));
- _and = _notEquals;
- }
- boolean _while = _and;
- while (_while) {
- EObject _eContainer_1 = ctx.eContainer();
- ctx = _eContainer_1;
- boolean _and_1 = false;
- if (!(!(ctx instanceof StateGraph))) {
- _and_1 = false;
- } else {
- EObject _eContainer_2 = ctx.eContainer();
- boolean _notEquals_1 = (!Objects.equal(_eContainer_2, null));
- _and_1 = _notEquals_1;
- }
- _while = _and_1;
+ ctx = _eContainer;
}
if ((ctx instanceof StateGraph)) {
return ((StateGraph)ctx);

Back to the top