- fix bug #43: static and const in Tolerance class
authoralpar
Tue, 09 May 2006 09:23:39 +0000
changeset 2073d886e4b131e6
parent 2072 224d3781b00b
child 2074 c7ee2a2a3cff
- fix bug #43: static and const in Tolerance class
- fix return value of nonZero()
lemon/tolerance.h
     1.1 --- a/lemon/tolerance.h	Tue May 09 09:21:48 2006 +0000
     1.2 +++ b/lemon/tolerance.h	Tue May 09 09:23:39 2006 +0000
     1.3 @@ -105,7 +105,7 @@
     1.4      Tolerance(float e) : _epsilon(e) {}
     1.5  
     1.6      ///Return the epsilon value.
     1.7 -    Value epsilon() {return _epsilon;}
     1.8 +    Value epsilon() const {return _epsilon;}
     1.9      ///Set the epsilon value.
    1.10      void epsilon(Value e) {_epsilon=e;}
    1.11  
    1.12 @@ -120,15 +120,15 @@
    1.13      ///@{
    1.14  
    1.15      ///Returns \c true if \c a is \e surely strictly less than \c b
    1.16 -    bool less(Value a,Value b) {return a+_epsilon<b;}
    1.17 +    bool less(Value a,Value b) const {return a+_epsilon<b;}
    1.18      ///Returns \c true if \c a is \e surely different from \c b
    1.19 -    bool different(Value a,Value b) { return less(a,b)||less(b,a); }
    1.20 +    bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
    1.21      ///Returns \c true if \c a is \e surely positive
    1.22 -    bool positive(Value a) { return _epsilon<a; }
    1.23 +    bool positive(Value a) const { return _epsilon<a; }
    1.24      ///Returns \c true if \c a is \e surely negative
    1.25 -    bool negative(Value a) { return -_epsilon>a; }
    1.26 +    bool negative(Value a) const { return -_epsilon>a; }
    1.27      ///Returns \c true if \c a is \e surely non-zero
    1.28 -    Value nonZero(Value a) { return positive(a)||negative(a); };
    1.29 +    bool nonZero(Value a) const { return positive(a)||negative(a); };
    1.30  
    1.31      ///@}
    1.32  
    1.33 @@ -156,7 +156,7 @@
    1.34      Tolerance(double e) : _epsilon(e) {}
    1.35  
    1.36      ///Return the epsilon value.
    1.37 -    Value epsilon() {return _epsilon;}
    1.38 +    Value epsilon() const {return _epsilon;}
    1.39      ///Set the epsilon value.
    1.40      void epsilon(Value e) {_epsilon=e;}
    1.41  
    1.42 @@ -171,15 +171,15 @@
    1.43      ///@{
    1.44  
    1.45      ///Returns \c true if \c a is \e surely strictly less than \c b
    1.46 -    bool less(Value a,Value b) {return a+_epsilon<b;}
    1.47 +    bool less(Value a,Value b) const {return a+_epsilon<b;}
    1.48      ///Returns \c true if \c a is \e surely different from \c b
    1.49 -    bool different(Value a,Value b) { return less(a,b)||less(b,a); }
    1.50 +    bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
    1.51      ///Returns \c true if \c a is \e surely positive
    1.52 -    bool positive(Value a) { return _epsilon<a; }
    1.53 +    bool positive(Value a) const { return _epsilon<a; }
    1.54      ///Returns \c true if \c a is \e surely negative
    1.55 -    bool negative(Value a) { return -_epsilon>a; }
    1.56 +    bool negative(Value a) const { return -_epsilon>a; }
    1.57      ///Returns \c true if \c a is \e surely non-zero
    1.58 -    Value nonZero(Value a) { return positive(a)||negative(a); };
    1.59 +    bool nonZero(Value a) const { return positive(a)||negative(a); };
    1.60  
    1.61      ///@}
    1.62  
    1.63 @@ -207,7 +207,7 @@
    1.64      Tolerance(long double e) : _epsilon(e) {}
    1.65  
    1.66      ///Return the epsilon value.
    1.67 -    Value epsilon() {return _epsilon;}
    1.68 +    Value epsilon() const {return _epsilon;}
    1.69      ///Set the epsilon value.
    1.70      void epsilon(Value e) {_epsilon=e;}
    1.71  
    1.72 @@ -222,15 +222,15 @@
    1.73      ///@{
    1.74  
    1.75      ///Returns \c true if \c a is \e surely strictly less than \c b
    1.76 -    bool less(Value a,Value b) {return a+_epsilon<b;}
    1.77 +    bool less(Value a,Value b) const {return a+_epsilon<b;}
    1.78      ///Returns \c true if \c a is \e surely different from \c b
    1.79 -    bool different(Value a,Value b) { return less(a,b)||less(b,a); }
    1.80 +    bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
    1.81      ///Returns \c true if \c a is \e surely positive
    1.82 -    bool positive(Value a) { return _epsilon<a; }
    1.83 +    bool positive(Value a) const { return _epsilon<a; }
    1.84      ///Returns \c true if \c a is \e surely negative
    1.85 -    bool negative(Value a) { return -_epsilon>a; }
    1.86 +    bool negative(Value a) const { return -_epsilon>a; }
    1.87      ///Returns \c true if \c a is \e surely non-zero
    1.88 -    Value nonZero(Value a) { return positive(a)||negative(a); };
    1.89 +    bool nonZero(Value a) const { return positive(a)||negative(a); };
    1.90  
    1.91      ///@}
    1.92  
    1.93 @@ -263,7 +263,7 @@
    1.94      ///Returns \c true if \c a is \e surely negative
    1.95      static bool negative(Value a) { return 0>a; }
    1.96      ///Returns \c true if \c a is \e surely non-zero
    1.97 -    static Value nonZero(Value a) { return a!=0;};
    1.98 +    static bool nonZero(Value a) { return a!=0; };
    1.99  
   1.100      ///@}
   1.101  
   1.102 @@ -299,7 +299,7 @@
   1.103      ///Returns \c true if \c a is \e surely negative
   1.104      static bool negative(Value a) { return 0>a; }
   1.105      ///Returns \c true if \c a is \e surely non-zero
   1.106 -    static Value nonZero(Value a) { return a!=0;};
   1.107 +    static bool nonZero(Value a) { return a!=0;};
   1.108  
   1.109      ///@}
   1.110