Package collections
SLArray #sleela 2.5 (lib/collections/SLArray.sleela)
SLArray class
A concrete, fixed-capacity, bounds-safe String array wrapper built directly on the VM-managed native array primitive. Unlike SLList, the logical length equals the capacity: every slot is addressable from construction and defaults to null. This first implementation deliberately avoids Generics and mirrors the storage discipline of SLList.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
values | String[] values = new String[0] | No description in source. |
size | int size = 0 | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
allocate | void allocate(int n) | No description in source. |
length | int length() | Number of addressable slots. |
empty | boolean empty() | True when there are no slots. |
inBounds | boolean inBounds(int index) | True when index addresses a real slot. |
get | String get(int index) | No description in source. |
set | boolean set(int index, String value) | Write the slot at index; returns false when the index is out of range. |
fill | void fill(String value) | Set every slot to value. |
clear | void clear() | Set every slot back to null. |
indexOf | int indexOf(String value) | No description in source. |
contains | boolean contains(String value) | True when value is present at any slot. |
reverse | void reverse() | Reverse the contents of the array in place. |
copyTo | int copyTo(SLArray dest, int srcPos, int destPos, int length) | No description in source. |
toList | SLList toList() | No description in source. |
SLIterator #sleela 2.5 (lib/collections/SLIterator.sleela)
SLIterator class
Defines the SLeeLa standard-library type SLIterator used within the collections library family.
SLList #sleela 2.5 (lib/collections/SLList.sleela)
SLList class
A concrete, string-valued list with stable order and bounded index behavior. This first implementation deliberately avoids Generics.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
values | String[] values = new String[0] | No description in source. |
size | int size = 0 | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
add | void add(String value) | Append one String. Existing capacity is reused after removals. |
get | String get(int index) | Return null for an invalid index; valid indices are 0 through length()-1. |
set | boolean set(int index, String value) | Replace a value; return false when the index is invalid. |
removeAt | boolean removeAt(int index) | Remove at index and preserve the order of remaining values. |
remove | void remove() | Compatibility convenience: remove the final item, if present. |
clear | void clear() | Clear the logical list; capacity remains available for reuse. |
length | int length() | No description in source. |
empty | boolean empty() | No description in source. |
SLMap #sleela 2.5 (lib/collections/SLMap.sleela)
SLMap class
A concrete, String-keyed, String-valued map backed by two parallel VM-managed growable native arrays (keys and values at matching indices). Keys are unique; lookup is a linear scan (suited to small-to-moderate maps). Deliberately avoids Generics.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
keys | String[] keys = new String[0] | No description in source. |
vals | String[] vals = new String[0] | No description in source. |
size | int size = 0 | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
indexOfKey | int indexOfKey(String key) | Index of key, or -1 when absent. A null key is never stored. |
containsKey | boolean containsKey(String key) | True when key is present. |
put | boolean put(String key, String value) | No description in source. |
get | String get(String key) | Value associated with key, or null when the key is absent. |
removeKey | boolean removeKey(String key) | No description in source. |
keyAt | String keyAt(int index) | Key at the given insertion-order index, or null when out of range. |
valueAt | String valueAt(int index) | Value at the given insertion-order index, or null when out of range. |
clear | void clear() | Drop every entry; capacity remains available for reuse. |
length | int length() | No description in source. |
empty | boolean empty() | No description in source. |
SLQueue #sleela 2.5 (lib/collections/SLQueue.sleela)
SLQueue class
A concrete, String-valued FIFO queue backed by the VM-managed growable native array. enqueue appends to the tail; dequeue removes from the head. A head cursor avoids shifting on every dequeue; storage is compacted when the dead prefix dominates. Deliberately avoids Generics.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
values | String[] values = new String[0] | No description in source. |
head | int head = 0 | No description in source. |
tail | int tail = 0 | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
compact | void compact() | No description in source. |
enqueue | void enqueue(String value) | Append one value to the tail. Freed capacity is reused after dequeues. |
front | String front() | Return the head value without removing it; null when empty. |
dequeue | String dequeue() | Remove and return the head value; null when empty. |
add | void add(String value) | Compatibility convenience: enqueue defers to add for a uniform API. |
remove | void remove() | Compatibility convenience: discard the head item, if present. |
clear | void clear() | Drop every item; capacity remains available for reuse. |
length | int length() | No description in source. |
empty | boolean empty() | No description in source. |
SLRange #sleela 2.5 (lib/collections/SLRange.sleela)
SLRange class
Defines the SLeeLa standard-library type SLRange used within the collections library family.
SLSet #sleela 2.5 (lib/collections/SLSet.sleela)
SLSet class
A concrete, String-valued set with no duplicate members, backed by the VM-managed growable native array. Membership and insertion are linear scans (suited to small-to-moderate sets); order of iteration is insertion order. This first implementation deliberately avoids Generics.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
values | String[] values = new String[0] | No description in source. |
size | int size = 0 | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
indexOf | int indexOf(String value) | No description in source. |
contains | boolean contains(String value) | True when value is a member. |
add | boolean add(String value) | No description in source. |
discard | boolean discard(String value) | No description in source. |
at | String at(int index) | Member at the given insertion-order index, or null when out of range. |
remove | void remove() | Compatibility convenience: drop one member (the last), if present. |
clear | void clear() | Drop every member; capacity remains available for reuse. |
length | int length() | No description in source. |
empty | boolean empty() | No description in source. |
SLStack #sleela 2.5 (lib/collections/SLStack.sleela)
SLStack class
A concrete, String-valued LIFO stack backed by the VM-managed growable native array. push appends; pop and peek address the top. This first implementation deliberately avoids Generics.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
values | String[] values = new String[0] | No description in source. |
size | int size = 0 | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
push | void push(String value) | Push one value onto the top. Freed capacity is reused after pops. |
peek | String peek() | Return the top value without removing it; null when empty. |
pop | String pop() | Remove and return the top value; null when empty. |
add | void add(String value) | Compatibility convenience: push defers to add for a uniform collection API. |
remove | void remove() | Compatibility convenience: discard the top item, if present. |
clear | void clear() | Drop every item; capacity remains available for reuse. |
length | int length() | No description in source. |
empty | boolean empty() | No description in source. |
SLValueList #sleela 2.5 (lib/collections/SLValueList.sleela)
SLValueList class
a non-generic heterogeneous list for VM values.
Fields — the named values this unit stores.
| Field | Declaration | What it holds |
|---|---|---|
values | Any[] values = new Any[0] | No description in source. |
size | int size = 0 | No description in source. |
Methods — the actions this unit can perform.
| Method | Signature | What it does |
|---|---|---|
add | void add(Any value) | Append a value of any supported runtime kind, preserving reference identity. |
get | Any get(int index) | Return null when index is outside the logical list. |
set | boolean set(int index, Any value) | No description in source. |
removeAt | boolean removeAt(int index) | No description in source. |
remove | void remove() | No description in source. |
clear | void clear() | Capacity is retained for reuse; removed references are cleared for GC. |
length | int length() | No description in source. |
empty | boolean empty() | No description in source. |