# HG changeset patch # User alpar # Date 1153376427 0 # Node ID f9171bfc7ebb23e2c42b67aead7a4731b5deaa26 # Parent 478ba329ffb79f6f0f0628785a4b515f9a66d3b8 - Doc improvements - rot180() added to xy.h diff -r 478ba329ffb7 -r f9171bfc7ebb doc/coding_style.dox --- a/doc/coding_style.dox Wed Jul 19 15:13:24 2006 +0000 +++ b/doc/coding_style.dox Thu Jul 20 06:20:27 2006 +0000 @@ -11,6 +11,14 @@ it. Please comply with these conventions if you want to contribute developing LEMON library. +\note When the coding style requires the capitalization of an abbreviation, +only the first letter should be upper case. + +\code +XmlReader +\endcode + + \warning In some cases we diverge from these rules. This primary done because STL uses different naming convention and in certain cases diff -r 478ba329ffb7 -r f9171bfc7ebb doc/dirs.dox --- a/doc/dirs.dox Wed Jul 19 15:13:24 2006 +0000 +++ b/doc/dirs.dox Thu Jul 20 06:20:27 2006 +0000 @@ -9,7 +9,8 @@ /** \dir doc \brief Auxiliary (and the whole generated) documentation. - Auxiliary (and the whole generated) documentation. + +Auxiliary (and the whole generated) documentation. */ /** diff -r 478ba329ffb7 -r f9171bfc7ebb doc/namespaces.dox --- a/doc/namespaces.dox Wed Jul 19 15:13:24 2006 +0000 +++ b/doc/namespaces.dox Thu Jul 20 06:20:27 2006 +0000 @@ -1,12 +1,12 @@ /// The namespace of LEMON -/// \todo Some more detailed description would be nice here. +/// The namespace of LEMON /// namespace lemon { /// The namespace of LEMON concepts and concept checking classes - /// \todo Some more detailed description would be nice here. + /// The namespace of LEMON concepts and concept checking classes /// namespace concept {} } diff -r 478ba329ffb7 -r f9171bfc7ebb doc/template.h --- a/doc/template.h Wed Jul 19 15:13:24 2006 +0000 +++ b/doc/template.h Thu Jul 20 06:20:27 2006 +0000 @@ -1,7 +1,9 @@ /* -*- C++ -*- - * lemon/template.h - Part of LEMON, a generic C++ optimization library * - * Copyright (C) 2006 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport + * This file is a part of LEMON, a generic C++ optimization library + * + * Copyright (C) 2003-2006 + * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport * (Egervary Research Group on Combinatorial Optimization, EGRES). * * Permission to use, modify and distribute this software is granted diff -r 478ba329ffb7 -r f9171bfc7ebb lemon/xy.h --- a/lemon/xy.h Wed Jul 19 15:13:24 2006 +0000 +++ b/lemon/xy.h Thu Jul 20 06:20:27 2006 +0000 @@ -47,6 +47,13 @@ ///with the usual vector /// operators. /// + ///\note As you might have noticed, this class does not follow the + ///\ref naming_conv "LEMON Coding Style" (it should be called \c Xy + ///according to it). There is a stupid Hungarian proverb, "A kivétel + ///erõsíti a szabályt" ("An exception + ///reinforces a rule", which is + ///actually a mistranslation of the Latin proverb "Exceptio probat regulam"). + ///This class is an example for that. ///\author Attila Bernath template class xy { @@ -63,106 +70,106 @@ ///Default constructor xy() {} - ///Constructing the instance from coordinates + ///Construct an instance from coordinates xy(T a, T b) : x(a), y(b) { } ///Conversion constructor template xy(const xy &p) : x(p.x), y(p.y) {} - ///Gives back the square of the norm of the vector + ///Give back the square of the norm of the vector T normSquare() const { return x*x+y*y; } - ///Increments the left hand side by u + ///Increment the left hand side by u xy& operator +=(const xy& u) { x += u.x; y += u.y; return *this; } - ///Decrements the left hand side by u + ///Decrement the left hand side by u xy& operator -=(const xy& u) { x -= u.x; y -= u.y; return *this; } - ///Multiplying the left hand side with a scalar + ///Multiply the left hand side with a scalar xy& operator *=(const T &u) { x *= u; y *= u; return *this; } - ///Dividing the left hand side by a scalar + ///Divide the left hand side by a scalar xy& operator /=(const T &u) { x /= u; y /= u; return *this; } - ///Returns the scalar product of two vectors + ///Return the scalar product of two vectors T operator *(const xy& u) const { return x*u.x+y*u.y; } - ///Returns the sum of two vectors + ///Return the sum of two vectors xy operator+(const xy &u) const { xy b=*this; return b+=u; } - ///Returns the neg of the vectors + ///Return the neg of the vectors xy operator-() const { xy b=*this; b.x=-b.x; b.y=-b.y; return b; } - ///Returns the difference of two vectors + ///Return the difference of two vectors xy operator-(const xy &u) const { xy b=*this; return b-=u; } - ///Returns a vector multiplied by a scalar + ///Return a vector multiplied by a scalar xy operator*(const T &u) const { xy b=*this; return b*=u; } - ///Returns a vector divided by a scalar + ///Return a vector divided by a scalar xy operator/(const T &u) const { xy b=*this; return b/=u; } - ///Testing equality + ///Test equality bool operator==(const xy &u) const { return (x==u.x) && (y==u.y); } - ///Testing inequality + ///Test inequality bool operator!=(xy u) const { return (x!=u.x) || (y!=u.y); } }; - ///Returns an xy + ///Return an xy - ///Returns an xy + ///Return an xy ///\relates xy template inline xy make_xy(const T& x, const T& y) { return xy(x, y); } - ///Returns a vector multiplied by a scalar + ///Return a vector multiplied by a scalar - ///Returns a vector multiplied by a scalar + ///Return a vector multiplied by a scalar ///\relates xy template xy operator*(const T &u,const xy &x) { return x*u; @@ -219,6 +226,17 @@ return xy(-z.y,z.x); } + ///Rotate by 180 degrees + + ///Returns its parameter rotated by 180 degrees. + ///\relates xy + /// + template + inline xy rot180(const xy &z) + { + return xy(-z.x,-z.y); + } + ///Rotate by 270 degrees ///Returns its parameter rotated by 90 degrees in negative direction. @@ -246,7 +264,7 @@ ///Default constructor: creates an empty bounding box BoundingBox() { _empty = true; } - ///Constructing the instance from one point + ///Construct an instance from one point BoundingBox(xy a) { bottom_left=top_right=a; _empty = false; } ///Were any points added? @@ -254,117 +272,153 @@ return _empty; } - ///Makes the BoundingBox empty + ///Make the BoundingBox empty void clear() { _empty=1; } - ///\brief Gives back the bottom left corner - ///(if the bounding box is empty, then the return value is not defined) + ///Give back the bottom left corner + + ///Give back the bottom left corner. + ///If the bounding box is empty, then the return value is not defined. xy bottomLeft() const { return bottom_left; } - ///\brief Sets the bottom left corner - ///(should only bee used for non-empty box) + ///Set the bottom left corner + + ///Set the bottom left corner. + ///It should only bee used for non-empty box. void bottomLeft(xy p) { bottom_left = p; } - ///\brief Gives back the top right corner - ///(if the bounding box is empty, then the return value is not defined) + ///Give back the top right corner + + ///Give back the top right corner. + ///If the bounding box is empty, then the return value is not defined. xy topRight() const { return top_right; } - ///\brief Sets the top right corner - ///(should only bee used for non-empty box) + ///Set the top right corner + + ///Set the top right corner. + ///It should only bee used for non-empty box. void topRight(xy p) { top_right = p; } - ///\brief Gives back the bottom right corner - ///(if the bounding box is empty, then the return value is not defined) + ///Give back the bottom right corner + + ///Give 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); } - ///\brief Sets the bottom right corner - ///(should only bee used for non-empty box) + ///Set the bottom right corner + + ///Set the bottom right corner. + ///It should only bee used for non-empty box. void bottomRight(xy p) { top_right.x = p.x; bottom_left.y = p.y; } + + ///Give back the top left corner - ///\brief Gives back the top left corner - ///(if the bounding box is empty, then the return value is not defined) + ///Give 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); } - ///\brief Sets the top left corner - ///(should only bee used for non-empty box) + ///Set the top left corner + + ///Set the top left corner. + ///It should only bee used for non-empty box. void topLeft(xy p) { top_right.y = p.y; bottom_left.x = p.x; } - ///\brief Gives back the bottom of the box - ///(if the bounding box is empty, then the return value is not defined) + ///Give back the bottom of the box + + ///Give 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; } - ///\brief Sets the bottom of the box - ///(should only bee used for non-empty box) + ///Set the bottom of the box + + ///Set the bottom of the box. + ///It should only bee used for non-empty box. void bottom(T t) { bottom_left.y = t; } - ///\brief Gives back the top of the box - ///(if the bounding box is empty, then the return value is not defined) + ///Give back the top of the box + + ///Give 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; } - ///\brief Sets the top of the box - ///(should only bee used for non-empty box) + ///Set the top of the box + + ///Set the top of the box. + ///It should only bee used for non-empty box. void top(T t) { top_right.y = t; } - ///\brief Gives back the left side of the box - ///(if the bounding box is empty, then the return value is not defined) + ///Give back the left side of the box + + ///Give 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; } + + ///Set the left side of the box - ///\brief Sets the left side of the box - ///(should only bee used for non-empty box) + ///Set the left side of the box. + ///It should only bee used for non-empty box void left(T t) { bottom_left.x = t; } - ///\brief Gives back the right side of the box - ///(if the bounding box is empty, then the return value is not defined) + /// Give back the right side of the box + + /// Give 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; } - ///\brief Sets the right side of the box - ///(should only bee used for non-empty box) + ///Set the right side of the box + + ///Set the right side of the box. + ///It should only bee used for non-empty box void right(T t) { top_right.x = t; } - ///\brief Gives back the height of the box - ///(if the bounding box is empty, then the return value is not defined) + ///Give back the height of the box + + ///Give 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; } - ///\brief Gives back the width of the box - ///(if the bounding box is empty, then the return value is not defined) + ///Give back the width of the box + + ///Give 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; }