The following document contains the results of PMD's CPD 4.2.5.
File | Line |
---|---|
cz/cuni/amis/pogamut/sposh/context/UT2004Behaviour.java | 374 |
cz/cuni/amis/pogamut/sposh/context/UT2004Context.java | 365 |
protected void initialize() { initializeModules(bot); initializePathFinding(bot); initializeListeners(bot); } /** * Initializes {@link UT2004Behaviour#listenerRegistrator} and calls {@link AnnotationListenerRegistrator#addListeners()} method * to probe all declared methods for event-annotation presence. * @param bot */ protected void initializeListeners(BOT bot) { listenerRegistrator = new AnnotationListenerRegistrator(this, getWorldView(), bot.getLogger().getCategory("Listeners")); listenerRegistrator.addListeners(); } /** * Initializes path-finding modules: {@link UT2004BotModuleControllerNew#pathPlanner} and {@link UT2004BotModuleControllerNew#pathExecutor}. * If you need different path planner / path executor - override this method and initialize your own modules. * @param bot */ protected void initializePathFinding(BOT bot) { pathPlanner = new UT2004AStarPathPlanner(bot); fwMap = new FloydWarshallMap(bot); aStar = new UT2004AStar(bot); pathExecutor = new UT2004PathExecutor<ILocated>( bot, info, move, new LoqueNavigator<ILocated>(bot, info, move, bot.getLog()) ); getBackToNavGraph = new UT2004GetBackToNavGraph(bot, info, move); runStraight = new UT2004RunStraight(bot, info, move); navigation = new UT2004Navigation(bot, pathExecutor, fwMap, getBackToNavGraph, runStraight); } /** * Initializes memory/command modules of the bot. * * @param bot */ protected void initializeModules(BOT bot) { world = getWorldView(); act = getAct(); game = new Game(bot); navPoints = new NavPoints(bot); players = new Players(bot); descriptors = new ItemDescriptors(bot); config = new AgentConfig(bot); raycasting = new Raycasting(bot); stats = new AgentStats(bot); navBuilder = new NavigationGraphBuilder(bot); info = new UT2004AgentInfo(bot, game); visibility = new Visibility(bot, info); ctf = new CTF(bot, info); weaponry = new Weaponry(bot, descriptors); items = new UT2004Items(bot, info, game, weaponry, null); senses = new Senses(bot, info, players); body = new CompleteBotCommandsWrapper(bot, weaponry, null); shoot = body.getImprovedShooting(); move = body.getLocomotion(); weaponPrefs = new WeaponPrefs(weaponry, bot); combo = new AdrenalineCombo(bot, info); } /** * Called after the behaviour construction to initialize user's data structures. * @param bot */ protected void prepareBehaviour(BOT bot) { } /** * This method is called whenever {@link InitedMessage} is received. Various agent modules are usable since this * method is called. * * @param gameInfo * @param config * @param init * @param self */ public void botInitialized(GameInfo info, ConfigChange config, InitedMessage init) { } /** * This method is called only once whenever first batch of information what the bot can see is received. * <i><i> * It is sort of "first-logic-method" where you may issue commands for the first time and handle everything * else in bot's logic then. It eliminates the need to have 'boolean firstLogic' field inside your bot. * <p><p> * Note that this method has advantage over the {@link IUT2004BotController#botInitialized(GameInfo, ConfigChange, InitedMessage)} * that you already have {@link Self} object. * * @param gameInfo * @param config * @param init * @param self */ public void botSpawned(GameInfo gameInfo, ConfigChange config, InitedMessage init, Self self) { } /** * Called after {@link UT2004Behaviour#botFirstSpawn(GameInfo, ConfigChange, InitedMessage, Self)} as a hook for Pogamut's core developers * to finalize initialization of various modules. * <p><p> * <b>NOTE:</b> This is Pogamut's developers reserved method - do not override it and if you do, always use 'super' * to call parent's finishControllerInitialization. */ public void finishInitialization() { |