EntityBag

Description

Type EntityBag
Method getSize:Int (
)

Method getCapacity:Int (
)

Method isEmpty:Short (
)

Method contains:Int (
     obj:Entity
)

Method findObject:Int (
     obj:Entity
)

Method get:Entity (
     index:Int
)

Method add (
     obj:Entity
)

Method addCollection (
     bag:EntityBag
)

Method addArray (
     objects:Entity[]
)

Method set (
     index:Int,
     obj:Entity
)

Method remove:Entity (
     index:Int
)

Method removeLast:Entity (
)

Method removeObject:Short (
     obj:Entity
)

Method removeCollection:Int (
     bag:EntityBag
)

Method clear (
)

Method sort (
     sortOrder:Int
)

Method ObjectEnumerator:EntityBagEnum (
)

End Type

A "bag" is a collection of items that do not need to be in a particular order but need to be accessed quickly. It's slow to search for items, but fast to retrieve them by index (much like an array). In most places a TList can be replaced with an EntityBag with a few minor changes. EntityBags also support EachIn operations.