summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmake/build.xml11
-rw-r--r--src/java/com/jogamp/common/util/IntIntHashMap.java20
2 files changed, 24 insertions, 7 deletions
diff --git a/make/build.xml b/make/build.xml
index 74b8d9f..a9a7d6a 100755
--- a/make/build.xml
+++ b/make/build.xml
@@ -437,7 +437,7 @@
<param name="map.name" value="IntLongHashMap"/>
<param name="map.key" value="int"/>
<param name="map.value" value="long"/>
- <param name="map.null" value="0"/>
+ <param name="map.null" value="-1"/>
</antcall>
<!-- Long*Maps -->
@@ -452,14 +452,14 @@
<param name="map.name" value="LongIntHashMap"/>
<param name="map.key" value="long"/>
<param name="map.value" value="int"/>
- <param name="map.null" value="0"/>
+ <param name="map.null" value="-1"/>
</antcall>
<antcall target="create-map" inheritrefs="true">
<param name="map.name" value="LongLongHashMap"/>
<param name="map.key" value="long"/>
<param name="map.value" value="long"/>
- <param name="map.null" value="0"/>
+ <param name="map.null" value="-1"/>
</antcall>
</target>
@@ -473,7 +473,7 @@
<replaceregex pattern="@see ${map.name}" replace="@see IntIntHashMap"/>
<replaceregex pattern="/\*value\*/int/\*value\*/" replace="${map.value}"/>
<replaceregex pattern="/\*key\*/int/\*key\*/" replace="${map.key}"/>
- <replaceregex pattern="/\*null\*/0/\*null\*/" replace="${map.null}"/>
+ <replaceregex pattern="/\*null\*/-1/\*null\*/" replace="${map.null}"/>
</filterchain>
<!-- no clue why we have to do this twice... otherwise it will only replace one token per line -->
<filterchain>
@@ -619,6 +619,9 @@
<fileset dir="${classes-cdc}">
<include name="com/jogamp/gluegen/runtime/*.class" />
<include name="com/jogamp/gluegen/runtime/opengl/*.class" />
+ <include name="com/jogamp/common/impl/*.class" />
+ <include name="com/jogamp/common/jvm/*.class" />
+ <include name="com/jogamp/common/util/*.class" />
<include name="com/jogamp/common/nio/*.class" />
<include name="com/jogamp/common/os/*.class" />
<include name="com/jogamp/common/*.class" />
diff --git a/src/java/com/jogamp/common/util/IntIntHashMap.java b/src/java/com/jogamp/common/util/IntIntHashMap.java
index f9b0f2d..1288ad4 100644
--- a/src/java/com/jogamp/common/util/IntIntHashMap.java
+++ b/src/java/com/jogamp/common/util/IntIntHashMap.java
@@ -58,6 +58,7 @@ public class /*name*/IntIntHashMap/*name*/ {
private int mask;
private int capacity;
private int threshold;
+ private /*value*/int/*value*/ keyNotFoundValue = /*null*/-1/*null*/;
public /*name*/IntIntHashMap/*name*/() {
this(16, 0.75f);
@@ -87,6 +88,19 @@ public class /*name*/IntIntHashMap/*name*/ {
this.mask = capacity - 1;
}
+ /**
+ * Sets the new key not found value.
+ * For primitive types (int, long) the default is -1,
+ * for Object types, the default is null.
+ *
+ * @return the previous key not found value
+ */
+ public /*value*/int/*value*/ setKeyNotFoundValue(/*value*/int/*value*/ newKeyNotFoundValue) {
+ /*value*/int/*value*/ t = keyNotFoundValue;
+ keyNotFoundValue = newKeyNotFoundValue;
+ return t;
+ }
+
public boolean containsValue(/*value*/int/*value*/ value) {
Entry[] table = this.table;
for (int i = table.length; i-- > 0;) {
@@ -118,7 +132,7 @@ public class /*name*/IntIntHashMap/*name*/ {
return e.value;
}
}
- return /*null*/0/*null*/;
+ return keyNotFoundValue;
}
// @SuppressWarnings(value="cast")
@@ -158,7 +172,7 @@ public class /*name*/IntIntHashMap/*name*/ {
threshold = (int) (newCapacity * loadFactor);
mask = capacity - 1;
}
- return /*null*/0/*null*/;
+ return keyNotFoundValue;
}
// @SuppressWarnings(value="cast")
@@ -180,7 +194,7 @@ public class /*name*/IntIntHashMap/*name*/ {
prev = e;
e = next;
}
- return /*null*/0/*null*/;
+ return keyNotFoundValue;
}
public int size() {