/[eiffelstudio]/vendor/gobosoft.com/gobo/4.0d/library/structure/src/container/ds_linear_cursor.e
ViewVC logotype

Contents of /vendor/gobosoft.com/gobo/4.0d/library/structure/src/container/ds_linear_cursor.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 98698 - (show annotations)
Mon May 9 13:53:54 2016 UTC (3 years, 5 months ago) by manus
File size: 2308 byte(s)
Update 4.0d version with changes in Gobo from 2016/05/09

1 note
2
3 description:
4
5 "Cursors for data structures that can be traversed forward"
6
7 library: "Gobo Eiffel Structure Library"
8 copyright: "Copyright (c) 1999-2016, Eric Bezault and others"
9 license: "MIT License"
10 date: "$Date$"
11 revision: "$Revision$"
12
13 deferred class DS_LINEAR_CURSOR [G]
14
15 inherit
16
17 DS_CURSOR [G]
18 redefine
19 container,
20 next_cursor
21 end
22
23 ITERATION_CURSOR [G]
24 undefine
25 copy, is_equal
26 redefine
27 after
28 end
29
30 ITERABLE [G]
31 rename
32 new_cursor as new_iterator
33 undefine
34 copy,
35 is_equal
36 end
37
38 feature -- Access
39
40 container: DS_LINEAR [G]
41 -- Data structure traversed
42 deferred
43 end
44
45 new_iterator: like Current
46 -- New external cursor to be used in the 'across' construct
47 -- to traverse `container'
48 do
49 Result := container.new_iterator
50 end
51
52 feature -- Status report
53
54 is_first: BOOLEAN
55 -- Is cursor on first item?
56 do
57 Result := container.cursor_is_first (Current)
58 ensure
59 not_empty: Result implies not container.is_empty
60 not_off: Result implies not off
61 end
62
63 after: BOOLEAN
64 -- Is there no valid position to right of cursor?
65 deferred
66 ensure then
67 after_constraint: Result implies off
68 end
69
70 off: BOOLEAN
71 -- Is there no item at cursor position?
72 do
73 Result := after
74 end
75
76 feature -- Cursor movement
77
78 start
79 -- Move cursor to first position.
80 do
81 container.cursor_start (Current)
82 ensure
83 empty_behavior: container.is_empty implies after
84 first_or_after: is_first xor after
85 end
86
87 forth
88 -- Move cursor to next position.
89 do
90 container.cursor_forth (Current)
91 end
92
93 search_forth (v: G)
94 -- Move to first position at or after current
95 -- position where `item' and `v' are equal.
96 -- (Use `equality_tester''s criterion from `container'
97 -- if not void, use `=' criterion otherwise.)
98 -- Move `after' if not found.
99 require
100 not_off: not off or after
101 do
102 container.cursor_search_forth (Current, v)
103 end
104
105 go_after
106 -- Move cursor to `after' position.
107 do
108 container.cursor_go_after (Current)
109 ensure
110 after: after
111 end
112
113 feature {DS_LINEAR} -- Implementation
114
115 next_cursor: detachable DS_LINEAR_CURSOR [G]
116 -- Next cursor
117 -- (Used by `container' to keep track of traversing
118 -- cursors (i.e. cursors associated with `container'
119 -- and which are not currently `off').)
120
121 end

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.23