source: branches/stable/PRIMER_DESIGN/PRD_Range.cxx

Last change on this file was 16766, checked in by westram, 6 years ago
  • 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  minimum = value1_;
11  maximum = value2_;
12}
13
14Range::Range () {
15  minimum = 0;
16  maximum = 0;
17}
18
19
20//
21// check if given value is in range
22//
23bool Range::includes (PRD_Sequence_Pos value_) {
24   if ((value_ < minimum) || (value_ > maximum)) return false;
25
26   return true;
27}
28
29
30//
31// check if given range overlaps self
32//
33bool Range::includes(PRD_Sequence_Pos min_, PRD_Sequence_Pos max_) {
34  return includes(min_) || includes(max_);
35}
36
37
38//
39// print range
40//
41void Range::print (const char *prefix_, const char *suffix_) {
42  cout << prefix_ << "(" << minimum << "," << maximum << ")" << suffix_;
43}
Note: See TracBrowser for help on using the repository browser.