Home › Packages › collections

Package collections

This package contains 9 source unit(s) defining 9 class(es) / struct(s). Each unit below lists its fields (the values it stores) and methods (the actions it performs), with a plain explanation of each.

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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valuesString[] values = new String[0]No description in source.
sizeint size = 0No description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
allocatevoid allocate(int n)No description in source.
lengthint length()Number of addressable slots.
emptyboolean empty()True when there are no slots.
inBoundsboolean inBounds(int index)True when index addresses a real slot.
getString get(int index)No description in source.
setboolean set(int index, String value)Write the slot at index; returns false when the index is out of range.
fillvoid fill(String value)Set every slot to value.
clearvoid clear()Set every slot back to null.
indexOfint indexOf(String value)No description in source.
containsboolean contains(String value)True when value is present at any slot.
reversevoid reverse()Reverse the contents of the array in place.
copyToint copyTo(SLArray dest, int srcPos, int destPos, int length)No description in source.
toListSLList 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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valuesString[] values = new String[0]No description in source.
sizeint size = 0No description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
addvoid add(String value)Append one String. Existing capacity is reused after removals.
getString get(int index)Return null for an invalid index; valid indices are 0 through length()-1.
setboolean set(int index, String value)Replace a value; return false when the index is invalid.
removeAtboolean removeAt(int index)Remove at index and preserve the order of remaining values.
removevoid remove()Compatibility convenience: remove the final item, if present.
clearvoid clear()Clear the logical list; capacity remains available for reuse.
lengthint length()No description in source.
emptyboolean 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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
keysString[] keys = new String[0]No description in source.
valsString[] vals = new String[0]No description in source.
sizeint size = 0No description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
indexOfKeyint indexOfKey(String key)Index of key, or -1 when absent. A null key is never stored.
containsKeyboolean containsKey(String key)True when key is present.
putboolean put(String key, String value)No description in source.
getString get(String key)Value associated with key, or null when the key is absent.
removeKeyboolean removeKey(String key)No description in source.
keyAtString keyAt(int index)Key at the given insertion-order index, or null when out of range.
valueAtString valueAt(int index)Value at the given insertion-order index, or null when out of range.
clearvoid clear()Drop every entry; capacity remains available for reuse.
lengthint length()No description in source.
emptyboolean 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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valuesString[] values = new String[0]No description in source.
headint head = 0No description in source.
tailint tail = 0No description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
compactvoid compact()No description in source.
enqueuevoid enqueue(String value)Append one value to the tail. Freed capacity is reused after dequeues.
frontString front()Return the head value without removing it; null when empty.
dequeueString dequeue()Remove and return the head value; null when empty.
addvoid add(String value)Compatibility convenience: enqueue defers to add for a uniform API.
removevoid remove()Compatibility convenience: discard the head item, if present.
clearvoid clear()Drop every item; capacity remains available for reuse.
lengthint length()No description in source.
emptyboolean 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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valuesString[] values = new String[0]No description in source.
sizeint size = 0No description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
indexOfint indexOf(String value)No description in source.
containsboolean contains(String value)True when value is a member.
addboolean add(String value)No description in source.
discardboolean discard(String value)No description in source.
atString at(int index)Member at the given insertion-order index, or null when out of range.
removevoid remove()Compatibility convenience: drop one member (the last), if present.
clearvoid clear()Drop every member; capacity remains available for reuse.
lengthint length()No description in source.
emptyboolean 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.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valuesString[] values = new String[0]No description in source.
sizeint size = 0No description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
pushvoid push(String value)Push one value onto the top. Freed capacity is reused after pops.
peekString peek()Return the top value without removing it; null when empty.
popString pop()Remove and return the top value; null when empty.
addvoid add(String value)Compatibility convenience: push defers to add for a uniform collection API.
removevoid remove()Compatibility convenience: discard the top item, if present.
clearvoid clear()Drop every item; capacity remains available for reuse.
lengthint length()No description in source.
emptyboolean empty()No description in source.

SLValueList #sleela 2.5 (lib/collections/SLValueList.sleela)

SLValueList class

a non-generic heterogeneous list for VM values.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
valuesAny[] values = new Any[0]No description in source.
sizeint size = 0No description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
addvoid add(Any value)Append a value of any supported runtime kind, preserving reference identity.
getAny get(int index)Return null when index is outside the logical list.
setboolean set(int index, Any value)No description in source.
removeAtboolean removeAt(int index)No description in source.
removevoid remove()No description in source.
clearvoid clear()Capacity is retained for reuse; removed references are cleared for GC.
lengthint length()No description in source.
emptyboolean empty()No description in source.