-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuery.cpp
47 lines (36 loc) · 991 Bytes
/
Query.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// Query.cpp
// DNASequenceAlignment
//
// Created by Zihan Qu on 6/27/21.
// Copyright © 2021 Zihan Qu. All rights reserved.
//
#include <stdio.h>
#include "Set.hpp"
unsigned int queryThreshold = 20;
Query::Query(unsigned int q, unsigned int r, unsigned int length) {
this->queryPosition = q;
this->referencePosition = r;
this->length = length;
}
unsigned int Query::getQueryPosition() {
return this->queryPosition;
}
unsigned int Query::getReferencePosition() {
return this->referencePosition;
}
bool Query::checkSameGroup(Query* rhs) {
// r1 - q1
int lhsDifference = this->referencePosition - this->queryPosition;
// r2 - q2
int rhsDifference
= rhs->referencePosition - rhs->queryPosition;
// Check threashold
if (abs((int)lhsDifference - (int)rhsDifference) <= queryThreshold
&& abs((int)lhsDifference - (int)rhsDifference) >= 0) {
return true;
}
else {
return false;
}
}