Difference between revisions of "Lib/abilities"

From Liberty Eiffel Wiki
Jump to navigation Jump to search
 
m
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Book]]
+
[[Category: Library]]
  +
[[Category: Design Pattern]]
{{TranslationWanted}}
 
  +
This essential library offers abstract classes that allow you to grant certain ''properties'' to objects.
  +
  +
== COMPARABLE ==
  +
Sort objects by increasing order.
  +
[[library_class:COMPARABLE|This class]] supplies comparison features <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&lt;=</tt>, <tt>&gt;=</tt> etc. One of them is deferred (<tt>&lt;</tt>), the others are built using that one.
  +
  +
Identically, the <tt>is_equal</tt> 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.
  +
[[library_class:DISPOSABLE|This class]] supplies the <tt>dispose</tt> feature that is called when the object is freed by the garbage collector.
  +
  +
== HASHABLE ==
  +
Define a hash key.
  +
[[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 ==
  +
[[library_class:OBSERVABLE|This class]] is used with the [[library_class:OBSERVER|observer]] [[lib/design_patterns|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 <tt>notify</tt> feature.
  +
  +
== STORABLE ==
  +
Serializing objects.
  +
[[library_class:STORABLE|This class]] only allows to mark the kind of the objects storable in a [[library_class:REPOSITORY|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 <tt>lower</tt>, <tt>upper</tt> and <tt>item</tt>), either by using an [[library_class:ITERATOR|iterator]].
  +
  +
== VISITABLE ==
  +
[[library_class:VISITABLE|This class]] is used with the [[library_class:VISITOR|visitor]] [[lib/design_patterns|design pattern]]. An instance of this class must implement the <tt>accept</tt> feature.

Latest revision as of 11: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.