Skip to content
Snippets Groups Projects
Commit 3bd1297d authored by René Schöne's avatar René Schöne
Browse files

update

- remove CanReachObjectOfInterestWrapper
parent fd77cc1f
No related branches found
No related tags found
No related merge requests found
Pipeline #13908 failed
// --- receiving --- // --- receiving ---
receive WorldModelB.MyScene using ParseScene, ConvertScene ; receive WorldModelB.MyScene using ParseScene, ConvertScene ;
receive indexed WorldModelB.OtherScene ; receive indexed WorldModelB.OtherScene ;
receive Robot.CanReachObjectOfInterestWrapper using ParseReachability, ConvertReachability ; receive Robot.CanReachObjectOfInterest using ParseReachability, ConvertReachability ;
receive Robot.OwnedCollaborationZoneNames using ConfigChangeCommandCheckForOwnedCollaborationZone ; receive Robot.OwnedCollaborationZoneNames using ConfigChangeCommandCheckForOwnedCollaborationZone ;
receive Robot.OccupiedCollaborationZoneNames using CommandCheckForOccupiedCollaborationZone ; receive Robot.OccupiedCollaborationZoneNames using CommandCheckForOccupiedCollaborationZone ;
receive Robot.CurrentPosition ; receive Robot.CurrentPosition ;
...@@ -11,11 +11,11 @@ ParseReachability maps byte[] bytes to de.tudresden.inf.st.ceti.Reachability {: ...@@ -11,11 +11,11 @@ ParseReachability maps byte[] bytes to de.tudresden.inf.st.ceti.Reachability {:
return de.tudresden.inf.st.ceti.Reachability.parseFrom(bytes); return de.tudresden.inf.st.ceti.Reachability.parseFrom(bytes);
:} :}
ConvertReachability maps de.tudresden.inf.st.ceti.Reachability r to CanReachObjectOfInterestWrapper {: ConvertReachability maps de.tudresden.inf.st.ceti.Reachability r to JastAddList<CanReachObjectOfInterest> {:
var result = new CanReachObjectOfInterestWrapper(); var result = new JastAddList<CanReachObjectOfInterest>();
for (var objReach : r.getObjectsList()) { for (var objReach : r.getObjectsList()) {
if (objReach.getReachable()) { if (objReach.getReachable()) {
result.addCanReachObjectOfInterest(new CanReachObjectOfInterest().setObjectName(objReach.getIdObject())); result.addChild(new CanReachObjectOfInterest().setObjectName(objReach.getIdObject()));
} }
} }
return result; return result;
......
...@@ -309,15 +309,15 @@ aspect Computation { ...@@ -309,15 +309,15 @@ aspect Computation {
return errorNoExecutableOperation(); return errorNoExecutableOperation();
} }
//--- canReach --- // //--- canReach --- | TODO not used
syn boolean Robot.canReach(String objectName) { // syn boolean Robot.canReach(String objectName) {
for (CanReachObjectOfInterest canReachObj : getCanReachObjectOfInterestWrapper().getCanReachObjectOfInterestList()) { // for (CanReachObjectOfInterest canReachObj : getCanReachObjectOfInterestList()) {
if (canReachObj.getObjectName().equals(objectName)) { // if (canReachObj.getObjectName().equals(objectName)) {
return true; // return true;
} // }
} // }
return false; // return false;
} // }
//--- reachableObjects --- //--- reachableObjects ---
syn List<ObjectOfInterest> Robot.reachableObjects() { syn List<ObjectOfInterest> Robot.reachableObjects() {
...@@ -325,7 +325,7 @@ aspect Computation { ...@@ -325,7 +325,7 @@ aspect Computation {
return Collections.emptyList(); return Collections.emptyList();
} }
List<ObjectOfInterest> result = new ArrayList<>(); List<ObjectOfInterest> result = new ArrayList<>();
for (CanReachObjectOfInterest canReachObj : getCanReachObjectOfInterestWrapper().getCanReachObjectOfInterestList()) { for (CanReachObjectOfInterest canReachObj : getCanReachObjectOfInterestList()) {
result.add(worldModelB().getMyScene().resolveObjectOfInterest(canReachObj.getObjectName())); result.add(worldModelB().getMyScene().resolveObjectOfInterest(canReachObj.getObjectName()));
} }
return result; return result;
......
WorldModelB ::= Region* Robot* [MyScene:Scene] OtherScene:LogicalScene* ExecutedOperation:Operation* /NextOperation:Operation/ ; WorldModelB ::= Region* Robot* [MyScene:Scene] OtherScene:LogicalScene* ExecutedOperation:Operation* /NextOperation:Operation/ ;
// FIXME inline CanReachObjectOfInterestWrapper Robot ::= <Name:String> CanReachObjectOfInterest* <OwnedCollaborationZoneNames> <OccupiedCollaborationZoneNames> <CurrentPosition> ;
Robot ::= <Name:String> CanReachObjectOfInterestWrapper <OwnedCollaborationZoneNames> <OccupiedCollaborationZoneNames> <CurrentPosition> ;
// relations into nodes received by RagConnect are not allowed // relations into nodes received by RagConnect are not allowed
//rel Robot.OwnedCollaborationZone* <-> CollaborationZone.Owner? ; //rel Robot.OwnedCollaborationZone* <-> CollaborationZone.Owner? ;
//rel Robot.OccupiedCollaborationZone? <-> CollaborationZone.Occupient? ; //rel Robot.OccupiedCollaborationZone? <-> CollaborationZone.Occupient? ;
CanReachObjectOfInterestWrapper ::= CanReachObjectOfInterest* ;
CanReachObjectOfInterest ::= <ObjectName:String> ; CanReachObjectOfInterest ::= <ObjectName:String> ;
abstract Difference ; abstract Difference ;
......
...@@ -122,8 +122,8 @@ public class MainB extends SharedMainParts<MqttHandler, WorldModelB> { ...@@ -122,8 +122,8 @@ public class MainB extends SharedMainParts<MqttHandler, WorldModelB> {
Robot robot = UtilB.createRobot(robotConfiguration.name); Robot robot = UtilB.createRobot(robotConfiguration.name);
model.addRobot(robot); model.addRobot(robot);
CanReachObjectOfInterestWrapper reachabilityWrapper = UtilB.convertToReachability(robotConfiguration.reachableLocations); JastAddList<CanReachObjectOfInterest> reachabilityList = UtilB.convertToReachability(robotConfiguration.reachableLocations);
robot.setCanReachObjectOfInterestWrapper(reachabilityWrapper); robot.setCanReachObjectOfInterestList(reachabilityList);
} }
} }
......
...@@ -133,8 +133,8 @@ public class SimpleMainB { ...@@ -133,8 +133,8 @@ public class SimpleMainB {
Robot robot = UtilB.createRobot(robotConfiguration.name); Robot robot = UtilB.createRobot(robotConfiguration.name);
model.addRobot(robot); model.addRobot(robot);
CanReachObjectOfInterestWrapper reachabilityWrapper = UtilB.convertToReachability(robotConfiguration.reachableLocations); JastAddList<CanReachObjectOfInterest> reachabilityList = UtilB.convertToReachability(robotConfiguration.reachableLocations);
robot.setCanReachObjectOfInterestWrapper(reachabilityWrapper); robot.setCanReachObjectOfInterestList(reachabilityList);
} }
Runnable close = () -> { Runnable close = () -> {
......
...@@ -38,12 +38,10 @@ public class UtilB { ...@@ -38,12 +38,10 @@ public class UtilB {
static Robot createRobot(String name, String... canReach) { static Robot createRobot(String name, String... canReach) {
Robot result = new Robot().setName(name).setCurrentPosition("unknown"); Robot result = new Robot().setName(name).setCurrentPosition("unknown");
CanReachObjectOfInterestWrapper wrapper = new CanReachObjectOfInterestWrapper();
for (String canReachName : canReach) { for (String canReachName : canReach) {
wrapper.addCanReachObjectOfInterest(new CanReachObjectOfInterest(canReachName)); result.addCanReachObjectOfInterest(new CanReachObjectOfInterest(canReachName));
} }
result.setCanReachObjectOfInterestWrapper(wrapper);
return result; return result;
} }
...@@ -103,9 +101,8 @@ public class UtilB { ...@@ -103,9 +101,8 @@ public class UtilB {
robot -> robot.getName() robot -> robot.getName()
+ "(" + (robot.isBusy() ? "busy" : "free") + "(" + (robot.isBusy() ? "busy" : "free")
+ ", canReach: " + ", canReach: "
+ robot.getCanReachObjectOfInterestWrapper() + robot.getCanReachObjectOfInterestList().prettyPrint(
.getCanReachObjectOfInterestList() canReachObj -> resolveObjName(model, canReachObj.getObjectName()))
.prettyPrint(canReachObj -> resolveObjName(model, canReachObj.getObjectName()))
+ ")")) + ")"))
.append("\n"); .append("\n");
if (detailed) { if (detailed) {
...@@ -144,9 +141,9 @@ public class UtilB { ...@@ -144,9 +141,9 @@ public class UtilB {
return new ExposingASTNode().exposed_apply_ConvertScene(scene); return new ExposingASTNode().exposed_apply_ConvertScene(scene);
} }
static CanReachObjectOfInterestWrapper convertToReachability(List<String> reachableLocations) { static JastAddList<CanReachObjectOfInterest> convertToReachability(List<String> reachableLocations) {
CanReachObjectOfInterestWrapper result = new CanReachObjectOfInterestWrapper(); JastAddList<CanReachObjectOfInterest> result = new JastAddList<>();
reachableLocations.forEach(location -> result.addCanReachObjectOfInterest(new CanReachObjectOfInterest(location))); reachableLocations.forEach(location -> result.addChild(new CanReachObjectOfInterest(location)));
return result; return result;
} }
...@@ -189,9 +186,9 @@ public class UtilB { ...@@ -189,9 +186,9 @@ public class UtilB {
public Scene exposed_apply_ConvertScene(de.tudresden.inf.st.ceti.Scene pbScene) throws Exception { public Scene exposed_apply_ConvertScene(de.tudresden.inf.st.ceti.Scene pbScene) throws Exception {
return _ragconnect__apply_ConvertScene(pbScene); return _ragconnect__apply_ConvertScene(pbScene);
} }
public CanReachObjectOfInterestWrapper exposed_apply_ConvertReachability(de.tudresden.inf.st.ceti.Reachability r) throws Exception { // public CanReachObjectOfInterestWrapper exposed_apply_ConvertReachability(de.tudresden.inf.st.ceti.Reachability r) throws Exception {
return _ragconnect__apply_ConvertReachability(r); // return _ragconnect__apply_ConvertReachability(r);
} // }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment