indexing description: "[ Implements an effects list for a channel. This class is used by EM_CHANNEL and EM_CHANNELS to store effects. You likely never use this class as everything is done in the channels for you. ]" date: "$Date$" revision: "$Revision$" class EM_EFFECTS create make_empty feature -- Initialization make_empty is -- Create new effect list. do create effect_list.make end feature -- Access count: INTEGER is -- Amount of effects in list do Result := effect_list.count end i_th (an_index: INTEGER): EM_EFFECT is -- Effect at `an_index' require an_index_is_valid: 1 <= an_index and then an_index <= count do Result := effect_list.item (an_index) end feature -- Operations extend (an_effect: EM_EFFECT) is -- Extend list with `an_effect'. -- -- New effects are put at last position. require an_effect_not_void: an_effect /= Void do effect_list.put_last (an_effect) ensure effct_list_count_increased: effect_list.count = old effect_list.count + 1 end put (an_effect: EM_EFFECT; an_index: INTEGER) is -- Put `an_effect' to the list at `an_index'. require an_effect_not_void: an_effect /= Void an_index_is_valid: 1 <= an_index and then an_index <= count do effect_list.put (an_effect, an_index) ensure an_effect_is_put: effect_list.item (an_index) = an_effect end remove (an_effect: EM_EFFECT) is -- Remove an effect from the list. require an_effect_not_void: an_effect /= Void do effect_list.delete (an_effect) end wipe_out is -- Remove all effects from list. do create effect_list.make ensure list_empty: effect_list.count = 0 end feature {NONE} -- Internal variables effect_list: DS_LINKED_LIST [EM_EFFECT] -- Hold effects invariant effect_list_created: effect_list /= Void end