summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjung2012-12-11 01:58:46 (EST)
committertjung2012-12-11 01:58:46 (EST)
commit156a426c9597d75deaccfe8e0e5bb791a1bb754e (patch)
tree5a09a6357446091127424ca4bf70989b2420110f
parent42624a9ae1a468137ee9d45e47a2434ef00bf874 (diff)
downloadorg.eclipse.etrice-156a426c9597d75deaccfe8e0e5bb791a1bb754e.zip
org.eclipse.etrice-156a426c9597d75deaccfe8e0e5bb791a1bb754e.tar.gz
org.eclipse.etrice-156a426c9597d75deaccfe8e0e5bb791a1bb754e.tar.bz2
[core.room] derived protocol validation changed
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java51
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java4
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java2
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java8
-rw-r--r--plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java2
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/PortMessageSelectionDialog.java8
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java6
7 files changed, 29 insertions, 52 deletions
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
index fbfe575..f40572f 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
@@ -698,20 +698,26 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
private void fillTriggerStringMap() {
// improve performance using maps name2ifitem and name2msgs
HashMap<String, InterfaceItem> name2ifitem = new HashMap<String, InterfaceItem>();
- HashMap<String, EList<Message>> name2msgs = new HashMap<String, EList<Message>>();
+ HashMap<String, List<Message>> name2msgs = new HashMap<String, List<Message>>();
ActorClass ac = getActorClass();
- while (ac!=null) {
+ while (ac!=null){
for (Port ip : ac.getIntPorts()) {
- mapPort(ip, name2ifitem, name2msgs);
+ name2ifitem.put(ip.getName(), ip);
+ name2msgs.put(ip.getName(),RoomHelpers.getMessageListDeep(ip, false));
}
for (ExternalPort ep : ac.getExtPorts()) {
- mapPort(ep.getIfport(), name2ifitem, name2msgs);
+ Port p=ep.getIfport();
+ name2ifitem.put(p.getName(),p);
+ name2msgs.put(p.getName(),RoomHelpers.getMessageListDeep(p, false));
}
for (SAPRef sap : ac.getStrSAPs()) {
- mapSAP(sap, name2ifitem, name2msgs);
+ name2ifitem.put(sap.getName(),sap);
+ name2msgs.put(sap.getName(),RoomHelpers.getMessageListDeep(sap, false));
}
for (ServiceImplementation spp : ac.getServiceImplementations()) {
- mapSPP(spp.getSpp(), name2ifitem, name2msgs);
+ SPPRef p=spp.getSpp();
+ name2ifitem.put(p.getName(),p);
+ name2msgs.put(p.getName(),RoomHelpers.getMessageListDeep(p, false));
}
ac = ac.getBase();
@@ -738,7 +744,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
// this should always hold true
assert(ii!=null): "The name '"+parts[0]+"' did not match an interface item (in name2ifitem)!";
- EList<Message> msgs = name2msgs.get(parts[0]);
+ List<Message> msgs = name2msgs.get(parts[0]);
// this should always hold true
assert(msgs!=null): "The name '"+parts[0]+"' did not match an interface item (in name2msgs)!";
@@ -758,36 +764,7 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
triggerstring2mif.put(trig, mif);
}
}
-
- private void mapPort(Port p, HashMap<String, InterfaceItem> name2ifitem,
- HashMap<String, EList<Message>> name2msgs) {
- name2ifitem.put(p.getName(), p);
-
- if (!(p.getProtocol() instanceof ProtocolClass))
- return;
-
- if (p.isConjugated())
- name2msgs.put(p.getName(), ((ProtocolClass)p.getProtocol()).getOutgoingMessages());
- else
- name2msgs.put(p.getName(), ((ProtocolClass)p.getProtocol()).getIncomingMessages());
- }
-
- private void mapSAP(SAPRef sap, HashMap<String, InterfaceItem> name2ifitem,
- HashMap<String, EList<Message>> name2msgs) {
- name2ifitem.put(sap.getName(), sap);
-
- // sap is conjugated wrt to the protocol
- name2msgs.put(sap.getName(), sap.getProtocol().getOutgoingMessages());
- }
-
- private void mapSPP(SPPRef spp, HashMap<String, InterfaceItem> name2ifitem,
- HashMap<String, EList<Message>> name2msgs) {
- name2ifitem.put(spp.getName(), spp);
-
- // spp is regular wrt to the protocol
- name2msgs.put(spp.getName(), spp.getProtocol().getIncomingMessages());
- }
-
+
private void addTransitionChain(Transition t) {
TransitionChain tc = ETriceGenFactory.eINSTANCE.createTransitionChain();
tc.setTransition(t);
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java
index 73a5431..8870941 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java
@@ -814,7 +814,7 @@ public class RoomHelpers {
return true;
}
- public static List<Message> getMessageList(InterfaceItem item, boolean outgoing) {
+ public static List<Message> getMessageListDeep(InterfaceItem item, boolean outgoing) {
ProtocolClass protocol = null;
if (item instanceof Port) {
if (!(((Port) item).getProtocol() instanceof ProtocolClass)) {
@@ -839,7 +839,7 @@ public class RoomHelpers {
return null;
}
- return outgoing? protocol.getOutgoingMessages():protocol.getIncomingMessages();
+ return outgoing? RoomHelpers.getAllMessages(protocol,false):RoomHelpers.getAllMessages(protocol,true);
}
public static PortClass getPortClass(InterfaceItem item) {
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java
index 6896114..8e34318 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java
@@ -337,7 +337,7 @@ public class RoomScopeProvider extends AbstractDeclarativeScopeProvider {
}
if (protocol!=null)
- for (Message msg : conjugated?protocol.getOutgoingMessages():protocol.getIncomingMessages()) {
+ for (Message msg : conjugated?RoomHelpers.getAllMessages(protocol,false):RoomHelpers.getAllMessages(protocol,true)) {
scopes.add(EObjectDescription.create(msg.getName(), msg));
}
}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java
index 7d36928..17ee618 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/ValidationUtil.java
@@ -325,18 +325,18 @@ public class ValidationUtil {
}
else {
if (RoomHelpers.isDerivedFrom((ProtocolClass)pc1, (ProtocolClass)pc2)) {
- if (((ProtocolClass)pc1).getIncomingMessages().size()>0)
+ if (RoomHelpers.getAllMessages((ProtocolClass)pc1,true).size() > RoomHelpers.getAllMessages((ProtocolClass)pc2,true).size())
pc1extendsIncoming = true;
- if (((ProtocolClass)pc1).getOutgoingMessages().size()>0)
+ if (RoomHelpers.getAllMessages((ProtocolClass)pc1,false).size()>RoomHelpers.getAllMessages((ProtocolClass)pc2,false).size())
pc1extendsOutgoing = true;
if (pc1extendsIncoming && pc1extendsOutgoing)
return Result.error("derived protocols not connectable (both directions extended)");
}
else if (RoomHelpers.isDerivedFrom((ProtocolClass)pc2, (ProtocolClass)pc1)) {
- if (((ProtocolClass)pc2).getIncomingMessages().size()>0)
+ if (RoomHelpers.getAllMessages((ProtocolClass)pc2,true).size()>RoomHelpers.getAllMessages((ProtocolClass)pc1,true).size())
pc2extendsIncoming = true;
- if (((ProtocolClass)pc2).getOutgoingMessages().size()>0)
+ if (RoomHelpers.getAllMessages((ProtocolClass)pc2,false).size()>RoomHelpers.getAllMessages((ProtocolClass)pc1,false).size())
pc2extendsOutgoing = true;
if (pc2extendsIncoming && pc2extendsOutgoing)
return Result.error("derived protocols not connectable (both directions extended)");
diff --git a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java
index e66a345..c721f8d 100644
--- a/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java
+++ b/plugins/org.eclipse.etrice.generator/src/org/eclipse/etrice/generator/base/DetailCodeTranslator.java
@@ -270,7 +270,7 @@ public class DetailCodeTranslator {
String token = getToken(text, curr);
- List<Message> messages = RoomHelpers.getMessageList(item, outgoing);
+ List<Message> messages = RoomHelpers.getMessageListDeep(item, outgoing);
for (Message message : messages) {
if (message.getName().equals(token))
return message;
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/PortMessageSelectionDialog.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/PortMessageSelectionDialog.java
index d0c9ab3..f5aed3d 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/PortMessageSelectionDialog.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/PortMessageSelectionDialog.java
@@ -103,7 +103,7 @@ public class PortMessageSelectionDialog extends FormDialog {
List<InterfaceItem> items = RoomHelpers.getAllInterfaceItems(ac);
for (InterfaceItem item : items) {
ArrayList<MethodItemPair> pairs = new ArrayList<MethodItemPair>();
- List<Message> out = RoomHelpers.getMessageList(item, true);
+ List<Message> out = RoomHelpers.getMessageListDeep(item, true);
if (!recvOnly) {
for (Message msg : out) {
if (!msg.isPriv())
@@ -111,7 +111,7 @@ public class PortMessageSelectionDialog extends FormDialog {
}
}
if (RoomHelpers.getProtocol(item).getCommType()==CommunicationType.DATA_DRIVEN) {
- List<Message> in = RoomHelpers.getMessageList(item, false);
+ List<Message> in = RoomHelpers.getMessageListDeep(item, false);
for (Message msg : in) {
if (!msg.isPriv())
pairs.add(new MsgItemPair(item, msg, false));
@@ -158,11 +158,11 @@ public class PortMessageSelectionDialog extends FormDialog {
public boolean hasChildren(Object element) {
if (element instanceof InterfaceItem) {
InterfaceItem item = (InterfaceItem)element;
- if (!RoomHelpers.getMessageList(item, true).isEmpty())
+ if (!RoomHelpers.getMessageListDeep(item, true).isEmpty())
return true;
if (RoomHelpers.getProtocol(item).getCommType()==CommunicationType.DATA_DRIVEN)
- if (!RoomHelpers.getMessageList(item, false).isEmpty())
+ if (!RoomHelpers.getMessageListDeep(item, false).isEmpty())
return true;
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java
index f48c176..9dca3a3 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/dialogs/TransitionPropertyDialog.java
@@ -323,7 +323,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
return false;
for (InterfaceItem item : interfaceItems) {
- if (!RoomHelpers.getMessageList(item, false).isEmpty())
+ if (!RoomHelpers.getMessageListDeep(item, false).isEmpty())
return true;
}
return false;
@@ -619,7 +619,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
for (int i = 0; i < items.length; i++) {
if (items[i].equals(mif.getFrom().getName())) {
interfaceCombo.select(i);
- currentMsgs = RoomHelpers.getMessageList(mif.getFrom(), false);
+ currentMsgs = RoomHelpers.getMessageListDeep(mif.getFrom(), false);
int pos = 0;
int idx = -1;
for (Message message : currentMsgs) {
@@ -659,7 +659,7 @@ public class TransitionPropertyDialog extends AbstractMemberAwarePropertyDialog
private MessageFromIf createDefaultMif() {
MessageFromIf mif = RoomFactory.eINSTANCE.createMessageFromIf();
for (InterfaceItem item : interfaceItems) {
- List<Message> msgs = RoomHelpers.getMessageList(item, false);
+ List<Message> msgs = RoomHelpers.getMessageListDeep(item, false);
if (!msgs.isEmpty()) {
mif.setFrom(item);
mif.setMessage(msgs.get(0));