indexing description: "[ An container for EM_GOOF_OBJECT. ]" date: "$Date$" revision: "$Revision$" class EM_GOOF_CONTAINER inherit EM_GOOF_OBJECT redefine draw, process, make end feature -- Initialization make(img: EM_BITMAP x: DOUBLE y: DOUBLE phs: EM_GOOF_PHYSICS) is -- Make container do Precursor(img, x, y, phs) create items.make end feature -- Properties items: DS_LINKED_LIST[EM_GOOF_OBJECT] -- Contained objects feature -- Operation add_item(a_item: EM_GOOF_OBJECT) is -- Add 'a_item' to this container require a_item_not_void: a_item /= void do items.put_right(a_item) ensure item_added: items.has(a_item) end feature {EM_GOOF_OBJECT, EM_GOOF_PHYSICS} -- Drawing draw(screen: EM_VIDEO_SURFACE at: EM_VECTOR_2D at_angle: DOUBLE) is -- Draw object (with contained objects) local cursor: DS_LINKED_LIST_CURSOR[EM_GOOF_OBJECT] do from cursor := items.new_cursor cursor.start until cursor.after loop cursor.item.draw(screen, (at + position), at_angle) cursor.forth end end feature {EM_GOOF_OBJECT, EM_GOOF_PHYSICS} -- Processing process(time_length: DOUBLE) is -- process this object local cursor: DS_LINKED_LIST_CURSOR[EM_GOOF_OBJECT] do from cursor := items.new_cursor cursor.start until cursor.after loop cursor.item.process(time_length) cursor.forth end end invariant items_not_void: items /= void end