@@ -51,38 +51,42 @@ public Builder(double num) {
51
51
}
52
52
53
53
public Builder add (double num ) {
54
- if (inParenthesis )
54
+ if (inParenthesis ) {
55
55
sideNumber += num ;
56
- else
56
+ } else {
57
57
number += num ;
58
+ }
58
59
return this ;
59
60
}
60
61
61
62
// Takes a number and a condition, only does the operation if condition is true.
62
63
public Builder addIf (double num , BiFunction <Double , Double , Boolean > condition ) {
63
64
if (!condition .apply (number , num )) return this ;
64
- if (inParenthesis )
65
+ if (inParenthesis ) {
65
66
sideNumber += num ;
66
- else
67
+ } else {
67
68
number += num ;
69
+ }
68
70
return this ;
69
71
}
70
72
71
73
public Builder minus (double num ) {
72
- if (inParenthesis )
74
+ if (inParenthesis ) {
73
75
sideNumber -= num ;
74
- else
76
+ } else {
75
77
number -= num ;
78
+ }
76
79
return this ;
77
80
}
78
81
79
82
// Takes a number and a condition, only does the operation if condition is true.
80
83
public Builder minusIf (double num , BiFunction <Double , Double , Boolean > condition ) {
81
84
if (!condition .apply (number , num )) return this ;
82
- if (inParenthesis )
85
+ if (inParenthesis ) {
83
86
sideNumber -= num ;
84
- else
87
+ } else {
85
88
number -= num ;
89
+ }
86
90
return this ;
87
91
}
88
92
@@ -116,218 +120,244 @@ public Builder randomInRange(double min, double max) {
116
120
}
117
121
118
122
public Builder toDegrees () {
119
- if (inParenthesis )
123
+ if (inParenthesis ) {
120
124
sideNumber = Math .toDegrees (sideNumber );
121
- else
125
+ } else {
122
126
number = Math .toDegrees (number );
127
+ }
123
128
return this ;
124
129
}
125
130
126
131
public Builder max (double num ) {
127
- if (inParenthesis )
132
+ if (inParenthesis ) {
128
133
sideNumber = Math .max (sideNumber , num );
129
- else
134
+ } else {
130
135
number = Math .max (number , num );
136
+ }
131
137
return this ;
132
138
}
133
139
134
140
public Builder min (double num ) {
135
- if (inParenthesis )
141
+ if (inParenthesis ) {
136
142
sideNumber = Math .min (sideNumber , num );
137
- else
143
+ } else {
138
144
number = Math .min (number , num );
145
+ }
139
146
return this ;
140
147
}
141
148
142
149
public Builder multiply (double num ) {
143
- if (inParenthesis )
150
+ if (inParenthesis ) {
144
151
sideNumber *= num ;
145
- else
152
+ } else {
146
153
number *= num ;
154
+ }
147
155
return this ;
148
156
}
149
157
150
158
// Takes a number and a condition, only does the operation if condition is true.
151
159
public Builder multiplyIf (double num , BiFunction <Double , Double , Boolean > condition ) {
152
160
if (!condition .apply (number , num )) return this ;
153
- if (inParenthesis )
161
+ if (inParenthesis ) {
154
162
sideNumber *= num ;
155
- else
163
+ } else {
156
164
number *= num ;
165
+ }
157
166
return this ;
158
167
}
159
168
160
169
public Builder divide (double num ) {
161
170
if (num == 0 ) return this ;
162
- if (inParenthesis )
171
+ if (inParenthesis ) {
163
172
sideNumber /= num ;
164
- else
173
+ } else {
165
174
number /= num ;
175
+ }
166
176
return this ;
167
177
}
168
178
169
179
// Takes a number and a condition, only does the operation if condition is true.
170
180
public Builder divideIf (double num , BiFunction <Double , Double , Boolean > condition ) {
171
181
if (num == 0 ) return this ;
172
182
if (!condition .apply (number , num )) return this ;
173
- if (inParenthesis )
183
+ if (inParenthesis ) {
174
184
sideNumber /= num ;
175
- else
185
+ } else {
176
186
number /= num ;
187
+ }
177
188
return this ;
178
189
}
179
190
180
191
public Builder mod (double num ) {
181
- if (inParenthesis )
192
+ if (inParenthesis ) {
182
193
sideNumber %= num ;
183
- else
194
+ } else {
184
195
number %= num ;
196
+ }
185
197
return this ;
186
198
}
187
199
188
200
// Takes a number and a condition, only does the operation if condition is true.
189
201
public Builder modIf (double num , BiFunction <Double , Double , Boolean > condition ) {
190
202
if (!condition .apply (number , num )) return this ;
191
- if (inParenthesis )
203
+ if (inParenthesis ) {
192
204
sideNumber %= num ;
193
- else
205
+ } else {
194
206
number %= num ;
207
+ }
195
208
return this ;
196
209
}
197
210
198
211
public Builder pow (double num ) {
199
- if (inParenthesis )
212
+ if (inParenthesis ) {
200
213
sideNumber = Math .pow (sideNumber , num );
201
- else
214
+ } else {
202
215
number = Math .pow (number , num );
216
+ }
203
217
return this ;
204
218
}
205
219
206
220
public Builder sqrt () {
207
- if (inParenthesis )
221
+ if (inParenthesis ) {
208
222
sideNumber = Math .sqrt (sideNumber );
209
- else
223
+ } else {
210
224
number = Math .sqrt (number );
225
+ }
211
226
return this ;
212
227
}
213
228
214
229
public Builder round () {
215
- if (inParenthesis )
230
+ if (inParenthesis ) {
216
231
sideNumber = Math .round (sideNumber );
217
- else
232
+ } else {
218
233
number = Math .round (number );
234
+ }
219
235
return this ;
220
236
}
221
237
222
238
public Builder floor () {
223
- if (inParenthesis )
239
+ if (inParenthesis ) {
224
240
sideNumber = Math .floor (sideNumber );
225
- else
241
+ } else {
226
242
number = Math .floor (number );
243
+ }
227
244
return this ;
228
245
}
229
246
230
247
public Builder ceil () {
231
- if (inParenthesis )
248
+ if (inParenthesis ) {
232
249
sideNumber = Math .ceil (sideNumber );
233
- else
250
+ } else {
234
251
number = Math .ceil (number );
252
+ }
235
253
return this ;
236
254
}
237
255
238
256
public Builder abs () {
239
- if (inParenthesis )
257
+ if (inParenthesis ) {
240
258
sideNumber = Math .abs (sideNumber );
241
- else
259
+ } else {
242
260
number = Math .abs (number );
261
+ }
243
262
return this ;
244
263
}
245
264
246
265
public Builder cbrt () {
247
- if (inParenthesis )
266
+ if (inParenthesis ) {
248
267
sideNumber = Math .cbrt (sideNumber );
249
- else
268
+ } else {
250
269
number = Math .cbrt (number );
270
+ }
251
271
return this ;
252
272
}
253
273
254
274
public Builder log () {
255
- if (inParenthesis )
275
+ if (inParenthesis ) {
256
276
sideNumber = Math .log (sideNumber );
257
- else
277
+ } else {
258
278
number = Math .log (number );
279
+ }
259
280
return this ;
260
281
}
261
282
262
283
public Builder log10 () {
263
- if (inParenthesis )
284
+ if (inParenthesis ) {
264
285
sideNumber = Math .log10 (sideNumber );
265
- else
286
+ } else {
266
287
number = Math .log10 (number );
288
+ }
267
289
return this ;
268
290
}
269
291
270
292
public Builder sin () {
271
- if (inParenthesis )
293
+ if (inParenthesis ) {
272
294
sideNumber = Math .sin (sideNumber );
273
- else
295
+ } else {
274
296
number = Math .sin (number );
297
+ }
275
298
return this ;
276
299
}
277
300
278
301
public Builder cos () {
279
- if (inParenthesis )
302
+ if (inParenthesis ) {
280
303
sideNumber = Math .cos (sideNumber );
281
- else
304
+ } else {
282
305
number = Math .cos (number );
306
+ }
283
307
return this ;
284
308
}
285
309
286
310
public Builder tan () {
287
- if (inParenthesis )
311
+ if (inParenthesis ) {
288
312
sideNumber = Math .tan (sideNumber );
289
- else
313
+ } else {
290
314
number = Math .tan (number );
315
+ }
291
316
return this ;
292
317
}
293
318
294
319
public Builder sinh () {
295
- if (inParenthesis )
320
+ if (inParenthesis ) {
296
321
sideNumber = Math .sinh (sideNumber );
297
- else
322
+ } else {
298
323
number = Math .sinh (number );
324
+ }
299
325
return this ;
300
326
}
301
327
302
328
public Builder cosh () {
303
- if (inParenthesis )
329
+ if (inParenthesis ) {
304
330
sideNumber = Math .cosh (sideNumber );
305
- else
331
+ } else {
306
332
number = Math .cosh (number );
333
+ }
307
334
return this ;
308
335
}
309
336
310
337
public Builder tanh () {
311
- if (inParenthesis )
338
+ if (inParenthesis ) {
312
339
sideNumber = Math .tanh (sideNumber );
313
- else
340
+ } else {
314
341
number = Math .tanh (number );
342
+ }
315
343
return this ;
316
344
}
317
345
318
346
public Builder exp () {
319
- if (inParenthesis )
347
+ if (inParenthesis ) {
320
348
sideNumber = Math .exp (sideNumber );
321
- else
349
+ } else {
322
350
number = Math .exp (number );
351
+ }
323
352
return this ;
324
353
}
325
354
326
355
public Builder toRadians () {
327
- if (inParenthesis )
356
+ if (inParenthesis ) {
328
357
sideNumber = Math .toRadians (sideNumber );
329
- else
358
+ } else {
330
359
number = Math .toRadians (number );
360
+ }
331
361
return this ;
332
362
}
333
363
0 commit comments