Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2011-03-12 08:56:48 +0000
committerHenrik Rentz-Reichert2011-03-12 08:56:48 +0000
commit3616566dbcbf1cc49f97a6d62424f9d3201957b8 (patch)
tree75c24aa612fbcac980a69cedeb05812bc6c3d855
parent4a6cc7935ef94c6474449d6923c9699d5536f484 (diff)
downloadorg.eclipse.etrice-3616566dbcbf1cc49f97a6d62424f9d3201957b8.tar.gz
org.eclipse.etrice-3616566dbcbf1cc49f97a6d62424f9d3201957b8.tar.xz
org.eclipse.etrice-3616566dbcbf1cc49f97a6d62424f9d3201957b8.zip
core.room: further helpers
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/room/util/RoomHelpers.java89
1 files changed, 82 insertions, 7 deletions
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 7ca5fac88..5dcfb2e1b 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
@@ -12,7 +12,10 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.ActorContainerRef;
+import org.eclipse.etrice.core.room.Binding;
import org.eclipse.etrice.core.room.InterfaceItem;
+import org.eclipse.etrice.core.room.LayerConnection;
import org.eclipse.etrice.core.room.LogicalSystem;
import org.eclipse.etrice.core.room.StructureClass;
import org.eclipse.etrice.core.room.SubSystemClass;
@@ -25,11 +28,11 @@ import org.eclipse.etrice.core.room.SubSystemClass;
*/
public class RoomHelpers {
- public static List<InterfaceItem> getInterfaceItems(StructureClass acc) {
+ public static List<InterfaceItem> getInterfaceItems(StructureClass sc) {
ArrayList<InterfaceItem> result = new ArrayList<InterfaceItem>();
- if (acc instanceof ActorClass) {
- ActorClass ac = (ActorClass) acc;
+ if (sc instanceof ActorClass) {
+ ActorClass ac = (ActorClass) sc;
do {
result.addAll(ac.getIfSPPs());
result.addAll(ac.getIfPorts());
@@ -37,17 +40,89 @@ public class RoomHelpers {
}
while (ac!=null);
}
- else if (acc instanceof SubSystemClass) {
- result.addAll(((SubSystemClass) acc).getIfSPPs());
- result.addAll(((SubSystemClass) acc).getRelayPorts());
+ else if (sc instanceof SubSystemClass) {
+ result.addAll(((SubSystemClass) sc).getIfSPPs());
+ result.addAll(((SubSystemClass) sc).getRelayPorts());
}
- else if (acc instanceof LogicalSystem) {
+ else if (sc instanceof LogicalSystem) {
// has no interface items
}
else {
assert(false): "unexpected sub type";
}
+
return result;
}
+ public static List<ActorContainerRef> getRefs(StructureClass sc) {
+ ArrayList<ActorContainerRef> result = new ArrayList<ActorContainerRef>();
+
+ if (sc instanceof ActorClass) {
+ ActorClass ac = (ActorClass) sc;
+ do {
+ result.addAll(ac.getActorRefs());
+ ac = ac.getBase();
+ }
+ while (ac!=null);
+ }
+ else if (sc instanceof SubSystemClass) {
+ result.addAll(((SubSystemClass) sc).getActorRefs());
+ }
+ else if (sc instanceof LogicalSystem) {
+ result.addAll(((LogicalSystem) sc).getSubSystems());
+ }
+ else {
+ assert(false): "unexpected sub type";
+ }
+
+ return result;
+ }
+
+ public static List<Binding> getBindings(StructureClass sc) {
+ ArrayList<Binding> result = new ArrayList<Binding>();
+
+ if (sc instanceof ActorClass) {
+ ActorClass ac = (ActorClass) sc;
+ do {
+ result.addAll(ac.getBindings());
+ ac = ac.getBase();
+ }
+ while (ac!=null);
+ }
+ else if (sc instanceof SubSystemClass) {
+ result.addAll(((SubSystemClass) sc).getBindings());
+ }
+ else if (sc instanceof LogicalSystem) {
+ result.addAll(((LogicalSystem) sc).getBindings());
+ }
+ else {
+ assert(false): "unexpected sub type";
+ }
+
+ return result;
+ }
+
+ public static List<LayerConnection> getConnections(StructureClass sc) {
+ ArrayList<LayerConnection> result = new ArrayList<LayerConnection>();
+
+ if (sc instanceof ActorClass) {
+ ActorClass ac = (ActorClass) sc;
+ do {
+ result.addAll(ac.getConnections());
+ ac = ac.getBase();
+ }
+ while (ac!=null);
+ }
+ else if (sc instanceof SubSystemClass) {
+ result.addAll(((SubSystemClass) sc).getConnections());
+ }
+ else if (sc instanceof LogicalSystem) {
+ result.addAll(((LogicalSystem) sc).getConnections());
+ }
+ else {
+ assert(false): "unexpected sub type";
+ }
+
+ return result;
+ }
}

Back to the top