Priority todo: get element priority

Static methods

@:externstaticinlinecreateIds(a:Array<String>):PriorityIds

Constructor

@:value({ dbl : false })new(?data:Array<T>, dbl:Bool = false)

Variables

@:value([0])read onlycounters:Array<Int> = [0]

Counters for loops

read onlycurrent:T

Current element in loop.

@:value([])read onlydata:Array<T> = []

double:Bool

if true: [[1, 1, 3]] - normal. Default false.

@:value(true)read onlyempty:Bool = true

True if priority list not have element and false if have.

read onlyfirst:T

First element.

read onlylast:T

Last element.

read onlylength:Int

Total elements count.

@:value(false)lock:Bool = false

read onlymax:Int

Hightest priority number.

read onlymin:Int

Lowest priority number.

read onlyonLost:Signal0

read onlyonTake:Signal0

Methods

@:value({ priority : 0 })add(e:T, priority:Int = 0):Priority<T>

Add element in priority list with custom priority.

Parameters:

element

elements for adding.

priority

priority, smalest first, bigest last, default 0 (0 - normal priority).

@:value({ priority : 0 })@:externinlineaddArray(a:Array<T>, priority:Int = 0):Priority<T>

Add elements array in priority list with custom priority.

Parameters:

a

elements array for adding.

priority

priority, smalest first, bigest last, default 0 (0 - normal priority).

@:externinlineaddToBegin(e:T):Void

Add element with lowest priority.

Parameters:

o

T or Array<T>.

@:externinlineaddToEnd(e:T):Void

Add element with hightest priority.

Parameters:

o

T or Array<T>.

backLoop():Null<T>

Make infinity loop. This good method for devolopment UI.

Returns:

Previos element in loop.

@:externinlinebrk():Void

Call this method if you use break

@:value({ priority : 0 })change(e:T, priority:Int = 0):Priority<T>

todo: optimize

@:value({ priority : 0 })changeArray(a:Array<T>, priority:Int = 0):Priority<T>

@:value({ priority : 0 })changeFunction(f:T ‑> Bool, priority:Int = 0):Priority<T>

@:externinlineclear():Priority<T>

Remove all elements

dynamiccompare(a:T, b:T):Bool

Set this function for custom compare priority elements

Parameters:

a
null

b

destroy():Void

Destroy this object

@:externinlineexists(element:T):Bool

existsArray(a:Array<T>):Bool

@:externinlineexistsFunction(f:T ‑> Bool):Bool

getPriority(e:T):Null<Int>

Parameters:

e

Element

@:externinlineindexOfElement(element:T):Int

@:externinlineindexOfFunction(f:T ‑> Bool):Int

@:externinlineisDestroy():Bool

iterator():Iterator<T>

Example: [ var sum:Int = 0; for (e in p)

sum += e;

sum; //145 ] Elements begining with lowest priority, ending higtest.
This funcion not crashed if you make operations with Priority object. You can remove and add elements in "for" body.

@:externinlinejoin(sep:String):String

loop():Null<T>

Make infinity loop. This good method for devolopment UI.

Returns:

Next element in loop.

inlinemap(f:T ‑> T):Void

dynamicreal(e:T):Bool

@:externinlinereloop(e:T):Void

Start loop from custom element. Use exists() before call this function for safely run.

Parameters:

e

first element for loop.

remove(e:T):Bool

Parameters:

e

Element for removing

@:externinlineremoveArray(a:Array<T>):Bool

@:externinlineremoveFunction(f:T ‑> Bool):Bool

@:value({ priority : 0 })@:externinlinerepriority(priority:Int = 0):Void

All elements taking new priority, but save order.

Parameters:

priority

New priority, default 0

@:externinlineresetLoop():Priority<T>

Next time loop return first element.

search(f:T ‑> Bool):Null<T>

Some time need take object with custom value.

@:externinlinetoString():String