[1] | 1 | package genius.gui.progress;
|
---|
| 2 |
|
---|
| 3 | import java.util.ArrayList;
|
---|
| 4 | import java.util.HashMap;
|
---|
| 5 | import java.util.List;
|
---|
| 6 |
|
---|
| 7 | import 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 | */
|
---|
| 32 | public enum DataKey implements Comparable<DataKey> {
|
---|
[232] | 33 | RUNTIME("Run time (s)", false), ROUND("Round", false), EXCEPTION("Exception", false), DEADLINE("deadline", false), IS_AGREEMENT(
|
---|
| 34 | "Agreement", false), IS_DISCOUNT("Discounted", false), NUM_AGREE("#agreeing", false), MINUTIL(
|
---|
| 35 | "min.util.", false), MAXUTIL("max.util.", false), DIST_PARETO(
|
---|
| 36 | "Dist. to Pareto", false), DIST_NASH("Dist. to Nash", false), SOCIAL_WELFARE("Social Welfare", false),
|
---|
[1] | 37 | /**
|
---|
| 38 | * List of the agent class names
|
---|
| 39 | */
|
---|
[232] | 40 | AGENTS("Agent", true),
|
---|
[1] | 41 | /**
|
---|
| 42 | * List of Undiscounted utilities for all agents (in proper order)
|
---|
| 43 | */
|
---|
[232] | 44 | UTILS("Utility", true),
|
---|
[1] | 45 | /**
|
---|
| 46 | * List with the discounted utilities for all agents (in proper order)
|
---|
| 47 | */
|
---|
[232] | 48 | DISCOUNTED_UTILS("Disc. Util.", true),
|
---|
[30] | 49 | /**
|
---|
| 50 | * List with the perceived utilities in case of uncertainty (in proper order)
|
---|
| 51 | */
|
---|
[232] | 52 | PERCEIVED_UTILS("Perceived. Util.", true),
|
---|
| 53 | /**
|
---|
| 54 | * List with the total bothers inflicted to the users by each agent (in proper order)
|
---|
| 55 | */
|
---|
| 56 | USER_BOTHERS("User Bother", true),
|
---|
| 57 | /**
|
---|
| 58 | * List with the user utilities, i.e. the true utilities minus the user bothers (in proper order)
|
---|
| 59 | */
|
---|
| 60 | USER_UTILS("User Util.", true),
|
---|
[1] | 61 |
|
---|
[232] | 62 | FILES("Profile", true);
|
---|
[1] | 63 |
|
---|
| 64 | String name;
|
---|
[232] | 65 | boolean multiple;
|
---|
[1] | 66 |
|
---|
[232] | 67 | /**
|
---|
| 68 | * Constructor of DataKey
|
---|
| 69 | * @param n: name of the DataKey
|
---|
| 70 | * @param multiple: says if the Key supports multiple columns
|
---|
| 71 | */
|
---|
| 72 | DataKey(String n, boolean m) {
|
---|
[1] | 73 | name = n;
|
---|
[232] | 74 | multiple = m;
|
---|
[1] | 75 | }
|
---|
| 76 |
|
---|
| 77 | /**
|
---|
[232] | 78 | *@return the value of multiple
|
---|
| 79 | */
|
---|
| 80 | public boolean getMultiple(){
|
---|
| 81 | return multiple;
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | /**
|
---|
[1] | 85 | *
|
---|
| 86 | * @return human-readable short description of this column
|
---|
| 87 | */
|
---|
| 88 | public String getName() {
|
---|
| 89 | return name;
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | /**
|
---|
| 93 | * @return n human-readable short descriptions of this column. The
|
---|
| 94 | * descriptions are just the name, but with an added number 1..n
|
---|
| 95 | */
|
---|
| 96 | public List<String> getNames(int num) {
|
---|
| 97 | List<String> names = new ArrayList<String>();
|
---|
| 98 | for (int n = 1; n <= num; n++) {
|
---|
| 99 | names.add(name + " " + n);
|
---|
| 100 | }
|
---|
| 101 | return names;
|
---|
| 102 | }
|
---|
| 103 |
|
---|
| 104 | };
|
---|