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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add the arguments and sort according to the PriorityCollectionSorting value for the manager configuration.
    void
    add(T t)
    Add the argument and sort according to the PriorityCollectionSorting value for the manager configuration.
    void
    add(T... c)
    Add the arguments and sort according to the PriorityCollectionSorting value for the manager configuration.
    void
    Remove all elements from the collection.
    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
     
     
    void
    remove(T c)
    Remove the argument.
    void
    remove(T... c)
    Remove the arguments.
    void
     
    void
    set(Set<T> c)
     
    void
    set(T... c)
    Remove all elements, replace with the arguments and sort according to priority.
    int
     
     

    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

      public PriorityCollection(PriorityCollectionSorting sorting)
      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

      public void set(Iterable<T> c)
      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

      public void set(Set<T> c)
      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

      public void set(T... c)
      Remove all elements, replace with the arguments and sort according to priority.
      Parameters:
      c - list of elements to set
    • add

      public void add(T... c)
      Add the arguments and sort according to the PriorityCollectionSorting value for the manager configuration.
      Parameters:
      c - list of elements to add
    • add

      public void add(T t)
      Add the argument and sort according to the PriorityCollectionSorting value for the manager configuration.
      Parameters:
      t - element to add
    • add

      public void add(Iterable<T> c)
      Add the arguments and sort according to the PriorityCollectionSorting value for the manager configuration.
      Parameters:
      c - list of elements to add
    • remove

      public void remove(T... c)
      Remove the arguments.
      Parameters:
      c - list of elements to remove
    • remove

      public void remove(T c)
      Remove the argument.
      Parameters:
      c - element to remove
    • clear

      public void clear()
      Remove all elements from the collection.
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T extends Serializable>
    • getByMIMEType

      public PriorityCollection<T> 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. 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

      public String toString()
      Overrides:
      toString in class Object