From 086d933a0dc6e5058ff426d88cbc76d021a7b1c8 Mon Sep 17 00:00:00 2001 From: Speiger Date: Thu, 2 Jun 2022 14:59:39 +0200 Subject: [PATCH] Small fixes -Fixed: NavigableMap.keySet is now a NavigableSet instead of a sorted one. -Started: Trying to fix wrappers. --- build.gradle | 2 +- .../maps/impl/tree/AVLTreeMap.template | 7 +++-- .../maps/impl/tree/RBTreeMap.template | 17 +++++++++-- .../maps/interfaces/NavigableMap.template | 4 ++- .../maps/interfaces/SortedMap.template | 6 ++-- .../templates/utils/Collections.template | 8 ++--- .../templates/utils/maps/Maps.template | 30 ++++++++++++------- 7 files changed, 50 insertions(+), 24 deletions(-) diff --git a/build.gradle b/build.gradle index 8d76ce72..509f0ff3 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ repositories { } archivesBaseName = 'Primitive Collections' -version = '0.6.2.8-SNAPSHOT'; +version = '0.6.2.10-SNAPSHOT'; sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaVersion.current(); diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/AVLTreeMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/AVLTreeMap.template index 5055e819..b8b03f42 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/AVLTreeMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/AVLTreeMap.template @@ -30,8 +30,9 @@ import speiger.src.collections.PACKAGE.maps.interfaces.MAP; import speiger.src.collections.PACKAGE.maps.interfaces.NAVIGABLE_MAP; import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET; +#if TYPE_OBJECT import speiger.src.collections.PACKAGE.sets.SET; -import speiger.src.collections.PACKAGE.sets.SORTED_SET; +#endif import speiger.src.collections.PACKAGE.utils.maps.MAPS; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; @@ -682,7 +683,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public SORTED_SET KEY_GENERIC_TYPE keySet() { + public NAVIGABLE_SET KEY_GENERIC_TYPE keySet() { return navigableKeySet(); } @@ -1474,7 +1475,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public SET KEY_GENERIC_TYPE keySet() { + public NAVIGABLE_SET KEY_GENERIC_TYPE keySet() { return navigableKeySet(); } diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/RBTreeMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/RBTreeMap.template index 48d470e6..bac1b9f6 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/RBTreeMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/RBTreeMap.template @@ -30,8 +30,9 @@ import speiger.src.collections.PACKAGE.maps.interfaces.MAP; import speiger.src.collections.PACKAGE.maps.interfaces.NAVIGABLE_MAP; import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET; +#if TYPE_OBJECT import speiger.src.collections.PACKAGE.sets.SET; -import speiger.src.collections.PACKAGE.sets.SORTED_SET; +#endif import speiger.src.collections.PACKAGE.utils.maps.MAPS; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; @@ -685,7 +686,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public SORTED_SET KEY_GENERIC_TYPE keySet() { + public NAVIGABLE_SET KEY_GENERIC_TYPE keySet() { return navigableKeySet(); } @@ -1310,6 +1311,11 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G return keySet; } + @Override + public NAVIGABLE_SET KEY_GENERIC_TYPE keySet() { + return navigableKeySet(); + } + @Override public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, boolean fromInclusive, KEY_TYPE toKey, boolean toInclusive) { if (!inRange(fromKey, fromInclusive)) throw new IllegalArgumentException("fromKey out of range"); @@ -1396,6 +1402,11 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G return keySet; } + @Override + public NAVIGABLE_SET KEY_GENERIC_TYPE keySet() { + return navigableKeySet(); + } + @Override public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, boolean fromInclusive, KEY_TYPE toKey, boolean toInclusive) { if (!inRange(fromKey, fromInclusive)) throw new IllegalArgumentException("fromKey out of range"); @@ -1531,7 +1542,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public SET KEY_GENERIC_TYPE keySet() { + public NAVIGABLE_SET KEY_GENERIC_TYPE keySet() { return navigableKeySet(); } diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/NavigableMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/NavigableMap.template index 644ff566..27904ccc 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/NavigableMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/NavigableMap.template @@ -34,7 +34,9 @@ public interface NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE extends SORTED_MAP KEY_VAL /** @return a Type Specific pollLastEntry */ @Override public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLastEntry(); - + /** @return a Type Specific Navigable Key Set */ + @Override + public NAVIGABLE_SET KEY_GENERIC_TYPE keySet(); /** * Creates a Wrapped NavigableMap that is Synchronized * @return a new NavigableMap that is synchronized diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/SortedMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/SortedMap.template index edcf6819..d186f366 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/SortedMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/SortedMap.template @@ -9,9 +9,11 @@ import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.functions.COMPARATOR; #endif -import speiger.src.collections.PACKAGE.sets.SET; +import speiger.src.collections.PACKAGE.sets.SORTED_SET; import speiger.src.collections.PACKAGE.utils.maps.MAPS; +#if !TYPE_OBJECT import speiger.src.collections.objects.sets.ObjectSortedSet; +#endif import speiger.src.collections.objects.collections.ObjectBidirectionalIterator; /** @@ -31,7 +33,7 @@ public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap