SequenceLocation was being intialized with left,right
authorDiane Trout <diane@caltech.edu>
Sat, 1 Jul 2006 06:19:05 +0000 (06:19 +0000)
committerDiane Trout <diane@caltech.edu>
Sat, 1 Jul 2006 06:19:05 +0000 (06:19 +0000)
not left,count. this made the getSubsequence rather wrong when the
'right' side was being used as a count.

alg/sequence_location.cpp
alg/sequence_location.hpp

index bb17e34fd5a334f96e5d71833d4dd7e79a975560..704cb89e4469c974b772e684c2ab9daedd368f88 100644 (file)
@@ -3,19 +3,19 @@
 SequenceLocation::SequenceLocation(
     const boost::shared_ptr<Sequence> 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<Sequence> 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;
 }
index 31831ce96b316e7d28514b0de41892ff0ec00636..3aca443b4164352817ff84e5edfb7e6abe6477e5 100644 (file)
@@ -7,8 +7,8 @@
 //! convenience structure for holding selected track segments
 class SequenceLocation {
   public:
-    SequenceLocation(boost::shared_ptr<Sequence> s, int l, int c);
-    SequenceLocation(const Sequence& s, int l, int c);
+    SequenceLocation(boost::shared_ptr<Sequence> 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> sequence;
     int left;
-    int count;
+    int right;
   };
 #endif