indexing description: "[ Implements a countainer to hold channel groups. Use this class to store channel groups. Note: You should not use this class as grouping is available through {EM_CHANNELS}. {EM_CHANNELS} will do all the dirty work for you. ]" date: "$Date$" revision: "$Revision$" class EM_AUDIO_GROUPS create make_empty feature -- Initialization make_empty is -- Create group list. do create group_list.make end feature -- Access count: INTEGER is -- Number of groups in list do Result := group_list.count end i_th (an_index: INTEGER): EM_AUDIO_GROUP is -- Group at position `an_index' require valid_index: 1 <= an_index and then an_index <= count do Result := group_list.item (an_index) end feature -- Operations extend (a_number: INTEGER) is -- Extend groups with `a_number' of channels. -- New channels are put as last elements. local i: INTEGER do from i := 1 until i > a_number loop group_list.put_last (create {EM_AUDIO_GROUP}.make (group_list.count + 1)) i := i + 1 end end put (a_group: EM_AUDIO_GROUP; an_index: INTEGER) is -- Put `a_group' into list at position `an_index'. require valid_index: 1 <= an_index and then an_index <= count valid_group: a_group.number = an_index do group_list.put (a_group, an_index) end remove (a_number: INTEGER) is -- Remove `a_number' of groups from group_list. local i: INTEGER do from i := group_list.count - a_number until i > group_list.count loop group_list.item (i).wipe_out i := i + 1 end group_list.keep_first (group_list.count - a_number) end feature {NONE} -- Internal variables group_list: DS_LINKED_LIST [EM_AUDIO_GROUP] -- Stores groups in list invariant group_list_created: group_list /= Void end