Added Priority Queue Module

This commit is contained in:
2022-12-07 05:30:23 +01:00
parent ce9343348e
commit 3ce52668df
9 changed files with 323 additions and 210 deletions
@@ -37,8 +37,8 @@ import speiger.src.collections.PACKAGE.lists.LINKED_LIST;
#endif
#if !TYPE_BOOLEAN && OBJECT_ASYNC_MODULE
#if SET_MODULE
import speiger.src.collections.PACKAGE.sets.SET;
#if LINKED_SET_FEATURE || LINKED_CUSTOM_SET_FEATURE || SET_FEATURE || CUSTOM_SET_FEATURE || RB_TREE_SET_FEATURE || AVL_TREE_SET_FEATURE || ARRAY_SET_FEATURE
import speiger.src.collections.PACKAGE.sets.SET;
#if LINKED_SET_FEATURE
import speiger.src.collections.PACKAGE.sets.LINKED_HASH_SET;
#else if LINKED_CUSTOM_SET_FEATURE
@@ -11,7 +11,9 @@ import speiger.src.collections.PACKAGE.collections.COLLECTION;
#if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
#endif
#if DEQUEUE_FEATURE
import speiger.src.collections.PACKAGE.queues.PRIORITY_DEQUEUE;
#endif
import speiger.src.collections.PACKAGE.queues.PRIORITY_QUEUE;
#if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.functions.CONSUMER;
@@ -46,6 +48,7 @@ public class PRIORITY_QUEUES
return queue instanceof SynchronizedPriorityQueue ? (SynchronizedPriorityQueue KEY_GENERIC_TYPE)queue : new SynchronizedPriorityQueueBRACES(queue, mutex);
}
#if DEQUEUE_FEATURE
/**
* Returns a synchronized PriorityDequeue instance based on the instance given.
* @param dequeue that should be synchronized
@@ -67,6 +70,7 @@ public class PRIORITY_QUEUES
return dequeue instanceof SynchronizedPriorityDequeue ? (SynchronizedPriorityDequeue KEY_GENERIC_TYPE)dequeue : new SynchronizedPriorityDequeueBRACES(dequeue, mutex);
}
#endif
/**
* Wrapper class for synchronization
* @Type(T)
@@ -134,6 +138,7 @@ public class PRIORITY_QUEUES
public int count(PREDICATE KEY_GENERIC_TYPE filter) { synchronized(mutex) { return queue.count(filter); } }
}
#if DEQUEUE_FEATURE
/**
* Wrapper class for synchronization
* @Type(T)
@@ -166,4 +171,5 @@ public class PRIORITY_QUEUES
@Override
public PRIORITY_DEQUEUE KEY_GENERIC_TYPE copy() { synchronized(mutex) { return dequeue.copy(); } }
}
#endif
}