CPD Results

The following document contains the results of PMD's CPD 4.2.5.

Duplications

FileLine
cz/cuni/amis/pogamut/sposh/context/EmohawkBehaviour.java383
cz/cuni/amis/pogamut/sposh/context/EmohawkContext.java348
		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);
		pathExecutor = 
        	new UT2004PathExecutor<ILocated>(
        		bot, 
        		new LoqueNavigator<ILocated>(bot, 
        		bot.getLog())
        	);   
		
		// add stuck detectors that watch over the path-following, if it (heuristicly) finds out that the bot has stuck somewhere,
    	// it reports an appropriate path event and the path executor will stop following the path which in turn allows 
    	// us to issue another follow-path command in the right time
        pathExecutor.addStuckDetector(new UT2004TimeStuckDetector(bot, 3000, 100000)); // if the bot does not move for 3 seconds, considered that it is stuck
        pathExecutor.addStuckDetector(new UT2004PositionStuckDetector(bot));           // watch over the position history of the bot, if the bot does not move sufficiently enough, consider that it is stuck
        pathExecutor.addStuckDetector(new UT2004DistanceStuckDetector(bot));           // watch over distances to target
		
		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) {
FileLine
cz/cuni/amis/pogamut/sposh/context/EmohawkBehaviour.java431
cz/cuni/amis/pogamut/sposh/context/EmohawkContext.java398
		game        = new Game(bot);
		info        = new AgentInfo(bot, game);
		players     = new Players(bot);
//		descriptors = new ItemDescriptors(bot);
//		weaponry    = new Weaponry(bot, descriptors);
//		items       = new Items(bot, info, game, weaponry, null);
		senses      = new Senses(bot, info, players);
		config      = new AgentConfig(bot);
		raycasting  = new Raycasting(bot);
//		shoot       = body.getImprovedShooting();
		move        = new AdvancedLocomotion(getBot(), getBot().getLogger().getCategory("Move"));
		comm        = new Communication(getBot(), getBot().getLogger().getCategory("Communicaton"));
//		navBuilder  = new NavigationGraphBuilder(bot);
		stats       = new AgentStats(bot);
        animations  = new Animations(bot);
        emoticons   = new Emoticons(bot);
        places      = new Places(bot);
        steering    = new Steering(bot);
        inventory   = new Inventory(bot);
//		weaponPrefs = new WeaponPrefs(weaponry, bot);
	}