diff options
author | Sven Gothel <[email protected]> | 2010-04-10 01:21:45 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-04-10 01:21:45 +0200 |
commit | 4aa39b922872a8dac0d49505536a7b058ef40f7a (patch) | |
tree | 47da5b4be0e51b13e097787c65c5b40434b98f3f /src/java/com/jogamp/common/util | |
parent | 5d2fd3da2541e9ddfdad6cdbba9d251fd305bfd7 (diff) | |
parent | 1968a05de1e1c734865b045b257714abd52c7e56 (diff) |
Merge branch 'master' of github.com:mbien/gluegen
Diffstat (limited to 'src/java/com/jogamp/common/util')
-rw-r--r-- | src/java/com/jogamp/common/util/IntIntHashMap.java | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/java/com/jogamp/common/util/IntIntHashMap.java b/src/java/com/jogamp/common/util/IntIntHashMap.java index 7a32654..6960161 100644 --- a/src/java/com/jogamp/common/util/IntIntHashMap.java +++ b/src/java/com/jogamp/common/util/IntIntHashMap.java @@ -31,32 +31,33 @@ package com.jogamp.common.util; /** - * Fast HashMap with int keys and int values. + * Fast HashMap for primitive data.. * Original code is based on the <a href="http://code.google.com/p/skorpios/"> skorpios project</a> * released under new BSD license. * @author Michael Bien * @see IntObjectHashMap + * @see IntLongHashMap */ -public class IntIntHashMap { +public class /*name*/IntIntHashMap/*name*/ { private final float loadFactor; private Entry[] table; - + private int size; private int mask; private int capacity; private int threshold; - public IntIntHashMap() { + public /*name*/IntIntHashMap/*name*/() { this(16, 0.75f); } - public IntIntHashMap(int initialCapacity) { + public /*name*/IntIntHashMap/*name*/(int initialCapacity) { this(initialCapacity, 0.75f); } - public IntIntHashMap(int initialCapacity, float loadFactor) { + public /*name*/IntIntHashMap/*name*/(int initialCapacity, float loadFactor) { if (initialCapacity > 1 << 30) { throw new IllegalArgumentException("initialCapacity is too large."); } @@ -76,7 +77,7 @@ public class IntIntHashMap { this.mask = capacity - 1; } - public boolean containsValue(int value) { + public boolean containsValue(/*value*/int/*value*/ value) { Entry[] table = this.table; for (int i = table.length; i-- > 0;) { for (Entry e = table[i]; e != null; e = e.next) { @@ -88,8 +89,8 @@ public class IntIntHashMap { return false; } - public boolean containsKey(int key) { - int index = key & mask; + public boolean containsKey(/*key*/int/*key*/ key) { + /*key*/int/*key*/ index = key & mask; for (Entry e = table[index]; e != null; e = e.next) { if (e.key == key) { return true; @@ -98,24 +99,24 @@ public class IntIntHashMap { return false; } - public int get(int key) { + public /*value*/int/*value*/ get(/*key*/int/*key*/ key) { int index = key & mask; for (Entry e = table[index]; e != null; e = e.next) { if (e.key == key) { return e.value; } } - return 0; + return /*null*/0/*null*/; } - public int put(int key, int value) { + public /*value*/int/*value*/ put(/*key*/int/*key*/ key, /*value*/int/*value*/ value) { int index = key & mask; // Check if key already exists. for (Entry e = table[index]; e != null; e = e.next) { if (e.key != key) { continue; } - int oldValue = e.value; + /*value*/int/*value*/ oldValue = e.value; e.value = value; return oldValue; } @@ -144,10 +145,10 @@ public class IntIntHashMap { threshold = (int) (newCapacity * loadFactor); mask = capacity - 1; } - return 0; + return /*null*/0/*null*/; } - public int remove(int key) { + public /*value*/int/*value*/ remove(/*key*/int/*key*/ key) { int index = key & mask; Entry prev = table[index]; Entry e = prev; @@ -165,7 +166,7 @@ public class IntIntHashMap { prev = e; e = next; } - return 0; + return /*null*/0/*null*/; } public int size() { @@ -182,11 +183,11 @@ public class IntIntHashMap { private final static class Entry { - private final int key; - private int value; + private final /*key*/int/*key*/ key; + private /*value*/int/*value*/ value; private Entry next; - private Entry(int k, int v, Entry n) { + private Entry(/*key*/int/*key*/ k, /*value*/int/*value*/ v, Entry n) { key = k; value = v; next = n; |