Skip to content

Commit bdd67f5

Browse files
author
monkstone
committed
javadoc friendly
1 parent b3c8d0c commit bdd67f5

20 files changed

Lines changed: 947 additions & 952 deletions

src/monkstone/ColorUtil.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public class ColorUtil {
2020
/**
2121
* Returns hex long as a positive int unless greater than Integer.MAX_VALUE
2222
* else return the complement as a negative integer or something like that
23+
* @param hexlong long
24+
* @return rgb int
2325
*/
2426
static final int hexLong(long hexlong) {
2527
long SPLIT = Integer.MAX_VALUE + 1;
@@ -32,35 +34,35 @@ static final int hexLong(long hexlong) {
3234

3335
/**
3436
*
35-
* @param hexstring
36-
* @return
37+
* @param hexstring String
38+
* @return rgb int
3739
*/
3840
static public int colorString(String hexstring) {
3941
return java.awt.Color.decode(hexstring).getRGB();
4042
}
4143

4244
/**
4345
*
44-
* @param hex
45-
* @return
46+
* @param hex double
47+
* @return hex float
4648
*/
4749
static public float colorLong(double hex) {
4850
return (float) hex;
4951
}
5052

5153
/**
5254
*
53-
* @param hexlong
54-
* @return
55+
* @param hexlong long
56+
* @return hexlong int
5557
*/
5658
static public int colorLong(long hexlong){
5759
return hexLong(hexlong);
5860
}
5961

6062
/**
6163
*
62-
* @param hex
63-
* @return
64+
* @param hex double
65+
* @return hex float
6466
*/
6567
static public float colorDouble(double hex){
6668
return (float)hex;

src/monkstone/MathTool.java

Lines changed: 45 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
2-
* The purpose of this tool is to allow JRubyArt users to use an alternative
2+
* The purpose of this tool is to allow JRubyArt users to use an alternative
33
* to processing.org map, lerp and norm methods in their sketches
4-
* Copyright (C) 2015 Martin Prout. This tool is free software; you can
5-
* redistribute it and/or modify it under the terms of the GNU Lesser General
4+
* Copyright (C) 2015 Martin Prout. This tool is free software; you can
5+
* redistribute it and/or modify it under the terms of the GNU Lesser General
66
* Public License as published by the Free Software Foundation; either version
77
* 2.1 of the License, or (at your option) any later version.
8-
*
8+
*
99
* Obtain a copy of the license at http://www.gnu.org/licenses/lgpl-2.1.html
1010
*/
1111
package monkstone;
@@ -29,7 +29,7 @@ public class MathTool extends RubyObject {
2929

3030
/**
3131
*
32-
* @param runtime
32+
* @param runtime Ruby
3333
*/
3434
public static void createMathTool(Ruby runtime) {
3535
RubyModule processing = runtime.defineModule("Processing");
@@ -39,10 +39,10 @@ public static void createMathTool(Ruby runtime) {
3939

4040
/**
4141
*
42-
* @param context JRuby runtime
43-
* @param recv self
42+
* @param context ThreadContext
43+
* @param recv IRubyObject
4444
* @param args array of RubyRange (must be be numeric)
45-
* @return RubyFloat
45+
* @return mapped value RubyFloat
4646
*/
4747
@JRubyMethod(name = "map1d", rest = true, module = true)
4848
public static IRubyObject mapOneD(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
@@ -58,10 +58,10 @@ public static IRubyObject mapOneD(ThreadContext context, IRubyObject recv, IRuby
5858

5959
/**
6060
*
61-
* @param context JRuby runtime
62-
* @param recv self
61+
* @param context ThreadContext
62+
* @param recv IRubyObject
6363
* @param args array of RubyRange (must be be numeric)
64-
* @return RubyFloat
64+
* @return mapped value RubyFloat
6565
*/
6666
@JRubyMethod(name = "constrained_map", rest = true, module = true)
6767
public static IRubyObject constrainedMap(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
@@ -82,13 +82,13 @@ public static IRubyObject constrainedMap(ThreadContext context, IRubyObject recv
8282
}
8383
return mapMt(context, value, first1, last1, first2, last2);
8484
}
85-
85+
8686
/**
8787
*
88-
* @param context JRuby runtime
89-
* @param recv self
88+
* @param context ThreadContext
89+
* @param recv self IRubyObject
9090
* @param args floats as in processing map function
91-
* @return RubyFloat
91+
* @return mapped value RubyFloat
9292
*/
9393
@JRubyMethod(name = "p5map", rest = true, module = true)
9494
public static IRubyObject mapProcessing(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
@@ -98,15 +98,15 @@ public static IRubyObject mapProcessing(ThreadContext context, IRubyObject recv,
9898
double last1 = (Double) args[2].toJava(Double.class);
9999
double last2 = (Double) args[4].toJava(Double.class);
100100
return mapMt(context, value, first1, last1, first2, last2);
101-
}
102-
101+
}
102+
103103

104104
/**
105105
* A more correct version than processing.org version
106-
* @param context
107-
* @param recv
106+
* @param context ThreadContext
107+
* @param recv self IRubyObject
108108
* @param args args[2] should be between 0 and 1.0 if not returns start or stop
109-
* @return
109+
* @return lerped value RubyFloat
110110
*/
111111
@JRubyMethod(name = "lerp", rest = true, module = true)
112112
public static IRubyObject lerpP(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
@@ -116,33 +116,33 @@ public static IRubyObject lerpP(ThreadContext context, IRubyObject recv, IRubyOb
116116
if (amount <= 0) return args[0];
117117
if (amount >= 1.0) return args[1];
118118
return context.getRuntime().newFloat((1 - amount) * start + (stop * amount));
119-
}
119+
}
120+
120121

121-
122122
/**
123123
* Identical to p5map(value, low, high, 0, 1).
124-
* Numbers outside of the range are not clamped to 0 and 1,
125-
* because out-of-range values are often intentional and useful.
126-
* @param context
127-
* @param recv
128-
* @param args
129-
* @return
124+
* Numbers outside of the range are not clamped to 0 and 1,
125+
* because out-of-range values are often intentional and useful.
126+
* @param context ThreadContext
127+
* @param recv IRubyObject
128+
* @param args array of args must be be numeric
129+
* @return mapped value RubyFloat
130130
*/
131131
@JRubyMethod(name = "norm", rest = true, module = true)
132-
public static IRubyObject normP(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
132+
public static IRubyObject normP(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
133133
double value = (Double) args[0].toJava(Double.class);
134134
double start = (Double) args[1].toJava(Double.class);
135-
double stop = (Double) args[2].toJava(Double.class);
135+
double stop = (Double) args[2].toJava(Double.class);
136136
return mapMt(context, value, start, stop, 0, 1.0);
137137
}
138-
138+
139139
/**
140140
* Identical to p5map(value, low, high, 0, 1) but 'clamped'.
141-
* Numbers outside of the range are clamped to 0 and 1,
142-
* @param context
143-
* @param recv
144-
* @param args
145-
* @return
141+
* Numbers outside of the range are clamped to 0 and 1,
142+
* @param context ThreadContext
143+
* @param recv IRubyObject
144+
* @param args array of args must be be numeric
145+
* @return mapped value RubyFloat
146146
*/
147147
@JRubyMethod(name = "norm_strict", rest = true, module = true)
148148
public static IRubyObject norm_strict(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
@@ -157,18 +157,18 @@ public static IRubyObject norm_strict(ThreadContext context, IRubyObject recv, I
157157
} else {
158158
return mapMt(context, value, start, stop, 0, 1.0);
159159
}
160-
}
161-
162-
static final RubyFloat mapMt(ThreadContext context, double value, double first1, double last1, double first2, double last2) {
160+
}
161+
162+
static final RubyFloat mapMt(ThreadContext context, double value, double first1, double last1, double first2, double last2) {
163163
double result = first2 + (last2 - first2) * ((value - first1) / (last1 - first1));
164164
return context.getRuntime().newFloat(result);
165165
}
166-
166+
167167
/**
168168
* Provides processing constrain method as a ruby module method
169-
* @param context
170-
* @param recv
171-
* @param args
169+
* @param context ThreadContext
170+
* @param recv IRubyObject
171+
* @param args array of args must be be numeric
172172
* @return original or limit values
173173
*/
174174
@JRubyMethod(name = "constrain", rest = true, module = true)
@@ -185,12 +185,10 @@ public static IRubyObject constrainValue(ThreadContext context, IRubyObject recv
185185
}
186186
}
187187

188-
189-
190188
/**
191189
*
192-
* @param runtime
193-
* @param metaClass
190+
* @param runtime Ruby
191+
* @param metaClass RubyClass
194192
*/
195193
public MathTool(Ruby runtime, RubyClass metaClass) {
196194
super(runtime, metaClass);

src/monkstone/MathToolLibrary.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@ public class MathToolLibrary implements Library{
2323

2424
/**
2525
*
26-
* @param runtime
26+
* @param runtime Ruby
2727
*/
2828
public static void load(final Ruby runtime) {
2929
MathTool.createMathTool(runtime);
3030
}
3131

3232
/**
33-
*
34-
* @param runtime
35-
* @param wrap
36-
* @throws java.io.IOException
33+
*
34+
* @param runtime Ruby
35+
* @param wrap boolean
3736
*/
3837
@Override
3938
public void load(final Ruby runtime, boolean wrap) throws IOException {

src/monkstone/arcball/Arcball.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public Arcball(PApplet parent, double center_x, double center_y, double radius)
7979
/**
8080
* Default centered arcball and half width or half height whichever smaller
8181
*
82-
* @param parent
82+
* @param parent PApplet
8383
*
8484
*/
8585
public Arcball(PApplet parent) {
@@ -93,7 +93,7 @@ public Arcball(PApplet parent) {
9393
/**
9494
* mouse event to register
9595
*
96-
* @param e
96+
* @param e MouseEvent
9797
*/
9898
public void mouseEvent(MouseEvent e) {
9999
int x = e.getX();
@@ -120,7 +120,7 @@ public void mouseEvent(MouseEvent e) {
120120
/**
121121
* key event to register
122122
*
123-
* @param e
123+
* @param e KeyEvent
124124
*/
125125
public void keyEvent(processing.event.KeyEvent e) {
126126
if (e.getAction() != KeyEvent.PRESS) {
@@ -156,7 +156,7 @@ public void pre() {
156156
* May or may not be required for use in Web Applet it works so why worry as
157157
* used by Jonathan Feinberg peasycam, and that works OK
158158
*
159-
* @param active
159+
* @param active boolean
160160
*/
161161
public void setActive(boolean active) {
162162
if (active != isActive) {
@@ -188,8 +188,8 @@ private void update() {
188188
* Returns either the Jvector of mouse position mapped to a sphere or the
189189
* constrained version (when constrained to one axis)
190190
*
191-
* @param x
192-
* @param y
191+
* @param x double
192+
* @param y double
193193
* @return mouse coordinate mapped to unit sphere
194194
*/
195195
public Jvector mouse2sphere(double x, double y) {
@@ -209,9 +209,9 @@ public Jvector mouse2sphere(double x, double y) {
209209
/**
210210
* Returns the Jvector if the axis is constrained
211211
*
212-
* @param vector
213-
* @param axis
214-
* @return
212+
* @param vector Jvector
213+
* @param axis Jvector
214+
* @return constrained axis Jvector
215215
*/
216216
public Jvector constrainVector(Jvector vector, Jvector axis) {
217217
Jvector res = vector.sub(axis.mult(axis.dot(vector)));
@@ -221,7 +221,7 @@ public Jvector constrainVector(Jvector vector, Jvector axis) {
221221
/**
222222
* Constrain rotation to this axis
223223
*
224-
* @param axis
224+
* @param axis Constrain
225225
*/
226226
public void constrain(Constrain axis) {
227227
this.axis = axis;
@@ -230,7 +230,7 @@ public void constrain(Constrain axis) {
230230
/**
231231
* Rotate the parent sketch according to the quaternion
232232
*
233-
* @param q
233+
* @param q Quaternion
234234
*/
235235
public void applyQuaternion2Matrix(Quaternion q) {
236236
// instead of transforming q into a matrix and applying it...
@@ -247,8 +247,8 @@ public void dispose() {
247247

248248
/**
249249
*
250-
* @param obj
251-
* @return
250+
* @param obj Object
251+
* @return a boolean
252252
*/
253253
@Override
254254
public boolean equals(Object obj) {
@@ -273,7 +273,7 @@ public boolean equals(Object obj) {
273273

274274
/**
275275
*
276-
* @return
276+
* @return hash int
277277
*/
278278
@Override
279279
public int hashCode() {

src/monkstone/arcball/ArcballLibrary.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,16 @@ public class ArcballLibrary implements Library {
1212

1313
/**
1414
*
15-
* @param runtime
15+
* @param runtime Ruby
1616
*/
1717
public static void load(final Ruby runtime) {
1818
Rarcball.createArcBall(runtime);
1919
}
2020

2121
/**
2222
*
23-
* @param runtime
24-
* @param wrap
25-
* @throws IOException
23+
* @param runtime Ruby
24+
* @param wrap boolean
2625
*/
2726
@Override
2827
public void load(final Ruby runtime, boolean wrap) throws IOException {

src/monkstone/arcball/Constrain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public enum Constrain {
5151

5252
/**
5353
* Numeric value of constrained axis
54-
* @return
54+
* @return axis int
5555
*/
5656
public int index() {
5757
return index;

0 commit comments

Comments
 (0)