Id64.Uint32Set Class

A specialized replacement for Set optimized for performance-critical code which represents large sets of Id64s as pairs of 32-bit integers. The internal representation is a Map<number, Set> where the Map key is the upper 4 bytes of the IDs and the Set elements are the lower 4 bytes of the IDs. Because the upper 4 bytes store the 24-bit briefcase ID plus the upper 8 bits of the local ID, there will be a very small distribution of unique Map keys. To further optimize this data type, the following assumptions are made regarding the { lower, upper } inputs, and no validation is performed to confirm them:

  • The inputs are unsigned 32-bit integers;
  • The inputs represent a valid Id64String (e.g., local ID is not zero).

@see Uint32Map for a similarly-optimized replacement for Map<Id64String, T>

Methods

Name Description
constructor(ids?: Id64Arg): Id64.Uint32Set Construct a new Uint32Set.  
add(low: number, high: number): void Add an Id to the set.  
addId(id: string): void Add an Id to the set.  
addIds(ids: Id64Arg): void Add any number of Ids to the set.  
clear(): void Remove all contents of this set.  
delete(low: number, high: number): void Remove an Id from the set.  
deleteId(id: string): void Remove an Id from the set.  
deleteIds(ids: Id64Arg): void Remove any number of Ids from the set.  
equals(other: Id64.Uint32Set): boolean Return true if this and other contain the same set of Ids.  
forEach(func: (lo: number, hi: number) => void): void Execute a function against each Id in this set.  
has(low: number, high: number): boolean Returns true if the set contains the specified Id.  
hasId(id: string): boolean Returns true if the set contains the specified Id.  
hasPair(pair: Id64.Uint32Pair): boolean Returns true if the set contains the Id specified by pair.  
toId64Array(): Id64Array Populates and returns an array of all Ids contained in the set.  
toId64Set(): Id64Set Populates and returns a set of all Ids contained in the set.  

Properties

Name Type Description
_map Protected Readonly Map<number, Set<number>>    
isEmpty Accessor ReadOnly boolean Returns true if the set contains no Ids.  
size Accessor ReadOnly number Returns the number of Ids contained in the set.  

Defined in

Last Updated: 14 November, 2024