unclearmessage.java

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

JAVA
76
字号
package MRL.Utilities.MessageManagement;import yab.agent.DisasterSpace;import yab.agent.object.*;import java.util.Map;import MRL.Utilities.Partitioning.Path;/** * Created by IntelliJ IDEA. * User: Mohammad * Date: Jul 5, 2005 * Time: 2:14:40 PM *///saeed 85-2-3public class UnClearMessage extends Message{    private int roadId;    public UnClearMessage(RCRObject road)    {        super(Type.UNCLEAR_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 UnClearMessage)) return false;        return ((UnClearMessage) m).roadId == roadId;    }    public int hashCode()    {        return roadId;    }    void updateWorld(DisasterSpace world, int time)    {        obj = world.get(roadId);        Road r = (Road) obj;        if (!r.isReportedAsClear() && !r.hasBeenSeen())        {            r.setHearTime(time);            r.setTime(time);            r.setBlock(r.width(), time);        }    }    public UnClearMessage(char[] message, Map virtualIdToId)    {        super(Type.UNCLEAR_REPORT, null);        this.roadId = ((Integer) virtualIdToId.get(new Integer(Util.charArrayToint(message, 0, idSize)))).intValue();    }}

⌨️ 快捷键说明

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