Index: lemon/bits/array_map.h
===================================================================
--- lemon/bits/array_map.h	(revision 1996)
+++ lemon/bits/array_map.h	(revision 1999)
@@ -21,13 +21,11 @@
 
 #include <memory>
-#include <lemon/bits/map_extender.h>
+
+#include <lemon/bits/traits.h>
 #include <lemon/bits/alteration_notifier.h>
-#include <lemon/concept_check.h>
-#include <lemon/concept/maps.h>
 
 /// \ingroup graphbits
 /// \file
-/// \brief Graph maps that construct and destruct
-/// their elements dynamically.
+/// \brief Graph map based on the array storage.
 
 namespace lemon {
@@ -38,20 +36,18 @@
   ///
   /// The ArrayMap template class is graph map structure what
-  /// automatically indates the map when a key is added to or erased from
+  /// automatically updates the map when a key is added to or erased from
   /// the map. This map uses the allocators to implement 
   /// the container functionality.
   ///
-  /// The template parameter is the AlterationNotifier that the maps
-  /// will belong to and the Value.
-
-  template <typename _Graph, 
-	    typename _Item,
-	    typename _Value>
-  class ArrayMap : public AlterationNotifier<_Item>::ObserverBase {
-
-    typedef _Item Item;
+  /// The template parameter is the Graph the current Item type and
+  /// the Value type of the map.
+  template <typename _Graph, typename _Item, typename _Value>
+  class ArrayMap 
+    : public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
   public:
     /// The graph type of the maps. 
     typedef _Graph Graph;
+    /// The item type of the map.
+    typedef _Item Item;
     /// The reference map tag.
     typedef True ReferenceMapTag;
@@ -61,4 +57,5 @@
     /// The value type of the map.
     typedef _Value Value;
+
     /// The const reference type of the map.
     typedef const _Value& ConstReference;
@@ -66,19 +63,13 @@
     typedef _Value& Reference;
 
-    typedef const Value ConstValue;
-    typedef Value* Pointer;
-    typedef const Value* ConstPointer;
-
-    typedef AlterationNotifier<_Item> Registry;
+    /// The notifier type.
+    typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
 
     /// The MapBase of the Map which imlements the core regisitry function.
-    typedef typename Registry::ObserverBase Parent;
+    typedef typename Notifier::ObserverBase Parent;
 		
-
-
   private:
     typedef std::allocator<Value> Allocator;
 
-
   public:
 
@@ -86,10 +77,11 @@
     ///
     /// Graph initialized map constructor.
-    ArrayMap(const Graph& _g) : graph(&_g) {
+    ArrayMap(const Graph& graph) {
+      Parent::attach(graph.getNotifier(Item()));
+      allocate_memory();
+      Notifier* notifier = Parent::getNotifier();
       Item it;
-      attach(_g.getNotifier(Item()));
-      allocate_memory();
-      for (graph->first(it); it != INVALID; graph->next(it)) {
-	int id = graph->id(it);;
+      for (notifier->first(it); it != INVALID; notifier->next(it)) {
+	int id = notifier->id(it);;
 	allocator.construct(&(values[id]), Value());
       }								
@@ -99,11 +91,12 @@
     ///
     /// It constructs a map and initialize all of the the map. 
-    ArrayMap(const Graph& _g, const Value& _v) : graph(&_g) {
+    ArrayMap(const Graph& graph, const Value& value) {
+      Parent::attach(graph.getNotifier(Item()));
+      allocate_memory();
+      Notifier* notifier = Parent::getNotifier();
       Item it;
-      attach(_g.getNotifier(_Item()));
-      allocate_memory();
-      for (graph->first(it); it != INVALID; graph->next(it)) {
-	int id = graph->id(it);;
-	allocator.construct(&(values[id]), _v);
+      for (notifier->first(it); it != INVALID; notifier->next(it)) {
+	int id = notifier->id(it);;
+	allocator.construct(&(values[id]), value);
       }								
     }
@@ -112,14 +105,15 @@
     ///
     /// Constructor to copy a map of the same map type.     
-    ArrayMap(const ArrayMap& copy) : Parent(), graph(copy.graph) {
+    ArrayMap(const ArrayMap& copy) : Parent() {
       if (copy.attached()) {
-	attach(*copy.getRegistry());
+	attach(*copy.getNotifier());
       }
       capacity = copy.capacity;
       if (capacity == 0) return;
       values = allocator.allocate(capacity);
+      Notifier* notifier = Parent::getNotifier();
       Item it;
-      for (graph->first(it); it != INVALID; graph->next(it)) {
-	int id = graph->id(it);;
+      for (notifier->first(it); it != INVALID; notifier->next(it)) {
+	int id = notifier->id(it);;
 	allocator.construct(&(values[id]), copy.values[id]);
       }
@@ -146,9 +140,4 @@
     using Parent::attached;
 
-    const Graph* getGraph() {
-      return graph;
-    }
-
-
   public:
 
@@ -158,5 +147,5 @@
     /// actual keys of the graph. 
     Value& operator[](const Key& key) {
-      int id = graph->id(key);
+      int id = Parent::getNotifier()->id(key);
       return values[id];
     } 
@@ -167,5 +156,5 @@
     /// actual keys of the graph. 
     const Value& operator[](const Key& key) const {
-      int id = graph->id(key);
+      int id = Parent::getNotifier()->id(key);
       return values[id];
     }
@@ -181,8 +170,11 @@
   protected:
 
-    /// Add a new key to the map. It called by the map registry.
-         
+    /// \brief Adds a new key to the map.
+    ///		
+    /// It adds a new key to the map. It called by the observer notifier
+    /// and it overrides the add() member function of the observer base.     
     virtual void add(const Key& key) {
-      int id = graph->id(key);
+      Notifier* notifier = Parent::getNotifier();
+      int id = notifier->id(key);
       if (id >= capacity) {
 	int new_capacity = (capacity == 0 ? 1 : capacity);
@@ -192,6 +184,6 @@
 	Value* new_values = allocator.allocate(new_capacity);
 	Item it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  int jd = graph->id(it);;
+	for (notifier->first(it); it != INVALID; notifier->next(it)) {
+	  int jd = notifier->id(it);;
 	  if (id != jd) {
 	    allocator.construct(&(new_values[jd]), values[jd]);
@@ -206,8 +198,13 @@
     }
 
+    /// \brief Adds more new keys to the map.
+    ///		
+    /// It adds more new keys to the map. It called by the observer notifier
+    /// and it overrides the add() member function of the observer base.     
     virtual void add(const std::vector<Key>& keys) {
+      Notifier* notifier = Parent::getNotifier();
       int max_id = -1;
       for (int i = 0; i < (int)keys.size(); ++i) {
-	int id = graph->id(keys[i]);
+	int id = notifier->id(keys[i]);
 	if (id > max_id) {
 	  max_id = id;
@@ -221,9 +218,9 @@
 	Value* new_values = allocator.allocate(new_capacity);
 	Item it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  int id = graph->id(it);
+	for (notifier->first(it); it != INVALID; notifier->next(it)) {
+	  int id = notifier->id(it);
 	  bool found = false;
 	  for (int i = 0; i < (int)keys.size(); ++i) {
-	    int jd = graph->id(keys[i]);
+	    int jd = notifier->id(keys[i]);
 	    if (id == jd) {
 	      found = true;
@@ -240,37 +237,53 @@
       }
       for (int i = 0; i < (int)keys.size(); ++i) {
-	int id = graph->id(keys[i]);
+	int id = notifier->id(keys[i]);
 	allocator.construct(&(values[id]), Value());
       }
     }
 		
-    /// Erase a key from the map. It called by the map registry.
-     
+    /// \brief Erase a key from the map.
+    ///
+    /// Erase a key from the map. It called by the observer notifier
+    /// and it overrides the erase() member function of the observer base.     
     virtual void erase(const Key& key) {
-      int id = graph->id(key);
+      int id = Parent::getNotifier()->id(key);
       allocator.destroy(&(values[id]));
     }
 
+    /// \brief Erase more keys from the map.
+    ///
+    /// Erase more keys from the map. It called by the observer notifier
+    /// and it overrides the erase() member function of the observer base.     
     virtual void erase(const std::vector<Key>& keys) {
       for (int i = 0; i < (int)keys.size(); ++i) {
-	int id = graph->id(keys[i]);
+	int id = Parent::getNotifier()->id(keys[i]);
 	allocator.destroy(&(values[id]));
       }
     }
 
+    /// \brief Buildes the map.
+    ///	
+    /// It buildes the map. It called by the observer notifier
+    /// and it overrides the build() member function of the observer base. 
     virtual void build() {
+      Notifier* notifier = Parent::getNotifier();
       allocate_memory();
       Item it;
-      for (graph->first(it); it != INVALID; graph->next(it)) {
-	int id = graph->id(it);;
+      for (notifier->first(it); it != INVALID; notifier->next(it)) {
+	int id = notifier->id(it);;
 	allocator.construct(&(values[id]), Value());
       }								
     }
 
+    /// \brief Clear the map.
+    ///
+    /// It erase all items from the map. It called by the observer notifier
+    /// and it overrides the clear() member function of the observer base.     
     virtual void clear() {	
+      Notifier* notifier = Parent::getNotifier();
       if (capacity != 0) {
 	Item it;
-	for (graph->first(it); it != INVALID; graph->next(it)) {
-	  int id = graph->id(it);
+	for (notifier->first(it); it != INVALID; notifier->next(it)) {
+	  int id = notifier->id(it);
 	  allocator.destroy(&(values[id]));
 	}								
@@ -283,5 +296,5 @@
       
     void allocate_memory() {
-      int max_id = graph->maxId(_Item());
+      int max_id = Parent::getNotifier()->maxId();
       if (max_id == -1) {
 	capacity = 0;
@@ -296,5 +309,4 @@
     }      
 
-    const Graph* graph;
     int capacity;
     Value* values;
