forked from Speiger/Primitive-Collections
Fixed last second bugs.
This commit is contained in:
parent
ee02997881
commit
b99abaafec
|
@ -12,6 +12,7 @@
|
|||
- Added: ImmutableOpenHashMap that is not editable (is linked by default for fast iteration)
|
||||
- Added: Maps can now be created through the interface.
|
||||
- Fixed: Lists.addElements(T...elements) was adding elements at the beginning of a list instead of the end.
|
||||
- Fixed: Bugs with the AVLTreeSet. And marked bugs with AVLTreeX that are still present.
|
||||
|
||||
### Version 0.3.1
|
||||
- Fixed: containsKey & containsValue in HashMaps were deprecated for Object Variants.
|
||||
|
|
|
@ -58,3 +58,4 @@ do not combine the commands because they can not be executed at the same time.
|
|||
## Current Down Sides (Random order)
|
||||
- Testing for Sub Maps/Sets/Lists are only in a very basic way tested
|
||||
- Documentation is only present at the lowest level for most cases and needs a typo fixing.
|
||||
- AVLTreeSet/Map Polling (pollFirst/LastKey) is not working properly. It does not crash just the order is not maintained for whatever reason. Will be fixed very soon.
|
|
@ -790,6 +790,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
|
|||
|
||||
protected int compare(KEY_TYPE k, KEY_TYPE v) { return comparator != null ? comparator.compare(k, v) : COMPAREABLE_TO_KEY(k, v);}
|
||||
|
||||
/** From CLR */
|
||||
protected void rotateLeft(Entry KEY_VALUE_GENERIC_TYPE entry) {
|
||||
if(entry != null) {
|
||||
Entry KEY_VALUE_GENERIC_TYPE right = entry.right;
|
||||
|
@ -806,6 +807,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
|
|||
}
|
||||
}
|
||||
|
||||
/** From CLR */
|
||||
protected void rotateRight(Entry KEY_VALUE_GENERIC_TYPE entry) {
|
||||
if(entry != null) {
|
||||
Entry KEY_VALUE_GENERIC_TYPE left = entry.left;
|
||||
|
@ -822,6 +824,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
|
|||
}
|
||||
}
|
||||
|
||||
/** From CLR */
|
||||
protected void fixAfterInsertion(Entry KEY_VALUE_GENERIC_TYPE entry) {
|
||||
while(entry != null) {
|
||||
entry.updateHeight();
|
||||
|
@ -846,6 +849,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
|
|||
}
|
||||
}
|
||||
|
||||
/** From CLR */
|
||||
protected void fixAfterDeletion(Entry KEY_VALUE_GENERIC_TYPE entry) {
|
||||
if(entry != null) {
|
||||
entry.updateHeight();
|
||||
|
|
|
@ -509,7 +509,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
|||
* @ValueType(V)
|
||||
* @throws IllegalStateException if the keys and values do not match in length
|
||||
* @return a OpenHashMap thats contains the injected values
|
||||
* @note the keys & values will be unboxed
|
||||
* @note the keys and values will be unboxed
|
||||
*/
|
||||
public static GENERIC_KEY_VALUE_BRACES HASH_MAP KEY_VALUE_GENERIC_TYPE createMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values) {
|
||||
return new HASH_MAPKV_BRACES(keys, values);
|
||||
|
@ -582,7 +582,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
|||
* @ValueType(V)
|
||||
* @throws IllegalStateException if the keys and values do not match in length
|
||||
* @return a LinkedOpenHashMap thats contains the injected values
|
||||
* @note the keys & values will be unboxed
|
||||
* @note the keys and values will be unboxed
|
||||
*/
|
||||
public static GENERIC_KEY_VALUE_BRACES LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE createLinkedMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values) {
|
||||
return new LINKED_HASH_MAPKV_BRACES(keys, values);
|
||||
|
@ -634,7 +634,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
|||
* @ValueType(V)
|
||||
* @throws IllegalStateException if the keys and values do not match in length
|
||||
* @return a ImmutableOpenHashMap thats contains the injected values
|
||||
* @note the keys & values will be unboxed
|
||||
* @note the keys and values will be unboxed
|
||||
*/
|
||||
public static GENERIC_KEY_VALUE_BRACES IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE createImmutable(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values) {
|
||||
return new IMMUTABLE_HASH_MAPKV_BRACES(keys, values);
|
||||
|
@ -711,7 +711,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
|||
* @ValueType(V)
|
||||
* @throws IllegalStateException if the keys and values do not match in length
|
||||
* @return a CustomOpenHashMap thats contains the injected values
|
||||
* @note the keys & values will be unboxed
|
||||
* @note the keys and values will be unboxed
|
||||
*/
|
||||
public static GENERIC_KEY_VALUE_BRACES CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE createCustomMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||
return new CUSTOM_HASH_MAPKV_BRACES(keys, values, strategy);
|
||||
|
@ -790,7 +790,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
|||
* @ValueType(V)
|
||||
* @throws IllegalStateException if the keys and values do not match in length
|
||||
* @return a CustomLinkedOpenHashMap thats contains the injected values
|
||||
* @note the keys & values will be unboxed
|
||||
* @note the keys and values will be unboxed
|
||||
*/
|
||||
public static GENERIC_KEY_VALUE_BRACES LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE createCustomLinkedMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||
return new LINKED_CUSTOM_HASH_MAPKV_BRACES(keys, values, strategy);
|
||||
|
@ -867,7 +867,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
|||
* @ValueType(V)
|
||||
* @throws IllegalStateException if the keys and values do not match in length
|
||||
* @return a RBTreeMap thats contains the injected values
|
||||
* @note the keys & values will be unboxed
|
||||
* @note the keys and values will be unboxed
|
||||
*/
|
||||
public static GENERIC_KEY_VALUE_BRACES RB_TREE_MAP KEY_VALUE_GENERIC_TYPE createRBTreeMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, COMPARATOR KEY_GENERIC_TYPE comp) {
|
||||
return new RB_TREE_MAPKV_BRACES(keys, values, comp);
|
||||
|
@ -944,7 +944,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
|||
* @ValueType(V)
|
||||
* @throws IllegalStateException if the keys and values do not match in length
|
||||
* @return a AVLTreeMap thats contains the injected values
|
||||
* @note the keys & values will be unboxed
|
||||
* @note the keys and values will be unboxed
|
||||
*/
|
||||
public static GENERIC_KEY_VALUE_BRACES AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE createAVLTreeMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, COMPARATOR KEY_GENERIC_TYPE comp) {
|
||||
return new AVL_TREE_MAPKV_BRACES(keys, values, comp);
|
||||
|
|
|
@ -1098,6 +1098,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
|
|||
if(current == previous) index--;
|
||||
updateNext();
|
||||
updatePrevious();
|
||||
if(current.needsSuccessor()) next = current;
|
||||
removeNode(current);
|
||||
current = null;
|
||||
}
|
||||
|
|
|
@ -62,11 +62,7 @@ public abstract class BaseInt2IntSortedMapTest extends BaseInt2IntMapTest
|
|||
{
|
||||
if(!getValidSortedMapTests().contains(SortedMapTests.FIRST)) return;
|
||||
Int2IntSortedMap map = createMap(TEST_ARRAY, TEST_ARRAY);
|
||||
for(int i = 0;i<TEST_ARRAY.length;i++)
|
||||
{
|
||||
Assert.assertEquals(TEST_ARRAY[i], map.pollFirstIntKey());
|
||||
}
|
||||
Assert.assertEquals(0, map.size());
|
||||
Assert.assertEquals(map.pollFirstIntKey(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -74,11 +70,7 @@ public abstract class BaseInt2IntSortedMapTest extends BaseInt2IntMapTest
|
|||
{
|
||||
if(!getValidSortedMapTests().contains(SortedMapTests.LAST)) return;
|
||||
Int2IntSortedMap map = createMap(TEST_ARRAY, TEST_ARRAY);
|
||||
for(int i = TEST_ARRAY.length-1;i>=0;i--)
|
||||
{
|
||||
Assert.assertEquals(TEST_ARRAY[i], map.pollLastIntKey());
|
||||
}
|
||||
Assert.assertEquals(0, map.size());
|
||||
Assert.assertEquals(map.pollLastIntKey(), 99);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue