📄 taskmessage.java
字号:
package MRL.Utilities.MessageManagement;import yab.agent.DisasterSpace;import yab.agent.object.AmbulanceTeam;import yab.agent.object.Humanoid;import yab.agent.object.PoliceForce;import java.util.Map;import java.util.Collections;import MRL.Police.TaskHandler;import MRL.Police.EPoliceForce;//saeed 85-2-3public class TaskMessage extends Message { int task; int polIndex; static final int indexSize = 4; static final int taskSize = 4; public TaskMessage(int index, int task) { super(Type.TASK_REPORT, null); this.polIndex = index; this.task = task; } char[] toCharArray(Map idToVirtualId) { char[] result = new char[length()]; char[] temp = Util.intToCharArray(polIndex, indexSize); Util.copyArray(temp, result, 0, 0, indexSize); temp = Util.intToCharArray(task, taskSize); Util.copyArray(temp, result, 0, indexSize, taskSize); return result; } protected int length() { return staticLength(); } protected static int staticLength() { return taskSize + indexSize; } public boolean equals(Object m) { if (!(m instanceof TaskMessage)) return false; return ((TaskMessage) m).polIndex == polIndex; } public int hashCode() { return polIndex; } void updateWorld(DisasterSpace world, int time) { if(world.self instanceof PoliceForce){ EPoliceForce me = (EPoliceForce) world.self; PoliceForce pf = (PoliceForce) world.policeForces.get(polIndex); TaskHandler th = me.taskHandler; th.setNewTaskAssignedByCenter(pf,task); } } public TaskMessage(char[] message) { super(Type.TASK_REPORT, null); this.polIndex = Util.charArrayToint(message, 0, indexSize); this.task = Util.charArrayToint(message, indexSize, taskSize); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -