1.1 --- a/lemon/bits/array_map.h Fri Oct 16 10:21:37 2009 +0200
1.2 +++ b/lemon/bits/array_map.h Thu Nov 05 15:50:01 2009 +0100
1.3 @@ -2,7 +2,7 @@
1.4 *
1.5 * This file is a part of LEMON, a generic C++ optimization library.
1.6 *
1.7 - * Copyright (C) 2003-2008
1.8 + * Copyright (C) 2003-2009
1.9 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.10 * (Egervary Research Group on Combinatorial Optimization, EGRES).
1.11 *
1.12 @@ -36,25 +36,24 @@
1.13 //
1.14 // \brief Graph map based on the array storage.
1.15 //
1.16 - // The ArrayMap template class is graph map structure what
1.17 - // automatically updates the map when a key is added to or erased from
1.18 - // the map. This map uses the allocators to implement
1.19 - // the container functionality.
1.20 + // The ArrayMap template class is graph map structure that automatically
1.21 + // updates the map when a key is added to or erased from the graph.
1.22 + // This map uses the allocators to implement the container functionality.
1.23 //
1.24 - // The template parameters are the Graph the current Item type and
1.25 + // The template parameters are the Graph, the current Item type and
1.26 // the Value type of the map.
1.27 template <typename _Graph, typename _Item, typename _Value>
1.28 class ArrayMap
1.29 : public ItemSetTraits<_Graph, _Item>::ItemNotifier::ObserverBase {
1.30 public:
1.31 - // The graph type of the maps.
1.32 - typedef _Graph Graph;
1.33 - // The item type of the map.
1.34 + // The graph type.
1.35 + typedef _Graph GraphType;
1.36 + // The item type.
1.37 typedef _Item Item;
1.38 // The reference map tag.
1.39 typedef True ReferenceMapTag;
1.40
1.41 - // The key type of the maps.
1.42 + // The key type of the map.
1.43 typedef _Item Key;
1.44 // The value type of the map.
1.45 typedef _Value Value;
1.46 @@ -64,13 +63,17 @@
1.47 // The reference type of the map.
1.48 typedef _Value& Reference;
1.49
1.50 + // The map type.
1.51 + typedef ArrayMap Map;
1.52 +
1.53 // The notifier type.
1.54 typedef typename ItemSetTraits<_Graph, _Item>::ItemNotifier Notifier;
1.55
1.56 + private:
1.57 +
1.58 // The MapBase of the Map which imlements the core regisitry function.
1.59 typedef typename Notifier::ObserverBase Parent;
1.60
1.61 - private:
1.62 typedef std::allocator<Value> Allocator;
1.63
1.64 public:
1.65 @@ -78,7 +81,7 @@
1.66 // \brief Graph initialized map constructor.
1.67 //
1.68 // Graph initialized map constructor.
1.69 - explicit ArrayMap(const Graph& graph) {
1.70 + explicit ArrayMap(const GraphType& graph) {
1.71 Parent::attach(graph.notifier(Item()));
1.72 allocate_memory();
1.73 Notifier* nf = Parent::notifier();
1.74 @@ -92,7 +95,7 @@
1.75 // \brief Constructor to use default value to initialize the map.
1.76 //
1.77 // It constructs a map and initialize all of the the map.
1.78 - ArrayMap(const Graph& graph, const Value& value) {
1.79 + ArrayMap(const GraphType& graph, const Value& value) {
1.80 Parent::attach(graph.notifier(Item()));
1.81 allocate_memory();
1.82 Notifier* nf = Parent::notifier();
1.83 @@ -136,7 +139,7 @@
1.84
1.85 // \brief Template assign operator.
1.86 //
1.87 - // The given parameter should be conform to the ReadMap
1.88 + // The given parameter should conform to the ReadMap
1.89 // concecpt and could be indiced by the current item set of
1.90 // the NodeMap. In this case the value for each item
1.91 // is assigned by the value of the given ReadMap.
1.92 @@ -200,7 +203,7 @@
1.93
1.94 // \brief Adds a new key to the map.
1.95 //
1.96 - // It adds a new key to the map. It called by the observer notifier
1.97 + // It adds a new key to the map. It is called by the observer notifier
1.98 // and it overrides the add() member function of the observer base.
1.99 virtual void add(const Key& key) {
1.100 Notifier* nf = Parent::notifier();
1.101 @@ -228,7 +231,7 @@
1.102
1.103 // \brief Adds more new keys to the map.
1.104 //
1.105 - // It adds more new keys to the map. It called by the observer notifier
1.106 + // It adds more new keys to the map. It is called by the observer notifier
1.107 // and it overrides the add() member function of the observer base.
1.108 virtual void add(const std::vector<Key>& keys) {
1.109 Notifier* nf = Parent::notifier();
1.110 @@ -272,7 +275,7 @@
1.111
1.112 // \brief Erase a key from the map.
1.113 //
1.114 - // Erase a key from the map. It called by the observer notifier
1.115 + // Erase a key from the map. It is called by the observer notifier
1.116 // and it overrides the erase() member function of the observer base.
1.117 virtual void erase(const Key& key) {
1.118 int id = Parent::notifier()->id(key);
1.119 @@ -281,7 +284,7 @@
1.120
1.121 // \brief Erase more keys from the map.
1.122 //
1.123 - // Erase more keys from the map. It called by the observer notifier
1.124 + // Erase more keys from the map. It is called by the observer notifier
1.125 // and it overrides the erase() member function of the observer base.
1.126 virtual void erase(const std::vector<Key>& keys) {
1.127 for (int i = 0; i < int(keys.size()); ++i) {
1.128 @@ -290,9 +293,9 @@
1.129 }
1.130 }
1.131
1.132 - // \brief Buildes the map.
1.133 + // \brief Builds the map.
1.134 //
1.135 - // It buildes the map. It called by the observer notifier
1.136 + // It builds the map. It is called by the observer notifier
1.137 // and it overrides the build() member function of the observer base.
1.138 virtual void build() {
1.139 Notifier* nf = Parent::notifier();
1.140 @@ -306,7 +309,7 @@
1.141
1.142 // \brief Clear the map.
1.143 //
1.144 - // It erase all items from the map. It called by the observer notifier
1.145 + // It erase all items from the map. It is called by the observer notifier
1.146 // and it overrides the clear() member function of the observer base.
1.147 virtual void clear() {
1.148 Notifier* nf = Parent::notifier();