From 720dc7de34ddc08265926b49ddde5380004f589e Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Sat, 1 Jul 2006 06:19:05 +0000 Subject: [PATCH] SequenceLocation was being intialized with left,right not left,count. this made the getSubsequence rather wrong when the 'right' side was being used as a count. --- alg/sequence_location.cpp | 24 ++++++++++++------------ alg/sequence_location.hpp | 7 ++++--- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/alg/sequence_location.cpp b/alg/sequence_location.cpp index bb17e34..704cb89 100644 --- a/alg/sequence_location.cpp +++ b/alg/sequence_location.cpp @@ -3,19 +3,19 @@ SequenceLocation::SequenceLocation( const boost::shared_ptr s, int l, - int c + int r ) : sequence(s), left(l), - count(c) + right(r) { } SequenceLocation::SequenceLocation( const Sequence& s, int l, - int c + int r ) : left(l), - count(c) + right(r) { boost::shared_ptr copy(new Sequence(s)); sequence = copy; @@ -25,7 +25,7 @@ SequenceLocation::SequenceLocation( SequenceLocation::SequenceLocation(const SequenceLocation& o) : sequence(o.sequence), left(o.left), - count(o.count) + right(o.right) { } @@ -33,8 +33,8 @@ SequenceLocation& SequenceLocation::operator=(const SequenceLocation& o) { if (this != &o) { sequence = o.sequence; - left = o.left; - count = o.count; + left = o.getLeft(); + right = o.getRight(); } return *this; } @@ -47,7 +47,7 @@ const Sequence& SequenceLocation::getSequence() const Sequence SequenceLocation::getSelectedSequence() const { - return sequence->subseq(left, count); + return sequence->subseq(getLeft(), getCount()); } void SequenceLocation::setLeft(int l) @@ -62,20 +62,20 @@ int SequenceLocation::getLeft() const void SequenceLocation::setCount(int c) { - count = c; + right = left + c; } int SequenceLocation::getCount() const { - return count; + return right - left; } void SequenceLocation::setRight(int r) { - count = r-left; + right = r; } int SequenceLocation::getRight() const { - return left+count; + return right; } diff --git a/alg/sequence_location.hpp b/alg/sequence_location.hpp index 31831ce..3aca443 100644 --- a/alg/sequence_location.hpp +++ b/alg/sequence_location.hpp @@ -7,8 +7,8 @@ //! convenience structure for holding selected track segments class SequenceLocation { public: - SequenceLocation(boost::shared_ptr s, int l, int c); - SequenceLocation(const Sequence& s, int l, int c); + SequenceLocation(boost::shared_ptr s, int l, int r); + SequenceLocation(const Sequence& s, int l, int r); SequenceLocation(const SequenceLocation& ); SequenceLocation& operator=(const SequenceLocation&); @@ -20,12 +20,13 @@ class SequenceLocation { int getLeft() const; void setCount(int c); int getCount() const ; + //! set one past the right-most base void setRight(int r); int getRight() const; private: boost::shared_ptr sequence; int left; - int count; + int right; }; #endif -- 2.30.2