59 lines
1.8 KiB
Plaintext
59 lines
1.8 KiB
Plaintext
|
package speiger.src.collections.PACKAGE.queues;
|
||
|
|
||
|
#if TYPE_OBJECT
|
||
|
import java.util.Comparator;
|
||
|
#else
|
||
|
import speiger.src.collections.PACKAGE.collections.ITERABLE;
|
||
|
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
||
|
import speiger.src.collections.objects.queues.ObjectPriorityQueue;
|
||
|
#endif
|
||
|
|
||
|
#if TYPE_OBJECT
|
||
|
public interface PRIORITY_QUEUE KEY_GENERIC_TYPE extends Iterable<KEY_TYPE>
|
||
|
#else
|
||
|
public interface PRIORITY_QUEUE KEY_GENERIC_TYPE extends ObjectPriorityQueue<CLASS_TYPE>, ITERABLE KEY_GENERIC_TYPE
|
||
|
#endif
|
||
|
{
|
||
|
#if TYPE_OBJECT
|
||
|
public default boolean isEmpty() { return size() <= 0; }
|
||
|
public int size();
|
||
|
public void clear();
|
||
|
|
||
|
#endif
|
||
|
public void ENQUEUE(KEY_TYPE e);
|
||
|
public KEY_TYPE DEQUEUE();
|
||
|
|
||
|
public KEY_TYPE PEEK(int index);
|
||
|
public default KEY_TYPE FIRST_KEY() { return peek(0); }
|
||
|
public default KEY_TYPE LAST_KEY() { return peek(size()-1); }
|
||
|
|
||
|
public boolean REMOVE(KEY_TYPE e);
|
||
|
public boolean REMOVE_LAST(KEY_TYPE e);
|
||
|
|
||
|
public void onChanged();
|
||
|
|
||
|
@PrimitiveOverride
|
||
|
public COMPARATOR KEY_SUPER_GENERIC_TYPE comparator();
|
||
|
|
||
|
public default KEY_TYPE[] TO_ARRAY() { return TO_ARRAY(NEW_KEY_ARRAY(size())); }
|
||
|
public KEY_TYPE[] TO_ARRAY(KEY_TYPE[] input);
|
||
|
|
||
|
#if !TYPE_OBJECT
|
||
|
public default void enqueue(CLASS_TYPE e) { ENQUEUE(OBJ_TO_KEY(e)); }
|
||
|
public default CLASS_TYPE dequeue() { return KEY_TO_OBJ(DEQUEUE()); }
|
||
|
|
||
|
public default CLASS_TYPE peek(int index) { return KEY_TO_OBJ(PEEK(index)); }
|
||
|
public default CLASS_TYPE first() { return peek(0); }
|
||
|
public default CLASS_TYPE last() { return peek(size()-1); }
|
||
|
|
||
|
public default boolean remove(CLASS_TYPE e) { return REMOVE(OBJ_TO_KEY(e)); }
|
||
|
public default boolean removeLast(CLASS_TYPE e) { return REMOVE_LAST(OBJ_TO_KEY(e)); }
|
||
|
|
||
|
@Deprecated
|
||
|
public default CLASS_TYPE[] toArray() { return toArray(new CLASS_TYPE[size()]); }
|
||
|
@Deprecated
|
||
|
public CLASS_TYPE[] toArray(CLASS_TYPE[] input);
|
||
|
|
||
|
#endif
|
||
|
}
|