ARB
PT_rangeCheck.cxx
Go to the documentation of this file.
1 // ============================================================= //
2 // //
3 // File : PT_rangeCheck.cxx //
4 // Purpose : Check whether probe is inside region //
5 // //
6 // Coded by Ralf Westram (coder@reallysoft.de) in March 2011 //
7 // Institute of Microbiology (Technical University Munich) //
8 // http://www.arb-home.de/ //
9 // //
10 // ============================================================= //
11 
12 #include "PT_rangeCheck.h"
13 #include "pt_prototypes.h"
14 
15 using namespace std;
16 
17 int Range::calc_max_abs_pos() const {
18  // returns the max abs startpos of a specific species,
19  // such that a probe of length 'probe_len' hits inside this Range.
20  //
21  // This check is expensive!
22 
23  const probe_input_data& pid = curr_match->get_pid();
24 
25  pid.preload_rel2abs();
26 
27  int rel_size = pid.get_size();
28  int abs_size = pid.get_abspos(rel_size-1)+1;
29 
30  int max_wanted_abs = min(end, abs_size-1);
31 
32  for (int rel = 0; rel<rel_size; ++rel) { // @@@ brute forced
33  if (int(pid.get_abspos(rel))>max_wanted_abs) {
34  int max_rel = rel-probe_len;
35  return pid.get_abspos(max_rel);
36  }
37  }
38 
39  return -1;
40 }
41 
size_t get_abspos(size_t rel_pos) const
Definition: probe.h:249
int get_size() const
Definition: probe.h:211
STL namespace.
void preload_rel2abs() const
Definition: probe.h:229
#define min(a, b)
Definition: f2c.h:153