| Class DS_SEARCHABLE |
indexing
description:
"Data structures that can be searched"
library: "Gobo Eiffel Structure Library"
author: "Eric Bezault <ericb@gobosoft.com>"
copyright: "Copyright (c) 1999, Eric Bezault and others"
license: "Eiffel Forum Freeware License v1 (see forum.txt)"
deferred class interface
DS_SEARCHABLE [G]
inherit
DS_CONTAINER [G]
feature -- Access
equality_tester: DS_EQUALITY_TESTER [G]
-- Equality tester;
-- A void equality tester means that `='
-- will be used as comparison criterion.
feature -- Measurement
count: INTEGER -- Number of items in container -- (From DS_CONTAINER.) deferredoccurrences (v: G): INTEGER -- Number of times v appears in container -- (Use equality_tester's comparison criterion -- if not void, use `=' criterion otherwise.) deferred ensure positive: Result >= 0 has: has (v) implies Result >= 1
feature -- Status report
has (v: G): BOOLEAN -- Does container include v? -- (Use equality_tester's comparison criterion -- if not void, use `=' criterion otherwise.) deferred ensure not_empty: Result implies not is_emptyis_empty: BOOLEAN -- Is container empty? -- (From DS_CONTAINER.)
feature -- Comparison
is_equal (other: like Current): BOOLEAN
-- Is current container equal to other?
-- (From GENERAL.)
require
other_not_void: other /= Void
deferred
ensure
consistent: standard_is_equal (other) implies Result
same_type: Result implies same_type (other)
symmetric: Result implies other.is_equal (Current)
same_count: Result implies count = other.count
feature -- Duplication
copy (other: like Current)
-- Copy other to current container.
-- (From GENERAL.)
require
other_not_void: other /= Void
type_identity: same_type (other)
deferred
ensure
is_equal: is_equal (other)
feature -- Setting
set_equality_tester (a_tester: like equality_tester)
-- Set equality_tester to a_tester.
-- A void equality tester means that `='
-- will be used as comparison criterion.
ensure
equality_tester_set: equality_tester = a_tester
feature -- Removal
wipe_out
-- Remove all items from container.
-- (From DS_CONTAINER.)
deferred
ensure
wiped_out: is_empty
invariant
positive_count: count >= 0
empty_definition: is_empty = (count = 0)
-- (From DS_CONTAINER.)
end -- class DS_SEARCHABLE
|
Copyright © 1999, Eric
Bezault mailto:ericb@gobosoft.com http://www.gobosoft.com Last Updated: 4 July 1999 |