Package org.biopax.paxtools.util
Class BiopaxSafeSet<E extends BioPAXElement>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.biopax.paxtools.util.BiopaxSafeSet<E>
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,Set<E>
A thread-safe Set of BioPAX objects that also prevents adding several elements having the same URI.
This is backed by an internal Map (more memory but faster ~O(1) add/contains/remove operations).
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
addAll, clear, containsAll, isEmpty, retainAll, spliterator, toArray, toArray
-
Constructor Details
-
BiopaxSafeSet
public BiopaxSafeSet()
-
-
Method Details
-
iterator
- Specified by:
iteratorin interfaceCollection<E extends BioPAXElement>- Specified by:
iteratorin interfaceIterable<E extends BioPAXElement>- Specified by:
iteratorin interfaceSet<E extends BioPAXElement>- Specified by:
iteratorin classAbstractCollection<E extends BioPAXElement>
-
size
public int size()- Specified by:
sizein interfaceCollection<E extends BioPAXElement>- Specified by:
sizein interfaceSet<E extends BioPAXElement>- Specified by:
sizein classAbstractCollection<E extends BioPAXElement>
-
add
Adds a new element to the collection unless it is null, wrong type, or URI is blank, or already contains an element with the same URI and model interface. #- Specified by:
addin interfaceCollection<E extends BioPAXElement>- Specified by:
addin interfaceSet<E extends BioPAXElement>- Overrides:
addin classAbstractCollection<E extends BioPAXElement>- Parameters:
bpe- biopax object- Returns:
- true when the element was actually added to the set
- Throws:
NullPointerException- when bpe or uri is null
-
contains
#- Specified by:
containsin interfaceCollection<E extends BioPAXElement>- Specified by:
containsin interfaceSet<E extends BioPAXElement>- Overrides:
containsin classAbstractCollection<E extends BioPAXElement>- Throws:
NullPointerException- when o or o.uri is nullClassCastException- when the o is not a BioPAX element
-
remove
#- Specified by:
removein interfaceCollection<E extends BioPAXElement>- Specified by:
removein interfaceSet<E extends BioPAXElement>- Overrides:
removein classAbstractCollection<E extends BioPAXElement>- Throws:
NullPointerException- when o or o.uri is nullClassCastException- when the o is not a BioPAX element
-
get
Gets a BioPAX element by URI.- Parameters:
uri- absolute URI of a BioPAX individual- Returns:
- BioPAX object or null
-