new TrackingSet(a)
Constructs a TrackingSet, mirroring the behavior of Array constructor, with memory array size pre-allocation, and partial copy ctor
logic. All logic we have encapsulated into the constructor to avoid the overhead of additional function calls due to fake ctor
overloading.
Parameters:
Name | Type | Description |
---|---|---|
a |
undefined | TrackingSet | Set | Number | * | * If the first parameter is undefined because no parameters are given, an empty
TrackingSet will be created. * If the first and only parameter is a TrackingSet, see classes.common.TrackingSet._ctor_copy * If the first and only parameter is a JS Set object (or Set-like via T#__isSet), see classes.common.TrackingSet._ctor_set * If the first and only parameter is a number, see classes.common.TrackingSet._ctor_size |
Extends
- Array
Methods
-
static __new__()
-
Mimicks the behaviour of DepsCreatable for compatibility
-
static _ctor_copy(a) → {classes.common.TrackingSet}
-
Constructor "overload" when the first and only parameter is a TrackingSet. Copy ctor logic will be applied - elements will be copied by reference from the other TrackingSet's internal set property (unless primitives) and the set itself will be "moved" (reference copied). Take note: further modification to either TrackingSet will modify the same underlying set property but array locations will not be synced. This will break direct access with [] and map functions but not .has()
Parameters:
Name Type Description a
TrackingSet The input TrackingSet to load from. Returns:
classes.common.TrackingSet - The newly constructed TrackingSet -
static _ctor_set(a) → {classes.common.TrackingSet}
-
Constructor "overload" when the first and only parameter is a JS Set object (or is Set-like via T#__isSet), that set will be used to verify against future modifications to this TrackingSet. Furthermore, its values iterator will be looped to copy elements over by reference (unless primitives).
Parameters:
Name Type Description a
Set The input Set-like. Returns:
classes.common.TrackingSet - The newly constructed TrackingSet -
static _ctor_set(a) → {classes.common.TrackingSet}
-
Constructor "overload" when the first and only parameter is a JS number. This ctor matches that of new Array(N). However, memory pre-allocation will not occur because we use something similar to array.push() on item insertions, which may lead to index confusion. This ctor catches that possibility and does not forward the same call to super(). This ctor thus acts as if no arguments werep provided, though minutely slower.
Parameters:
Name Type Description a
Number Allocation size suggestion Returns:
classes.common.TrackingSet - The newly constructed TrackingSet