Package me.datafox.dfxengine.handles
Class TreeHandleSet
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<Handle>,Collection<Handle>,NavigableSet<Handle>,SequencedCollection<Handle>,SequencedSet<Handle>,Set<Handle>,SortedSet<Handle>,HandleSet
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTreeHandleSet(Space space) UsesLoggerFactory.getLogger(Class)withTreeHandleSet.class.TreeHandleSet(Space space, org.slf4j.Logger logger) -
Method Summary
Modifier and TypeMethodDescriptionCreates aHandlewith the specified id if one does not already exist and adds it to this set.booleanAdds the specified element to this set if it is not already present.booleanaddAll(Collection<? extends Handle> c) Adds all elements in the specified collection to this set if they're not already present.booleanReturnstrueif this set contains the specified element.booleancontainsAll(Collection<?> c) Returnstrueif this set contains all elements present in the specified collection.Returns allHandlesin this set containing the specified tag.getByTags(Collection<?> tags) Returns allHandlesin this set containing the specified tags.booleanRemoves the specified element from this set if it is present.booleanremoveAll(Collection<?> c) Removes from this set all of its elements that are contained in the specified collection.booleanretainAll(Collection<?> c) Retains only the elements in this set that are contained in the specified collection.Returns an unmodifiable version of this set.Methods inherited from class java.util.TreeSet
addFirst, addLast, ceiling, clear, clone, comparator, descendingIterator, descendingSet, first, floor, headSet, headSet, higher, isEmpty, iterator, last, lower, pollFirst, pollLast, size, spliterator, subSet, subSet, tailSet, tailSetMethods inherited from class java.util.AbstractSet
equals, hashCodeMethods inherited from class java.util.AbstractCollection
toArray, toArray, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.NavigableSet
removeFirst, removeLast, reversed
-
Constructor Details
-
TreeHandleSet
- Parameters:
space-Spaceto be associated with this setlogger-Loggerfor this set
-
TreeHandleSet
UsesLoggerFactory.getLogger(Class)withTreeHandleSet.class.- Parameters:
space-Spaceto be associated with this set
-
-
Method Details
-
get
-
add
Creates aHandlewith the specified id if one does not already exist and adds it to this set.- Specified by:
addin interfaceHandleSet- Parameters:
id- id for the newHandle- Returns:
- created or pre-existing
Handle - Throws:
UnsupportedOperationException- if theaddoperation is not supported by this setNullPointerException- if the id isnullIllegalArgumentException- if the id is empty, blank, contains non-ASCII or non-printable characters or more than one colon (:)
-
unmodifiable
Returns an unmodifiable version of this set. All changes made to the original set will be reflected in the returned one.- Specified by:
unmodifiablein interfaceHandleSet- Returns:
- unmodifiable version of this set
-
getByTag
Returns allHandlesin this set containing the specified tag. The tag may be aHandleor itsStringid.- Specified by:
getByTagin interfaceHandleSet- Parameters:
tag- tagHandleor itsStringid- Returns:
- all
Handlesin this set containing the specified tag - Throws:
ClassCastException- if the tag is not aHandleor aStringNullPointerException- if the tag isnullIllegalArgumentException- if theHandleis not a tag
-
getByTags
Returns allHandlesin this set containing the specified tags. The tags may beHandlesor theirStringids.- Specified by:
getByTagsin interfaceHandleSet- Parameters:
tags- tagHandlesor theirStringids- Returns:
- all
Handlesin this set containing the specified tags - Throws:
ClassCastException- if any of the tags is not aHandleor aStringNullPointerException- if the specified collection contains one or morenullelements or if the collection itself isnullIllegalArgumentException- if any of theHandlesis not a tag
-
contains
Returnstrueif this set contains the specified element. The element may be aHandleor itsStringid.- Specified by:
containsin interfaceCollection<Handle>- Specified by:
containsin interfaceHandleSet- Specified by:
containsin interfaceSet<Handle>- Overrides:
containsin classTreeSet<Handle>- Parameters:
o-Handleelement or itsStringid whose presence in this set is to be tested- Returns:
trueif this set contains the specified element- Throws:
ClassCastException- if the object is of not aHandleor aStringNullPointerException- if the specified element isnull
-
add
Adds the specified element to this set if it is not already present. TheHandleelement must be present in this set's associatedSpace.- Specified by:
addin interfaceCollection<Handle>- Specified by:
addin interfaceHandleSet- Specified by:
addin interfaceSet<Handle>- Overrides:
addin classTreeSet<Handle>- Parameters:
handle- element to be added to this set- Returns:
trueif this set did not already contain the specified element- Throws:
UnsupportedOperationException- if theaddoperation is not supported by this setNullPointerException- if the specified element isnullIllegalArgumentException- if theHandleelement is not present in this set's associatedSpace
-
remove
Removes the specified element from this set if it is present. The element may be aHandleor itsStringid.- Specified by:
removein interfaceCollection<Handle>- Specified by:
removein interfaceHandleSet- Specified by:
removein interfaceSet<Handle>- Overrides:
removein classTreeSet<Handle>- Parameters:
o-Handleelement or itsStringid to be removed from this set, if present- Returns:
trueif this set contained the specified element- Throws:
UnsupportedOperationException- if theremoveoperation is not supported by this setClassCastException- if the object is of not aHandleor aStringNullPointerException- if the specified element isnull
-
containsAll
Returnstrueif this set contains all elements present in the specified collection. The elements may beHandlesor theirStringids.- Specified by:
containsAllin interfaceCollection<Handle>- Specified by:
containsAllin interfaceHandleSet- Specified by:
containsAllin interfaceSet<Handle>- Overrides:
containsAllin classAbstractCollection<Handle>- Parameters:
c-Handleelements or theirStringids to be checked for containment in this set- Returns:
trueif this set contains all elements of the specified collection- Throws:
ClassCastException- if any of the elements is not aHandleor aStringNullPointerException- if the specified collection contains one or morenullelements
-
addAll
Adds all elements in the specified collection to this set if they're not already present. TheHandleelements must be present in this set's associatedSpace.- Specified by:
addAllin interfaceCollection<Handle>- Specified by:
addAllin interfaceHandleSet- Specified by:
addAllin interfaceSet<Handle>- Overrides:
addAllin classTreeSet<Handle>- Parameters:
c- collection containing elements to be added to this set- Returns:
trueif this set changed as a result of the call- Throws:
UnsupportedOperationException- if theaddAlloperation is not supported by this setNullPointerException- if the specified collection contains one or morenullelementsIllegalArgumentException- if any of theHandleelements is not present within this set's associatedSpace
-
retainAll
Retains only the elements in this set that are contained in the specified collection. The elements may beHandlesor theirStringids.- Specified by:
retainAllin interfaceCollection<Handle>- Specified by:
retainAllin interfaceHandleSet- Specified by:
retainAllin interfaceSet<Handle>- Overrides:
retainAllin classAbstractCollection<Handle>- Parameters:
c- collection containing elements to be retained in this set- Returns:
trueif this set changed as a result of the call- Throws:
UnsupportedOperationException- if theretainAlloperation is not supported by this setClassCastException- if any of the elements is not aHandleor aStringNullPointerException- if the specified collection contains anullelement
-
removeAll
Removes from this set all of its elements that are contained in the specified collection. The elements may beHandlesor theirStringids.- Specified by:
removeAllin interfaceCollection<Handle>- Specified by:
removeAllin interfaceHandleSet- Specified by:
removeAllin interfaceSet<Handle>- Overrides:
removeAllin classAbstractSet<Handle>- Parameters:
c- collection containing elements to be removed from this set- Returns:
trueif this set changed as a result of the call- Throws:
UnsupportedOperationException- if theremoveAlloperation is not supported by this setClassCastException- if any of the elements is not aHandleor aStringNullPointerException- if the specified collection contains anullelement
-