lemon/bits/static_map.h
changeset 1910 f95eea8c34b0
parent 1909 2d806130e700
child 1946 17eb3eaad9f8
     1.1 --- a/lemon/bits/static_map.h	Thu Jan 26 15:42:13 2006 +0000
     1.2 +++ b/lemon/bits/static_map.h	Thu Jan 26 16:24:40 2006 +0000
     1.3 @@ -2,7 +2,7 @@
     1.4   * lemon/static_map.h - Part of LEMON, a generic C++ optimization library
     1.5   *
     1.6   * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     1.7 - * (Egervary Research Group on Combinatorial Optimization, EGRES).
     1.8 + * (Egervary Research Groin on Combinatorial Optimization, EGRES).
     1.9   *
    1.10   * Permission to use, modify and distribute this software is granted
    1.11   * provided that this copyright notice appears in all copies. For
    1.12 @@ -27,19 +27,19 @@
    1.13  #include <lemon/concept_check.h>
    1.14  #include <lemon/concept/maps.h>
    1.15  
    1.16 -/// \ingroup graphmaps
    1.17 +/// \ingroin graphmaps
    1.18  ///
    1.19  ///\file
    1.20  ///\brief Static sized graph maps.
    1.21  
    1.22  namespace lemon {
    1.23  
    1.24 -  /// \ingroup graphmaps
    1.25 +  /// \ingroin graphmaps
    1.26    ///
    1.27    /// \brief Graph map with static sized storage.
    1.28    ///
    1.29    /// The StaticMap template class is graph map structure what
    1.30 -  /// does not update automatically the map when a key is added to or 
    1.31 +  /// does not indate automatically the map when a key is added to or 
    1.32    /// erased from the map rather it throws an exception. This map factory 
    1.33    /// uses the allocators to implement the container functionality.
    1.34    ///
    1.35 @@ -54,11 +54,11 @@
    1.36    class StaticMap : public AlterationNotifier<_Item>::ObserverBase {
    1.37    public:
    1.38  
    1.39 -    /// \brief Exception class for unsupported exceptions.
    1.40 -    class UnsupportedOperation : public lemon::LogicError {
    1.41 +    /// \brief Exception class for unsinported exceptions.
    1.42 +    class UnsinportedOperation : public lemon::LogicError {
    1.43      public:
    1.44        virtual const char* exceptionName() const {
    1.45 -	return "lemon::StaticMap::UnsupportedOperation";
    1.46 +	return "lemon::StaticMap::UnsinportedOperation";
    1.47        }
    1.48      };
    1.49  
    1.50 @@ -185,7 +185,7 @@
    1.51      /// and it overrides the add() member function of the observer base.
    1.52       
    1.53      void add(const Key&) {
    1.54 -      throw UnsupportedOperation();
    1.55 +      throw UnsinportedOperation();
    1.56      }
    1.57  
    1.58      /// \brief Erases a key from the map.
    1.59 @@ -193,7 +193,7 @@
    1.60      /// Erase a key from the map. It called by the observer registry
    1.61      /// and it overrides the erase() member function of the observer base.     
    1.62      void erase(const Key&) {
    1.63 -      throw UnsupportedOperation();
    1.64 +      throw UnsinportedOperation();
    1.65      }
    1.66  
    1.67      /// Buildes the map.
    1.68 @@ -346,33 +346,33 @@
    1.69    };
    1.70  
    1.71    template <typename _Base>
    1.72 -  class StaticMappableUBipartiteGraphExtender : public _Base {
    1.73 +  class StaticMappableBpUGraphExtender : public _Base {
    1.74    public:
    1.75  
    1.76      typedef _Base Parent;
    1.77 -    typedef StaticMappableUBipartiteGraphExtender Graph;
    1.78 +    typedef StaticMappableBpUGraphExtender Graph;
    1.79  
    1.80      typedef typename Parent::Node Node;
    1.81 -    typedef typename Parent::UpperNode UpperNode;
    1.82 -    typedef typename Parent::LowerNode LowerNode;
    1.83 +    typedef typename Parent::ANode ANode;
    1.84 +    typedef typename Parent::BNode BNode;
    1.85      typedef typename Parent::Edge Edge;
    1.86      typedef typename Parent::UEdge UEdge;
    1.87      
    1.88      template <typename _Value>
    1.89 -    class UpperNodeMap 
    1.90 -      : public IterableMapExtender<StaticMap<Graph, UpperNode, _Value> > {
    1.91 +    class ANodeMap 
    1.92 +      : public IterableMapExtender<StaticMap<Graph, ANode, _Value> > {
    1.93      public:
    1.94 -      typedef StaticMappableUBipartiteGraphExtender Graph;
    1.95 -      typedef IterableMapExtender<StaticMap<Graph, UpperNode, _Value> > 
    1.96 +      typedef StaticMappableBpUGraphExtender Graph;
    1.97 +      typedef IterableMapExtender<StaticMap<Graph, ANode, _Value> > 
    1.98        Parent;
    1.99      
   1.100 -      UpperNodeMap(const Graph& _g) 
   1.101 +      ANodeMap(const Graph& _g) 
   1.102  	: Parent(_g) {}
   1.103 -      UpperNodeMap(const Graph& _g, const _Value& _v) 
   1.104 +      ANodeMap(const Graph& _g, const _Value& _v) 
   1.105  	: Parent(_g, _v) {}
   1.106      
   1.107 -      UpperNodeMap& operator=(const UpperNodeMap& cmap) {
   1.108 -	return operator=<UpperNodeMap>(cmap);
   1.109 +      ANodeMap& operator=(const ANodeMap& cmap) {
   1.110 +	return operator=<ANodeMap>(cmap);
   1.111        }
   1.112      
   1.113  
   1.114 @@ -380,13 +380,13 @@
   1.115        ///
   1.116        /// The given parameter should be conform to the ReadMap
   1.117        /// concept and could be indiced by the current item set of
   1.118 -      /// the UpperNodeMap. In this case the value for each item
   1.119 +      /// the ANodeMap. In this case the value for each item
   1.120        /// is assigned by the value of the given ReadMap. 
   1.121        template <typename CMap>
   1.122 -      UpperNodeMap& operator=(const CMap& cmap) {
   1.123 -	checkConcept<concept::ReadMap<UpperNode, _Value>, CMap>();
   1.124 +      ANodeMap& operator=(const CMap& cmap) {
   1.125 +	checkConcept<concept::ReadMap<ANode, _Value>, CMap>();
   1.126  	const typename Parent::Graph* graph = Parent::getGraph();
   1.127 -	UpperNode it;
   1.128 +	ANode it;
   1.129  	for (graph->first(it); it != INVALID; graph->next(it)) {
   1.130  	  Parent::set(it, cmap[it]);
   1.131  	}
   1.132 @@ -396,20 +396,20 @@
   1.133      };
   1.134  
   1.135      template <typename _Value>
   1.136 -    class LowerNodeMap 
   1.137 -      : public IterableMapExtender<StaticMap<Graph, LowerNode, _Value> > {
   1.138 +    class BNodeMap 
   1.139 +      : public IterableMapExtender<StaticMap<Graph, BNode, _Value> > {
   1.140      public:
   1.141 -      typedef StaticMappableUBipartiteGraphExtender Graph;
   1.142 -      typedef IterableMapExtender<StaticMap<Graph, LowerNode, _Value> > 
   1.143 +      typedef StaticMappableBpUGraphExtender Graph;
   1.144 +      typedef IterableMapExtender<StaticMap<Graph, BNode, _Value> > 
   1.145        Parent;
   1.146      
   1.147 -      LowerNodeMap(const Graph& _g) 
   1.148 +      BNodeMap(const Graph& _g) 
   1.149  	: Parent(_g) {}
   1.150 -      LowerNodeMap(const Graph& _g, const _Value& _v) 
   1.151 +      BNodeMap(const Graph& _g, const _Value& _v) 
   1.152  	: Parent(_g, _v) {}
   1.153      
   1.154 -      LowerNodeMap& operator=(const LowerNodeMap& cmap) {
   1.155 -	return operator=<LowerNodeMap>(cmap);
   1.156 +      BNodeMap& operator=(const BNodeMap& cmap) {
   1.157 +	return operator=<BNodeMap>(cmap);
   1.158        }
   1.159      
   1.160  
   1.161 @@ -417,13 +417,13 @@
   1.162        ///
   1.163        /// The given parameter should be conform to the ReadMap
   1.164        /// concept and could be indiced by the current item set of
   1.165 -      /// the LowerNodeMap. In this case the value for each item
   1.166 +      /// the BNodeMap. In this case the value for each item
   1.167        /// is assigned by the value of the given ReadMap. 
   1.168        template <typename CMap>
   1.169 -      LowerNodeMap& operator=(const CMap& cmap) {
   1.170 -	checkConcept<concept::ReadMap<LowerNode, _Value>, CMap>();
   1.171 +      BNodeMap& operator=(const CMap& cmap) {
   1.172 +	checkConcept<concept::ReadMap<BNode, _Value>, CMap>();
   1.173  	const typename Parent::Graph* graph = Parent::getGraph();
   1.174 -	LowerNode it;
   1.175 +	BNode it;
   1.176  	for (graph->first(it); it != INVALID; graph->next(it)) {
   1.177  	  Parent::set(it, cmap[it]);
   1.178  	}
   1.179 @@ -437,32 +437,32 @@
   1.180      template <typename _Value>
   1.181      class NodeMapBase : public Parent::NodeNotifier::ObserverBase {
   1.182      public:
   1.183 -      typedef StaticMappableUBipartiteGraphExtender Graph;
   1.184 +      typedef StaticMappableBpUGraphExtender Graph;
   1.185  
   1.186        typedef Node Key;
   1.187        typedef _Value Value;
   1.188  
   1.189        /// The reference type of the map;
   1.190 -      typedef typename LowerNodeMap<_Value>::Reference Reference;
   1.191 +      typedef typename BNodeMap<_Value>::Reference Reference;
   1.192        /// The pointer type of the map;
   1.193 -      typedef typename LowerNodeMap<_Value>::Pointer Pointer;
   1.194 +      typedef typename BNodeMap<_Value>::Pointer Pointer;
   1.195        
   1.196        /// The const value type of the map.
   1.197        typedef const Value ConstValue;
   1.198        /// The const reference type of the map;
   1.199 -      typedef typename LowerNodeMap<_Value>::ConstReference ConstReference;
   1.200 +      typedef typename BNodeMap<_Value>::ConstReference ConstReference;
   1.201        /// The pointer type of the map;
   1.202 -      typedef typename LowerNodeMap<_Value>::ConstPointer ConstPointer;
   1.203 +      typedef typename BNodeMap<_Value>::ConstPointer ConstPointer;
   1.204  
   1.205        typedef True ReferenceMapTag;
   1.206  
   1.207        NodeMapBase(const Graph& _g) 
   1.208 -	: graph(&_g), lowerMap(_g), upperMap(_g) {
   1.209 +	: graph(&_g), bNodeMap(_g), aNodeMap(_g) {
   1.210  	Parent::NodeNotifier::ObserverBase::attach(_g.getNotifier(Node()));
   1.211        }
   1.212        NodeMapBase(const Graph& _g, const _Value& _v) 
   1.213 -	: graph(&_g), lowerMap(_g, _v), 
   1.214 -	  upperMap(_g, _v) {
   1.215 +	: graph(&_g), bNodeMap(_g, _v), 
   1.216 +	  aNodeMap(_g, _v) {
   1.217  	Parent::NodeNotifier::ObserverBase::attach(_g.getNotifier(Node()));
   1.218        }
   1.219  
   1.220 @@ -473,26 +473,26 @@
   1.221        }
   1.222      
   1.223        ConstReference operator[](const Key& node) const {
   1.224 -	if (Parent::upper(node)) {
   1.225 -	  return upperMap[node];
   1.226 +	if (Parent::aNode(node)) {
   1.227 +	  return aNodeMap[node];
   1.228  	} else {
   1.229 -	  return lowerMap[node];
   1.230 +	  return bNodeMap[node];
   1.231  	}
   1.232        } 
   1.233  
   1.234        Reference operator[](const Key& node) {
   1.235 -	if (Parent::upper(node)) {
   1.236 -	  return upperMap[node];
   1.237 +	if (Parent::aNode(node)) {
   1.238 +	  return aNodeMap[node];
   1.239  	} else {
   1.240 -	  return lowerMap[node];
   1.241 +	  return bNodeMap[node];
   1.242  	}
   1.243        }
   1.244  
   1.245        void set(const Key& node, const Value& value) {
   1.246 -	if (Parent::upper(node)) {
   1.247 -	  upperMap.set(node, value);
   1.248 +	if (Parent::aNode(node)) {
   1.249 +	  aNodeMap.set(node, value);
   1.250  	} else {
   1.251 -	  lowerMap.set(node, value);
   1.252 +	  bNodeMap.set(node, value);
   1.253  	}
   1.254        }
   1.255  
   1.256 @@ -507,8 +507,8 @@
   1.257        
   1.258      private:
   1.259        const Graph* graph;
   1.260 -      LowerNodeMap<_Value> lowerMap;
   1.261 -      UpperNodeMap<_Value> upperMap;
   1.262 +      BNodeMap<_Value> bNodeMap;
   1.263 +      ANodeMap<_Value> aNodeMap;
   1.264      };
   1.265      
   1.266    public:
   1.267 @@ -517,7 +517,7 @@
   1.268      class NodeMap 
   1.269        : public IterableMapExtender<NodeMapBase<_Value> > {
   1.270      public:
   1.271 -      typedef StaticMappableUBipartiteGraphExtender Graph;
   1.272 +      typedef StaticMappableBpUGraphExtender Graph;
   1.273        typedef IterableMapExtender< NodeMapBase<_Value> > Parent;
   1.274      
   1.275        NodeMap(const Graph& _g) 
   1.276 @@ -555,7 +555,7 @@
   1.277      class EdgeMap 
   1.278        : public IterableMapExtender<StaticMap<Graph, Edge, _Value> > {
   1.279      public:
   1.280 -      typedef StaticMappableUBipartiteGraphExtender Graph;
   1.281 +      typedef StaticMappableBpUGraphExtender Graph;
   1.282        typedef IterableMapExtender<StaticMap<Graph, Edge, _Value> > Parent;
   1.283      
   1.284        EdgeMap(const Graph& _g) 
   1.285 @@ -583,7 +583,7 @@
   1.286      class UEdgeMap 
   1.287        : public IterableMapExtender<StaticMap<Graph, UEdge, _Value> > {
   1.288      public:
   1.289 -      typedef StaticMappableUBipartiteGraphExtender Graph;
   1.290 +      typedef StaticMappableBpUGraphExtender Graph;
   1.291        typedef IterableMapExtender<StaticMap<Graph, UEdge, _Value> > 
   1.292        Parent;
   1.293