From ce8f49cd1f457876717bf22c5f5c6186fb9e06cc Mon Sep 17 00:00:00 2001 From: Speiger Date: Wed, 23 Jun 2021 19:34:32 +0200 Subject: [PATCH] Maps.get function is no longer using Suffixes unless its absolutely necessary. --- Changelog.md | 3 ++- README.md | 6 +++--- .../java/speiger/src/builder/GlobalVariables.java | 3 ++- .../collections/ints/base/BaseInt2IntMapTest.java | 12 ++++++------ 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Changelog.md b/Changelog.md index 3853c22..b7a207d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,4 +6,5 @@ - Changed: remove/removeLast/enqueue/enqueueFirst no longer use Type Suffixes - Removed: Suffixes for unmodifiable & synchronize functions. - Changed: Primitive Stacks no longer depend on the base Stack class. Because seriously not needed. -- Changed: PriorityQueues no longer extends Object Variant. \ No newline at end of file +- Changed: PriorityQueues no longer extends Object Variant. +- Changed: Maps.get function is no longer using Suffixes unless its absolutely necessary. \ No newline at end of file diff --git a/README.md b/README.md index 9565734..93b6507 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ But its focus is a different one. - Iterators # Notes about Versions -Any 0.x.0 version (Minor) can be reason for massive changes including API. -To ensure that problems can be dealt with even if it is breaking the current API. -Any breaking changes will be Documented (once 1.0 is released) +Any 0.x.0 version (Minor) can be reason for massive changes including API. +To ensure that problems can be dealt with even if it is breaking the current API. +Any breaking changes will be Documented (once 1.0 is released) # How to install Using Gradle: diff --git a/src/builder/java/speiger/src/builder/GlobalVariables.java b/src/builder/java/speiger/src/builder/GlobalVariables.java index e7930bb..9464e34 100644 --- a/src/builder/java/speiger/src/builder/GlobalVariables.java +++ b/src/builder/java/speiger/src/builder/GlobalVariables.java @@ -230,7 +230,8 @@ public class GlobalVariables addFunctionMappers("ENTRY_KEY", "get%sKey"); addFunctionValueMappers("ENTRY_VALUE", "get%sValue"); addFunctionMapper("GET_KEY", "get"); - addFunctionValueMapper("GET_VALUE", valueType.isObject() ? "getObject" : "get"); + if(type.isObject()) addFunctionValueMapper("GET_VALUE", valueType.isObject() ? "getObject" : "get"); + else addSimpleMapper("GET_VALUE", "get"); addFunctionMapper("LAST_KEY", "last"); addFunctionValueMapper("MERGE", "merge"); addFunctionMapper("NEXT", "next"); diff --git a/src/test/java/speiger/src/collections/ints/base/BaseInt2IntMapTest.java b/src/test/java/speiger/src/collections/ints/base/BaseInt2IntMapTest.java index 1c19105..6610708 100644 --- a/src/test/java/speiger/src/collections/ints/base/BaseInt2IntMapTest.java +++ b/src/test/java/speiger/src/collections/ints/base/BaseInt2IntMapTest.java @@ -33,7 +33,7 @@ public abstract class BaseInt2IntMapTest Assert.assertEquals(1, putMap.put(513, 2)); Assert.assertEquals(PUT_ARRAY.length + 1, putMap.size()); Assert.assertEquals(512, putMap.addTo(0, 1)); - Assert.assertEquals(513, putMap.getInt(0)); + Assert.assertEquals(513, putMap.get(0)); } @Test @@ -70,13 +70,13 @@ public abstract class BaseInt2IntMapTest if(!getValidMapTests().contains(MapTests.REPLACE)) return; Int2IntMap map = createMap(TEST_ARRAY, TEST_ARRAY); Assert.assertEquals(0, map.replace(0, 512)); - Assert.assertEquals(512, map.getInt(0)); + Assert.assertEquals(512, map.get(0)); Assert.assertTrue(map.replace(0, 512, 0)); Assert.assertFalse(map.replace(0, 512, 0)); map = createMap(TEST_ARRAY, TEST_ARRAY); map.replaceInts((K, V) -> 99 - V); - Assert.assertEquals(99, map.getInt(0)); - Assert.assertEquals(0, map.getInt(99)); + Assert.assertEquals(99, map.get(0)); + Assert.assertEquals(0, map.get(99)); } @Test @@ -85,7 +85,7 @@ public abstract class BaseInt2IntMapTest if(!getValidMapTests().contains(MapTests.COMPUTE)) return; Int2IntMap map = createMap(TEST_ARRAY, TEST_ARRAY); Assert.assertEquals(512, map.computeInt(0, (K, V) -> 512)); - Assert.assertEquals(512, map.getInt(0)); + Assert.assertEquals(512, map.get(0)); Assert.assertEquals(512, map.computeIntIfAbsent(0, T -> 0)); Assert.assertEquals(0, map.computeIntIfPresent(0, (T, V) -> 0)); Assert.assertEquals(0, map.computeIntIfAbsent(-10, T -> 0)); @@ -107,7 +107,7 @@ public abstract class BaseInt2IntMapTest Int2IntMap map = createMap(TEST_ARRAY, TEST_ARRAY); for(int i = 0;i