/[eiffelstudio]/branches/eth/eve/Src/Eiffel/API/error/common/iterable_function.e
ViewVC logotype

Contents of /branches/eth/eve/Src/Eiffel/API/error/common/iterable_function.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 94983 - (show annotations)
Fri May 2 11:05:28 2014 UTC (5 years, 5 months ago) by jasonw
File size: 2481 byte(s)
<<Merged from trunk#94978.>>
1 note
2 description: "[
3 Structure that can be iterated over based on another iterable structure and a function that performs a required conversion.
4 First parameter specifies a type of elements returned by this iterable structure.
5 Second parameter specifies a type of elements in the original iterable structure.
6 ]"
7
8 class ITERABLE_FUNCTION [G, H]
9
10 inherit
11 ITERABLE [G]
12
13 create
14 make
15
16 feature {NONE} -- Creation
17
18 make (map: FUNCTION [ANY, TUPLE [H], G]; other: ITERABLE [H])
19 -- Associate iteration with `other' which elements are to be transformed using `map'.
20 do
21 target := other
22 mapping_function := map
23 ensure
24 target = other
25 mapping_function = map
26 end
27
28 feature -- Access
29
30 new_cursor: ITERATION_CURSOR [G]
31 -- <Precursor>
32 do
33 create {ITERABLE_FUNCTION_CURSOR [G, H]} Result.make (mapping_function, target.new_cursor)
34 end
35
36 feature {NONE} -- Access
37
38 target: ITERABLE [H]
39 -- Original structure to be iterated over.
40
41 mapping_function: FUNCTION [ANY, TUPLE [H], G]
42 -- Function to tranform elements of the original structure `target' to elements of the desired type {G}.
43
44 ;note
45 date: "$Date$"
46 revision: "$Revision$"
47 copyright: "Copyright (c) 1984-2014, Eiffel Software"
48 license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
49 licensing_options: "http://www.eiffel.com/licensing"
50 copying: "[
51 This file is part of Eiffel Software's Eiffel Development Environment.
52
53 Eiffel Software's Eiffel Development Environment is free
54 software; you can redistribute it and/or modify it under
55 the terms of the GNU General Public License as published
56 by the Free Software Foundation, version 2 of the License
57 (available at the URL listed under "license" above).
58
59 Eiffel Software's Eiffel Development Environment is
60 distributed in the hope that it will be useful, but
61 WITHOUT ANY WARRANTY; without even the implied warranty
62 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
63 See the GNU General Public License for more details.
64
65 You should have received a copy of the GNU General Public
66 License along with Eiffel Software's Eiffel Development
67 Environment; if not, write to the Free Software Foundation,
68 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
69 ]"
70 source: "[
71 Eiffel Software
72 5949 Hollister Ave., Goleta, CA 93117 USA
73 Telephone 805-685-1006, Fax 805-685-6869
74 Website http://www.eiffel.com
75 Customer support http://support.eiffel.com
76 ]"
77 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date ID Revision

  ViewVC Help
Powered by ViewVC 1.1.23