--- trunk/FAS/src/bitvector.cpp 2002/08/14 17:24:36 73 +++ trunk/FAS/src/bitvector.cpp 2002/08/14 19:56:11 74 @@ -18,4 +18,240 @@ * ***********************************************************************/ #include "bitvector.h" +/*********************************************************************** +* Class TBitVector +***********************************************************************/ +// +void TBitVector::Resize(int newSize) +{ + if (newSize > Count()) + { + this->insert(this->end(), newSize-Count(), false); + } + else if (newSize < Count()) + { + this->erase(this->begin()+Count()-newSize, this->end()); + } + else + { + return; + } +} +bool TBitVector::IsEmpty() +{ + return (Count() == 0); +} + +// bit operation +void TBitVector::SetBitOn(int index) +{ + (*this)[index] = true; +} + +void TBitVector::SetBitOff(int index) +{ + (*this)[index] = false; +} + +void TBitVector::SetRangeOn(int begin, int end) +{ + for(int i=begin; i &intVec) +{ + int max; + vector::iterator i; + + + for(i=intVec.begin(); i max) + max = *i; + } + + Resize(max); + SetAllOff(); + + for(i=intVec.begin(); i &intVec) +{ + intVec.clear(); + + for(int i=0; i