1.1 --- a/lemon/bits/vector_map.h Fri Oct 16 10:21:37 2009 +0200
1.2 +++ b/lemon/bits/vector_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 @@ -38,9 +38,9 @@
1.13 //
1.14 // \brief Graph map based on the std::vector storage.
1.15 //
1.16 - // The VectorMap 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 type uses the std::vector to store the values.
1.19 + // The VectorMap template class is graph map structure that automatically
1.20 + // updates the map when a key is added to or erased from the graph.
1.21 + // This map type uses std::vector to store the values.
1.22 //
1.23 // \tparam _Graph The graph this map is attached to.
1.24 // \tparam _Item The item type of the graph items.
1.25 @@ -56,7 +56,7 @@
1.26 public:
1.27
1.28 // The graph type of the map.
1.29 - typedef _Graph Graph;
1.30 + typedef _Graph GraphType;
1.31 // The item type of the map.
1.32 typedef _Item Item;
1.33 // The reference map tag.
1.34 @@ -72,20 +72,24 @@
1.35
1.36 // The map type.
1.37 typedef VectorMap Map;
1.38 - // The base class of the map.
1.39 - typedef typename Notifier::ObserverBase Parent;
1.40
1.41 // The reference type of the map;
1.42 typedef typename Container::reference Reference;
1.43 // The const reference type of the map;
1.44 typedef typename Container::const_reference ConstReference;
1.45
1.46 + private:
1.47 +
1.48 + // The base class of the map.
1.49 + typedef typename Notifier::ObserverBase Parent;
1.50 +
1.51 + public:
1.52
1.53 // \brief Constructor to attach the new map into the notifier.
1.54 //
1.55 // It constructs a map and attachs it into the notifier.
1.56 // It adds all the items of the graph to the map.
1.57 - VectorMap(const Graph& graph) {
1.58 + VectorMap(const GraphType& graph) {
1.59 Parent::attach(graph.notifier(Item()));
1.60 container.resize(Parent::notifier()->maxId() + 1);
1.61 }
1.62 @@ -94,7 +98,7 @@
1.63 //
1.64 // It constructs a map uses a given value to initialize the map.
1.65 // It adds all the items of the graph to the map.
1.66 - VectorMap(const Graph& graph, const Value& value) {
1.67 + VectorMap(const GraphType& graph, const Value& value) {
1.68 Parent::attach(graph.notifier(Item()));
1.69 container.resize(Parent::notifier()->maxId() + 1, value);
1.70 }
1.71 @@ -124,7 +128,7 @@
1.72
1.73 // \brief Template assign operator.
1.74 //
1.75 - // The given parameter should be conform to the ReadMap
1.76 + // The given parameter should conform to the ReadMap
1.77 // concecpt and could be indiced by the current item set of
1.78 // the NodeMap. In this case the value for each item
1.79 // is assigned by the value of the given ReadMap.
1.80 @@ -169,7 +173,7 @@
1.81
1.82 // \brief Adds a new key to the map.
1.83 //
1.84 - // It adds a new key to the map. It called by the observer notifier
1.85 + // It adds a new key to the map. It is called by the observer notifier
1.86 // and it overrides the add() member function of the observer base.
1.87 virtual void add(const Key& key) {
1.88 int id = Parent::notifier()->id(key);
1.89 @@ -180,7 +184,7 @@
1.90
1.91 // \brief Adds more new keys to the map.
1.92 //
1.93 - // It adds more new keys to the map. It called by the observer notifier
1.94 + // It adds more new keys to the map. It is called by the observer notifier
1.95 // and it overrides the add() member function of the observer base.
1.96 virtual void add(const std::vector<Key>& keys) {
1.97 int max = container.size() - 1;
1.98 @@ -195,7 +199,7 @@
1.99
1.100 // \brief Erase a key from the map.
1.101 //
1.102 - // Erase a key from the map. It called by the observer notifier
1.103 + // Erase a key from the map. It is called by the observer notifier
1.104 // and it overrides the erase() member function of the observer base.
1.105 virtual void erase(const Key& key) {
1.106 container[Parent::notifier()->id(key)] = Value();
1.107 @@ -203,7 +207,7 @@
1.108
1.109 // \brief Erase more keys from the map.
1.110 //
1.111 - // Erase more keys from the map. It called by the observer notifier
1.112 + // It erases more keys from the map. It is called by the observer notifier
1.113 // and it overrides the erase() member function of the observer base.
1.114 virtual void erase(const std::vector<Key>& keys) {
1.115 for (int i = 0; i < int(keys.size()); ++i) {
1.116 @@ -211,9 +215,9 @@
1.117 }
1.118 }
1.119
1.120 - // \brief Buildes the map.
1.121 + // \brief Build the map.
1.122 //
1.123 - // It buildes the map. It called by the observer notifier
1.124 + // It builds the map. It is called by the observer notifier
1.125 // and it overrides the build() member function of the observer base.
1.126 virtual void build() {
1.127 int size = Parent::notifier()->maxId() + 1;
1.128 @@ -223,7 +227,7 @@
1.129
1.130 // \brief Clear the map.
1.131 //
1.132 - // It erase all items from the map. It called by the observer notifier
1.133 + // It erases all items from the map. It is called by the observer notifier
1.134 // and it overrides the clear() member function of the observer base.
1.135 virtual void clear() {
1.136 container.clear();