mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-05 22:04:27 +08:00
refactoring of the BitVect interface to make capitalization consistent
w/ the rest of the RDKit. i.e.: SetNumBits -> setNumBits
This commit is contained in:
@@ -22,13 +22,13 @@
|
||||
//
|
||||
// Construct a SparseBitVect from a binary string.
|
||||
// The format of the string should be
|
||||
// the format produced by SparseBitVect::ToString
|
||||
// the format produced by SparseBitVect::toString
|
||||
//
|
||||
// """ -------------------------------------------------------
|
||||
SparseBitVect::SparseBitVect(const std::string &s)
|
||||
{
|
||||
d_size=0;dp_bits = 0;
|
||||
InitFromText(s.c_str(),s.length());
|
||||
initFromText(s.c_str(),s.length());
|
||||
}
|
||||
|
||||
|
||||
@@ -36,13 +36,13 @@ SparseBitVect::SparseBitVect(const std::string &s)
|
||||
//
|
||||
// Construct a SparseBitVect from a binary string stored as a char *.
|
||||
// The format of the string should be
|
||||
// the format produced by SparseBitVect::ToString
|
||||
// the format produced by SparseBitVect::toString
|
||||
//
|
||||
// """ -------------------------------------------------------
|
||||
SparseBitVect::SparseBitVect(const char *data,const unsigned int dataLen)
|
||||
{
|
||||
d_size=0;dp_bits = 0;
|
||||
InitFromText(data,dataLen);
|
||||
initFromText(data,dataLen);
|
||||
}
|
||||
|
||||
// """ -------------------------------------------------------
|
||||
@@ -77,7 +77,7 @@ SparseBitVect::operator=(const SparseBitVect& other)
|
||||
{
|
||||
IntSet *bv=other.dp_bits;
|
||||
if(dp_bits) delete dp_bits;
|
||||
d_size = other.GetNumBits();
|
||||
d_size = other.getNumBits();
|
||||
dp_bits = new IntSet;
|
||||
std::copy(bv->begin(),bv->end(),std::inserter(*dp_bits,dp_bits->end()));
|
||||
|
||||
@@ -144,7 +144,7 @@ SparseBitVect::operator~ () const
|
||||
{
|
||||
SparseBitVect ans(d_size);
|
||||
for(unsigned int i=0;i<d_size;i++){
|
||||
if(!GetBit(i)) ans.SetBit(i);
|
||||
if(!getBit(i)) ans.setBit(i);
|
||||
}
|
||||
|
||||
return(ans);
|
||||
@@ -152,12 +152,12 @@ SparseBitVect::operator~ () const
|
||||
|
||||
// """ -------------------------------------------------------
|
||||
//
|
||||
// GetBit(int which)
|
||||
// getBit(int which)
|
||||
// Returns the state of bit which
|
||||
//
|
||||
// """ -------------------------------------------------------
|
||||
bool
|
||||
SparseBitVect::GetBit(const unsigned int which) const
|
||||
SparseBitVect::getBit(const unsigned int which) const
|
||||
{
|
||||
if(which >= d_size){
|
||||
throw IndexErrorException(which);
|
||||
@@ -169,12 +169,12 @@ SparseBitVect::GetBit(const unsigned int which) const
|
||||
|
||||
// """ -------------------------------------------------------
|
||||
//
|
||||
// GetBit(const IntVectIter which) (C++ SPECIFIC)
|
||||
// getBit(const IntVectIter which) (C++ SPECIFIC)
|
||||
// Returns the state of bit which
|
||||
//
|
||||
// """ -------------------------------------------------------
|
||||
bool
|
||||
SparseBitVect::GetBit (const IntVectIter which) const
|
||||
SparseBitVect::getBit (const IntVectIter which) const
|
||||
{
|
||||
if(*which < 0 || static_cast<unsigned int>(*which) >= d_size){
|
||||
throw IndexErrorException(*which);
|
||||
@@ -186,12 +186,12 @@ SparseBitVect::GetBit (const IntVectIter which) const
|
||||
|
||||
// """ -------------------------------------------------------
|
||||
//
|
||||
// GetBit(const IntSetIter which) (C++ SPECIFIC)
|
||||
// getBit(const IntSetIter which) (C++ SPECIFIC)
|
||||
// Returns the state of bit which
|
||||
//
|
||||
// """ -------------------------------------------------------
|
||||
bool
|
||||
SparseBitVect::GetBit (const IntSetIter which) const
|
||||
SparseBitVect::getBit (const IntSetIter which) const
|
||||
{
|
||||
if(*which < 0 || static_cast<unsigned int>(*which) >= d_size){
|
||||
throw IndexErrorException(*which);
|
||||
@@ -209,7 +209,7 @@ SparseBitVect::GetBit (const IntSetIter which) const
|
||||
//
|
||||
// """ -------------------------------------------------------
|
||||
bool
|
||||
SparseBitVect::SetBit(const unsigned int which)
|
||||
SparseBitVect::setBit(const unsigned int which)
|
||||
{
|
||||
if(!dp_bits){
|
||||
throw ValueErrorException("BitVect not properly initialized.");
|
||||
@@ -224,14 +224,14 @@ SparseBitVect::SetBit(const unsigned int which)
|
||||
|
||||
// """ -------------------------------------------------------
|
||||
//
|
||||
// SetBit(const IntSetIter which) (C++ SPECIFIC)
|
||||
// setBit(const IntSetIter which) (C++ SPECIFIC)
|
||||
// Sets bit which to be on.
|
||||
//
|
||||
// Returns the original state of the bit
|
||||
//
|
||||
// """ -------------------------------------------------------
|
||||
bool
|
||||
SparseBitVect::SetBit(const IntSetIter which)
|
||||
SparseBitVect::setBit(const IntSetIter which)
|
||||
{
|
||||
if(!dp_bits){
|
||||
throw ValueErrorException("BitVect not properly initialized.");
|
||||
@@ -252,7 +252,7 @@ SparseBitVect::SetBit(const IntSetIter which)
|
||||
//
|
||||
// """ -------------------------------------------------------
|
||||
bool
|
||||
SparseBitVect::UnSetBit(const unsigned int which)
|
||||
SparseBitVect::unsetBit(const unsigned int which)
|
||||
{
|
||||
if(!dp_bits){
|
||||
throw ValueErrorException("BitVect not properly initialized.");
|
||||
@@ -272,7 +272,7 @@ SparseBitVect::UnSetBit(const unsigned int which)
|
||||
|
||||
// """ -------------------------------------------------------
|
||||
//
|
||||
// GetOnBits(IntVect &which)
|
||||
// getOnBits(IntVect &which)
|
||||
// C++: Passes the set of on bits out in the IntVect passed in.
|
||||
// The contents of IntVect are destroyed.
|
||||
//
|
||||
@@ -280,12 +280,12 @@ SparseBitVect::UnSetBit(const unsigned int which)
|
||||
//
|
||||
// """ -------------------------------------------------------
|
||||
void
|
||||
SparseBitVect::GetOnBits(IntVect& v) const
|
||||
SparseBitVect::getOnBits(IntVect& v) const
|
||||
{
|
||||
if(!dp_bits){
|
||||
throw ValueErrorException("BitVect not properly initialized.");
|
||||
}
|
||||
unsigned int nOn = GetNumOnBits();
|
||||
unsigned int nOn = getNumOnBits();
|
||||
if(!v.empty()) IntVect().swap(v);
|
||||
v.reserve(nOn);
|
||||
v.resize(nOn);
|
||||
@@ -294,11 +294,11 @@ SparseBitVect::GetOnBits(IntVect& v) const
|
||||
|
||||
// """ -------------------------------------------------------
|
||||
//
|
||||
// ToString()
|
||||
// toString()
|
||||
// Returns a binary string with the contents of the BitVector
|
||||
//
|
||||
// """ -------------------------------------------------------
|
||||
std::string SparseBitVect::ToString() const {
|
||||
std::string SparseBitVect::toString() const {
|
||||
// This Function replaces the older version (version 16) of writing the onbits to
|
||||
// a string
|
||||
// the old version does not perform any run length encoding, it only checks to see if
|
||||
@@ -315,7 +315,7 @@ std::string SparseBitVect::ToString() const {
|
||||
RDKit::streamWrite(ss,tInt);
|
||||
tInt=d_size;
|
||||
RDKit::streamWrite(ss,tInt);
|
||||
tInt=GetNumOnBits();
|
||||
tInt=getNumOnBits();
|
||||
RDKit::streamWrite(ss,tInt);
|
||||
|
||||
int prev = -1;
|
||||
@@ -332,7 +332,7 @@ std::string SparseBitVect::ToString() const {
|
||||
return res;
|
||||
}
|
||||
|
||||
void SparseBitVect::_InitForSize(unsigned int size){
|
||||
void SparseBitVect::_initForSize(unsigned int size){
|
||||
d_size=size;
|
||||
if(dp_bits) delete dp_bits;
|
||||
dp_bits=new IntSet;
|
||||
|
||||
Reference in New Issue
Block a user