ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/utils/Utility.hpp
(Generate patch)

Comparing branches/new_design/OOPSE-3.0/src/utils/Utility.hpp (file contents):
Revision 1818 by tim, Wed Dec 1 20:05:49 2004 UTC vs.
Revision 1823 by tim, Thu Dec 2 02:23:45 2004 UTC

# Line 2 | Line 2
2   #define _UTILITY_H_
3   #include <vector>
4   #include <math.h>
5 + #include "utils/next_combination.hpp"
6  
7 + namespace oopse {
8   inline double roundMe( double x ){
9    return ( x >= 0 ) ? floor( x + 0.5 ) : ceil( x - 0.5 );
10   }
11  
12 + /**
13 + * @brief iteratively replace the sequence with wild cards
14 + * @return true if more combination sequence is avaliable, otherwise return true
15 + * @param cont iterator container, if expect the whole series of combinations,  pass an empty iterator
16 + * container. The user should not modify this iterator container
17 + * @param sequence the whole sequence used to generate combination
18 + * @param result a possible combination sequence which is set on return
19 + * @param wildCard the wild card string. Its value is "X" by default
20 + * @note since next_combination never returns an empty sequence, replaceWildCard will not generate
21 + * one special combination, which is n identical wild cards (n is equal to the size of the passing sequence)
22 + *
23 + * @code
24 + * std::vector<std::string> sv;
25 + * std::vector<std::vector<std::string>::iterator> sic;
26 + * std::vector<std::string> resultString;
27 + * sv.push_back("H");
28 + * sv.push_back("C");
29 + * sv.push_back("N");
30 +
31 + * while (replaceWithWildCard(sic, sv, resultString)) {  
32 + *     for(std::vector<std::string>::iterator i = resultString.begin(); i != resultString.end(); ++i) {
33 + *         std::cout << *i << "\t";
34 + *     }
35 + *     std::cout << std::endl;
36 + * }
37 + * //output
38 + * //H X X
39 + * //X C X
40 + * //X X N
41 + * //H C X
42 + * //H X N
43 + * //X C N
44 + * //H C N
45 + * @endcode
46 + */
47 + bool replaceWithWildCard(std::vector<std::vector<std::string>::iterator>& cont,
48 +                                             std::vector<std::string>& sequence, std::vector<std::string>& result,
49 +                                             const std::string& wildCard = "X");
50 + }
51   #endif
52 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines