⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 requesttargetmessage.java

📁 2004年robotcup世界冠军源代码
💻 JAVA
字号:
package MRL.Utilities.MessageManagement;import yab.agent.DisasterSpace;import yab.agent.object.*;import java.util.Map;import java.util.Collections;import java.util.List;import java.util.ArrayList;import MRL.Utilities.Partitioning.Partition;//saeed 85-2-3public class RequestTargetMessage extends Message{    int index;    static final int indexSize = 4;    public RequestTargetMessage(int index)    {        super(Type.REQUESTTARGET_REPORT, null);        this.index = index;    }    char[] toCharArray(Map ids)    {        char[] result = new char[length()];        char[] temp = Util.intToCharArray(index, indexSize);        Util.copyArray(temp, result, 0, 0, indexSize);        return result;    }    protected int length()    {        return staticLength();    }    protected static int staticLength()    {        return indexSize;    }    public boolean equals(Object m)    {        if (!(m instanceof RequestTargetMessage)) return false;        return ((RequestTargetMessage) m).index == index;    }    public int hashCode()    {        return index;    }    void updateWorld(DisasterSpace world, int time)    {        if (world.self instanceof AmbulanceCenter)        {            Collections.sort(world.ambulanceTeams, yab.agent.Util.idComparator);            AmbulanceTeam at = (AmbulanceTeam) world.ambulanceTeams.get(index);           if (at.myAssignedTarget!=null &&(world.time() - at.getTargetAssignmentTime())>=3 )            {                at.myAssignedTarget=null;                at.setTargetAssignmentTime(-1);            }        }    }    public RequestTargetMessage(char[] message)    {        super(Type.REQUESTTARGET_REPORT, null);        this.index = Util.charArrayToint(message, 0, indexSize);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -