Commit f9623601 authored by k20066's avatar k20066
Browse files

refactoring FBAllocator

parent a6504720
...@@ -159,25 +159,6 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator { ...@@ -159,25 +159,6 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
@Override @Override
public FireTargetAllocator updateInfo(MessageManager messageManager) { public FireTargetAllocator updateInfo(MessageManager messageManager) {
super.updateInfo(messageManager); super.updateInfo(messageManager);
/*List<CommunicationMessage> mescivlist = messageManager.getReceivedMessageList(MessageCivilian.class);
for(CommunicationMessage mes : mescivlist){
MessageCivilian mesciv = (MessageCivilian) mes;
StandardMessagePriority level = mesciv.getSendingPriority();
//if(level != StandardMessagePriority.HIGH) continue;
MessageUtil.reflectMessage(this.worldInfo, mesciv);
//boolean mdc = (mesciv instanceof MessageDamageCivilian);
//if(!(mesciv instanceof MessageDamageCivilian)) continue;
EntityID civID = mesciv.getAgentID();
StandardEntity civ = this.worldInfo.getEntity(civID);
if(!this.isNeedRescueHuman(civ)) continue;
if(finishEntityIDs.contains(civID)) continue;
EntityID buildingID = mesciv.getPosition();
//int time = this.agentInfo.getTime();
//System.out.println("[FBCenter] time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+" civID:"+civID+" buildingID:"+buildingID+" size:"+mesciv.getByteArraySize()+" mdc:"+mdc);
System.out.println("[FBCenter] time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+" civID:"+civID+" buildingID:"+buildingID+" size:"+mesciv.getByteArraySize()+" isNeedRescueHuman:"+this.isNeedRescueHuman(civ));
this.taskSet.add(civID);
}*/
Set<EntityID> recievetasks = messageManager.getReceivedMessageList(MessageCivilian.class).stream() Set<EntityID> recievetasks = messageManager.getReceivedMessageList(MessageCivilian.class).stream()
.map(e -> { .map(e -> {
...@@ -203,17 +184,14 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator { ...@@ -203,17 +184,14 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
(mesfb.getAction() == MessageFireBrigade.ACTION_RESCUE) ? false : true, this.agentInfo.getTime()); (mesfb.getAction() == MessageFireBrigade.ACTION_RESCUE) ? false : true, this.agentInfo.getTime());
} }
List<CommunicationMessage> reportlist = messageManager.getReceivedMessageList(MessageReport.class); List<EntityID> reportlist = messageManager.getReceivedMessageList(MessageReport.class).stream()
for(CommunicationMessage mes : reportlist){ .map(MessageReport.class::cast)
MessageReport report = (MessageReport) mes; .filter(MessageReport::isDone)
EntityID targetID = report.getFromID(); .map(MessageReport::getFromID)
//System.out.println("[FBCenter] report time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+" fbID:"+senderID+" tagID:"+targetID); .collect(Collectors.toList());
boolean done = report.isDone();
if(done) { this.finishEntityIDs.addAll(reportlist);
this.finishEntityIDs.add(targetID); this.taskSet.removeAll(reportlist);
this.taskSet.remove(targetID);
}
}
return this; return this;
} }
......
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