Package convex.core.data
Class AHashSet<T extends ACell>
java.lang.Object
convex.core.data.AObject
convex.core.data.ACell
convex.core.data.ACountable<E>
convex.core.data.ADataStructure<T>
convex.core.data.ACollection<T>
convex.core.data.ASet<T>
convex.core.data.AHashSet<T>
- All Implemented Interfaces:
IAssociative<T,,CVMBool> IValidated,IWriteable,Iterable<T>,Collection<T>,Set<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intFields inherited from class convex.core.data.ADataStructure
countFields inherited from class convex.core.data.ACell
cachedRef, EMPTY_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplySelf(int setOp) conj(R a) Adds an element to this collection, according to the natural semantics of the collectionconjAll(ACollection<R> elements) Adds multiple elements to this data structure, in the natural manner defined by the general data structure type.booleanTests if this Set contains a given valueabstract booleancontainsHash(Hash hash) Tests if this Set contains a given hashdisjAll(ACollection<T> b) Removes all elements from this set, returning a new set.Updates the set to exclude the given elementexcludeAll(ASet<T> elements) Updates the set to exclude all the given elements.excludeRef(Ref<T> valueRef) final CVMBoolGet the value associated with a given key.Gets the Value in the set for the given hash, or null if not foundinclude(R a) Updates the set to include the given elementincludeAll(ASet<R> elements) Updates the set to include all the given elements.includeRef(Ref<T> ref) Adds a value to this set using a Ref to the valueincludeRef(Ref<T> e, int i) intersectAll(ASet<T> elements) Returns the intersection of two setsprotected final intreverseOp(int setOp) Object[]toArray()Converts this Cell to its canonical version.protected abstract voidvalidateWithPrefix(Hash prefix, int digit, int position) Validates the set with a given hex prefix.Methods inherited from class convex.core.data.ASet
assoc, contains, containsAll, containsKey, empty, get, get, getRefByHash, getTag, getType, getValueRef, isSubset, map, print, slice, slice, toVectorMethods inherited from class convex.core.data.ACollection
add, addAll, clear, containsAll, copyToArray, encode, iterator, remove, removeAll, retainAll, toArray, toCellArrayMethods inherited from class convex.core.data.ADataStructure
checkIndex, count, isEmpty, size, toCVMStringMethods inherited from class convex.core.data.ACountable
getElementRefMethods inherited from class convex.core.data.ACell
announce, announce, attachMemorySize, attachRef, cachedEncoding, cachedHash, calcMemorySize, createAnnounced, createEncoding, createPersisted, createPersisted, createRef, encodeRaw, equals, equals, getCanonical, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getRef, getRef, getRefCount, hashCode, isCanonical, isCompletelyEncoded, isCVMValue, isEmbedded, mark, mark, toString, updateRefs, validate, validateCellMethods inherited from class convex.core.data.AObject
attachEncoding, print, printMethods 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 convex.core.data.IWriteable
estimatedEncodingSize
-
Field Details
-
OP_UNION
protected static final int OP_UNION- See Also:
-
OP_INTERSECTION
protected static final int OP_INTERSECTION- See Also:
-
OP_DIFF_LEFT
protected static final int OP_DIFF_LEFT- See Also:
-
OP_DIFF_RIGHT
protected static final int OP_DIFF_RIGHT- See Also:
-
MAX_SHIFT
protected static final int MAX_SHIFT- See Also:
-
-
Constructor Details
-
AHashSet
protected AHashSet(long count)
-
-
Method Details
-
mergeWith
-
mergeWith
-
includeAll
Description copied from class:ASetUpdates the set to include all the given elements. Can be used to implement union of sets- Specified by:
includeAllin classASet<T extends ACell>- Parameters:
elements- Elements to include- Returns:
- Updated set
-
reverseOp
protected final int reverseOp(int setOp) -
applyOp
-
applySelf
-
intersectAll
Description copied from class:ASetReturns the intersection of two sets- Specified by:
intersectAllin classASet<T extends ACell>- Parameters:
elements- Set to intersect with- Returns:
- Intersection of the two sets
-
excludeAll
Description copied from class:ASetUpdates the set to exclude all the given elements.- Specified by:
excludeAllin classASet<T extends ACell>- Parameters:
elements- Elements to exclude- Returns:
- Updated set
-
toCanonical
Description copied from class:ACellConverts this Cell to its canonical version. Must return this Cell if already canonical, may be O(n) in size of value otherwise.- Specified by:
toCanonicalin classACell- Returns:
- Canonical version of Cell
-
conjAll
Description copied from class:ADataStructureAdds multiple elements to this data structure, in the natural manner defined by the general data structure type. e.g. append at the end of a vector. This may be more efficient than using 'conj' for individual items. -
disjAll
Description copied from class:ASetRemoves all elements from this set, returning a new set. -
excludeRef
-
includeRef
Description copied from class:ASetAdds a value to this set using a Ref to the value- Specified by:
includeRefin classASet<T extends ACell>- Parameters:
ref- Ref to value to include- Returns:
- Updated set
-
conj
Description copied from class:ACollectionAdds an element to this collection, according to the natural semantics of the collection -
exclude
Description copied from class:ASetUpdates the set to exclude the given element -
include
Description copied from class:ASetUpdates the set to include the given element -
validateWithPrefix
protected abstract void validateWithPrefix(Hash prefix, int digit, int position) throws InvalidDataException Validates the set with a given hex prefix. This is necessary to ensure that child maps are valid, in particular have the correct shift level and that all hashes start with the correct prefix of hex characters.- Parameters:
prefix- Hash for earlier prefix valuesdigit- Hex digit expected at position [shift]- Throws:
InvalidDataException
-
toArray
-
get
Description copied from class:ADataStructureGet the value associated with a given key. -
getByHash
Gets the Value in the set for the given hash, or null if not found- Parameters:
hash- Hash of value to check in set- Returns:
- The Value for the given Hash if found, null otherwise.
-
includeRef
-
containsHash
Tests if this Set contains a given hash- Parameters:
hash- Hash to test for set membership- Returns:
- True if set contains value for given hash, false otherwise
-
contains
Description copied from class:ASetTests if this Set contains a given value
-