Abstract
Create a new instance.
Changes to objects will be propagated to the change tracker
Protected
Readonly
batchesBatches. All batches in this collection are at least partially occupied.
Protected
Readonly
changeChanges to objects will be propagated to the change tracker
Protected
Readonly
entryProtected
Optional
maximumsProtected
Readonly
queuedNew entries are queued until all changes are applied to a batch.
Entries across all batches. Does not respect queued adds/deletes.
Add an object to the batcher. Additions are queued, apply with Batcher#finalize.
Object to add
Created entry
Protected
addProtected
applyApply only entries with queued changes. Entries in between will may be moved if gaps occur or space is needed.
Batch
Protected
applyCalled when an entry change is applied.
Changed entry
Batch containing entry
Element offset in batch
Protected
applyApply all queued changes.
Protected
applyDistribute queued new entries into batches. May create new batches if needed.
Protected
canCheck if entry
can be added to batch
.
Entry
Batch
Optional
additionalSize: numberOptional, if set this is the additional size required
true
if entry
fits into batch
Mark an entry as changed. Changes are queued, apply with Batcher#finalize.
Changed entry
true
if the entry was present
Protected
changeCalled when an entry is marked as changed. Should set sizes and any other properties.
Entry
Batch containing entry
Clear batcher of all batches and entries.
Protected
clearClear a batch of all its entries. Batcher#discardEntry should be called for each entry.
Batch
Protected
Abstract
copyMove data within a batch. Used if e.g. entries change size and multiple entries must be moved to fill gaps or crate space.
Affected batch
Target element offset
Start element offset
End element offset
Protected
Abstract
createProtected
createDelete an entry. Deletes are queued unless the entry is itself queued for add, apply with Batcher#finalize.
Entry
true
if an entry was deleted/queued
Protected
Abstract
discardProtected
discardDiscard empty batches.
Protected
discardApplies all queued additions, changes, and deletions.
Finalized batches
Find an entry for object
by doing a linear search through all batches and entries.
Object to find entry for
First entry, if present
If Batcher#add was called multiple times with the same object, multiple entries can exist for the same object. In this case this method returns only the first entry it finds.
Generally, the returned entry from Batcher#add should be stored to then reuse it for Batcher#change and Batcher#change calls.
Protected
onCalled when an entry was removed from a batch.
Deleted entry
Batch containing entry
Protected
queueProtected
queueQueue an entry change.
Changed entry
Batch containing entry
Protected
rebuildProtected
shouldDecide if a batch should be completely rebuilt. Generally this should be true if most/all of the batch's entries must be processed anyways.
Batch
true
if batch should be rebuilt.
Protected
updateUpdate batch. Should call either Batcher#rebuildBatch or Batcher#applyBatchChanges.
Batch