abstractambulanceteamagent.java

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

JAVA
52
字号
// Copyright (C) 2002 Takeshi Morimoto <morimoto@takopen.cs.uec.ac.jp>// All rights reserved.package yab.agent;import java.net.*;import yab.agent.*;import yab.agent.object.*;import yab.io.ProtocolConstants;import MRL.Ambulance.EAmbulanceTeam;public abstract class AbstractAmbulanceTeamAgent extends PlatoonAgent {    protected AbstractAmbulanceTeamAgent(InetAddress address, int port) {        super(ProtocolConstants.AGENT_TYPE_AMBULANCE_TEAM, address, port);    }    protected EAmbulanceTeam self() { return (EAmbulanceTeam) world.self; }    private Humanoid m_loadingInjured = null;    protected Humanoid loadingInjured() { return m_loadingInjured; }    protected boolean isLoadingInjured() { return m_loadingInjured != null; }    protected void checkLoadingInjured() {        if (loadingInjured() instanceof Humanoid            && loadingInjured().position() != self())            m_loadingInjured = null;    }    protected void prepareForAct() {        super.prepareForAct();        checkLoadingInjured();    }    protected void rescue(Humanoid target) throws ActionCommandException {        self().setAct(RESCUE_ACT);        socket().akRescue(self().id, target.id);        throw new ActionCommandException();    }    protected void load(Humanoid target) throws ActionCommandException {        self().setAct(LOAD_ACT);        socket().akLoad(self().id, target.id);        m_loadingInjured = target;        throw new ActionCommandException();    }    protected void unload() throws ActionCommandException {        self().setAct(UNLOAD_ACT);        socket().akUnload(self().id);        m_loadingInjured = null;        throw new ActionCommandException();    }}

⌨️ 快捷键说明

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