IndexedCollectionInterval<T extends CollectionWithLength> Class

Object describing a (contiguous) subset of indices to an IndexedXYZCollection

Extended by

Methods

Name Description
constructor(points: T extends CollectionWithLength, base: number, limit: number): IndexedCollectionInterval Protected    
advanceBegin(): boolean Add one to this.begin.  
advanceEnd(): boolean advance this.end (but do not go beyond this.points.length) return true if the interval is still live.  
advanceToHead(other: IndexedCollectionInterval<T extends CollectionWithLength>): boolean Advance this.begin to (other.begin), i.e.  
advanceToTail(other: IndexedCollectionInterval<T extends CollectionWithLength>): boolean Advance this.begin to (other.end-1), i.e.  
localIndexToParentIndex(localIndex: number): number | undefined Return (if possible) the parent index corresponding to localIndex  
restrictEnd(): void restrict this.end to this.points.length  
setFrom(other: IndexedCollectionInterval<T extends CollectionWithLength>, base?: number, limit?: number): void Set this interval from another, with conditional replacements:
* Always reference the same points as other.
 
createBeginEnd<T extends CollectionWithLength>(points: T extends CollectionWithLength, begin: number, end: number): IndexedCollectionInterval<T extends CollectionWithLength> Static Create an interval which matches a collection from start <= i < end.  
createBeginLength<T extends CollectionWithLength>(points: T extends CollectionWithLength, begin: number, length: number): IndexedCollectionInterval<T extends CollectionWithLength> Static Create an interval which matches a collection from start <= i < end.  
createComplete<T extends CollectionWithLength>(points: T extends CollectionWithLength): IndexedCollectionInterval<T extends CollectionWithLength> Static Create an interval which matches a complete indexed collection.  

Properties

Name Type Description
begin number lower limit of index range  
end number upper limit (beyond) index range.  
isNonEmpty Accessor ReadOnly boolean Return true if length is 1 or more  
isSingleton Accessor ReadOnly boolean Return true if the length is exactly 1  
isValidSubset Accessor ReadOnly boolean Return true if
the interval is empty (the empty set is a subset of all sets!)
all indices in its range are valid.
 
length Accessor ReadOnly number Return the number of steps possible with current begin and end  
points T extends CollectionWithLength Any collection that has a .length member or property  

Defined in

Last Updated: 08 January, 2020