COIN-OR::LEMON - Graph Library

Changeset 209:765619b7cbb2 in lemon-main for lemon/path.h


Ignore:
Timestamp:
07/13/08 20:51:02 (16 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Phase:
public
Message:

Apply unify-sources.sh to the source tree

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/path.h

    r157 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    3  * This file is a part of LEMON, a generic C++ optimization library
     3 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    55 * Copyright (C) 2003-2008
     
    9494      ArcIt(Invalid) : path(0), idx(-1) {}
    9595      /// \brief Initializate the iterator to the first arc of path
    96       ArcIt(const Path &_path) 
     96      ArcIt(const Path &_path)
    9797        : path(&_path), idx(_path.empty() ? -1 : 0) {}
    9898
    9999    private:
    100100
    101       ArcIt(const Path &_path, int _idx) 
     101      ArcIt(const Path &_path, int _idx)
    102102        : path(&_path), idx(_idx) {}
    103103
     
    110110
    111111      /// \brief Next arc
    112       ArcIt& operator++() { 
     112      ArcIt& operator++() {
    113113        ++idx;
    114         if (idx >= path->length()) idx = -1; 
    115         return *this; 
     114        if (idx >= path->length()) idx = -1;
     115        return *this;
    116116      }
    117117
     
    285285      ArcIt(Invalid) : path(0), idx(-1) {}
    286286      /// \brief Initializate the constructor to the first arc of path
    287       ArcIt(const SimplePath &_path) 
     287      ArcIt(const SimplePath &_path)
    288288        : path(&_path), idx(_path.empty() ? -1 : 0) {}
    289289
     
    291291
    292292      /// Constructor with starting point
    293       ArcIt(const SimplePath &_path, int _idx) 
     293      ArcIt(const SimplePath &_path, int _idx)
    294294        : idx(_idx), path(&_path) {}
    295295
     
    302302
    303303      /// Next arc
    304       ArcIt& operator++() { 
     304      ArcIt& operator++() {
    305305        ++idx;
    306         if (idx >= path->length()) idx = -1; 
    307         return *this; 
     306        if (idx >= path->length()) idx = -1;
     307        return *this;
    308308      }
    309309
     
    414414  protected:
    415415
    416     // the std::list<> is incompatible 
     416    // the std::list<> is incompatible
    417417    // hard to create invalid iterator
    418418    struct Node {
     
    426426
    427427  public:
    428  
     428
    429429    /// \brief Default constructor
    430430    ///
     
    471471      ArcIt(Invalid) : path(0), node(0) {}
    472472      /// \brief Initializate the constructor to the first arc of path
    473       ArcIt(const ListPath &_path) 
     473      ArcIt(const ListPath &_path)
    474474        : path(&_path), node(_path.first) {}
    475475
    476476    protected:
    477477
    478       ArcIt(const ListPath &_path, Node *_node) 
     478      ArcIt(const ListPath &_path, Node *_node)
    479479        : path(&_path), node(_node) {}
    480480
     
    488488
    489489      /// Next arc
    490       ArcIt& operator++() { 
     490      ArcIt& operator++() {
    491491        node = node->next;
    492         return *this; 
     492        return *this;
    493493      }
    494494
     
    758758    /// Default constructor
    759759    StaticPath() : len(0), arcs(0) {}
    760    
     760
    761761    /// \brief Template copy constructor
    762762    ///
     
    797797      ArcIt(Invalid) : path(0), idx(-1) {}
    798798      /// Initializate the constructor to the first arc of path
    799       ArcIt(const StaticPath &_path) 
     799      ArcIt(const StaticPath &_path)
    800800        : path(&_path), idx(_path.empty() ? -1 : 0) {}
    801801
     
    803803
    804804      /// Constructor with starting point
    805       ArcIt(const StaticPath &_path, int _idx) 
     805      ArcIt(const StaticPath &_path, int _idx)
    806806        : idx(_idx), path(&_path) {}
    807807
     
    814814
    815815      /// Next arc
    816       ArcIt& operator++() { 
     816      ArcIt& operator++() {
    817817        ++idx;
    818         if (idx >= path->length()) idx = -1; 
    819         return *this; 
     818        if (idx >= path->length()) idx = -1;
     819        return *this;
    820820      }
    821821
     
    910910    template <typename Path>
    911911    struct RevPathTagIndicator<
    912       Path, 
     912      Path,
    913913      typename enable_if<typename Path::RevPathTag, void>::type
    914914      > {
     
    923923    template <typename Path>
    924924    struct BuildTagIndicator<
    925       Path, 
     925      Path,
    926926      typename enable_if<typename Path::BuildTag, void>::type
    927927    > {
     
    930930
    931931    template <typename Target, typename Source,
    932               bool buildEnable = BuildTagIndicator<Target>::value,
    933               bool revEnable = RevPathTagIndicator<Source>::value>
     932              bool buildEnable = BuildTagIndicator<Target>::value,
     933              bool revEnable = RevPathTagIndicator<Source>::value>
    934934    struct PathCopySelector {
    935935      static void copy(Target& target, const Source& source) {
     
    982982  ///
    983983  /// This function checks that the target of each arc is the same
    984   /// as the source of the next one. 
    985   /// 
     984  /// as the source of the next one.
     985  ///
    986986  template <typename Digraph, typename Path>
    987987  bool checkPath(const Digraph& digraph, const Path& path) {
     
    10351035    typedef typename Path::Digraph Digraph;
    10361036    typedef typename Digraph::Node Node;
    1037    
     1037
    10381038    /// Default constructor
    10391039    PathNodeIt() {}
    10401040    /// Invalid constructor
    1041     PathNodeIt(Invalid) 
     1041    PathNodeIt(Invalid)
    10421042      : _digraph(0), _it(INVALID), _nd(INVALID) {}
    10431043    /// Constructor
    1044     PathNodeIt(const Digraph& digraph, const Path& path) 
     1044    PathNodeIt(const Digraph& digraph, const Path& path)
    10451045      : _digraph(&digraph), _it(path) {
    10461046      _nd = (_it != INVALID ? _digraph->source(_it) : INVALID);
    10471047    }
    10481048    /// Constructor
    1049     PathNodeIt(const Digraph& digraph, const Path& path, const Node& src) 
     1049    PathNodeIt(const Digraph& digraph, const Path& path, const Node& src)
    10501050      : _digraph(&digraph), _it(path), _nd(src) {}
    10511051
     
    10591059      if (_it == INVALID) _nd = INVALID;
    10601060      else {
    1061         _nd = _digraph->target(_it);
    1062         ++_it;
     1061        _nd = _digraph->target(_it);
     1062        ++_it;
    10631063      }
    10641064      return *this;
     
    10661066
    10671067    /// Comparison operator
    1068     bool operator==(const PathNodeIt& n) const { 
    1069       return _it == n._it && _nd == n._nd; 
     1068    bool operator==(const PathNodeIt& n) const {
     1069      return _it == n._it && _nd == n._nd;
    10701070    }
    10711071    /// Comparison operator
    1072     bool operator!=(const PathNodeIt& n) const { 
    1073       return _it != n._it || _nd != n._nd; 
     1072    bool operator!=(const PathNodeIt& n) const {
     1073      return _it != n._it || _nd != n._nd;
    10741074    }
    10751075    /// Comparison operator
    1076     bool operator<(const PathNodeIt& n) const { 
     1076    bool operator<(const PathNodeIt& n) const {
    10771077      return (_it < n._it && _nd != INVALID);
    10781078    }
    1079    
     1079
    10801080  };
    1081  
     1081
    10821082  ///@}
    10831083
Note: See TracChangeset for help on using the changeset viewer.