Difference between revisions of "Lib/abilities"

From Liberty Eiffel Wiki
Jump to: navigation, search
m (HASHABLE)
m
 
Line 1: Line 1:
 
[[Category: Library]]
 
[[Category: Library]]
 
[[Category: Design Pattern]]
 
[[Category: Design Pattern]]
This essential library brings together abstract classes that allow to grant certain ''properties'' to objects.
+
This essential library offers abstract classes that allow you to grant certain ''properties'' to objects.
   
 
== COMPARABLE ==
 
== COMPARABLE ==

Latest revision as of 12:07, 11 September 2018

This essential library offers abstract classes that allow you 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.