# HG changeset patch # User ladanyi # Date 1116409146 0 # Node ID 91eb709836973bd738ed7a603f5743d77333d37f # Parent f3717c08e2bea75f3a61f76d7d795ce061ead679 - minor corrections in the docs - fixed indenting diff -r f3717c08e2be -r 91eb70983697 src/lemon/concept/graph.h --- a/src/lemon/concept/graph.h Mon May 16 21:49:35 2005 +0000 +++ b/src/lemon/concept/graph.h Wed May 18 09:39:06 2005 +0000 @@ -36,61 +36,61 @@ /**************** The full-featured graph concepts ****************/ - /// \brief Modular builded static graph class. + /// \brief Modular static graph class. /// /// It should be the same as the \c StaticGraph class. class _StaticGraph : virtual public BaseGraphComponent, - public IterableGraphComponent, public MappableGraphComponent { + public IterableGraphComponent, public MappableGraphComponent { public: typedef BaseGraphComponent::Node Node; typedef BaseGraphComponent::Edge Edge; template struct Constraints { - void constraints() { - checkConcept(); - checkConcept(); - } + void constraints() { + checkConcept(); + checkConcept(); + } }; }; - /// \brief Modular builded extendable graph class. + /// \brief Modular extendable graph class. /// /// It should be the same as the \c ExtendableGraph class. class _ExtendableGraph : virtual public BaseGraphComponent, public _StaticGraph, - public ExtendableGraphComponent, public ClearableGraphComponent { + public ExtendableGraphComponent, public ClearableGraphComponent { public: typedef BaseGraphComponent::Node Node; typedef BaseGraphComponent::Edge Edge; template struct Constraints { - void constraints() { - checkConcept<_StaticGraph, _Graph >(); - checkConcept(); - checkConcept(); - } + void constraints() { + checkConcept<_StaticGraph, _Graph >(); + checkConcept(); + checkConcept(); + } }; }; - /// \brief Modular builded erasable graph class. + /// \brief Modular erasable graph class. /// /// It should be the same as the \c ErasableGraph class. class _ErasableGraph : virtual public BaseGraphComponent, public _ExtendableGraph, - public ErasableGraphComponent { + public ErasableGraphComponent { public: typedef BaseGraphComponent::Node Node; typedef BaseGraphComponent::Edge Edge; template struct Constraints { - void constraints() { - checkConcept<_ExtendableGraph, _Graph >(); - checkConcept(); - } + void constraints() { + checkConcept<_ExtendableGraph, _Graph >(); + checkConcept(); + } }; }; @@ -135,33 +135,33 @@ /// from the trivial node iterator. class Node { public: - /// Default constructor + /// Default constructor - /// @warning The default constructor sets the iterator - /// to an undefined value. - Node() { } - /// Copy constructor. + /// @warning The default constructor sets the iterator + /// to an undefined value. + Node() { } + /// Copy constructor. - /// Copy constructor. - /// - Node(const Node&) { } + /// Copy constructor. + /// + Node(const Node&) { } - /// Invalid constructor \& conversion. + /// Invalid constructor \& conversion. - /// This constructor initializes the iterator to be invalid. - /// \sa Invalid for more details. - Node(Invalid) { } - /// Equality operator + /// This constructor initializes the iterator to be invalid. + /// \sa Invalid for more details. + Node(Invalid) { } + /// Equality operator - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(Node) const { return true; } + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(Node) const { return true; } - /// Inequality operator - - /// \sa operator==(Node n) - /// - bool operator!=(Node) const { return true; } + /// Inequality operator + + /// \sa operator==(Node n) + /// + bool operator!=(Node) const { return true; } }; @@ -172,42 +172,42 @@ /// of nodes in graph \c g of type \c Graph like this: /// \code /// int count=0; - /// for (Graph::NodeIt n(g); n!=INVALID ++n) ++count; + /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count; /// \endcode class NodeIt : public Node { public: - /// Default constructor + /// Default constructor - /// @warning The default constructor sets the iterator - /// to an undefined value. - NodeIt() { } - /// Copy constructor. - - /// Copy constructor. - /// - NodeIt(const NodeIt& n) : Node(n) { } - /// Invalid constructor \& conversion. + /// @warning The default constructor sets the iterator + /// to an undefined value. + NodeIt() { } + /// Copy constructor. + + /// Copy constructor. + /// + NodeIt(const NodeIt& n) : Node(n) { } + /// Invalid constructor \& conversion. - /// Initialize the iterator to be invalid. - /// \sa Invalid for more details. - NodeIt(Invalid) { } - /// Sets the iterator to the first node. + /// Initialize the iterator to be invalid. + /// \sa Invalid for more details. + NodeIt(Invalid) { } + /// Sets the iterator to the first node. - /// Sets the iterator to the first node of \c g. - /// - NodeIt(const StaticGraph&) { } - /// Node -> NodeIt conversion. + /// Sets the iterator to the first node of \c g. + /// + NodeIt(const StaticGraph&) { } + /// Node -> NodeIt conversion. - /// Sets the iterator to the node of \c g pointed by the trivial - /// iterator n. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - NodeIt(const StaticGraph& g, const Node& n) { } - /// Next node. + /// Sets the iterator to the node of \c g pointed by the trivial + /// iterator n. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + NodeIt(const StaticGraph& g, const Node& n) { } + /// Next node. - /// Assign the iterator to the next node. - /// - NodeIt& operator++() { return *this; } + /// Assign the iterator to the next node. + /// + NodeIt& operator++() { return *this; } }; @@ -217,31 +217,31 @@ /// class Edge { public: - /// Default constructor + /// Default constructor - /// @warning The default constructor sets the iterator - /// to an undefined value. - Edge() { } - /// Copy constructor. + /// @warning The default constructor sets the iterator + /// to an undefined value. + Edge() { } + /// Copy constructor. - /// Copy constructor. - /// - Edge(const Edge&) { } - /// Initialize the iterator to be invalid. + /// Copy constructor. + /// + Edge(const Edge&) { } + /// Initialize the iterator to be invalid. - /// Initialize the iterator to be invalid. - /// - Edge(Invalid) { } - /// Equality operator + /// Initialize the iterator to be invalid. + /// + Edge(Invalid) { } + /// Equality operator - /// Two iterators are equal if and only if they point to the - /// same object or both are invalid. - bool operator==(Edge) const { return true; } - /// Inequality operator + /// Two iterators are equal if and only if they point to the + /// same object or both are invalid. + bool operator==(Edge) const { return true; } + /// Inequality operator - /// \sa operator==(Node n) - /// - bool operator!=(Edge) const { return true; } + /// \sa operator==(Node n) + /// + bool operator!=(Edge) const { return true; } }; /// This iterator goes trough the outgoing edges of a node. @@ -258,39 +258,39 @@ class OutEdgeIt : public Edge { public: - /// Default constructor + /// Default constructor - /// @warning The default constructor sets the iterator - /// to an undefined value. - OutEdgeIt() { } - /// Copy constructor. + /// @warning The default constructor sets the iterator + /// to an undefined value. + OutEdgeIt() { } + /// Copy constructor. - /// Copy constructor. - /// - OutEdgeIt(const OutEdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. + /// Copy constructor. + /// + OutEdgeIt(const OutEdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. - /// Initialize the iterator to be invalid. - /// - OutEdgeIt(Invalid) { } - /// This constructor sets the iterator to first outgoing edge. + /// Initialize the iterator to be invalid. + /// + OutEdgeIt(Invalid) { } + /// This constructor sets the iterator to the first outgoing edge. - /// This constructor set the iterator to the first outgoing edge of - /// node - ///@param n the node - ///@param g the graph - OutEdgeIt(const StaticGraph&, const Node&) { } - /// Edge -> OutEdgeIt conversion + /// This constructor sets the iterator to the first outgoing edge of + /// the node. + ///@param n the node + ///@param g the graph + OutEdgeIt(const StaticGraph&, const Node&) { } + /// Edge -> OutEdgeIt conversion - /// Sets the iterator to the value of the trivial iterator \c e. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - OutEdgeIt(const StaticGraph& g, const Edge& e) { } - ///Next outgoing edge - - /// Assign the iterator to the next - /// outgoing edge of the corresponding node. - OutEdgeIt& operator++() { return *this; } + /// Sets the iterator to the value of the trivial iterator \c e. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + OutEdgeIt(const StaticGraph& g, const Edge& e) { } + ///Next outgoing edge + + /// Assign the iterator to the next + /// outgoing edge of the corresponding node. + OutEdgeIt& operator++() { return *this; } }; /// This iterator goes trough the incoming edges of a node. @@ -307,39 +307,39 @@ class InEdgeIt : public Edge { public: - /// Default constructor + /// Default constructor - /// @warning The default constructor sets the iterator - /// to an undefined value. - InEdgeIt() { } - /// Copy constructor. + /// @warning The default constructor sets the iterator + /// to an undefined value. + InEdgeIt() { } + /// Copy constructor. - /// Copy constructor. - /// - InEdgeIt(const InEdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. + /// Copy constructor. + /// + InEdgeIt(const InEdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. - /// Initialize the iterator to be invalid. - /// - InEdgeIt(Invalid) { } - /// This constructor sets the iterator to first incoming edge. + /// Initialize the iterator to be invalid. + /// + InEdgeIt(Invalid) { } + /// This constructor sets the iterator to first incoming edge. - /// This constructor set the iterator to the first incoming edge of - /// node - ///@param n the node - ///@param g the graph - InEdgeIt(const StaticGraph&, const Node&) { } - /// Edge -> InEdgeIt conversion + /// This constructor set the iterator to the first incoming edge of + /// the node. + ///@param n the node + ///@param g the graph + InEdgeIt(const StaticGraph&, const Node&) { } + /// Edge -> InEdgeIt conversion - /// Sets the iterator to the value of the trivial iterator \c e. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - InEdgeIt(const StaticGraph&, const Edge&) { } - /// Next incoming edge + /// Sets the iterator to the value of the trivial iterator \c e. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + InEdgeIt(const StaticGraph&, const Edge&) { } + /// Next incoming edge - /// Assign the iterator to the next inedge of the corresponding node. - /// - InEdgeIt& operator++() { return *this; } + /// Assign the iterator to the next inedge of the corresponding node. + /// + InEdgeIt& operator++() { return *this; } }; /// This iterator goes through each edge. @@ -352,38 +352,36 @@ /// \endcode class EdgeIt : public Edge { public: - /// Default constructor + /// Default constructor - /// @warning The default constructor sets the iterator - /// to an undefined value. - EdgeIt() { } - /// Copy constructor. + /// @warning The default constructor sets the iterator + /// to an undefined value. + EdgeIt() { } + /// Copy constructor. - /// Copy constructor. - /// - EdgeIt(const EdgeIt& e) : Edge(e) { } - /// Initialize the iterator to be invalid. + /// Copy constructor. + /// + EdgeIt(const EdgeIt& e) : Edge(e) { } + /// Initialize the iterator to be invalid. - /// Initialize the iterator to be invalid. - /// - EdgeIt(Invalid) { } - /// This constructor sets the iterator to first edge. + /// Initialize the iterator to be invalid. + /// + EdgeIt(Invalid) { } + /// This constructor sets the iterator to the first edge. - /// This constructor set the iterator to the first edge of - /// node - ///@param g the graph - EdgeIt(const StaticGraph&) { } - /// Edge -> EdgeIt conversion + /// This constructor sets the iterator to the first edge of \c g. + ///@param g the graph + EdgeIt(const StaticGraph&) { } + /// Edge -> EdgeIt conversion - /// Sets the iterator to the value of the trivial iterator \c e. - /// This feature necessitates that each time we - /// iterate the edge-set, the iteration order is the same. - EdgeIt(const StaticGraph&, const Edge&) { } - ///Next edge - - /// Assign the iterator to the next - /// edge of the corresponding node. - EdgeIt& operator++() { return *this; } + /// Sets the iterator to the value of the trivial iterator \c e. + /// This feature necessitates that each time we + /// iterate the edge-set, the iteration order is the same. + EdgeIt(const StaticGraph&, const Edge&) { } + ///Next edge + + /// Assign the iterator to the next edge. + EdgeIt& operator++() { return *this; } }; ///Gives back the target node of an edge. @@ -407,16 +405,16 @@ { public: - ///\e - NodeMap(const StaticGraph&) { } - ///\e - NodeMap(const StaticGraph&, T) { } + ///\e + NodeMap(const StaticGraph&) { } + ///\e + NodeMap(const StaticGraph&, T) { } - ///Copy constructor - NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } - ///Assignment operator - NodeMap& operator=(const NodeMap&) { return *this; } - // \todo fix this concept + ///Copy constructor + NodeMap(const NodeMap& nm) : ReadWriteMap< Node, T >(nm) { } + ///Assignment operator + NodeMap& operator=(const NodeMap&) { return *this; } + // \todo fix this concept }; /// Read write map of the edges to type \c T. @@ -431,15 +429,15 @@ { public: - ///\e - EdgeMap(const StaticGraph&) { } - ///\e - EdgeMap(const StaticGraph&, T) { } - ///Copy constructor - EdgeMap(const EdgeMap& em) : ReadWriteMap(em) { } - ///Assignment operator - EdgeMap& operator=(const EdgeMap&) { return *this; } - // \todo fix this concept + ///\e + EdgeMap(const StaticGraph&) { } + ///\e + EdgeMap(const StaticGraph&, T) { } + ///Copy constructor + EdgeMap(const EdgeMap& em) : ReadWriteMap(em) { } + ///Assignment operator + EdgeMap& operator=(const EdgeMap&) { return *this; } + // \todo fix this concept }; template @@ -449,9 +447,8 @@ /// An empty non-static graph class. - /// This class provides everything that \ref StaticGraph - /// with additional functionality which enables to build a - /// graph from scratch. + /// This class provides everything that \ref StaticGraph does. + /// Additionally it enables building graphs from scratch. class ExtendableGraph : public StaticGraph { public: @@ -486,7 +483,7 @@ /// An empty erasable graph class. - /// This class is an extension of \ref ExtendableGraph. It also makes it + /// This class is an extension of \ref ExtendableGraph. It makes it /// possible to erase edges or nodes. class ErasableGraph : public ExtendableGraph { diff -r f3717c08e2be -r 91eb70983697 src/lemon/xy.h --- a/src/lemon/xy.h Mon May 16 21:49:35 2005 +0000 +++ b/src/lemon/xy.h Wed May 18 09:39:06 2005 +0000 @@ -29,7 +29,7 @@ /// operations. /// /// The class \ref lemon::BoundingBox "BoundingBox" can be used to determine -/// the rectangular bounding box a set of \ref lemon::xy "xy"'s. +/// the rectangular bounding box of a set of \ref lemon::xy "xy"'s. /// ///\author Attila Bernath @@ -67,81 +67,81 @@ ///Gives back the square of the norm of the vector T normSquare() const { - return x*x+y*y; + return x*x+y*y; } ///Increments the left hand side by u xy& operator +=(const xy& u) { - x += u.x; - y += u.y; - return *this; + x += u.x; + y += u.y; + return *this; } ///Decrements the left hand side by u xy& operator -=(const xy& u) { - x -= u.x; - y -= u.y; - return *this; + x -= u.x; + y -= u.y; + return *this; } ///Multiplying the left hand side with a scalar xy& operator *=(const T &u) { - x *= u; - y *= u; - return *this; + x *= u; + y *= u; + return *this; } ///Dividing the left hand side by a scalar xy& operator /=(const T &u) { - x /= u; - y /= u; - return *this; + x /= u; + y /= u; + return *this; } ///Returns the scalar product of two vectors T operator *(const xy& u) const { - return x*u.x+y*u.y; + return x*u.x+y*u.y; } ///Returns the sum of two vectors xy operator+(const xy &u) const { - xy b=*this; - return b+=u; + xy b=*this; + return b+=u; } ///Returns the neg of the vectors xy operator-() const { - xy b=*this; - b.x=-b.x; b.y=-b.y; - return b; + xy b=*this; + b.x=-b.x; b.y=-b.y; + return b; } ///Returns the difference of two vectors xy operator-(const xy &u) const { - xy b=*this; - return b-=u; + xy b=*this; + return b-=u; } ///Returns a vector multiplied by a scalar xy operator*(const T &u) const { - xy b=*this; - return b*=u; + xy b=*this; + return b*=u; } ///Returns a vector divided by a scalar xy operator/(const T &u) const { - xy b=*this; - return b/=u; + xy b=*this; + return b/=u; } ///Testing equality bool operator==(const xy &u) const { - return (x==u.x) && (y==u.y); + return (x==u.x) && (y==u.y); } ///Testing inequality bool operator!=(xy u) const { - return (x!=u.x) || (y!=u.y); + return (x!=u.x) || (y!=u.y); } }; @@ -229,116 +229,116 @@ bool _empty; public: - ///Default constructor: an empty bounding box + ///Default constructor: creates an empty bounding box BoundingBox() { _empty = true; } ///Constructing the instance from one point BoundingBox(xy a) { bottom_left=top_right=a; _empty = false; } - ///Is there any point added + ///Were any points added? bool empty() const { - return _empty; + return _empty; } ///Makes the BoundingBox empty void clear() { - _empty=1; + _empty=1; } ///Gives back the bottom left corner (if the bounding box is empty, then the return value is not defined) xy bottomLeft() const { - return bottom_left; + return bottom_left; } ///Gives back the top right corner (if the bounding box is empty, then the return value is not defined) xy topRight() const { - return top_right; + return top_right; } ///Gives back the bottom right corner (if the bounding box is empty, then the return value is not defined) xy bottomRight() const { - return xy(top_right.x,bottom_left.y); + return xy(top_right.x,bottom_left.y); } ///Gives back the top left corner (if the bounding box is empty, then the return value is not defined) xy topLeft() const { - return xy(bottom_left.x,top_right.y); + return xy(bottom_left.x,top_right.y); } ///Gives back the bottom of the box (if the bounding box is empty, then the return value is not defined) T bottom() const { - return bottom_left.y; + return bottom_left.y; } ///Gives back the top of the box (if the bounding box is empty, then the return value is not defined) T top() const { - return top_right.y; + return top_right.y; } ///Gives back the left side of the box (if the bounding box is empty, then the return value is not defined) T left() const { - return bottom_left.x; + return bottom_left.x; } ///Gives back the right side of the box (if the bounding box is empty, then the return value is not defined) T right() const { - return top_right.x; + return top_right.x; } ///Gives back the height of the box (if the bounding box is empty, then the return value is not defined) T height() const { - return top_right.y-bottom_left.y; + return top_right.y-bottom_left.y; } ///Gives back the width of the box (if the bounding box is empty, then the return value is not defined) T width() const { - return top_right.x-bottom_left.x; + return top_right.x-bottom_left.x; } ///Checks whether a point is inside a bounding box bool inside(const xy& u){ - if (_empty) - return false; - else{ - return ((u.x-bottom_left.x)*(top_right.x-u.x) >= 0 && - (u.y-bottom_left.y)*(top_right.y-u.y) >= 0 ); - } + if (_empty) + return false; + else{ + return ((u.x-bottom_left.x)*(top_right.x-u.x) >= 0 && + (u.y-bottom_left.y)*(top_right.y-u.y) >= 0 ); + } } ///Increments a bounding box with a point BoundingBox& operator +=(const xy& u){ - if (_empty){ - bottom_left=top_right=u; - _empty = false; - } - else{ - if (bottom_left.x > u.x) bottom_left.x = u.x; - if (bottom_left.y > u.y) bottom_left.y = u.y; - if (top_right.x < u.x) top_right.x = u.x; - if (top_right.y < u.y) top_right.y = u.y; - } - return *this; + if (_empty){ + bottom_left=top_right=u; + _empty = false; + } + else{ + if (bottom_left.x > u.x) bottom_left.x = u.x; + if (bottom_left.y > u.y) bottom_left.y = u.y; + if (top_right.x < u.x) top_right.x = u.x; + if (top_right.y < u.y) top_right.y = u.y; + } + return *this; } ///Sums a bounding box and a point BoundingBox operator +(const xy& u){ - BoundingBox b = *this; - return b += u; + BoundingBox b = *this; + return b += u; } ///Increments a bounding box with an other bounding box BoundingBox& operator +=(const BoundingBox &u){ - if ( !u.empty() ){ - *this += u.bottomLeft(); - *this += u.topRight(); - } - return *this; + if ( !u.empty() ){ + *this += u.bottomLeft(); + *this += u.topRight(); + } + return *this; } ///Sums two bounding boxes BoundingBox operator +(const BoundingBox& u){ - BoundingBox b = *this; - return b += u; + BoundingBox b = *this; + return b += u; } };//class Boundingbox