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

structure.container

Class DS_SORTABLE


Direct ancestors

DS_CONTAINER

Known direct descendants

DS_INDEXABLE

Features

Invariants

indexing

description

Data structures that can be sorted

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.6 $

deferred class

DS_SORTABLE [G]

inherit

DS_CONTAINER

feature -- Measurement

count: INTEGER

-- Number of items in container

-- (From DS_CONTAINER)

feature -- Comparison

is_equal (other: like Current): BOOLEAN

-- Is current container equal to other?

-- (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_empty: BOOLEAN

-- Is container empty?

-- (From DS_CONTAINER)

sorted (a_sorter: DS_SORTER [G]): BOOLEAN

-- Is container sorted according to a_sorter's criterion?

require
a_sorter_not_void: a_sorter /= Void

feature -- Removal

wipe_out

-- Remove all items from container.

-- (From DS_CONTAINER)

ensure
wiped_out: is_empty

feature -- Duplication

cloned_object: like Current

-- Clone of current object

-- (From KL_CLONABLE)

ensure
cloned_not_void: Result /= Void
same_type: ANY_.same_types (Result, Current)
is_equal: Result.is_equal (Current)
copy (other: like Current)

-- Update current object using fields of object attached
-- to other, so as to yield equal objects.

-- (From ANY)

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

feature -- Sort

sort (a_sorter: DS_SORTER [G])

-- Sort container using a_sorter's algorithm.

require
a_sorter_not_void: a_sorter /= Void
ensure
sorted: sorted (a_sorter)

invariant

-- From DS_CONTAINER
positive_count: count >= 0
empty_definition: is_empty = (count = 0)

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

end