[Lemon-commits] [lemon_svn] alpar: r2872 - in hugo/trunk: doc lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 21:50:56 CET 2006
Author: alpar
Date: Thu Jul 20 08:20:27 2006
New Revision: 2872
Modified:
hugo/trunk/doc/coding_style.dox
hugo/trunk/doc/dirs.dox
hugo/trunk/doc/namespaces.dox
hugo/trunk/doc/template.h
hugo/trunk/lemon/xy.h
Log:
- Doc improvements
- rot180() added to xy.h
Modified: hugo/trunk/doc/coding_style.dox
==============================================================================
--- hugo/trunk/doc/coding_style.dox (original)
+++ hugo/trunk/doc/coding_style.dox Thu Jul 20 08:20:27 2006
@@ -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
Modified: hugo/trunk/doc/dirs.dox
==============================================================================
--- hugo/trunk/doc/dirs.dox (original)
+++ hugo/trunk/doc/dirs.dox Thu Jul 20 08:20:27 2006
@@ -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.
*/
/**
Modified: hugo/trunk/doc/namespaces.dox
==============================================================================
--- hugo/trunk/doc/namespaces.dox (original)
+++ hugo/trunk/doc/namespaces.dox Thu Jul 20 08:20:27 2006
@@ -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 {}
}
Modified: hugo/trunk/doc/template.h
==============================================================================
--- hugo/trunk/doc/template.h (original)
+++ hugo/trunk/doc/template.h Thu Jul 20 08:20:27 2006
@@ -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
Modified: hugo/trunk/lemon/xy.h
==============================================================================
--- hugo/trunk/lemon/xy.h (original)
+++ hugo/trunk/lemon/xy.h Thu Jul 20 08:20:27 2006
@@ -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<typename T>
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<class TT> xy(const xy<TT> &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<T>& operator +=(const xy<T>& u) {
x += u.x;
y += u.y;
return *this;
}
- ///Decrements the left hand side by u
+ ///Decrement the left hand side by u
xy<T>& operator -=(const xy<T>& 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<T>& 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<T>& 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<T>& u) const {
return x*u.x+y*u.y;
}
- ///Returns the sum of two vectors
+ ///Return the sum of two vectors
xy<T> operator+(const xy<T> &u) const {
xy<T> b=*this;
return b+=u;
}
- ///Returns the neg of the vectors
+ ///Return the neg of the vectors
xy<T> operator-() const {
xy<T> 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<T> operator-(const xy<T> &u) const {
xy<T> b=*this;
return b-=u;
}
- ///Returns a vector multiplied by a scalar
+ ///Return a vector multiplied by a scalar
xy<T> operator*(const T &u) const {
xy<T> b=*this;
return b*=u;
}
- ///Returns a vector divided by a scalar
+ ///Return a vector divided by a scalar
xy<T> operator/(const T &u) const {
xy<T> b=*this;
return b/=u;
}
- ///Testing equality
+ ///Test equality
bool operator==(const xy<T> &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 <typename T>
inline xy<T> make_xy(const T& x, const T& y) {
return xy<T>(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<typename T> xy<T> operator*(const T &u,const xy<T> &x) {
return x*u;
@@ -219,6 +226,17 @@
return xy<T>(-z.y,z.x);
}
+ ///Rotate by 180 degrees
+
+ ///Returns its parameter rotated by 180 degrees.
+ ///\relates xy
+ ///
+ template<typename T>
+ inline xy<T> rot180(const xy<T> &z)
+ {
+ return xy<T>(-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<T> 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<T> 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<T> 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<T> 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<T> 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<T> bottomRight() const {
return xy<T>(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<T> 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<T> topLeft() const {
return xy<T>(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<T> 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;
}
More information about the Lemon-commits
mailing list