COIN-OR::LEMON - Graph Library

Changeset 2073:d886e4b131e6 in lemon-0.x for lemon


Ignore:
Timestamp:
05/09/06 11:23:39 (13 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2733
Message:
  • fix bug #43: static and const in Tolerance class
  • fix return value of nonZero()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/tolerance.h

    r1965 r2073  
    106106
    107107    ///Return the epsilon value.
    108     Value epsilon() {return _epsilon;}
     108    Value epsilon() const {return _epsilon;}
    109109    ///Set the epsilon value.
    110110    void epsilon(Value e) {_epsilon=e;}
     
    121121
    122122    ///Returns \c true if \c a is \e surely strictly less than \c b
    123     bool less(Value a,Value b) {return a+_epsilon<b;}
    124     ///Returns \c true if \c a is \e surely different from \c b
    125     bool different(Value a,Value b) { return less(a,b)||less(b,a); }
    126     ///Returns \c true if \c a is \e surely positive
    127     bool positive(Value a) { return _epsilon<a; }
    128     ///Returns \c true if \c a is \e surely negative
    129     bool negative(Value a) { return -_epsilon>a; }
    130     ///Returns \c true if \c a is \e surely non-zero
    131     Value nonZero(Value a) { return positive(a)||negative(a); };
     123    bool less(Value a,Value b) const {return a+_epsilon<b;}
     124    ///Returns \c true if \c a is \e surely different from \c b
     125    bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
     126    ///Returns \c true if \c a is \e surely positive
     127    bool positive(Value a) const { return _epsilon<a; }
     128    ///Returns \c true if \c a is \e surely negative
     129    bool negative(Value a) const { return -_epsilon>a; }
     130    ///Returns \c true if \c a is \e surely non-zero
     131    bool nonZero(Value a) const { return positive(a)||negative(a); };
    132132
    133133    ///@}
     
    157157
    158158    ///Return the epsilon value.
    159     Value epsilon() {return _epsilon;}
     159    Value epsilon() const {return _epsilon;}
    160160    ///Set the epsilon value.
    161161    void epsilon(Value e) {_epsilon=e;}
     
    172172
    173173    ///Returns \c true if \c a is \e surely strictly less than \c b
    174     bool less(Value a,Value b) {return a+_epsilon<b;}
    175     ///Returns \c true if \c a is \e surely different from \c b
    176     bool different(Value a,Value b) { return less(a,b)||less(b,a); }
    177     ///Returns \c true if \c a is \e surely positive
    178     bool positive(Value a) { return _epsilon<a; }
    179     ///Returns \c true if \c a is \e surely negative
    180     bool negative(Value a) { return -_epsilon>a; }
    181     ///Returns \c true if \c a is \e surely non-zero
    182     Value nonZero(Value a) { return positive(a)||negative(a); };
     174    bool less(Value a,Value b) const {return a+_epsilon<b;}
     175    ///Returns \c true if \c a is \e surely different from \c b
     176    bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
     177    ///Returns \c true if \c a is \e surely positive
     178    bool positive(Value a) const { return _epsilon<a; }
     179    ///Returns \c true if \c a is \e surely negative
     180    bool negative(Value a) const { return -_epsilon>a; }
     181    ///Returns \c true if \c a is \e surely non-zero
     182    bool nonZero(Value a) const { return positive(a)||negative(a); };
    183183
    184184    ///@}
     
    208208
    209209    ///Return the epsilon value.
    210     Value epsilon() {return _epsilon;}
     210    Value epsilon() const {return _epsilon;}
    211211    ///Set the epsilon value.
    212212    void epsilon(Value e) {_epsilon=e;}
     
    223223
    224224    ///Returns \c true if \c a is \e surely strictly less than \c b
    225     bool less(Value a,Value b) {return a+_epsilon<b;}
    226     ///Returns \c true if \c a is \e surely different from \c b
    227     bool different(Value a,Value b) { return less(a,b)||less(b,a); }
    228     ///Returns \c true if \c a is \e surely positive
    229     bool positive(Value a) { return _epsilon<a; }
    230     ///Returns \c true if \c a is \e surely negative
    231     bool negative(Value a) { return -_epsilon>a; }
    232     ///Returns \c true if \c a is \e surely non-zero
    233     Value nonZero(Value a) { return positive(a)||negative(a); };
     225    bool less(Value a,Value b) const {return a+_epsilon<b;}
     226    ///Returns \c true if \c a is \e surely different from \c b
     227    bool different(Value a,Value b) const { return less(a,b)||less(b,a); }
     228    ///Returns \c true if \c a is \e surely positive
     229    bool positive(Value a) const { return _epsilon<a; }
     230    ///Returns \c true if \c a is \e surely negative
     231    bool negative(Value a) const { return -_epsilon>a; }
     232    ///Returns \c true if \c a is \e surely non-zero
     233    bool nonZero(Value a) const { return positive(a)||negative(a); };
    234234
    235235    ///@}
     
    264264    static bool negative(Value a) { return 0>a; }
    265265    ///Returns \c true if \c a is \e surely non-zero
    266     static Value nonZero(Value a) { return a!=0;};
     266    static bool nonZero(Value a) { return a!=0; };
    267267
    268268    ///@}
     
    300300    static bool negative(Value a) { return 0>a; }
    301301    ///Returns \c true if \c a is \e surely non-zero
    302     static Value nonZero(Value a) { return a!=0;};
     302    static bool nonZero(Value a) { return a!=0;};
    303303
    304304    ///@}
Note: See TracChangeset for help on using the changeset viewer.