Package org.semanticweb.owlapi.util
Class PriorityCollection<T extends Serializable>
java.lang.Object
org.semanticweb.owlapi.util.PriorityCollection<T>
- Type Parameters:
T
- type of the collection
- All Implemented Interfaces:
Serializable
,Iterable<T>
- Direct Known Subclasses:
ConcurrentPriorityCollection
public class PriorityCollection<T extends Serializable>
extends Object
implements Iterable<T>, Serializable
A collection that is sorted by HasPriority annotation on its members.
- Since:
- 4.0.0
- Author:
- ignazio
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the arguments and sort according to the PriorityCollectionSorting value for the manager configuration.void
Add the argument and sort according to the PriorityCollectionSorting value for the manager configuration.void
Add the arguments and sort according to the PriorityCollectionSorting value for the manager configuration.void
clear()
Remove all elements from the collection.getByMIMEType
(String mimeType) Returns the first item matching the mime type
NOTE: The order in which the services are loaded an examined is not deterministic so this method may return different results if the MIME-Type matches more than one item.boolean
isEmpty()
iterator()
void
Remove the argument.void
Remove the arguments.void
void
void
Remove all elements, replace with the arguments and sort according to priority.int
size()
toString()
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
PriorityCollection
- Parameters:
sorting
- the configuration holder for sort settings.
-
-
Method Details
-
isEmpty
public boolean isEmpty()- Returns:
- true if the collection is empty
-
size
public int size()- Returns:
- size of the collection
-
set
- Parameters:
c
- collection of elements to set. Existing elements will be removed, and the priority collection will be sorted according to the PriorityCollectionSorting value for the manager configuration.
-
set
- Parameters:
c
- collection of elements to set. Existing elements will be removed, and the priority collection will be sorted according to the PriorityCollectionSorting value for the manager configuration.
-
set
Remove all elements, replace with the arguments and sort according to priority.- Parameters:
c
- list of elements to set
-
add
Add the arguments and sort according to the PriorityCollectionSorting value for the manager configuration.- Parameters:
c
- list of elements to add
-
add
Add the argument and sort according to the PriorityCollectionSorting value for the manager configuration.- Parameters:
t
- element to add
-
add
Add the arguments and sort according to the PriorityCollectionSorting value for the manager configuration.- Parameters:
c
- list of elements to add
-
remove
Remove the arguments.- Parameters:
c
- list of elements to remove
-
remove
Remove the argument.- Parameters:
c
- element to remove
-
clear
public void clear()Remove all elements from the collection. -
iterator
- Specified by:
iterator
in interfaceIterable<T extends Serializable>
-
getByMIMEType
Returns the first item matching the mime type
NOTE: The order in which the services are loaded an examined is not deterministic so this method may return different results if the MIME-Type matches more than one item. However, if the default MIME-Types are always unique, the correct item will always be chosen- Parameters:
mimeType
- A MIME type to use for choosing an item- Returns:
- An item matching the given mime type or null if none were found.
-
toString
-