source: src/main/java/genius/core/boaframework/BOA.java

Last change on this file was 161, checked in by Tim Baarslag, 6 years ago

Reordered BOA repository and added documentation

File size: 2.8 KB
Line 
1package genius.core.boaframework;
2
3import java.util.HashSet;
4import java.util.Map;
5import java.util.Set;
6
7import java.io.Serializable;
8
9import genius.core.NegotiationResult;
10import genius.core.repository.boa.BoaRepItem;
11
12/**
13 * Abstract superclass for BOA components. This should have been called
14 * BOAcomponent but that class is already in use. Usually instances are created
15 * using {@link BoaRepItem#getInstance()} and then calling
16 * {{@link #init(NegotiationSession)}}
17 **/
18public abstract class BOA {
19 /**
20 * Reference to the object which holds all information about the negotiation
21 */
22
23 protected NegotiationSession negotiationSession;
24 private Map<String, Double> parameters;
25
26 /**
27 * Initializes the model. The method must be called once, and only once,
28 * immediately after creating an opponent model.
29 *
30 * @param negotiationSession
31 * reference to the state of the negotiation
32 * @param parameters
33 * the init parameters used to configure this component
34 */
35 protected void init(NegotiationSession negotiationSession,
36 Map<String, Double> parameters) {
37 this.negotiationSession = negotiationSession;
38 this.parameters = parameters;
39 }
40
41 /**
42 * @return * The actual parameters that are used by this instance, as set by
43 * call to {@link #init(NegotiationSession, Map)}.
44 *
45 */
46 public Map<String, Double> getParameters() {
47 return parameters;
48 }
49
50 /**
51 * @return the parameter specifications of this BOA component. Default
52 * implementation returns empty set. If a BOA component has
53 * parameters, it should override this. This can be different from
54 * the actual parameters used at runtime, which is passed through
55 * {@link #init(NegotiationSession)} calls to the components.
56 *
57 */
58 public Set<BOAparameter> getParameterSpec() {
59 return new HashSet<BOAparameter>();
60 }
61
62 /**
63 * Method called at the end of the negotiation. Ideal location to call the
64 * storeData method to receiveMessage the data to be saved.
65 *
66 * @param result
67 * of the negotiation.
68 */
69 public void endSession(NegotiationResult result) {
70 }
71
72 /**
73 * Method used to store data that should be accessible in the next
74 * negotiation session on the same scenario. This method can be called
75 * during the negotiation, but it makes more sense to call it in the
76 * endSession method.
77 *
78 * @param object
79 * to be saved by this component.
80 */
81 abstract public void storeData(Serializable object);
82
83 /**
84 * Method used to load the saved object, possibly created in a previous
85 * negotiation session. The method returns null when such an object does not
86 * exist yet.
87 *
88 * @return saved object or null when not available.
89 */
90 abstract public Serializable loadData();
91
92 /**
93 *
94 * @return a short name for this component.
95 */
96 abstract public String getName();
97
98}
Note: See TracBrowser for help on using the repository browser.