bool SslReader::parseFile(){ Verbosity::debug("Parsing File."); if( ! openSsl() ){ return false; } Verbosity::debug("Collecting Psms."); collectPsms(); // for each ms2 file if( fileMap_.size() > 1 ){ initSpecFileProgress((int)fileMap_.size()); } map<string, vector<PSM*> >::iterator fileIterator = fileMap_.begin(); for(; fileIterator != fileMap_.end(); ++fileIterator) { setSpecFileName((fileIterator->first).c_str()); // move from map to psms_ psms_ = fileIterator->second; // look at first psm for scanKey vs scanName if( psms_.front()->specKey == -1 ){ // default value lookUpBy_ = NAME_ID; } else { lookUpBy_ = SCAN_NUM_ID; } buildTables(UNKNOWN_SCORE_TYPE); } return true; }
bool HuffmanStringProcessor::readHuffBuffer(BitStream* pStream, char* out_pBuffer) { if (mTablesBuilt == false) buildTables(); if (pStream->readFlag()) { U32 len = pStream->readInt(8); for (U32 i = 0; i < len; i++) { S32 index = 0; while (true) { if (index >= 0) { if (pStream->readFlag() == true) { index = mHuffNodes[index].index1; } else { index = mHuffNodes[index].index0; } } else { out_pBuffer[i] = mHuffLeaves[-(index+1)].symbol; break; } } } out_pBuffer[len] = '\0'; return true; } else { // Uncompressed string... U32 len = pStream->readInt(8); pStream->read(len, out_pBuffer); out_pBuffer[len] = '\0'; return true; } }
// The constructor takes the keyword and builds the tables. BM::BM(const std::string &key) : p(key) { alphabetSize = 256; delta1.resize(alphabetSize); pSize = key.length(); delta2.resize(pSize+1); f.resize(pSize+1); buildTables(key); }
void IRGenerator::buildBlocks(VirtualFunction& entry) { const CIL::Instructions& instructions = entry.getInstructions(); allocateInstructionBlocks(instructions.size()); createBlock(0); buildGuards(entry); buildTables(entry); buildInstructions(instructions); }
int main(int argc, char** argv) { char* seqA = argv[1]; char* seqB = argv[2]; int lenA = strlen(seqA); int lenB = strlen(seqB); int** countArray = allocate2Darray(lenA, lenB); int** direction = allocate2Darray(lenA, lenB); buildTables(seqA, seqB, lenA, lenB, countArray, direction); traceSequence(seqA, lenA-1, lenB-1, direction); return 0; }
MTrigTable::MTrigTable(unsigned short tableSize){ if(!m_initlized){ tableSize*=2; m_initlized=true; m_trigTableSize=tableSize; m_trigTableFactor=m_trigTableSize/(2*PI64); m_sinTable=new double[m_trigTableSize]; m_tanTable=new double[m_trigTableSize]; //m_useTable=true; buildTables(); } }
inline QVector<int> otsu(QVector<int> histogram, int classes) { qreal maxSum = 0.; QVector<int> thresholds(classes - 1, 0); QVector<qreal> H = buildTables(histogram); QVector<int> index(classes + 1); index[0] = 0; index[index.size() - 1] = histogram.size() - 1; for_loop(&maxSum, &thresholds, H, 1, histogram.size() - classes + 1, 1, histogram.size(), &index); return thresholds; }
bool HuffmanStringProcessor::writeHuffBuffer(BitStream* pStream, const char* out_pBuffer, U32 maxLen) { if (out_pBuffer == NULL) { pStream->writeFlag(false); pStream->writeInt(0, 8); return true; } if (mTablesBuilt == false) buildTables(); size_t llen = out_pBuffer ? strlen(out_pBuffer) : 0; TNLAssertV(llen <= 255, ("String \"%s\" TOO long for writeString", out_pBuffer)); U32 len = static_cast<U32>(llen); if (len > maxLen) len = maxLen; U32 numBits = 0; U32 i; for (i = 0; i < len; i++) numBits += mHuffLeaves[(unsigned char)out_pBuffer[i]].numBits; if (numBits >= (len * 8)) { pStream->writeFlag(false); pStream->writeInt(len, 8); pStream->write(len, out_pBuffer); } else { pStream->writeFlag(true); pStream->writeInt(len, 8); for (i = 0; i < len; i++) { HuffLeaf& rLeaf = mHuffLeaves[((unsigned char)out_pBuffer[i])]; pStream->writeBits(rLeaf.numBits, &rLeaf.code); } } return true; }