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 aHandle
with the specified id if one does not already exist and adds it to this set.boolean
Adds the specified element to this set if it is not already present.boolean
addAll
(Collection<? extends Handle> c) Adds all elements in the specified collection to this set if they're not already present.boolean
Returnstrue
if this set contains the specified element.boolean
containsAll
(Collection<?> c) Returnstrue
if this set contains all elements present in the specified collection.Returns allHandles
in this set containing the specified tag.getByTags
(Collection<?> tags) Returns allHandles
in this set containing the specified tags.boolean
Removes the specified element from this set if it is present.boolean
removeAll
(Collection<?> c) Removes from this set all of its elements that are contained in the specified collection.boolean
retainAll
(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, tailSet
Methods inherited from class java.util.AbstractSet
equals, hashCode
Methods inherited from class java.util.AbstractCollection
toArray, toArray, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.NavigableSet
removeFirst, removeLast, reversed
-
Constructor Details
-
TreeHandleSet
- Parameters:
space
-Space
to be associated with this setlogger
-Logger
for this set
-
TreeHandleSet
UsesLoggerFactory.getLogger(Class)
withTreeHandleSet.class
.- Parameters:
space
-Space
to be associated with this set
-
-
Method Details
-
get
-
add
Creates aHandle
with the specified id if one does not already exist and adds it to this set.- Specified by:
add
in interfaceHandleSet
- Parameters:
id
- id for the newHandle
- Returns:
- created or pre-existing
Handle
- Throws:
UnsupportedOperationException
- if theadd
operation is not supported by this setNullPointerException
- if the id isnull
IllegalArgumentException
- 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:
unmodifiable
in interfaceHandleSet
- Returns:
- unmodifiable version of this set
-
getByTag
Returns allHandles
in this set containing the specified tag. The tag may be aHandle
or itsString
id.- Specified by:
getByTag
in interfaceHandleSet
- Parameters:
tag
- tagHandle
or itsString
id- Returns:
- all
Handles
in this set containing the specified tag - Throws:
ClassCastException
- if the tag is not aHandle
or aString
NullPointerException
- if the tag isnull
IllegalArgumentException
- if theHandle
is not a tag
-
getByTags
Returns allHandles
in this set containing the specified tags. The tags may beHandles
or theirString
ids.- Specified by:
getByTags
in interfaceHandleSet
- Parameters:
tags
- tagHandles
or theirString
ids- Returns:
- all
Handles
in this set containing the specified tags - Throws:
ClassCastException
- if any of the tags is not aHandle
or aString
NullPointerException
- if the specified collection contains one or morenull
elements or if the collection itself isnull
IllegalArgumentException
- if any of theHandles
is not a tag
-
contains
Returnstrue
if this set contains the specified element. The element may be aHandle
or itsString
id.- Specified by:
contains
in interfaceCollection<Handle>
- Specified by:
contains
in interfaceHandleSet
- Specified by:
contains
in interfaceSet<Handle>
- Overrides:
contains
in classTreeSet<Handle>
- Parameters:
o
-Handle
element or itsString
id whose presence in this set is to be tested- Returns:
true
if this set contains the specified element- Throws:
ClassCastException
- if the object is of not aHandle
or aString
NullPointerException
- if the specified element isnull
-
add
Adds the specified element to this set if it is not already present. TheHandle
element must be present in this set's associatedSpace
.- Specified by:
add
in interfaceCollection<Handle>
- Specified by:
add
in interfaceHandleSet
- Specified by:
add
in interfaceSet<Handle>
- Overrides:
add
in classTreeSet<Handle>
- Parameters:
handle
- element to be added to this set- Returns:
true
if this set did not already contain the specified element- Throws:
UnsupportedOperationException
- if theadd
operation is not supported by this setNullPointerException
- if the specified element isnull
IllegalArgumentException
- if theHandle
element is not present in this set's associatedSpace
-
remove
Removes the specified element from this set if it is present. The element may be aHandle
or itsString
id.- Specified by:
remove
in interfaceCollection<Handle>
- Specified by:
remove
in interfaceHandleSet
- Specified by:
remove
in interfaceSet<Handle>
- Overrides:
remove
in classTreeSet<Handle>
- Parameters:
o
-Handle
element or itsString
id to be removed from this set, if present- Returns:
true
if this set contained the specified element- Throws:
UnsupportedOperationException
- if theremove
operation is not supported by this setClassCastException
- if the object is of not aHandle
or aString
NullPointerException
- if the specified element isnull
-
containsAll
Returnstrue
if this set contains all elements present in the specified collection. The elements may beHandles
or theirString
ids.- Specified by:
containsAll
in interfaceCollection<Handle>
- Specified by:
containsAll
in interfaceHandleSet
- Specified by:
containsAll
in interfaceSet<Handle>
- Overrides:
containsAll
in classAbstractCollection<Handle>
- Parameters:
c
-Handle
elements or theirString
ids to be checked for containment in this set- Returns:
true
if this set contains all elements of the specified collection- Throws:
ClassCastException
- if any of the elements is not aHandle
or aString
NullPointerException
- if the specified collection contains one or morenull
elements
-
addAll
Adds all elements in the specified collection to this set if they're not already present. TheHandle
elements must be present in this set's associatedSpace
.- Specified by:
addAll
in interfaceCollection<Handle>
- Specified by:
addAll
in interfaceHandleSet
- Specified by:
addAll
in interfaceSet<Handle>
- Overrides:
addAll
in classTreeSet<Handle>
- Parameters:
c
- collection containing elements to be added to this set- Returns:
true
if this set changed as a result of the call- Throws:
UnsupportedOperationException
- if theaddAll
operation is not supported by this setNullPointerException
- if the specified collection contains one or morenull
elementsIllegalArgumentException
- if any of theHandle
elements 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 beHandles
or theirString
ids.- Specified by:
retainAll
in interfaceCollection<Handle>
- Specified by:
retainAll
in interfaceHandleSet
- Specified by:
retainAll
in interfaceSet<Handle>
- Overrides:
retainAll
in classAbstractCollection<Handle>
- Parameters:
c
- collection containing elements to be retained in this set- Returns:
true
if this set changed as a result of the call- Throws:
UnsupportedOperationException
- if theretainAll
operation is not supported by this setClassCastException
- if any of the elements is not aHandle
or aString
NullPointerException
- if the specified collection contains anull
element
-
removeAll
Removes from this set all of its elements that are contained in the specified collection. The elements may beHandles
or theirString
ids.- Specified by:
removeAll
in interfaceCollection<Handle>
- Specified by:
removeAll
in interfaceHandleSet
- Specified by:
removeAll
in interfaceSet<Handle>
- Overrides:
removeAll
in classAbstractSet<Handle>
- Parameters:
c
- collection containing elements to be removed from this set- Returns:
true
if this set changed as a result of the call- Throws:
UnsupportedOperationException
- if theremoveAll
operation is not supported by this setClassCastException
- if any of the elements is not aHandle
or aString
NullPointerException
- if the specified collection contains anull
element
-