Tix
Tix is a unique id generator.
- Gives you unique ids
- Keeps track of whether a given id has been taken
- You can release a previously taken id
- Automatically expands backing store
- Uses bitmasks on an integer array for speed and awesomeness
var Tix = ; var ids = ; var id = ids; // 0 var anotherId = ids; // 1 ids; // trueids; // false var id = ids; // 2ids; // false ids;ids; // false var id = ids // 1
API
take() -> integer
returns the smallest positive integer not currently taken.
has() -> boolean
returns true
or false
depending on whether or not a given id currently taken.
release(id: integer) -> void
releases a taken id. Does nothing if the passed id hasn't been taken.