Package me.datafox.dfxengine.handles.api
Interface HandleSet
- All Known Implementing Classes:
HashHandleSet,TreeHandleSet
-
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.getSpace()Returns theSpaceassociated with this set.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 interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Method Details
-
getSpace
Space getSpace()Returns theSpaceassociated with this set. AllHandlespresent in this set must be associated with this space.- Returns:
Spaceassociated with this set
-
get
- Parameters:
id-Stringid of aHandle- Returns:
Handlewith the given id, ornullif none is present- Throws:
NullPointerException- if the specified id isnull
-
add
Creates aHandlewith the specified id if one does not already exist and adds it to this set.- 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
HandleSet unmodifiable()Returns an unmodifiable version of this set. All changes made to the original set will be reflected in the returned one.- Returns:
- unmodifiable version of this set
-
getByTag
Returns allHandlesin this set containing the specified tag. The tag may be aHandleor itsStringid.- 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.- 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 interfaceSet<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 interfaceSet<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 interfaceSet<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 interfaceSet<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 or if the collection itself isnull
-
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 interfaceSet<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 morenullelements or if the collection itself isnullIllegalArgumentException- 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 interfaceSet<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 one or morenullelements or if the collection itself isnull
-
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 interfaceSet<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 one or morenullelements or if the collection itself isnull
-