Skip to content

Commit 360dfc3

Browse files
committed
More cleanups
1 parent 7344bae commit 360dfc3

16 files changed

Lines changed: 17211 additions & 17839 deletions

File tree

src/main/java/monkstone/noise/OpenSimplex2F.java

Lines changed: 838 additions & 737 deletions
Large diffs are not rendered by default.

src/main/java/monkstone/slider/SliderBar.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ public void barWidth(int w) {
6868
if (w < MIN_BAR_WIDTH) {
6969
pH = MIN_BAR_WIDTH;
7070
} else {
71-
pH = (w > MAX_BAR_WIDTH) ? MAX_BAR_WIDTH : w;
71+
pH = w > MAX_BAR_WIDTH ? MAX_BAR_WIDTH : w;
7272
}
7373
}
7474

7575
final void limits(float iv, float fv) {
7676
vMin = iv;
7777
vMax = fv;
78-
SliderBar.this.setValue(iv);
78+
setValue(iv);
7979
}
8080

8181
/**
@@ -139,7 +139,7 @@ public void showBackground() {
139139
*/
140140
@Override
141141
public void labelSize(int s) {
142-
labelSize = (s < 4) ? 4 : s;
142+
labelSize = s < 4 ? 4 : s;
143143
}
144144

145145
/**
@@ -179,10 +179,9 @@ public void draw() {
179179
}
180180

181181
public void mouseEvent(MouseEvent evt) {
182-
if (evt.getAction() == MouseEvent.WHEEL) {
183-
if (scrollWheelHandler != null) {
184-
scrollWheelHandler.handleWheel((short) evt.getCount());
185-
}
182+
if (evt.getAction() == MouseEvent.WHEEL && scrollWheelHandler != null) {
183+
scrollWheelHandler.handleWheel((short) evt.getCount());
184+
186185
}
187186
}
188187

@@ -222,7 +221,7 @@ void deBounce(int n) {
222221
}
223222

224223
protected float map(float val, float begIn, float endIn, float beginOut, float endOut) {
225-
return (beginOut + (endOut - beginOut) * ((val - begIn) / (endIn - begIn)));
224+
return beginOut + (endOut - beginOut) * (val - begIn) / (endIn - begIn);
226225
}
227226

228227
protected int constrainMap(double val, double begIn, double endIn, double beginOut, double endOut) {

src/main/java/monkstone/sliders/SliderBar.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void barWidth(int length) {
106106
private void limits(float iv, float fv) {
107107
vMin = iv;
108108
vMax = fv;
109-
SliderBar.this.initialValue(iv);
109+
initialValue(iv);
110110
}
111111

112112
/**
@@ -178,7 +178,7 @@ public void showBackground() {
178178
* @param s
179179
*/
180180
public void labelSize(int s) {
181-
labelSize = (s < 4) ? 4 : s;
181+
labelSize = s < 4 ? 4 : s;
182182
}
183183

184184
/**
@@ -301,11 +301,10 @@ public void initialValue(float value) {
301301

302302
private void checkMouse() {
303303
if (debug) {
304-
if (mouseOver() && applet.keyPressed && applet.mouseButton == PConstants.LEFT && applet.mousePressed) {
305-
if (applet.keyCode == PConstants.CONTROL) {
304+
if (mouseOver() && applet.keyPressed && applet.mouseButton == PConstants.LEFT && applet.mousePressed
305+
&& applet.keyCode == PConstants.CONTROL) {
306306
pX = pX + applet.mouseX - applet.pmouseX;
307307
pY = pY + applet.mouseY - applet.pmouseY;
308-
}
309308
if (applet.keyCode == PConstants.SHIFT && pressOnlyOnce) {
310309
System.out.println(toString());
311310
pressOnlyOnce = false;
@@ -377,12 +376,11 @@ public void changeWithWheel(int delta) {
377376
if (applet.keyPressed && applet.keyCode == PConstants.CONTROL) {
378377
delta = delta * (int) (vMax / 4);
379378
}
380-
SliderBar.this.initialValue(pValue + delta);
379+
initialValue(pValue + delta);
381380
}
382381

383382
private void deBounce(int n) {
384-
if (pressOnlyOnce) {
385-
} else if (deb++ > n) {
383+
if (!pressOnlyOnce && deb++ > n) {
386384
deb = 0;
387385
pressOnlyOnce = true;
388386
}

src/main/java/monkstone/vecmath/vec2/Vec2.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -742,10 +742,8 @@ public boolean equals(Object obj) {
742742
}
743743
if (obj instanceof Vec2) {
744744
final Vec2 other = (Vec2) obj;
745-
if ((Double.compare(jx, (Double) other.jx) == 0)
746-
&& (Double.compare(jy, (Double) other.jy) == 0)) {
747-
return true;
748-
}
745+
return Double.compare(jx, (Double) other.jx) == 0
746+
&& Double.compare(jy, (Double) other.jy) == 0;
749747
}
750748
return false;
751749
}

src/main/java/monkstone/vecmath/vec3/Vec3.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -672,9 +672,9 @@ public IRubyObject eql_p(ThreadContext context, IRubyObject other) {
672672
}
673673
if (other instanceof Vec3) {
674674
Vec3 v = (Vec3) other.toJava(Vec3.class);
675-
if ((Double.compare(jx, (Double) v.jx) == 0)
676-
&& (Double.compare(jy, (Double) v.jy) == 0)
677-
&& (Double.compare(jz, (Double) v.jz) == 0)) {
675+
if (Double.compare(jx, (Double) v.jx) == 0
676+
&& Double.compare(jy, (Double) v.jy) == 0
677+
&& Double.compare(jz, (Double) v.jz) == 0) {
678678
return runtime.newBoolean(true);
679679
}
680680

0 commit comments

Comments
 (0)