clearmessage.java

来自「2004年robotcup世界冠军源代码」· Java 代码 · 共 82 行

JAVA
82
字号
package MRL.Utilities.MessageManagement;import yab.agent.DisasterSpace;import yab.agent.object.Road;import java.util.Map;/** * Created by IntelliJ IDEA. * User: Maryam * Date: Apr 27, 2005 * Time: 4:51:37 PM * To change this template use File | Settings | File Templates. *///saeed 85-2-3public class ClearMessage extends Message{    private int roadId;    public ClearMessage(Road road)    {        super(Type.CLEAR_REPORT, road);        roadId = road.id;    }    public ClearMessage(int roadId, Map virtualToIds)    {        super(Type.CLEAR_REPORT, null);        this.roadId = ((Integer) virtualToIds.get(new Integer(roadId))).intValue();    }    public ClearMessage(char[] message, Map virtualIdToId)    {        super(Type.CLEAR_REPORT, null);        this.roadId = ((Integer) virtualIdToId.get(new Integer(Util.charArrayToint(message, 0, idSize)))).intValue();    }    protected static int staticLength()    {        return idSize;    }    public boolean equals(Object m)    {        if (!(m instanceof ClearMessage)) return false;        return roadId == ((ClearMessage) m).roadId;    }    public int hashCode()    {        return roadId;    }    void updateWorld(DisasterSpace world, int time)    {        obj = world.get(roadId);        obj.setHearTime(time);        obj.setTime(time);        ((Road) obj).setIsReportedAsClear(true);        ((Road) obj).setBlock(0,time);    }    char[] toCharArray(Map idToVirtualIds)  // id    {        char[] result = new char[length()];        char[] temp = Util.intToCharArray(((Integer) idToVirtualIds.get(new Integer(roadId))).intValue(), idSize);        Util.copyArray(temp, result, 0, 0, idSize);        return result;    }    protected int length()    {        return staticLength();    }}

⌨️ 快捷键说明

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