source: branches/stable/PROBE/PT_rangeCheck.cxx

Last change on this file was 11060, checked in by westram, 10 years ago
File size: 1.4 KB
Line 
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
15using namespace std;
16
17int 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
Note: See TracBrowser for help on using the repository browser.