Class DS_REVERSE_COMPARATOR PreviousNext

note
description:

    "Reverse comparators"

library:    "Gobo Eiffel Structure Library"
author:     "Eric Bezault <ericb@gobosoft.com>"
copyright:  "Copyright (c) 2000-2001, Eric Bezault and others"
license:    "MIT License"
class interface
DS_REVERSE_COMPARATOR [G]
inherit
DS_COMPARATOR [G]
create
make (a_comparator: like comparator)
        -- Create a new reverse comparator based on a_comparator.
    require
        a_comparator_not_void: a_comparator /= Void
    ensure
        comparator_set: comparator = a_comparator
feature -- Status report
less_than (u, v: G): BOOLEAN
        -- Is u considered less than v?
        -- (From DS_COMPARATOR.)
    require
        u_not_void: u /= Void
        v_not_void: v /= Void
    ensure
        asymmetric: Result implies not less_than (v, u)
        definition: Result = comparator.less_than (v, u)
feature -- Access
comparator: DS_COMPARATOR [G]
        -- Base comparator
feature -- Setting
set_comparator (a_comparator: like comparator)
        -- Set comparator to a_comparator.
    require
        a_comparator_not_void: a_comparator /= Void
    ensure
        comparator_set: comparator = a_comparator
invariant
comparator_not_void: comparator /= Void
end -- class DS_REVERSE_COMPARATOR

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

HomeTocPreviousNext