CollectionImpl
Internal implementation of the Collection abstract. Handles the actual storage, indexing, and management of collection entries.
Instance Members
entries: ReadOnlyArray<ceramic.CollectionImpl.T>
The array of entries in the collection. Read-only access from outside the class.
length: Int
The number of entries in the collection.
Adds multiple entries to the collection at once.
Name | Type | Description |
---|---|---|
entries |
Array<ceramic.CollectionImpl.T> | Array of entries to add |
clear(): Void
Removes all entries from the collection.
push(entry: ceramic.CollectionImpl.T): Void
Adds a single entry to the collection.
Name | Type | Description |
---|---|---|
entry |
ceramic.CollectionImpl.T | The entry to add |
remove(entry: ceramic.CollectionImpl.T): Void
Removes an entry from the collection.
Name | Type | Description |
---|---|---|
entry |
ceramic.CollectionImpl.T | The entry to remove |
synchronize(): Void
Forces immediate synchronization of the collection's internal state. Normally done automatically when accessing entries.
get(id: String): ceramic.CollectionImpl.T
Gets an entry by its ID.
Name | Type | Description |
---|---|---|
id |
String | The ID of the entry to retrieve |
Returns | Description |
---|---|
ceramic.CollectionImpl.T | The entry with the given ID, or null if not found |
getByIndex(index: Int): ceramic.CollectionImpl.T
Gets an entry by its index in the collection.
Name | Type | Description |
---|---|---|
index |
Int | The index of the entry |
Returns | Description |
---|---|
ceramic.CollectionImpl.T | The entry at the given index |
Gets the index of an entry by its ID.
Name | Type | Description |
---|---|---|
id |
String | The ID to search for |
Returns | Description |
---|---|
Int | The index of the entry, or -1 if not found |
indexOf(entry: ceramic.CollectionImpl.T): Int
Gets the index of an entry in the collection.
Name | Type | Description |
---|---|---|
entry |
ceramic.CollectionImpl.T | The entry to find |
Returns | Description |
---|---|
Int | The index of the entry, or -1 if not found |
iterator(): Iterator
Returns an iterator for the collection. Enables for-in loop iteration.
Returns | Description |
---|---|
Iterator | An iterator over the collection entries |
new(): Void
Private Members
internalId: Int
lastChange: Int
indexDirty: Bool
Whether the ID index needs to be rebuilt
entriesDirty: Bool
Whether combined entries need to be recomputed
byId: Map
Map for fast lookup by ID
combinedCollections: Array<CollectionImpl<ceramic.CollectionImpl.T>>
Collections being combined into this one
Track changes in combined collections
filter(): Array<ceramic.CollectionImpl.T>
Optional filter function for combined collections
Returns |
---|
Array<ceramic.CollectionImpl.T> |
checkCombined(): Void
computeIndex(): Void
computeEntries(): Void
Metadata
Name | Parameters |
---|---|
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |
:allow |
ceramic.Collection |
:allow |
ceramic.CollectionUtils |