Attributes | Name and Description |
---|---|
|
caplin.core.SlidingWindow( nSize)
Creates a SlidingWindow, which allows a maximum number of items to be stored. |
Attributes | Name and Description |
---|---|
|
void
clear()
Clears all items from this SlidingWindow and resets it. |
|
void
forEach(Function func)
Iterates over each of the items in this window from oldest to newest. |
|
void
get( n)
|
|
void
getSize()
|
|
void
newest()
|
|
void
oldest()
|
|
void
push(Object oObject)
Adds an item into the end of this sliding window, possibly pushing an item out of the window in the process. |
|
void
setSize(Number nNewSize)
Changes the size of a SlidingWindow. |
|
String
toString()
|
►
caplin.core.SlidingWindow( nSize)
Creates a SlidingWindow, which allows a maximum number of items to be stored.
nSize | {Number} The maximum size of this window. This must be an integer larger than 0. |
►
void
clear()
Clears all items from this SlidingWindow and resets it.
►
void
forEach(Function func)
Iterates over each of the items in this window from oldest to newest.
Function | func | a function that will be called with each item. |
►
void
get( n)
n | {Number} the index of the item to be returned. |
►
void
getSize()
►
void
newest()
►
void
oldest()
►
void
push(Object oObject)
Adds an item into the end of this sliding window, possibly pushing an item out of the window in the process.
Object | oObject | an item to add into this window. |
►
void
setSize(Number nNewSize)
Changes the size of a SlidingWindow. This operation should not be expected to be performant; do not do it often. If the new size is smaller than the number of items in this window, this operation may cause some objects to be pushed out of the window.
Number | nNewSize | the new size the window should take up. Must be a positive integer. |
►
String
toString()