summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/common/util/IntIntHashMapTest.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-03 16:06:47 +0200
committerSven Gothel <[email protected]>2014-07-03 16:06:47 +0200
commitdf9ff7f340a5ab4e07efc613f5f264eeae63d4c7 (patch)
tree239ae276b82024b140428e6c0fe5d739fdd686a4 /src/junit/com/jogamp/common/util/IntIntHashMapTest.java
parenteb47aaba63e3b1bf55f274a0f338f1010a017ae4 (diff)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines
Diffstat (limited to 'src/junit/com/jogamp/common/util/IntIntHashMapTest.java')
-rw-r--r--src/junit/com/jogamp/common/util/IntIntHashMapTest.java90
1 files changed, 45 insertions, 45 deletions
diff --git a/src/junit/com/jogamp/common/util/IntIntHashMapTest.java b/src/junit/com/jogamp/common/util/IntIntHashMapTest.java
index fa56d3d..ac009cb 100644
--- a/src/junit/com/jogamp/common/util/IntIntHashMapTest.java
+++ b/src/junit/com/jogamp/common/util/IntIntHashMapTest.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
/**
* Created on Sunday, March 28 2010 21:01
*/
@@ -46,7 +46,7 @@ import static java.lang.System.*;
/**
*
* @author Michael Bien
- * @author Sven Gothel
+ * @author Sven Gothel
*/
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
@@ -86,20 +86,20 @@ public class IntIntHashMapTest {
assertEquals(map.size(), intmap.size());
- for (Entry<Integer, Integer> entry : map.entrySet()) {
+ for (final Entry<Integer, Integer> entry : map.entrySet()) {
assertTrue(intmap.containsKey(entry.getKey()));
assertTrue(intmap.containsValue(entry.getValue()));
}
int i = 0;
- for (Entry<Integer, Integer> entry : map.entrySet()) {
+ for (final Entry<Integer, Integer> entry : map.entrySet()) {
assertEquals((int)entry.getValue(), intmap.remove(entry.getKey()));
assertEquals(map.size() - i - 1, intmap.size());
i++;
}
}
-
+
@Test
public void iteratorTest() {
@@ -108,14 +108,14 @@ public class IntIntHashMapTest {
for (int i = 0; i < iterations; i++) {
intmap.put(pairs.keys[i], pairs.values[i]);
}
-
- Iterator<IntIntHashMap.Entry> iterator = intmap.iterator();
+
+ final Iterator<IntIntHashMap.Entry> iterator = intmap.iterator();
assertNotNull(iterator);
assertTrue(iterator.hasNext());
int n = 0;
while (iterator.hasNext()) {
- IntIntHashMap.Entry entry = iterator.next();
+ final IntIntHashMap.Entry entry = iterator.next();
assertNotNull(entry);
n++;
}
@@ -129,33 +129,33 @@ public class IntIntHashMapTest {
public void cloneTest() {
final int smallSize = iterations / 4 ;
-
+
final IntIntHashMap intmap = new IntIntHashMap( smallSize + smallSize / 4, 0.75f);
intmap.setKeyNotFoundValue(-1);
-
+
for (int i = 0; i < smallSize; i++) {
intmap.put(pairs.keys[i], pairs.values[i]);
}
assertEquals(intmap.size(), smallSize);
-
+
final IntIntHashMap intmapCopy = (IntIntHashMap) intmap.clone();
-
+
assertEquals(intmap.size(), intmapCopy.size());
assertEquals(intmap.getKeyNotFoundValue(), intmapCopy.getKeyNotFoundValue());
-
- Iterator<IntIntHashMap.Entry> iterator = intmap.iterator();
+
+ final Iterator<IntIntHashMap.Entry> iterator = intmap.iterator();
assertNotNull(iterator);
assertTrue(iterator.hasNext());
- Iterator<IntIntHashMap.Entry> iteratorCopy = intmapCopy.iterator();
+ final Iterator<IntIntHashMap.Entry> iteratorCopy = intmapCopy.iterator();
assertNotNull(iteratorCopy);
assertTrue(iteratorCopy.hasNext());
-
+
int n = 0;
while (iterator.hasNext()) {
assertTrue(iteratorCopy.hasNext());
- IntIntHashMap.Entry entry = iterator.next();
- IntIntHashMap.Entry entryCopy = iteratorCopy.next();
+ final IntIntHashMap.Entry entry = iterator.next();
+ final IntIntHashMap.Entry entryCopy = iteratorCopy.next();
assertNotNull(entry);
assertNotNull(entryCopy);
assertEquals(entry.key, entryCopy.key);
@@ -173,45 +173,45 @@ public class IntIntHashMapTest {
assertTrue(intmapCopy.containsValue(pairs.values[i]));
assertTrue(intmapCopy.containsKey(pairs.keys[i]));
}
-
+
// out.println(intmap);
}
@Test
public void capacityTest() {
- final int fixedSize = 16;
- final int capacity = 32;
-
+ final int fixedSize = 16;
+ final int capacity = 32;
+
final IntIntHashMap intmap = new IntIntHashMap( capacity, 0.75f);
intmap.setKeyNotFoundValue(-1);
-
- assertEquals(intmap.capacity(), capacity);
+
+ assertEquals(intmap.capacity(), capacity);
for (int i = 0; i < fixedSize; i++) {
intmap.put(pairs.keys[i], pairs.values[i]);
}
assertEquals(intmap.size(), fixedSize);
assertEquals(intmap.capacity(), capacity);
-
+
final IntIntHashMap intmapCopy = (IntIntHashMap) intmap.clone();
-
+
assertEquals(intmap.size(), intmapCopy.size());
assertEquals(intmap.capacity(), intmapCopy.capacity());
assertEquals(intmap.getKeyNotFoundValue(), intmapCopy.getKeyNotFoundValue());
-
- Iterator<IntIntHashMap.Entry> iterator = intmap.iterator();
+
+ final Iterator<IntIntHashMap.Entry> iterator = intmap.iterator();
assertNotNull(iterator);
assertTrue(iterator.hasNext());
- Iterator<IntIntHashMap.Entry> iteratorCopy = intmapCopy.iterator();
+ final Iterator<IntIntHashMap.Entry> iteratorCopy = intmapCopy.iterator();
assertNotNull(iteratorCopy);
assertTrue(iteratorCopy.hasNext());
-
+
int n = 0;
while (iterator.hasNext()) {
assertTrue(iteratorCopy.hasNext());
- IntIntHashMap.Entry entry = iterator.next();
- IntIntHashMap.Entry entryCopy = iteratorCopy.next();
+ final IntIntHashMap.Entry entry = iterator.next();
+ final IntIntHashMap.Entry entryCopy = iteratorCopy.next();
assertNotNull(entry);
assertNotNull(entryCopy);
assertEquals(entry.key, entryCopy.key);
@@ -231,7 +231,7 @@ public class IntIntHashMapTest {
assertTrue(intmapCopy.containsValue(pairs.values[i]));
assertTrue(intmapCopy.containsKey(pairs.keys[i]));
}
-
+
// out.println(intmap);
}
@@ -242,7 +242,7 @@ public class IntIntHashMapTest {
benchmark(false);
}
- void benchmark(boolean warmup) {
+ void benchmark(final boolean warmup) {
// simple benchmark
final IntIntHashMap intmap = new IntIntHashMap(1024);
@@ -256,14 +256,14 @@ public class IntIntHashMapTest {
for (int i = 0; i < iterations; i++) {
intmap.put(pairs.keys[i], pairs.values[i]);
}
- long intmapPutTime = (nanoTime() - time);
+ final long intmapPutTime = (nanoTime() - time);
out.println(" iimap: " + intmapPutTime/1000000.0f+"ms");
time = nanoTime();
for (int i = 0; i < iterations; i++) {
map.put(pairs.keys[i], pairs.values[i]);
}
- long mapPutTime = (nanoTime() - time);
+ final long mapPutTime = (nanoTime() - time);
out.println(" map: " + mapPutTime/1000000.0f+"ms");
@@ -273,14 +273,14 @@ public class IntIntHashMapTest {
for (int i = 0; i < iterations; i++) {
intmap.get(pairs.keys[i]);
}
- long intmapGetTime = (nanoTime() - time);
+ final long intmapGetTime = (nanoTime() - time);
out.println(" iimap: " + intmapGetTime/1000000.0f+"ms");
time = nanoTime();
for (int i = 0; i < iterations; i++) {
map.get(pairs.keys[i]);
}
- long mapGetTime = (nanoTime() - time);
+ final long mapGetTime = (nanoTime() - time);
out.println(" map: " + mapGetTime/1000000.0f+"ms");
@@ -291,7 +291,7 @@ public class IntIntHashMapTest {
intmap.remove(pairs.keys[i]);
}
assertEquals(0, intmap.size());
- long intmapRemoveTime = (nanoTime() - time);
+ final long intmapRemoveTime = (nanoTime() - time);
out.println(" iimap: " + intmapRemoveTime/1000000.0f+"ms");
time = nanoTime();
@@ -299,7 +299,7 @@ public class IntIntHashMapTest {
map.remove(pairs.keys[i]);
}
assertEquals(0, map.size());
- long mapRemoveTime = (nanoTime() - time);
+ final long mapRemoveTime = (nanoTime() - time);
out.println(" map: " + mapRemoveTime/1000000.0f+"ms");
if(!warmup) {
@@ -312,7 +312,7 @@ public class IntIntHashMapTest {
}
}
- public static void main(String args[]) throws IOException {
+ public static void main(final String args[]) throws IOException {
org.junit.runner.JUnitCore.main(IntIntHashMapTest.class.getName());
}