source: tags/arb-6.0/PRIMER_DESIGN/PRD_Range.cxx

Last change on this file was 6366, checked in by westram, 14 years ago
  • fixed whitespace (scripted)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 761 bytes
Line 
1#include "PRD_Range.hxx"
2#include <iostream>
3
4using namespace std;
5
6//
7// constructors
8//
9Range::Range (const PRD_Sequence_Pos value1_, const PRD_Sequence_Pos value2_)
10{
11  minimum = value1_;
12  maximum = value2_;
13}
14
15Range::Range ()
16{
17  minimum = 0;
18  maximum = 0;
19}
20
21
22//
23// check if given value is in range
24//
25bool Range::includes (PRD_Sequence_Pos value_)
26{
27   if ((value_ < minimum) || (value_ > maximum)) return false;
28
29   return true;
30}
31
32
33//
34// check if given range overlaps self
35//
36bool Range::includes(PRD_Sequence_Pos min_, PRD_Sequence_Pos max_)
37{
38  return includes(min_) || includes(max_);
39}
40
41
42//
43// print range
44//
45void Range::print (const char *prefix_, const char *suffix_) {
46  cout << prefix_ << "(" << minimum << "," << maximum << ")" << suffix_;
47}
Note: See TracBrowser for help on using the repository browser.