View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.analyzer;
2   
3   import cz.cuni.amis.pogamut.base.agent.IAgentId;
4   import cz.cuni.amis.pogamut.base.agent.params.IAgentParameters;
5   import cz.cuni.amis.pogamut.base.communication.connection.IWorldConnectionAddress;
6   import cz.cuni.amis.pogamut.ut2004.agent.params.UT2004AgentParameters;
7   
8   @Deprecated
9   public class UT2004AnalyzerObserverParameters extends UT2004AgentParameters {
10  
11  	private String observedAgentId;
12  	
13  	private Boolean waitForMatchRestart = null;
14  	
15  	private String outputPath = null;
16  	
17  	/**
18  	 * FileName to be used for the output. Must end with some file extension (e.g., .csv).
19  	 */
20  	private String fileName;
21  	
22  	public UT2004AnalyzerObserverParameters() {
23  		super();
24  	}
25  
26  	/**
27  	 * Returns ID of the player that should be observed.
28  	 * @return
29  	 */
30  	public String getObservedAgentId() {
31  		return observedAgentId;
32  	}
33  
34  	/**
35  	 * Sets 'id' (usually taken from the {@link UnrealId} that is present for instance in {@link Self#getId()}) 
36  	 * of the bot that is going to be observed by newly created observer.
37  	 * <p><p>
38  	 * WARNING: Note that you should not mess with 'setters' in different threads as they
39  	 * are non-thread-safe and may interrupt horrible agent instantiations with such behavior.
40  	 * @param address
41  	 * @return this instance
42  	 */
43  	public UT2004AnalyzerObserverParameters setObservedAgentId(String observedAgentId) {
44  		this.observedAgentId = observedAgentId;
45  		return this;
46  	}
47  	
48  	@Override
49  	public UT2004AnalyzerObserverParameters setAgentId(IAgentId agentId) {
50  		super.setAgentId(agentId);
51  		return this;
52  	}
53  	
54  	@Override
55  	public UT2004AnalyzerObserverParameters setWorldAddress(IWorldConnectionAddress address) {
56  		super.setWorldAddress(address);
57  		return this;
58  	}
59  	
60  	/**
61  	 * Contains path to directory where the observer should output its results. MUST POINT TO DIR!
62  	 * @return
63  	 */
64  	public String getOutputPath() {
65  		return outputPath;
66  	}
67  
68  	/**
69  	 * Sets  path to directory where the observer should output its results. MUST POINT TO DIR!
70  	 * @param outputPath
71  	 */
72  	public UT2004AnalyzerObserverParameters setOutputPath(String outputPath) {
73  		this.outputPath = outputPath;
74  		return this;
75  	}
76  
77  	/**
78  	 * Whether the observer should wait for match-restart before it starts to collect data.
79  	 * @return
80  	 */
81  	public boolean isWaitForMatchRestart() {
82  		return waitForMatchRestart == null ? false : waitForMatchRestart;
83  	}
84  
85  	/**
86  	 * Sets whether the observer should wait for match-restart before it starts to collect data.
87  	 * @param waitForMatchRestart
88  	 */
89  	public UT2004AnalyzerObserverParameters setWaitForMatchRestart(boolean waitForMatchRestart) {
90  		this.waitForMatchRestart = waitForMatchRestart;
91  		return this;
92  	}	
93  	
94  	/**
95  	 * Returns file name that should be used for outputting data (just file name, must be combined with {@link UT2004AnalyzerObserver#getOutputFilePath()}.
96  	 * @return
97  	 */
98  	public String getFileName() {
99  		return fileName;
100 	}
101 
102 	/**
103 	 * Sets FileName to be used for the output. Must end with some file extension (e.g., .csv). (Just file name, will be combined with {@link UT2004AnalyzerObserver#getOutputFilePath()}.
104 	 * @param fileName
105 	 */
106 	public UT2004AnalyzerObserverParameters setFileName(String fileName) {
107 		this.fileName = fileName;
108 		return this;
109 	}
110 
111 	@Override
112 	public void assignDefaults(IAgentParameters defaults) {
113 		super.assignDefaults(defaults);
114 		if (defaults instanceof UT2004AnalyzerObserverParameters) {
115 			if (waitForMatchRestart == null && ((UT2004AnalyzerObserverParameters)defaults).waitForMatchRestart != null)
116 				waitForMatchRestart = ((UT2004AnalyzerObserverParameters)defaults).waitForMatchRestart;
117 			if (outputPath == null) outputPath = ((UT2004AnalyzerObserverParameters)defaults).getOutputPath();
118 			if (fileName == null) fileName = ((UT2004AnalyzerObserverParameters)defaults).getFileName();
119 		}
120 	}
121 
122 	
123 
124 	
125 	
126 }