Map Tests & BugFixes.

-Added: Tests for all map implementations.
-Added: Missing Map Constructors.
-Fixed: Bugs with Maps & Sets.
-Fixed: Gradle Java Container.
-Fixed: Some javadoc stuff.
-Note: SubMap/List implementation are not really well tested and most likely buggy
-Changed: set JavaDoc to be quiet for now. Later goal.
This commit is contained in:
2021-04-22 23:02:04 +02:00
parent aaee550ea9
commit 0b11c3929a
43 changed files with 1206 additions and 149 deletions
@@ -38,6 +38,10 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public AVL_TREE_SET() {
}
public AVL_TREE_SET(COMPARATOR KEY_GENERIC_TYPE comp) {
comparator = comp;
}
public AVL_TREE_SET(KEY_TYPE[] array) {
this(array, 0, array.length);
}
@@ -47,15 +51,41 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
for(int i = 0;i<length;i++) add(array[offset+i]);
}
public AVL_TREE_SET(KEY_TYPE[] array, COMPARATOR KEY_GENERIC_TYPE comp) {
this(array, 0, array.length, comp);
}
public AVL_TREE_SET(KEY_TYPE[] array, int offset, int length, COMPARATOR KEY_GENERIC_TYPE comp) {
comparator = comp;
SanityChecks.checkArrayCapacity(array.length, offset, length);
for(int i = 0;i<length;i++) add(array[offset+i]);
}
public AVL_TREE_SET(SORTED_SET KEY_GENERIC_TYPE sortedSet) {
comparator = sortedSet.comparator();
addAll(sortedSet);
}
@Deprecated
public AVL_TREE_SET(Collection<? extends CLASS_TYPE> collection) {
addAll(collection);
}
@Deprecated
public AVL_TREE_SET(Collection<? extends CLASS_TYPE> collection, COMPARATOR KEY_GENERIC_TYPE comp) {
comparator = comp;
addAll(collection);
}
public AVL_TREE_SET(COLLECTION KEY_GENERIC_TYPE collection) {
addAll(collection);
}
public AVL_TREE_SET(COLLECTION KEY_GENERIC_TYPE collection, COMPARATOR KEY_GENERIC_TYPE comp) {
comparator = comp;
addAll(collection);
}
public AVL_TREE_SET(Iterator<CLASS_TYPE> iterator) {
#if !TYPE_OBJECT
this(ITERATORS.wrap(iterator));
@@ -64,10 +94,24 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
#endif
}
public AVL_TREE_SET(Iterator<CLASS_TYPE> iterator, COMPARATOR KEY_GENERIC_TYPE comp) {
#if !TYPE_OBJECT
this(ITERATORS.wrap(iterator), comp);
#else
comparator = comp;
while(iterator.hasNext()) add(iterator.next());
#endif
}
public AVL_TREE_SET(ITERATOR KEY_GENERIC_TYPE iterator) {
while(iterator.hasNext()) add(iterator.NEXT());
}
public AVL_TREE_SET(ITERATOR KEY_GENERIC_TYPE iterator, COMPARATOR KEY_GENERIC_TYPE comp) {
comparator = comp;
while(iterator.hasNext()) add(iterator.NEXT());
}
#if !TYPE_OBJECT
@Override
public void setDefaultMaxValue(KEY_TYPE value) { defaultMaxNotFound = value; }
@@ -339,6 +383,14 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
@Override
public int size() { return size; }
@Override
public void clear() {
size = 0;
first = null;
last = null;
tree = null;
}
@Override
public COMPARATOR KEY_GENERIC_TYPE comparator() { return comparator; }
@@ -533,7 +585,8 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
COMPARATOR KEY_GENERIC_TYPE comparator;
DescendingSubSet(AVL_TREE_SET KEY_GENERIC_TYPE set, boolean fromStart, KEY_TYPE start, boolean loInclusive, boolean toEnd, KEY_TYPE end, boolean hiInclusive) {
super(set, fromStart, start, loInclusive, toEnd, end, hiInclusive);
comparator = set.comparator().reversed();
comparator = set.comparator();
if(comparator != null) comparator = comparator.reversed();
}
@Override