Commit f9f134f9 authored by k20066's avatar k20066
Browse files

analysis allocate

parent 41657e3a
...@@ -74,6 +74,7 @@ public class CentralizedControlCommandExecutorFire extends CommandExecutor<Comma ...@@ -74,6 +74,7 @@ public class CentralizedControlCommandExecutorFire extends CommandExecutor<Comma
@Override @Override
public CommandExecutor setCommand(CommandFire command) { public CommandExecutor setCommand(CommandFire command) {
EntityID agentID = this.agentInfo.getID(); EntityID agentID = this.agentInfo.getID();
System.out.println("time:"+this.agentInfo.getTime()+" fbid:"+this.agentInfo.getID()+" commandAction:"+command.getAction()+" commandTarget:"+command.getTargetID()+" commanderID:"+command.getSenderID());
if(!this.commandCompleted) return this; if(!this.commandCompleted) return this;
if (command.isToIDDefined() && Objects.requireNonNull(command.getToID()).getValue() == agentID.getValue()) { if (command.isToIDDefined() && Objects.requireNonNull(command.getToID()).getValue() == agentID.getValue()) {
this.commandType = command.getAction();// 司令で出された行動内容 this.commandType = command.getAction();// 司令で出された行動内容
......
...@@ -165,7 +165,7 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator { ...@@ -165,7 +165,7 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
if(allocate[i] == -1) continue; if(allocate[i] == -1) continue;
this.fireBrigadeInfoMap.get(rowlist.get(i)).target = collist.get(allocate[i]); this.fireBrigadeInfoMap.get(rowlist.get(i)).target = collist.get(allocate[i]);
} }
//this.printAllocate(allocate, rowlist, collist, row); this.printAllocate(allocate, rowlist, collist, row);
return this; return this;
} }
...@@ -191,17 +191,26 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator { ...@@ -191,17 +191,26 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
.filter(e -> !(finishEntityIDs.contains(e))) .filter(e -> !(finishEntityIDs.contains(e)))
.collect(Collectors.toSet()); .collect(Collectors.toSet());
System.out.println("time:"+this.agentInfo.getTime()+" centerid:"+this.agentInfo.getID()+" recievetasks:"+recievetasks);
this.taskSet.addAll(recievetasks); this.taskSet.addAll(recievetasks);
// 消防隊の情報をリセット
for(EntityID fbid : this.fireBrigadeInfoMap.keySet()){
FireBrigadeInfo fbi = this.fireBrigadeInfoMap.get(fbid);
fbi.resetInfo();
}
List<EntityID> fblist = new ArrayList<>();
List<CommunicationMessage> mesfblist = messageManager.getReceivedMessageList(MessageFireBrigade.class); List<CommunicationMessage> mesfblist = messageManager.getReceivedMessageList(MessageFireBrigade.class);
for(CommunicationMessage mes : mesfblist){ for(CommunicationMessage mes : mesfblist){
MessageFireBrigade mesfb = (MessageFireBrigade) mes; MessageFireBrigade mesfb = (MessageFireBrigade) mes;
MessageUtil.reflectMessage(this.worldInfo, mesfb); MessageUtil.reflectMessage(this.worldInfo, mesfb);
EntityID fbID = mesfb.getAgentID(); EntityID fbID = mesfb.getAgentID();
fblist.add(fbID);
FireBrigadeInfo fbi = this.fireBrigadeInfoMap.get(fbID); FireBrigadeInfo fbi = this.fireBrigadeInfoMap.get(fbID);
fbi.setInfo(mesfb.getTargetID(), mesfb.getPosition(), mesfb.getBuriedness(), fbi.setInfo(mesfb.getTargetID(), mesfb.getPosition(), mesfb.getBuriedness(),
(mesfb.getAction() == MessageFireBrigade.ACTION_RESCUE) ? false : true, this.agentInfo.getTime()); (mesfb.getAction() == MessageFireBrigade.ACTION_RESCUE) ? false : true, this.agentInfo.getTime());
} }
System.out.println("time:"+this.agentInfo.getTime()+" centerid:"+this.agentInfo.getID()+" fblist:"+fblist);
List<EntityID> reportlist = messageManager.getReceivedMessageList(MessageReport.class).stream() List<EntityID> reportlist = messageManager.getReceivedMessageList(MessageReport.class).stream()
.map(MessageReport.class::cast) .map(MessageReport.class::cast)
...@@ -294,5 +303,16 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator { ...@@ -294,5 +303,16 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
this.canNewAction = canNewAction; this.canNewAction = canNewAction;
this.commandTime = commandTime; this.commandTime = commandTime;
} }
/**
* 消防隊に関する情報をリセットするメソッド
*/
public void resetInfo(){
prevtarget = null;
position = null;
buriedness = -1;
target = null;
canNewAction = true;
commandTime = -1;
}
} }
} }
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment