source: src/main/java/genius/gui/progress/DataKey.java@ 3

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

Initial import : Genius 9.0.0

File size: 2.3 KB
Line 
1package genius.gui.progress;
2
3import java.util.ArrayList;
4import java.util.HashMap;
5import java.util.List;
6
7import genius.core.events.SessionEndedNormallyEvent;
8
9/**
10 * These keys are datatypes for data , eg in {@link HashMap}s. See e.g.
11 * {@link SessionEndedNormallyEvent#getValues()}.
12 *
13 * The keys also have a human-readable text version. This can be used as basis
14 * for the column text strings for data display and logging.
15 *
16 * The keys {@link DataKey#DISCOUNTED_UTILS}, {@link DataKey#UTILS},
17 * {@link DataKey#FILES} and {@link DataKey#AGENTS} contain lists. The function
18 * {@link SessionEndedNormallyEvent#getValues()} will convert these to strings
19 * and extend these keys with the agent number, and we then have eg 3 columns
20 * "Utility 1", "Utility 2" and "Utility 3" in the table. In the map, the UTILS
21 * field will be an {@link List} with 3 values in that case. see also
22 * {@link SessionEndedNormallyEvent#getValues()}.
23 *
24 * The {@link DataKeyTableModel} can handle such data directly.
25 *
26 * Note that the order of the enum is irrelevant; the order in which the keys
27 * are provided to the {@link DataKeyTableModel} determines the column order.
28 *
29 * @author W.Pasman 16jul15
30 *
31 */
32public enum DataKey implements Comparable<DataKey> {
33 RUNTIME("Run time (s)"), ROUND("Round"), EXCEPTION("Exception"), DEADLINE("deadline"), IS_AGREEMENT(
34 "Agreement"), IS_DISCOUNT("Discounted"), NUM_AGREE("#agreeing"), MINUTIL(
35 "min.util."), MAXUTIL("max.util."), DIST_PARETO(
36 "Dist. to Pareto"), DIST_NASH("Dist. to Nash"), SOCIAL_WELFARE("Social Welfare"),
37 /**
38 * List of the agent class names
39 */
40 AGENTS("Agent"),
41 /**
42 * List of Undiscounted utilities for all agents (in proper order)
43 */
44 UTILS("Utility"),
45 /**
46 * List with the discounted utilities for all agents (in proper order)
47 */
48 DISCOUNTED_UTILS("Disc. Util."),
49
50 FILES("Profile");
51
52 String name;
53
54 DataKey(String n) {
55 name = n;
56 }
57
58 /**
59 *
60 * @return human-readable short description of this column
61 */
62 public String getName() {
63 return name;
64 }
65
66 /**
67 * @return n human-readable short descriptions of this column. The
68 * descriptions are just the name, but with an added number 1..n
69 */
70 public List<String> getNames(int num) {
71 List<String> names = new ArrayList<String>();
72 for (int n = 1; n <= num; n++) {
73 names.add(name + " " + n);
74 }
75 return names;
76 }
77
78};
Note: See TracBrowser for help on using the repository browser.