Next big batch of features.

-Added: Tests for IntSortedSet, IntNavigableSet.
-Added: Test Classes for: Open/Custom/Linked HashSet, TreeSets, ArraySet
-Changed: MemFreeMergeSort got improved by a lot.
-Fixed: Bugs that the tests uncovered.
-Note: TreeSets still have issues. But every other collection type is fixed.
This commit is contained in:
2021-01-08 21:12:20 +01:00
parent 0123cb8937
commit c0c719f2b6
23 changed files with 765 additions and 265 deletions
@@ -1,14 +1,22 @@
package speiger.src.collections.PACKAGE.sets;
import java.util.NoSuchElementException;
import java.util.Collection;
#if TYPE_OBJECT
import java.util.Comparator;
#endif
import java.util.Iterator;
import java.util.NoSuchElementException;
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
#if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
#endif
import speiger.src.collections.PACKAGE.collections.COLLECTION;
import speiger.src.collections.PACKAGE.collections.ITERATOR;
import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR;
#if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.utils.ITERATORS;
#endif
import speiger.src.collections.utils.SanityChecks;
public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE implements NAVIGABLE_SET KEY_GENERIC_TYPE
{
@@ -30,6 +38,36 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public RB_TREE_SET() {
}
public RB_TREE_SET(KEY_TYPE[] array) {
this(array, 0, array.length);
}
public RB_TREE_SET(KEY_TYPE[] array, int offset, int length) {
SanityChecks.checkArrayCapacity(array.length, offset, length);
for(int i = 0;i<length;i++) add(array[offset+i]);
}
@Deprecated
public RB_TREE_SET(Collection<? extends CLASS_TYPE> collection) {
addAll(collection);
}
public RB_TREE_SET(COLLECTION KEY_GENERIC_TYPE collection) {
addAll(collection);
}
public RB_TREE_SET(Iterator<CLASS_TYPE> iterator) {
#if !TYPE_OBJECT
this(ITERATORS.wrap(iterator));
#else
while(iterator.hasNext()) add(iterator.next());
#endif
}
public RB_TREE_SET(ITERATOR KEY_GENERIC_TYPE iterator) {
while(iterator.hasNext()) add(iterator.NEXT());
}
#if !TYPE_OBJECT
@Override
public void setDefaultMaxValue(KEY_TYPE value) { defaultMaxNotFound = value; }