source: src/main/java/genius/gui/uncertainty/SteppingSlider.java@ 126

Last change on this file since 126 was 126, checked in by Aron Hammond, 6 years ago

Added function to calculate opposition to MultiLateralAnalysis.java

Moved code to add RLBOA listeners to RLBOAUtils is misc package

Added input for strategyParameters to SessionPanel (gui)

!! close SessionInfo after tournament; this caused /tmp/ to fill up with GeniusData files

Our own package:

  • Added opponents and strategies that are mentioned in the report
  • Change class hierarchy, agents can now extend from RLBOAagentBilateral to inherit RL functionality.
  • States extend from AbstractState
File size: 1.1 KB
Line 
1package genius.gui.uncertainty;
2
3import java.util.Arrays;
4import java.util.Hashtable;
5
6import javax.swing.JLabel;
7import javax.swing.JSlider;
8
9public class SteppingSlider extends JSlider
10{
11 private static final long serialVersionUID = -1195270044097152629L;
12 private Integer[] values = { 10, 30, 60, 100 };
13 private final Hashtable<Integer, JLabel> LABELS = new Hashtable<>();
14
15
16 public SteppingSlider(Integer...allvalues)
17 {
18 super(0, allvalues.length - 1, 0);
19 values = allvalues;
20 for(int i = 0; i < values.length; ++i)
21 {
22 LABELS.put(i, new JLabel(values[i].toString()));
23 }
24 setLabelTable(LABELS);
25 setPaintTicks(true);
26 setPaintLabels(true);
27 setSnapToTicks(true);
28 setMajorTickSpacing(1);
29 }
30
31 public int getDomainValue()
32 {
33 return values[getValue()];
34 }
35
36 public void setDomainValue(int val)
37 {
38 int binarySearch = Arrays.binarySearch(values, val);
39 int index = binarySearch >= 0 ? binarySearch : -binarySearch - 1; // insertion point
40 setValue(index);
41 }
42}
Note: See TracBrowser for help on using the repository browser.