Package convex.core.data
Class AHashSet<T extends ACell>
java.lang.Object
convex.core.data.AObject
convex.core.data.ACell
convex.core.data.ACountable<T>
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, memorySize -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplySelf(int setOp) Adds an element to this collection, according to the natural semantics of the collectionconjAll(ACollection<? extends T> 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<?> valueRef) final CVMBoolGet the value associated with a given key.Gets the Value in the set for the given hash, or null if not foundUpdates the set to include the given elementincludeAll(ASet<? extends T> 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 a 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, isDataValue, isEmpty, size, toCVMStringMethods inherited from class convex.core.data.ACountable
getElementRefMethods inherited from class convex.core.data.ACell
attachMemorySize, attachRef, cachedEncoding, cachedHash, calcMemorySize, createEncoding, createRef, encodeRaw, equals, equals, genericEquals, getCanonical, getChildRefs, getEncoding, getEncodingLength, getHash, getMemorySize, getMemorySize, getRef, getRef, getRefCount, hashCode, isCanonical, isCVMValue, isEmbedded, 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
-
excludeAll
-
toCanonical
Description copied from class:ACellConverts this Cell to a canonical version. Must return this Cell if already canonical, may be O(n) in size of value otherwise. Callers should usually use getCanonical(), which caches canonical instances once created- 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
-
excludeRef
-
includeRef
-
conj
Description copied from class:ACollectionAdds an element to this collection, according to the natural semantics of the collection -
exclude
-
include
-
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
-
getByHash
-
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
-