Commit ea76c045 authored by k20066's avatar k20066
Browse files

comment delete

parent f9623601
......@@ -77,7 +77,6 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF
this.commandType = command.getAction();
this.target = command.getTargetID();
this.commanderID = command.getSenderID();
//System.out.println("[FireBrigade] recievecommand time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+" tagID:"+this.target+" commandType:"+this.commandType);
}
return this;
}
......@@ -94,7 +93,6 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF
this.actionExtMove.updateInfo(messageManager);
this.commandCompleted = this.isCommandCompleted(this.commandType);
//System.out.println("[FireBrigade] isCommandCompleted ["+this.commandCompleted+"] time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+" tagID:"+this.target+" commandType:"+this.commandType);
if (this.commandCompleted) {
if (this.commandType != ACTION_UNKNOWN) {
messageManager
......@@ -195,7 +193,6 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF
return this;
case ACTION_AUTONOMY:
if (this.target == null) {
System.out.println("[FireBrigade] excutor notarget time:"+this.agentInfo.getTime()+" id:"+this.commanderID+" tagID:"+this.target+" commandType:"+this.commandType);
return this;
}
StandardEntity targetEntity = this.worldInfo.getEntity(this.target);
......@@ -205,72 +202,11 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF
} else if (targetEntity instanceof Human) {
this.result = this.actionFireRescue.setTarget(this.target).calc()
.getAction();
System.out.println("[FireBrigade] excutor "+this.result+" time:"+this.agentInfo.getTime()+" id:"+this.commanderID+" tagID:"+this.target+" commandType:"+this.commandType);
}
}
return this;
}
/*private Action computeCommand(int commandType, EntityID target, EntityID commanderID){
Action action = null;
switch (commandType) {
case ACTION_REST:
EntityID position = this.agentInfo.getPosition();
if (target == null) {
Collection<
EntityID> refuges = this.worldInfo.getEntityIDsOfType(REFUGE);
if (refuges.contains(position)) {
action = new ActionRest();
} else {
this.pathPlanning.setFrom(position);
this.pathPlanning.setDestination(refuges);
List<EntityID> path = this.pathPlanning.calc().getResult();
if (path != null && path.size() > 0) {
action = new ActionMove(path);
} else {
action = new ActionRest();
}
}
return action;
}
if (position.getValue() != target.getValue()) {
List<EntityID> path = this.pathPlanning.getResult(position,
target);
if (path != null && path.size() > 0) {
action = new ActionMove(path);
return action;
}
}
action = new ActionRest();
return action;
case ACTION_MOVE:
if (target != null) {
action = this.actionExtMove.setTarget(target).calc()
.getAction();
}
return action;
case ACTION_RESCUE:
if (target != null) {
action = this.actionFireRescue.setTarget(target).calc()
.getAction();
}
return action;
case ACTION_AUTONOMY:
if (target == null) {
return action;
}
StandardEntity targetEntity = this.worldInfo.getEntity(target);
if (targetEntity instanceof Area) {
action = this.actionExtMove.setTarget(target).calc()
.getAction();
} else if (targetEntity instanceof Human) {
action = this.actionFireRescue.setTarget(target).calc()
.getAction();
}
}
return action;
}*/
private boolean isCommandCompleted(int commandType) {
Human agent = (Human) this.agentInfo.me();
switch (commandType) {
......@@ -303,23 +239,7 @@ public class CentralizedControlCommandExecutorF extends CommandExecutor<CommandF
commandType = ACTION_MOVE;
return this.isCommandCompleted(commandType);
} else if (targetEntity instanceof Human) {
//commandType = ACTION_MOVE;
//if(!this.isCommandCompleted(commandType)) return false;
Human h = (Human) targetEntity;
EntityID position = h.getPosition();
/*if (this.agentInfo.getPosition().getValue() != position.getValue()) {
return false;
}*/
commandType = ACTION_RESCUE;
/*if ((h.isHPDefined() && h.getHP() == 0)) {
return true;
}
//commandType = h.getStandardURN() == CIVILIAN ? ACTION_RESCUE : null;
if (h.getStandardURN() == CIVILIAN) {
commandType = ACTION_RESCUE;
}*/
return this.isCommandCompleted(commandType);
}
}
......
......@@ -140,7 +140,6 @@ public class ComplimentTacticsExtActionFireRescue extends ExtAction {
if(this.result != null){
Class<? extends Action> actionClass = this.result.getClass();
if (actionClass == ActionRescue.class) {
//System.out.println("[FireRescue time:"+this.agentInfo.getTime()+" myid:"+this.agentInfo.getID());
this.mm.addMessage(new MessageFireBrigade(true, agent, MessageFireBrigade.ACTION_RESCUE, this.target));
}
}
......
......@@ -152,12 +152,6 @@ public class CentralizedControlMessageCoordinator extends MessageCoordinator {
numChannels);
}
String a = "isPlatoon:"+isPlatoon;
for(int i = 0;i < channels.length; i++){
a += " channels["+i+"]:"+channels[i];
}
//System.out.println("time:"+agentInfo.getTime()+" myid:"+agentInfo.getID()+a);
return channels;
}
......
......@@ -57,20 +57,7 @@ public class CentralizedControlATHumanDetector extends HumanDetector {
public HumanDetector updateInfo(MessageManager messageManager) {
logger.debug("Time:" + agentInfo.getTime());
super.updateInfo(messageManager);
int time = this.agentInfo.getTime();
Action action = this.agentInfo.getExecutedAction(time - 1);
//System.out.println("time:"+time+" myid:"+this.agentInfo.getID()+" -1step action:"+action);
int[] chan = messageManager.getChannels();
String str = "";
for(int i=0; i<chan.length; i++){
str+=" getChannels["+i+"]:"+chan[i]+" chan_len:"+chan.length;
}
//System.out.println("time:"+time+" myid:"+this.agentInfo.getID()+" channelCount:"+scenarioInfo.getCommsChannelsCount()+str);
//List<CommunicationMessage> mes = messageManager.getReceivedMessageList(MessageCivilian.class);
Set<EntityID> changes = this.worldInfo.getChanged().getChangedEntities();
for(EntityID id : changes){
StandardEntity entity = this.worldInfo.getEntity(id);
......@@ -81,13 +68,7 @@ public class CentralizedControlATHumanDetector extends HumanDetector {
continue;
}
StandardMessagePriority level = StandardMessagePriority.HIGH;
//MessageCivilian civ_mes = new MessageDamageCivilian(true, level, civ);
MessageCivilian civ_mes = new MessageCivilian(true, level, civ);
//Building building = (Building) this.worldInfo.getPosition(id);
//System.out.println("time:"+time+" myid:"+this.agentInfo.getID()+" civ:"+civ.getID()+" level:"+civ_mes.getSendingPriority());
//messageManager.addMessage(building_mes,true);
messageManager.addMessage(civ_mes,true);
}
......
......@@ -145,13 +145,13 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
}
allocate = reverse_list;
}
String str = " allocate";
for(int i = 0; i<row; i++){
if(allocate[i] == -1) continue;
str += "\n["+i+"]:"+allocate[i]+" fbID:"+rowlist.get(i)+" tagID:"+collist.get(allocate[i]);
this.fireBrigadeInfoMap.get(rowlist.get(i)).target = collist.get(allocate[i]);
}
System.out.println("[FBCenter] time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+str);
//this.printAllocate(allocate, rowlist, collist, row);
return this;
}
......@@ -178,7 +178,6 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
MessageFireBrigade mesfb = (MessageFireBrigade) mes;
MessageUtil.reflectMessage(this.worldInfo, mesfb);
EntityID fbID = mesfb.getAgentID();
System.out.println("[FBCenter] time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+" fbID:"+fbID+" posi:"+mesfb.getPosition()+" Action:"+mesfb.getAction()+" level:"+mesfb.getSendingPriority()+" size:"+mesfb.getByteArraySize());
FireBrigadeInfo fbi = this.fireBrigadeInfoMap.get(fbID);
fbi.setInfo(mesfb.getTargetID(), mesfb.getPosition(), mesfb.getBuriedness(),
(mesfb.getAction() == MessageFireBrigade.ACTION_RESCUE) ? false : true, this.agentInfo.getTime());
......@@ -221,6 +220,15 @@ public class CentralizedControlFBAllocator extends FireTargetAllocator {
return true;
}
private void printAllocate(int[] allocate, List<EntityID> rowlist, List<EntityID> collist, int row){
String str = " allocate";
for(int i = 0; i<row; i++){
if(allocate[i] == -1) continue;
str += "\n["+i+"]:"+allocate[i]+" fbID:"+rowlist.get(i)+" tagID:"+collist.get(allocate[i]);
}
System.out.println("[FBCenter] time:"+this.agentInfo.getTime()+" id:"+this.agentInfo.getID()+str);
}
private class FireBrigadeInfo {
EntityID agentID;
......
......@@ -63,15 +63,6 @@ public class CentralizedControlFBHumanDetector extends HumanDetector {
this.mm = messageManager;
int time = this.agentInfo.getTime();
int[] chan = messageManager.getChannels();
String str = "";
for(int i=0; i<chan.length; i++){
str+=" getChannels["+i+"]:"+chan[i]+" chan_len:"+chan.length;
}
//System.out.println("time:"+time+" myid:"+this.agentInfo.getID()+" channelCount:"+scenarioInfo.getCommsChannelsCount()+str);
Set<EntityID> changes = this.worldInfo.getChanged().getChangedEntities();
for(EntityID id : changes){
StandardEntity entity = this.worldInfo.getEntity(id);
......@@ -84,8 +75,6 @@ public class CentralizedControlFBHumanDetector extends HumanDetector {
StandardMessagePriority level = StandardMessagePriority.HIGH;
MessageCivilian civ_mes = new MessageCivilian(true, level, civ);
//System.out.println("time:"+time+" myid:"+this.agentInfo.getID()+" civ:"+civ.getID()+" level:"+civ_mes.getSendingPriority());
messageManager.addMessage(civ_mes,true);
}
......
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