source: src/main/java/genius/core/StrategyParameters.java@ 33

Last change on this file since 33 was 1, checked in by Wouter Pasman, 6 years ago

Initial import : Genius 9.0.0

File size: 1.5 KB
Line 
1package genius.core;
2
3import java.io.Serializable;
4import java.util.HashMap;
5
6/**
7 * Simple class which stores the parameters given to a negotiation strategy, for
8 * example an concession factor.
9 *
10 * @author Mark Hendrikx
11 */
12public class StrategyParameters implements Serializable {
13
14 /**
15 *
16 */
17 private static final long serialVersionUID = 265616574821536192L;
18 /** Parameters as specified in the agent repository. */
19 protected HashMap<String, String> strategyParam;
20
21 /**
22 * Create an empty hashmap of parameters.
23 */
24 public StrategyParameters() {
25 strategyParam = new HashMap<String, String>();
26 }
27
28 /**
29 * Add a parameter to the list of parameters.
30 *
31 * @param name
32 * of the parameter.
33 * @param value
34 * of the parameter.
35 */
36 public void addVariable(String name, String value) {
37 strategyParam.put(name, value);
38 }
39
40 /**
41 * Returns the value of the parameter with the given name as string.
42 *
43 * @param name
44 * of the given parameter.
45 * @return value of the parameter as string.
46 */
47 public String getValueAsString(String name) {
48 return strategyParam.get(name);
49 }
50
51 /**
52 * Returns the value of the parameter with the given name as double.
53 *
54 * @param name
55 * of the given parameter.
56 * @return value of the parameter as double.
57 */
58 public double getValueAsDouble(String name) {
59 return Double.parseDouble(strategyParam.get(name));
60 }
61}
Note: See TracBrowser for help on using the repository browser.