Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

structure.container

Class DS_DYNAMIC_CURSOR


Direct ancestors

DS_CURSOR

Known direct descendants

DS_LIST_CURSOR, DS_SPARSE_TABLE_CURSOR

Features

Invariants

indexing

description

Cursors for dynamically modifiable data structure traversals

library

Gobo Eiffel Structure Library

copyright

Copyright (c) 1999, Eric Bezault and others

license

Eiffel Forum License v2 (see forum.txt)

date

$Date: 2003/02/07 12:58:08 $

revision

$Revision: 1.4 $

deferred class

DS_DYNAMIC_CURSOR [G]

inherit

DS_CURSOR

feature -- Access

any_: KL_ANY_ROUTINES

-- Routines that ought to be in class ANY

-- (From KL_IMPORTED_ANY_ROUTINES)

ensure
any_routines_not_void: Result /= Void
container: DS_TRAVERSABLE [G]

-- Data structure traversed

-- (From DS_CURSOR)

item: G

-- Item at cursor position

-- (From DS_CURSOR)

require
not_off: not off

feature -- Comparison

is_equal (other: like Current): BOOLEAN

-- Are other and current cursor at the same position?

-- (From ANY)

require
other_not_void: other /= Void
ensure
symmetric: Result implies other.is_equal (Current)
consistent: standard_is_equal (other) implies Result

feature -- Status report

is_valid: BOOLEAN

-- Is cursor valid?

-- (From DS_CURSOR)

obsolete

Backward compatibility with Gobo 1.4

ensure
definition: Result = True
off: BOOLEAN

-- Is there no item at cursor position?

-- (From DS_CURSOR)

same_position (other: like Current): BOOLEAN

-- Is current cursor at same position as other?

-- (From DS_CURSOR)

require
other_not_void: other /= Void
valid_cursor (other: like Current): BOOLEAN

-- Is other a valid cursor according
-- to current traversal strategy?

-- (From DS_CURSOR)

require
other_not_void: other /= Void
ensure
Result implies container.valid_cursor (other)

feature -- Cursor movement

go_to (other: like Current)

-- Move cursor to other's position.

-- (From DS_CURSOR)

require
other_not_void: other /= Void
other_valid: valid_cursor (other)
ensure
same_position: same_position (other)

feature -- Element change

replace (v: G)

-- Replace item at cursor position by v.

require
not_off: not off
ensure
replaced: item = v
swap (other: DS_DYNAMIC_CURSOR [G])

-- Exchange items at current and other's positions.
-- Note: cursors may reference two different containers.

require
not_off: not off
other_not_void: other /= Void
other_not_off: not other.off
ensure
new_item: item = old (other.item)
new_other: other.item = old item

feature -- Duplication

copy (other: like Current)

-- Copy other to current cursor.

-- (From ANY)

require
other_not_void: other /= Void
type_identity: same_type (other)
ensure
is_equal: is_equal (other)

feature {DS_TRAVERSABLE} -- Implementation

next_cursor: DS_CURSOR [G]

-- Next cursor
-- (Used by container to keep track of traversing
-- cursors (i.e. cursors associated with container
-- and which are not currently off).)

-- (From DS_CURSOR)

set_next_cursor (a_cursor: like next_cursor)

-- Set next_cursor to a_cursor.

-- (From DS_CURSOR)

ensure
next_cursor_set: next_cursor = a_cursor

invariant

-- From DS_CURSOR
container_not_void: container /= Void
empty_constraint: container.is_empty implies off

-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end