Difference between revisions of "Lib/abilities"

From Liberty Eiffel Wiki
Jump to navigation Jump to search
m
Line 17: Line 17:
 
== HASHABLE ==
 
== HASHABLE ==
 
Define a hash key.
 
Define a hash key.
[[library_class:HASHABLE|This class]] provides the deferred function <tt>hash_code</tt> and redefines <tt>is_equal</tt> for the implication of equality of the hash keys in the ensure clause.
+
[[library_class:HASHABLE|This class]] provides the deferred function <tt>hash_code</tt> and redefines <tt>is_equal</tt> to allow testing of implied equality of the hash keys in the ensure clause.
   
 
== OBSERVABLE ==
 
== OBSERVABLE ==

Revision as of 21:30, 11 September 2014

This essential library brings together abstract classes that allow to grant certain properties to objects.

COMPARABLE

Sort objects by increasing order. This class supplies comparison features <, >, <=, >= etc. One of them is deferred (<), the others are built using that one.

Identically, the is_equal feature is redefined as being a comparison of two objects where one is neither lower nor greater than the other.

Specifically, this class allows to define numbers (see the lib/numeric library), to sort collections (see the lib/sorting library), or to store dictionaries and sets (with AVL trees, see the lib/storage library).

DISPOSABLE

Memory management. This class supplies the dispose feature that is called when the object is freed by the garbage collector.

HASHABLE

Define a hash key. This class provides the deferred function hash_code and redefines is_equal to allow testing of implied equality of the hash keys in the ensure clause.

OBSERVABLE

This class is used with the observer design pattern. An instance of this class is in charge of notifying its attached observers each time a modification of the instance happens, by using the notify feature.

STORABLE

Serializing objects. This class only allows to mark the kind of the objects storable in a repository (see the lib/storage library).

TRAVERSABLE

Look through a set of objects. It is the read part of a collection (see the lib/storage library).

It can be used in two different ways: either directly (by using lower, upper and item), either by using an iterator.

VISITABLE

This class is used with the visitor design pattern. An instance of this class must implement the accept feature.