c846f8971d358eb32d8a1eacab4d01c7b1ebdcc0
[htsworkflow.git] / htswanalysis / src / SRLib / loci.cpp
1 #include <string>
2 #include <iostream>
3 #include "Loci.h"
4
5 using namespace std;
6
7 Loci::Loci(string chr, unsigned int pos) { 
8   this->chr = chr; 
9   this->pos = pos; 
10 }
11
12 Loci::Loci(const Loci& l) { 
13   this->chr = l.chr; 
14   this->pos = l.pos;
15 }
16
17 Loci& Loci::operator=(const Loci& l) { 
18   if(this != &l) {
19     this->chr = l.chr; 
20     this->pos = l.pos; 
21   }
22   return *this; 
23 }
24
25 bool Loci::operator<(const Loci& a) const { 
26   return((this->chr == a.chr)?(this->pos < a.pos):(this->chr < a.chr));
27 }
28
29 bool Loci::operator<=(const Loci& a) const { 
30   return((this->chr == a.chr)?(this->pos <= a.pos):(this->chr < a.chr));
31 }
32
33 bool Loci::operator>=(const Loci& a) const { 
34   return((this->chr == a.chr)?(this->pos >= a.pos):(this->chr > a.chr));
35 }
36
37 bool Loci::operator>(const Loci& a) const { 
38   return((this->chr == a.chr)?(this->pos > a.pos):(this->chr > a.chr));
39 }
40
41
42 ostream &operator<<( ostream &out, const Loci &h ) {
43   out << h.chr << "\t" << h.pos;
44   return out;
45 }