NarrativeQueue class

NarrativeQueue

Optimized queue for large-scale sentence processing. Manages BaseNarrativeModel items with optional order-based sorting.

Key Responsibilities:

  • Manual vs order-based enqueuing
  • Efficient, lazy sorting for pushOrdered operations
  • In-place operations for low memory churn

Usage Example:

final queue = NarrativeQueue();
queue.pushBack(sentence1);
queue.pushOrdered(sentence2); // Will be sorted by order
final next = queue.pop();

Constructors

NarrativeQueue()

Properties

hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
Returns true if the queue is empty.
no setter
isNotEmpty → bool
Returns true if the queue is not empty.
no setter
length → int
Returns the number of items in the queue.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Clear all
contains(BaseNarrativeModel item) → bool
Check if an item exists in the queue.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
peek() → BaseNarrativeModel
Peek without removing
pop() → BaseNarrativeModel
Pop first sentence
pushBack(BaseNarrativeModel item) → void
Push a sentence to the end (no sort)
pushBackAll(Iterable<BaseNarrativeModel> items) → void
Push many to the end (no sort)
pushFront(BaseNarrativeModel item) → void
Push a sentence to the front (no sort)
pushFrontAll(Iterable<BaseNarrativeModel> items) → void
Push many to the front (no sort)
pushOrdered(BaseNarrativeModel item) → void
Push one with order and force sort
pushOrderedAll(Iterable<BaseNarrativeModel> items) → void
Push many with order and force sort
remove(BaseNarrativeModel item) → void
Remove a specific item from the queue.
removeWhere(bool test(BaseNarrativeModel item)) → void
Remove items matching a condition.
sortByOrder() → void
Force sort manually
toList() → List<BaseNarrativeModel>
List of all items (preserves queue order)
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited