Class Batch<O, E, S>

A generic batch of objects.

Type Parameters

Hierarchy (View Summary)

Constructors

Properties

_entries: E[] = []
entries: readonly E[] = ...

Entries in this batch (in order of storage).

entryChanges: BatchEntryChange[] = []

Array containing an item for each entry in this batch. Allows using entry index to look up it's associated change.

firstChangedEntryIndex?: number

Entry index of the first changed entry. Allows skipping unchanged entries before it.

initialized: boolean = false
lastChangedEntryIndex?: number

Entry index of the last changed entry. Allows stopping change-application early.

objectEntries: Map<O, E> = ...

Map from object to entry. For lookup only.

storage: S

Batch storage. Entry updates/changes will also be applied to the storage

Accessors

Methods

  • Apply changes and try to do the least amount of work for it.

    With a lot of changes per tick this becomes a performance-critical method.

    Returns void

  • Check if this batch has an entry for object.

    Parameters

    • object: O

      Object

    Returns boolean

    true if an entry exists

  • Perform any additional clean up when an entry is deleted.

    Parameters

    • entry: E

      Deleted entry

    Returns void