diff --git a/core/src/processing/data/FloatDict.java b/core/src/processing/data/FloatDict.java index dbb89ecee..dc35f4b99 100644 --- a/core/src/processing/data/FloatDict.java +++ b/core/src/processing/data/FloatDict.java @@ -346,6 +346,15 @@ public class FloatDict { } + public void setIndex(int index, String key, float value) { + if (index < 0 || index >= count) { + throw new ArrayIndexOutOfBoundsException(index); + } + keys[index] = key; + values[index] = value; + } + + /** * @webref floatdict:method * @brief Check if a key is a part of the data structure diff --git a/core/src/processing/data/IntDict.java b/core/src/processing/data/IntDict.java index e3f5805b9..6ef168b46 100644 --- a/core/src/processing/data/IntDict.java +++ b/core/src/processing/data/IntDict.java @@ -348,6 +348,16 @@ public class IntDict { } } + + public void setIndex(int index, String key, int value) { + if (index < 0 || index >= count) { + throw new ArrayIndexOutOfBoundsException(index); + } + keys[index] = key; + values[index] = value; + } + + /** * @webref intdict:method * @brief Check if a key is a part of the data structure diff --git a/core/src/processing/data/StringDict.java b/core/src/processing/data/StringDict.java index a5d83fd09..e34d4663f 100644 --- a/core/src/processing/data/StringDict.java +++ b/core/src/processing/data/StringDict.java @@ -363,11 +363,21 @@ public class StringDict { } + public void setIndex(int index, String key, String value) { + if (index < 0 || index >= count) { + throw new ArrayIndexOutOfBoundsException(index); + } + keys[index] = key; + values[index] = value; + } + + public int index(String what) { Integer found = indices.get(what); return (found == null) ? -1 : found.intValue(); } + /** * @webref stringdict:method * @brief Check if a key is a part of the data structure