MCPcopy Create free account
hub / github.com/benfry/processing4 / replaceValue

Method replaceValue

core/src/processing/data/FloatList.java:258–275  ·  view source on GitHub ↗

Replace the first instance of a particular value

(float value, float newValue)

Source from the content-addressed store, hash-verified

256
257 /** Replace the first instance of a particular value */
258 @SuppressWarnings("unused")
259 public boolean replaceValue(float value, float newValue) {
260 if (Float.isNaN(value)) {
261 for (int i = 0; i < count; i++) {
262 if (Float.isNaN(data[i])) {
263 data[i] = newValue;
264 return true;
265 }
266 }
267 } else {
268 int index = index(value);
269 if (index != -1) {
270 data[index] = newValue;
271 return true;
272 }
273 }
274 return false;
275 }
276
277
278 /** Replace all instances of a particular value */

Callers

nothing calls this directly

Calls 1

indexMethod · 0.95

Tested by

no test coverage detected