Class DS_SORTABLE PreviousNext

note
description:

    "Data structures that can be sorted"

library:    "Gobo Eiffel Structure Library"
author:     "Eric Bezault <ericb@gobosoft.com>"
copyright:  "Copyright (c) 1999-2001, Eric Bezault and others"
license:    "MIT License"
deferred class interface
DS_SORTABLE [G]
inherit
DS_CONTAINER [G]
feature {NONE} -- Initialization
make_default
        -- Create an empty container.
        -- (From DS_CONTAINER.)
    deferred
    ensure
        empty: is_empty
feature -- Measurement
count: INTEGER
        -- Number of items in container
        -- (From DS_CONTAINER.)
    deferred
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 -- 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 -- 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)
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_SORTABLE

Copyright 1999-2001, Eric Bezault
mailto:
ericb@gobosoft.com
http:
//www.gobosoft.com
Last Updated: 31 March 2001

HomeTocPreviousNext