indexing description: "[ A composition of EM_COLLISION objects ]" date: "$Date$" revision: "$Revision$" class EM_COLLISION_COMPOSITION [G->EM_COLLIDABLE] inherit DS_LINKED_LIST [EM_COLLISION [G]] create make feature -- Status Report has_collidable (a_collidable: G): BOOLEAN is -- checks if the list of collisions contains a certain collidable local a_cell: DS_LINKABLE [EM_COLLISION [G]] do a_cell := first_cell from until (a_cell = Void) loop if a_cell.item.collidables.first = a_collidable or a_cell.item.collidables.second = a_collidable then Result := True a_cell := Void -- Jump out of the loop. else a_cell := a_cell.right end end end feature -- Access collidables: DS_LINKED_LIST [G] is -- Returns a list of all collidables in this composition local cursor: DS_LINKED_LIST_CURSOR [EM_COLLISION [G]] found: DS_LINKED_LIST [G] do create found.make create cursor.make (current) from cursor.start until cursor.off loop if not found.has (cursor.item.collidables.first) then found.force_last (cursor.item.collidables.first) end if not found.has (cursor.item.collidables.second) then found.force_last (cursor.item.collidables.second) end cursor.forth end Result := found ensure collidables_not_void: Result /= Void end end