diff -r c6acc34f98dc -r 1a7fe3bef514 lemon/bits/vector_map.h --- a/lemon/bits/vector_map.h Fri Oct 16 10:21:37 2009 +0200 +++ b/lemon/bits/vector_map.h Thu Nov 05 15:50:01 2009 +0100 @@ -2,7 +2,7 @@ * * This file is a part of LEMON, a generic C++ optimization library. * - * Copyright (C) 2003-2008 + * Copyright (C) 2003-2009 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * @@ -38,9 +38,9 @@ // // \brief Graph map based on the std::vector storage. // - // The VectorMap template class is graph map structure what - // automatically updates the map when a key is added to or erased from - // the map. This map type uses the std::vector to store the values. + // The VectorMap template class is graph map structure that automatically + // updates the map when a key is added to or erased from the graph. + // This map type uses std::vector to store the values. // // \tparam _Graph The graph this map is attached to. // \tparam _Item The item type of the graph items. @@ -56,7 +56,7 @@ public: // The graph type of the map. - typedef _Graph Graph; + typedef _Graph GraphType; // The item type of the map. typedef _Item Item; // The reference map tag. @@ -72,20 +72,24 @@ // The map type. typedef VectorMap Map; - // The base class of the map. - typedef typename Notifier::ObserverBase Parent; // The reference type of the map; typedef typename Container::reference Reference; // The const reference type of the map; typedef typename Container::const_reference ConstReference; + private: + + // The base class of the map. + typedef typename Notifier::ObserverBase Parent; + + public: // \brief Constructor to attach the new map into the notifier. // // It constructs a map and attachs it into the notifier. // It adds all the items of the graph to the map. - VectorMap(const Graph& graph) { + VectorMap(const GraphType& graph) { Parent::attach(graph.notifier(Item())); container.resize(Parent::notifier()->maxId() + 1); } @@ -94,7 +98,7 @@ // // It constructs a map uses a given value to initialize the map. // It adds all the items of the graph to the map. - VectorMap(const Graph& graph, const Value& value) { + VectorMap(const GraphType& graph, const Value& value) { Parent::attach(graph.notifier(Item())); container.resize(Parent::notifier()->maxId() + 1, value); } @@ -124,7 +128,7 @@ // \brief Template assign operator. // - // The given parameter should be conform to the ReadMap + // The given parameter should conform to the ReadMap // concecpt and could be indiced by the current item set of // the NodeMap. In this case the value for each item // is assigned by the value of the given ReadMap. @@ -169,7 +173,7 @@ // \brief Adds a new key to the map. // - // It adds a new key to the map. It called by the observer notifier + // It adds a new key to the map. It is called by the observer notifier // and it overrides the add() member function of the observer base. virtual void add(const Key& key) { int id = Parent::notifier()->id(key); @@ -180,7 +184,7 @@ // \brief Adds more new keys to the map. // - // It adds more new keys to the map. It called by the observer notifier + // It adds more new keys to the map. It is called by the observer notifier // and it overrides the add() member function of the observer base. virtual void add(const std::vector& keys) { int max = container.size() - 1; @@ -195,7 +199,7 @@ // \brief Erase a key from the map. // - // Erase a key from the map. It called by the observer notifier + // Erase a key from the map. It is called by the observer notifier // and it overrides the erase() member function of the observer base. virtual void erase(const Key& key) { container[Parent::notifier()->id(key)] = Value(); @@ -203,7 +207,7 @@ // \brief Erase more keys from the map. // - // Erase more keys from the map. It called by the observer notifier + // It erases more keys from the map. It is called by the observer notifier // and it overrides the erase() member function of the observer base. virtual void erase(const std::vector& keys) { for (int i = 0; i < int(keys.size()); ++i) { @@ -211,9 +215,9 @@ } } - // \brief Buildes the map. + // \brief Build the map. // - // It buildes the map. It called by the observer notifier + // It builds the map. It is called by the observer notifier // and it overrides the build() member function of the observer base. virtual void build() { int size = Parent::notifier()->maxId() + 1; @@ -223,7 +227,7 @@ // \brief Clear the map. // - // It erase all items from the map. It called by the observer notifier + // It erases all items from the map. It is called by the observer notifier // and it overrides the clear() member function of the observer base. virtual void clear() { container.clear();