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

📄 blockmessage.java

📁 2004年robotcup世界冠军源代码
💻 JAVA
字号:
package MRL.Utilities.MessageManagement;import yab.agent.DisasterSpace;import yab.agent.object.*;import java.util.Map;import MRL.Utilities.Partitioning.Path;import MRL.Police.EPoliceForce;/** * Message Manager for SBCe_Saviour 2006 * by Maryam Kalantary * **/public class BlockMessage extends Message{    private int roadId;    public BlockMessage(RCRObject road)    {        super(Type.BLOCK_REPORT, road);        this.roadId = obj.id;    }    char[] toCharArray(Map idToVirtualId)    {        char[] result = new char[length()];        char[] temp = Util.intToCharArray(((Integer) (idToVirtualId.get(new Integer(roadId)))).intValue(), idSize);        Util.copyArray(temp, result, 0, 0, idSize);        return result;    }    protected int length()    {        return staticLength();    }    protected static int staticLength()    {        return idSize;    }    public boolean equals(Object m)    {        if (!(m instanceof BlockMessage)) return false;        return ((BlockMessage) m).roadId == roadId;    }    public int hashCode()    {        return roadId;    }    void updateWorld(DisasterSpace world, int time)    {        obj = world.get(roadId);        if (world.self instanceof EPoliceForce)        {            Road r = (Road) obj;            EPoliceForce me = (EPoliceForce) world.self;            Path tpath = world.getContainingPath(r);            if (!tpath.shouldCheck()) return;              if(!me.reportedRoads.contains(r)) me.reportedRoads.add(r);              tpath.addReportedBIC();//              if (world.workingPartition != null) {//                if (world.workingPartition.ML_OBJS_IN_PART_CND.eval(tpath)) {//                  me.task = 0;//                  me.lastTimeTaskAssigned = time;//                }//              }//              else{//                if(world.freePolices.indexOf(me) == world.freePolices.size() -1 && world.freePolices.size() > 0){//                  me.task = 0;//                  me.lastTimeTaskAssigned = time;//                }//            }        }    }    public BlockMessage(char[] message, Map virtualIdToId)    {        super(Type.BLOCK_REPORT, null);        this.roadId = ((Integer) virtualIdToId.get(new Integer(Util.charArrayToint(message, 0, idSize)))).intValue();    }}

⌨️ 快捷键说明

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