indexing
description: "Indexable structure sorters"
library: "Gobo Eiffel Structure Library"
author: "Eric Bezault <ericb@gobo.demon.co.uk>"
copyright: "Copyright (c) 1997, Eric Bezault"
deferred class interface
DS_INDEXABLE_SORTER [G -> COMPARABLE]
feature -- Status report
sorted (a_container: DS_INDEXABLE [G]): BOOLEAN
-- Is a_container sorted in increasing order?
require -- from DS_SORTER
container_not_void: container /= void
subsorted (a_container: DS_INDEXABLE [G]; lower, upper: INTEGER): BOOLEAN
-- Is a_container sorted in increasing order
-- within bounds lower..upper?
require
a_container_not_void: a_container /= void;
valid_lower: a_container.valid_entry (lower);
valid_upper: a_container.valid_entry (upper);
constraint: lower <= upper
feature -- Sort
sort (a_container: DS_INDEXABLE [G])
-- Sort a_container in increasing order?
require -- from DS_SORTER
container_not_void: container /= void
ensure -- from DS_SORTER
sorted: sorted (container)
subsort (a_container: DS_INDEXABLE [G]; lower, upper: INTEGER)
-- Sort a_container in increasing order
-- within bounds lower..upper?
require
a_container_not_void: a_container /= void;
valid_lower: a_container.valid_entry (lower);
valid_upper: a_container.valid_entry (upper);
constraint: lower <= upper
ensure
subsorted: subsorted (a_container, lower, upper)
invariant
-- from GENERAL
reflexive_equality: standard_is_equal (Current);
reflexive_conformance: conforms_to (Current);
end -- class DS_INDEXABLE_SORTER