Skip to content

Commit 67020bb

Browse files
committed
javadoc corrections and additions
1 parent 53e8c08 commit 67020bb

File tree

3 files changed

+100
-31
lines changed

3 files changed

+100
-31
lines changed

jplotter/src/main/java/hageldave/jplotter/color/DefaultColorMap.java

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
* @author hageldave
2424
*/
2525
public enum DefaultColorMap implements ColorMap {
26-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_BLACK_WHITE.png"/> */
26+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_BLACK_WHITE.png"> */
2727
S_BLACK_WHITE(0xff_000000,0xff_ffffff),
28-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_GRAY_WHITE.png"/> */
28+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_GRAY_WHITE.png"> */
2929
S_GRAY_WHITE(0xff_888888,0xff_ffffff),
30-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_BLACK_GRAY.png"/> */
30+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_BLACK_GRAY.png"> */
3131
S_BLACK_GRAY(0xff_000000,0xff_888888),
32-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_RISING_DEEP_PURPLE.png"/> */
32+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_RISING_DEEP_PURPLE.png"> */
3333
S_RISING_DEEP_PURPLE(
3434
0xff_49006a,
3535
0xff_8a0179,
@@ -39,7 +39,7 @@ public enum DefaultColorMap implements ColorMap {
3939
0xff_fcd6d2,
4040
0xff_fff7f3
4141
),
42-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_COPPER.png"/> */
42+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_COPPER.png"> */
4343
S_COPPER(
4444
0xff_000000,
4545
0xff_330000,
@@ -49,12 +49,12 @@ public enum DefaultColorMap implements ColorMap {
4949
0xff_ff9966,
5050
0xff_ffcc88
5151
),
52-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_BLACKBODYRAD.png"/> */
52+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_BLACKBODYRAD.png"> */
5353
S_BLACKBODYRAD(
5454
new int[]{0xff_000000, 0xff_aa2222, 0xff_dd6605, 0xff_eedd22, 0xff_ffffff},
5555
new double[]{ 0, 0.39, 0.58, 0.84, 1}
5656
),
57-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_PLASMA.png"/> */
57+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_PLASMA.png"> */
5858
S_PLASMA(
5959
0xff_0c0786,
6060
0xff_5c00a5,
@@ -64,7 +64,7 @@ public enum DefaultColorMap implements ColorMap {
6464
0xff_fdb22e,
6565
0xff_eff821
6666
),
67-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_VIRIDIS.png"/> */
67+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_VIRIDIS.png"> */
6868
S_VIRIDIS(
6969
0xff_440154,
7070
0xff_433982,
@@ -74,7 +74,7 @@ public enum DefaultColorMap implements ColorMap {
7474
0xff_8fd643,
7575
0xff_fde724
7676
),
77-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_BEACH.png"/> */
77+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_BEACH.png"> */
7878
S_BEACH(0xff_081d58,
7979
0xff_24419a,
8080
0xff_1e80b8,
@@ -83,7 +83,7 @@ public enum DefaultColorMap implements ColorMap {
8383
0xff_dff2b2,
8484
0xff_ffffd9
8585
),
86-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_RAINBOW.png"/> */
86+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_RAINBOW.png"> */
8787
S_RAINBOW(
8888
0xff_dd00dd,
8989
0xff_8800ee,
@@ -97,7 +97,7 @@ public enum DefaultColorMap implements ColorMap {
9797
0xff_ee8800,
9898
0xff_ff0000
9999
),
100-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_TERRAIN.png"/> */
100+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/S_TERRAIN.png"> */
101101
S_TERRAIN(
102102
0xff_333399,
103103
0xff_1075db,
@@ -111,13 +111,13 @@ public enum DefaultColorMap implements ColorMap {
111111
0xff_cabbb8,
112112
0xff_fdfcfc
113113
),
114-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_BLACK_WHITE_BLACK.png"/> */
114+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_BLACK_WHITE_BLACK.png"> */
115115
D_BLACK_WHITE_BLACK(0xff000000, 0xff_ffffff, 0xff_000000),
116-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_BLACK_GRAY_BLACK.png"/> */
116+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_BLACK_GRAY_BLACK.png"> */
117117
D_BLACK_GRAY_BLACK(0xff_000000, 0xff_888888, 0xff_000000),
118-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_GRAY_WHITE_GRAY.png"/> */
118+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_GRAY_WHITE_GRAY.png"> */
119119
D_GRAY_WHITE_GRAY(0xff_888888, 0xff_ffffff, 0xff_888888),
120-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_COOL_WARM.png"/> */
120+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_COOL_WARM.png"> */
121121
D_COOL_WARM(
122122
0xff_3b4cc0,
123123
0xff_6688ee,
@@ -129,13 +129,13 @@ public enum DefaultColorMap implements ColorMap {
129129
0xff_dd6644,
130130
0xff_b40426
131131
),
132-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_BLUE_WHITE_RED.png"/> */
132+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_BLUE_WHITE_RED.png"> */
133133
D_BLUE_WHITE_RED(0xff_0000ff, 0xff_eeeeee, 0xff_ff0000),
134-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_FRANCE.png"/> */
134+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_FRANCE.png"> */
135135
D_FRANCE(0xff_002395, 0xff_ffffff, 0xff_ed2939),
136-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_IRELAND.png"/> */
136+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_IRELAND.png"> */
137137
D_IRELAND(0xff_169b62, 0xff_ffffff, 0xff_ff883e),
138-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_SPECTRAL.png"/> */
138+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/D_SPECTRAL.png"> */
139139
D_SPECTRAL(
140140
0xff_9e0142,
141141
0xff_e95d46,
@@ -145,7 +145,7 @@ public enum DefaultColorMap implements ColorMap {
145145
0xff_54aeac,
146146
0xff_5e4fa2
147147
),
148-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_8_DARK2.png"/> */
148+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_8_DARK2.png"> */
149149
Q_8_DARK2(
150150
0xff_1b9e77,
151151
0xff_d95f02,
@@ -156,7 +156,7 @@ public enum DefaultColorMap implements ColorMap {
156156
0xff_a6761d,
157157
0xff_666666
158158
),
159-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_8_SET2.png"/> */
159+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_8_SET2.png"> */
160160
Q_8_SET2(
161161
0xff_66c2a5,
162162
0xff_fc8d62,
@@ -167,7 +167,7 @@ public enum DefaultColorMap implements ColorMap {
167167
0xff_e5c494,
168168
0xff_b3b3b3
169169
),
170-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_8_PASTEL2.png"/> */
170+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_8_PASTEL2.png"> */
171171
Q_8_PASTEL2(
172172
0xff_b3e2cd,
173173
0xff_fdcdac,
@@ -178,7 +178,7 @@ public enum DefaultColorMap implements ColorMap {
178178
0xff_f1e2cc,
179179
0xff_cccccc
180180
),
181-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_8_ACCENT.png"/> */
181+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_8_ACCENT.png"> */
182182
Q_8_ACCENT(
183183
0xff_7fc97f,
184184
0xff_beaed4,
@@ -189,7 +189,7 @@ public enum DefaultColorMap implements ColorMap {
189189
0xff_bf5b17,
190190
0xff_666666
191191
),
192-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_9_SET1.png"/> */
192+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_9_SET1.png"> */
193193
Q_9_SET1(
194194
0xff_e41a1c,
195195
0xff_377eb8,
@@ -201,7 +201,7 @@ public enum DefaultColorMap implements ColorMap {
201201
0xff_f781bf,
202202
0xff_999999
203203
),
204-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_9_PASTEL1.png"/> */
204+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_9_PASTEL1.png"> */
205205
Q_9_PASTEL1(
206206
0xff_fbb4ae,
207207
0xff_b3cde3,
@@ -213,7 +213,7 @@ public enum DefaultColorMap implements ColorMap {
213213
0xff_fddaec,
214214
0xff_f2f2f2
215215
),
216-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_12_PAIRED.png"/> */
216+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_12_PAIRED.png"> */
217217
Q_12_PAIRED(
218218
0xff_a6cee3,
219219
0xff_1f78b4,
@@ -228,7 +228,7 @@ public enum DefaultColorMap implements ColorMap {
228228
0xff_ffff99,
229229
0xff_b15928
230230
),
231-
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_12_SET3.png"/> */
231+
/** <img src="https://raw.githubusercontent.com/wiki/hageldave/JPlotter/images/colormaps/Q_12_SET3.png"> */
232232
Q_12_SET3(
233233
0xff_8dd3c7,
234234
0xff_ffffb3,

jplotter/src/main/java/hageldave/jplotter/interaction/SimpleSelectionModel.java

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,81 @@
88
import java.util.SortedSet;
99
import java.util.TreeSet;
1010

11+
/**
12+
* A simple slection model for sets of elements using the listener pattern.
13+
* The model uses a SortedSet to remember a set of items (e.g. selected items).
14+
* When the selection (the item set) is changed, it will notify its registered
15+
* {@link SimpleSelectionListener}s of the change.
16+
* <p>
17+
* This can be used to synchronize across different UI elements
18+
* and can also be used for single valued components such as sliders.
19+
*
20+
* @author hageldave
21+
* @param <T> item type
22+
*/
1123
public class SimpleSelectionModel<T> {
1224

25+
/**
26+
* Listener interface for {@link SimpleSelectionModel}.
27+
*
28+
* @author hageldave
29+
* @param <T> item type
30+
*/
1331
public static interface SimpleSelectionListener<T> {
32+
/**
33+
* is called when model's selection changed.
34+
* @param selection the current (new) set of selected items.
35+
*/
1436
public void selectionChanged(SortedSet<T> selection);
1537
}
1638

1739
protected SortedSet<T> selection;
1840
protected ActionListener selectionListener;
1941

42+
/**
43+
* @param def default value to return when selection is empty
44+
* @return first element of the selection or the argument when selection is empty.
45+
*/
2046
public T getFirstOrDefault(T def){
2147
return selection.isEmpty() ? def:selection.first();
2248
}
2349

50+
/**
51+
* @param def default value to return when selection is empty
52+
* @return last element of the selection or the argument when selection is empty.
53+
*/
2454
public T getLastOrDefault(T def){
2555
return selection.isEmpty() ? def:selection.last();
2656
}
2757

58+
59+
/**
60+
* Creates a new SimpleSelectionModel using the specified comparator
61+
* to sort the model's items.
62+
* @param comp comparator to be used (null for natural ordering)
63+
*/
2864
public SimpleSelectionModel(Comparator<? super T> comp) {
2965
this.selection = new TreeSet<>(comp);
3066
}
3167

68+
/**
69+
* Creates a new SimpleSelectionModel.
70+
*/
3271
public SimpleSelectionModel() {
3372
this(null);
3473
}
3574

75+
/**
76+
* @return the current selection
77+
*/
3678
public SortedSet<T> getSelection() {
3779
return selection;
3880
}
3981

82+
/**
83+
* Sets the selection of this model to the specified elements.
84+
* @param selection iterable containing the elements (may be empty)
85+
*/
4086
public void setSelection(Iterable<T> selection){
4187
TreeSet<T> old = new TreeSet<>(this.selection);
4288
this.selection.clear();
@@ -46,17 +92,40 @@ public void setSelection(Iterable<T> selection){
4692
notifySelectionChange();
4793
}
4894

95+
/**
96+
* Sets the selection of this model to the specified elements.
97+
* @param elements to set as selection (may be empty)
98+
*/
4999
@SafeVarargs
50100
public final void setSelection(T ... elements){
51101
setSelection(Arrays.asList(elements));
52102
}
53103

54-
public synchronized void addSelectionListener(SimpleSelectionListener<T> l){
104+
/**
105+
* Adds a {@link SimpleSelectionListener} to this model that will be notified on changes.
106+
* @param l the listener to be called on change
107+
* @return the wrapping {@link ActionListener} object for later removal of the listener.
108+
*/
109+
public synchronized ActionListener addSelectionListener(SimpleSelectionListener<T> l){
55110
if(l==null)
56-
return;
57-
selectionListener = AWTEventMulticaster.add(selectionListener, e -> l.selectionChanged(getSelection()));
111+
return null;
112+
ActionListener al = new ActionListener() {
113+
@Override
114+
public void actionPerformed(ActionEvent e) {
115+
l.selectionChanged(getSelection());
116+
}
117+
};
118+
selectionListener = AWTEventMulticaster.add(selectionListener, al);
119+
return al;
120+
}
121+
122+
public synchronized void removeSelectionListener(ActionListener wrapper){
123+
AWTEventMulticaster.remove(selectionListener, wrapper);
58124
}
59125

126+
/**
127+
* notifies the listeners of a change to the selection
128+
*/
60129
public synchronized void notifySelectionChange(){
61130
if(selectionListener != null){
62131
selectionListener.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_FIRST, "selectionchanged"));

jplotter/src/main/java/hageldave/jplotter/renderables/Curves.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/**
1818
* The Curves class is a collection of cubic Bezier curves.
19-
* Each curve is defined by a 2D start & end point as well as two
19+
* Each curve is defined by a 2D start and end point as well as two
2020
* control points that affect the tangents at start/end.
2121
* A curve also has a color and thickness attribute, as well as a
2222
* picking color with which the curve is rendered into the (invisible) picking color attachment

0 commit comments

Comments
 (0)