Skip to content
Snippets Groups Projects
Commit f6b5bfdf authored by juergen's avatar juergen
Browse files

removed bogus region checks

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2210 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 7d2bed2f
No related branches found
No related tags found
No related merge requests found
...@@ -203,8 +203,8 @@ void AlignmentHandle::ShiftRegion(int start, int end, int amount, ...@@ -203,8 +203,8 @@ void AlignmentHandle::ShiftRegion(int start, int end, int amount,
AlignedRegion AlignmentHandle::MakeRegion(int start, int n, int master) const AlignedRegion AlignmentHandle::MakeRegion(int start, int n, int master) const
{ {
this->CheckValidity(); this->CheckValidity();
if(start<0 || n < 0 || start >= n || start + n > this->GetLength()){ if((start<0 )||( n < 0 )|| ((start + n) > this->GetLength())){
throw std::out_of_range("Region not valid"); throw std::out_of_range("invalid region");
} }
return AlignedRegion(*this, start, start+n, master); return AlignedRegion(*this, start, start+n, master);
} }
......
...@@ -170,7 +170,7 @@ int SequenceImpl::GetLength() const { ...@@ -170,7 +170,7 @@ int SequenceImpl::GetLength() const {
char SequenceImpl::GetOneLetterCode(int position) const char SequenceImpl::GetOneLetterCode(int position) const
{ {
if (position<0 || position>=static_cast<int>(seq_string_.length())) if (position<0 || position>static_cast<int>(seq_string_.length()))
throw Error("Position is not covered in sequence"); throw Error("Position is not covered in sequence");
return seq_string_[position]; return seq_string_[position];
} }
...@@ -281,7 +281,7 @@ void SequenceImpl::Replace(const String& str,int start, int end) ...@@ -281,7 +281,7 @@ void SequenceImpl::Replace(const String& str,int start, int end)
void SequenceImpl::ShiftRegion(int start, int end, int amount) void SequenceImpl::ShiftRegion(int start, int end, int amount)
{ {
if(start > end || start + amount <= 0 || end + amount > this->GetLength()){ if(start > end || start + amount <= 0 || end + amount > this->GetLength()){
throw std::out_of_range("Region not valid"); throw std::out_of_range("ShiftRegion: invalid region");
} }
String str1=seq_string_.substr(start, end-start); String str1=seq_string_.substr(start, end-start);
if (amount<0) { if (amount<0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment