1 package cz.cuni.amis.pogamut.ut2004.analyzer; 2 3 import java.lang.ref.WeakReference; 4 import java.util.Map; 5 6 import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId; 7 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player; 8 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Self; 9 import cz.cuni.amis.pogamut.ut2004.server.IUT2004Server; 10 11 /** 12 * Interface of the analyzer that should hook an {@link IUT2004AnalyzerObserver} agent onto 13 * every bot inside UT2004 game sniffing info about the bot. 14 * 15 * @author Jimmy 16 */ 17 public interface IUT2004Analyzer extends IUT2004Server { 18 19 /** 20 * Returns all observers currently owned by the analyzer. 21 * <p><p> 22 * The id can be obtained for instance from {@link Player#getId()} or {@link Self#getId()} 23 * or new one can be obtained from {@link String} via {@link UnrealId#get(String)}. 24 * 25 * <p><p> 26 * NOTE: returns unmodifiable map that is a copy of the inner map inside the analyzer. 27 * 28 * @return 29 */ 30 public Map<UnrealId, IUT2004AnalyzerObserver> getObservers(); 31 32 /** 33 * Hooks a listener that watches for creation/deletion of observers. ({@link WeakReference} is used to store the listener reference!) 34 * @param listener 35 */ 36 public void addListener(IAnalyzerObserverListener listener); 37 38 /** 39 * Removes a listener that watches for creation/deletion of observers. 40 * @param listener 41 */ 42 public void removeListener(IAnalyzerObserverListener listener); 43 44 /** 45 * Tests a listener whether it watches for creation/deletion of observers. 46 * @param listener 47 * @return 48 */ 49 public boolean isListening(IAnalyzerObserverListener listener); 50 51 }