//------------------------------------------------------------------------------ // operator== Returns true if two lists are equal. //------------------------------------------------------------------------------ bool List::operator==(const List& l) const { if (entries() != l.entries()) return false; const Item* tt = getFirstItem(); const Item* ll = l.getFirstItem(); while (tt != nullptr) { if (tt->getValue() != ll->getValue()) return false; tt = tt->getNext(); ll = ll->getNext(); } return true; }
// Is this frame a subset of 'other'? bool Frame::subset_elements (const Metalib& metalib, const Frame& other) const { // Find syntax entries. std::set<symbol> all; entries (all); // Loop over them. for (std::set<symbol>::const_iterator i = all.begin (); i != all.end (); i++) if (!subset (metalib, other, *i)) return false; return true; }
bool QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenuData &data) { Q_Q(QQuickWebEngineView); QObject *menu = ui()->addMenu(0, QString(), data.pos); if (!menu) return false; // Populate our menu MenuItemHandler *item = 0; if (data.selectedText.isEmpty()) { item = new MenuItemHandler(menu); QObject::connect(item, &MenuItemHandler::triggered, q, &QQuickWebEngineView::goBack); ui()->addMenuItem(item, QObject::tr("Back"), QStringLiteral("go-previous"), q->canGoBack()); item = new MenuItemHandler(menu); QObject::connect(item, &MenuItemHandler::triggered, q, &QQuickWebEngineView::goForward); ui()->addMenuItem(item, QObject::tr("Forward"), QStringLiteral("go-next"), q->canGoForward()); item = new MenuItemHandler(menu); QObject::connect(item, &MenuItemHandler::triggered, q, &QQuickWebEngineView::reload); ui()->addMenuItem(item, QObject::tr("Reload"), QStringLiteral("view-refresh")); } else { item = new CopyMenuItem(menu, data.selectedText); ui()->addMenuItem(item, QObject::tr("Copy...")); } if (!data.linkText.isEmpty() && data.linkUrl.isValid()) { item = new NavigateMenuItem(menu, adapter, data.linkUrl); ui()->addMenuItem(item, QObject::tr("Navigate to...")); item = new CopyMenuItem(menu, data.linkUrl.toString()); ui()->addMenuItem(item, QObject::tr("Copy link address")); } // FIXME: expose the context menu data as an attached property to make this more useful if (contextMenuExtraItems) { ui()->addMenuSeparator(menu); if (QObject* menuExtras = contextMenuExtraItems->create(qmlContext(q))) { menuExtras->setParent(menu); QQmlListReference entries(menu, defaultPropertyName(menu), qmlEngine(q)); if (entries.isValid()) entries.append(menuExtras); } } // Now fire the popup() method on the top level menu QMetaObject::invokeMethod(menu, "popup"); return true; }
/** \brief Write a FileCollection to the output stream. * * This function writes a simple textual representation of this * FileCollection to the output stream. * * \param[in,out] os The output stream. * \param[in] collection The collection to print out. * * \return A reference to the \p os output stream. */ std::ostream& operator << (std::ostream& os, FileCollection const& collection) { os << "collection '" << collection.getName() << "' {"; FileEntry::vector_t entries(collection.entries()); char const *sep(""); for(auto it = entries.begin(); it != entries.end(); ++it) { os << sep; sep = ", "; os << (*it)->getName(); } os << "}"; return os; }
void ViewerNode::refreshViewsKnobVisibility() { KnobChoicePtr knob = _imp->activeViewKnob.lock(); if (knob) { const std::vector<std::string>& views = getApp()->getProject()->getProjectViewNames(); std::vector<ChoiceOption> entries(views.size()); for (std::size_t i = 0; i < views.size(); ++i) { entries[i] = ChoiceOption(views[i], "", ""); } knob->populateChoices(entries); knob->setInViewerContextSecret(views.size() <= 1); } }
// ----------------------------------------------------------------------- // Print function for TableDescList // ----------------------------------------------------------------------- void TableDescList::print(FILE* ofd, const char* indent, const char* title) { #ifndef NDEBUG #pragma nowarn(1506) // warning elimination BUMP_INDENT(indent); #pragma warn(1506) // warning elimination for (CollIndex i = 0; i < entries(); i++) { fprintf(ofd,"%s%s[%2d] = (%p)\n",NEW_INDENT,title,i,at(i)); // at(i)->print(ofd,indent); } #endif } // TableDescList::print()
void TableFormat::writeRow( std::ostream& out, int rowIndex, const Array<TableColumn>& columns ) const { Array<RCP<TableEntry> > entries(columns.size()); for (Array<TableColumn>::size_type i=0; i<columns.size(); i++) { entries[i] = columns[i].entry(rowIndex); } writeRow(out, entries); }
// index access (both reference and value) to the // list represented by this left linear tree // // 1 entry 2 entries > 2 entries // [op] [op] // [0] / \ / \ // [0] [1] [op] [2] // / \ // [0] [1] // // [op] represents ElemDDLList node // [0], [1], [2] represent the leaf nodes. The // number between the square brackets represents // the index of a leaf node in the list represented // by the left linear tree. // // The case of 1 entry is not handled by this class. // This case is handled by the class ElemDDLNode. // // The algorithem in this method is very inefficient. // If the list is long and you would like to visit // all leaf nodes in the left linear tree, please use // the method traverseList instead. // ElemDDLNode * ElemDDLList::operator[](CollIndex index) { CollIndex count; ElemDDLNode * pElemDDLNode = this; if (index >= entries()) { return NULL; } if (index EQU 0) { for (count = 1; count < entries(); count ++) { pElemDDLNode = pElemDDLNode->getChild(0)->castToElemDDLNode(); } ComASSERT(pElemDDLNode->getOperatorType() NEQ getOperatorType()); return pElemDDLNode; } count = entries() - index; while (pElemDDLNode NEQ NULL AND count > 0) { if (pElemDDLNode->getOperatorType() EQU getOperatorType() AND pElemDDLNode->getArity() >= 2) { if (count EQU 1) pElemDDLNode = pElemDDLNode->getChild(1)->castToElemDDLNode(); else pElemDDLNode = pElemDDLNode->getChild(0)->castToElemDDLNode(); } count--; } ComASSERT(pElemDDLNode->getOperatorType() NEQ getOperatorType()); return pElemDDLNode; }
void playfield::initialize_playfield(const int &psize,const int &smaxnumber,const vector<vector<int> > &vertblocks, const vector<vector<int> > &horblocks) { somethingchanges=false; size()=psize; maxnumber=smaxnumber; vblocks()=vertblocks; hblocks()=horblocks; entries().resize(size()); for(unsigned int i=0;i<entries().size();++i) { entries().at(i).resize(size()); } // Größe der Feldelementmatrix Festlegen vpermutations.resize(psize); hpermutations.resize(psize); vector<bool> temp; temp.assign(true,smaxnumber+1); // indizies Werte von 0,1,2,..,maxnumber possp.spalte.resize(psize); possp.zeile.resize(psize); for(int i=0;i<psize;++i) { possp.zeile[i].resize(smaxnumber+1); possp.spalte[i].resize(smaxnumber+1); for(int j=0;j<=smaxnumber;++j) { possp.spalte[i][j]=true; possp.zeile[i][j]=true; } } // Am Anfang sind alle Werte moeglich feldelpos.resize(psize); for(int j=0;j<psize;++j) { feldelpos[j].resize(psize); for(int k=0;k<psize;++k) { feldelpos[j][k].wertpossible.resize(smaxnumber+1); for(int l=0;l<=smaxnumber;++l) { feldelpos[j][k].wertpossible[l]=true; // a priori sind in jedem Feld alle werte moeglich } } } }
Object* MethodTable::remove(STATE, Symbol* name) { check_frozen(state); utilities::thread::SpinLock::LockGuard lg(lock_); native_int num_entries = entries()->to_native(); native_int num_bins = bins()->to_native(); if(min_density_p(num_entries, num_bins) && (num_bins >> 1) >= METHODTABLE_MIN_SIZE) { redistribute(state, num_bins >>= 1); } native_int bin = find_bin(key_hash(name), num_bins); MethodTableBucket* entry = try_as<MethodTableBucket>(values()->at(state, bin)); MethodTableBucket* last = NULL; while(entry) { if(entry->name() == name) { Object* val = entry->method(); if(last) { last->next(state, entry->next()); } else { values()->put(state, bin, entry->next()); } entries(state, Fixnum::from(entries()->to_native() - 1)); return val; } last = entry; entry = try_as<MethodTableBucket>(entry->next()); } return nil<Executable>(); }
void finish_algorithm()const { if(num_piles>0){ /* Mark those elements which are in their correct position, i.e. those * belonging to the longest increasing subsequence. These are those * elements linked from the top of the last pile. */ entry* ent=entries()[num_piles-1].pile_top_entry; for(std::size_t n=num_piles;n--;){ ent->ordered=true; ent=ent->previous; } } }
// create an empty list of SelParameters SelParameters::SelParameters(NAHeap *h) : LIST(SelParameter*)(h) { } // free our allocated memory SelParameters::~SelParameters() { CollIndex x, count = entries(); for (x = 0; x < count; x++) { delete at(x); } } // return our elements' total byte size Lng32 SelParameters::getSize() const { Lng32 result = 0; CollIndex x, limit = entries(); for (x=0; x < limit; x++) { result += (*this)[x]->getSize(); } return result; }
void NAColumnArray::print(FILE* ofd, const char* indent, const char* title, CollHeap *c, char *buf) const { Space * space = (Space *)c; char mybuf[1000]; #pragma nowarn(1506) // warning elimination BUMP_INDENT(indent); #pragma warn(1506) // warning elimination for (CollIndex i = 0; i < entries(); i++) { snprintf(mybuf, sizeof(mybuf), "%s%s[%2d] =", NEW_INDENT, title, i); PRINTIT(ofd, c, space, buf, mybuf); at(i)->print(ofd, "", "", c, buf); } }
void FormData::get(const String& name, FormDataEntryValue& result) { const CString encodedName = encodeAndNormalize(name); for (const auto& entry : entries()) { if (entry->name() == encodedName) { if (entry->isString()) { result.setUSVString(decode(entry->value())); } else { ASSERT(entry->isFile()); result.setFile(entry->file()); } return; } } }
QgsWKBTypes::Type QgsWKBTypes::parseType( const QString &wktStr ) { QString typestr = wktStr.left( wktStr.indexOf( '(' ) ).simplified().remove( ' ' ); QMap<QgsWKBTypes::Type, QgsWKBTypes::wkbEntry>* knownTypes = entries(); QMap<QgsWKBTypes::Type, QgsWKBTypes::wkbEntry>::const_iterator it = knownTypes->constBegin(); for ( ; it != knownTypes->constEnd(); ++it ) { if ( it.value().mName.compare( typestr, Qt::CaseInsensitive ) == 0 ) { return it.key(); } } return Unknown; }
void replica_list_directory (saga_tools::common & c, std::string ldn) { // instantiate logical directory saga::replica::logical_directory ld (c.session (), saga::url (ldn)); // read replica entries std::vector <saga::url> entries (ld.list ()); std::vector <saga::url>::const_iterator it; for ( it = entries.begin (); it != entries.end (); ++it ) { std::cout << " " << (*it) << std::endl; } }
// method for building text NAString ElemDDLList::getSyntax(NAString separator) const { NAString syntax; ElemDDLList * ncThis = (ElemDDLList*)this; syntax = (*ncThis)[0]->getSyntax(); // notice we start from i = 1 for (CollIndex i = 1 ; i < entries() ; i++) { syntax += separator; syntax += (*ncThis)[i]->getSyntax(); } return syntax; }
void OFonoPhoneBook::getEntries(const QString & store) { qDebug() << "OFonoPhoneBook::getEntries store=" << store; // We support only "SM" store if (store != "SM") { QList < QPhoneBookEntry > list; emit entries(store, list); return; } if (!service->interfaceAvailable(&service->oPhoneBook)) { wantEntries = true; return; } import(); }
bool Frame::total_order () const { std::set<symbol> all; entries (all); int non_logs = all.size (); for (std::set<symbol>::const_iterator i = all.begin (); i != all.end (); i++) { const symbol key = *i; if (is_log (key)) non_logs--; } daisy_assert (non_logs >= 0); return non_logs == order ().size (); }
void Cache::printNewInsanity(InfoStreamPtr infoStream, boost::any value) { Collection<InsanityPtr> insanities(FieldCacheSanityChecker::checkSanity(FieldCachePtr(_wrapper))); for (Collection<InsanityPtr>::iterator insanity = insanities.begin(); insanity != insanities.end(); ++insanity) { Collection<FieldCacheEntryPtr> entries((*insanity)->getCacheEntries()); for (Collection<FieldCacheEntryPtr>::iterator entry = entries.begin(); entry != entries.end(); ++entry) { if (VariantUtils::equalsType((*entry)->getValue(), value)) { // OK this insanity involves our entry *infoStream << L"WARNING: new FieldCache insanity created\nDetails: " + (*insanity)->toString() << L"\n"; break; } } } }
//Symmetric Shiftbeta int symshiftbeta::discount(ngram ng_,int size,double& fstar,double& lambda, int /* unused parameter: cv */) { ngram ng(dict); ng.trans(ng_); // cout << "size :" << size << " " << ng <<"\n"; // Pr(x/y)= max{(c([x,y])-beta)/(N Pr(y)),0} + lambda Pr(x) // lambda=#bigrams/N assert(size<=2); // only works with bigrams // if (size == 3) { ngram history=ng; } if (size == 2) { //compute unigram probability of denominator ngram unig(dict,1); *unig.wordp(1)=*ng.wordp(2); double prunig=unigr(unig); //create symmetric bigram if (*ng.wordp(1) > *ng.wordp(2)) { int tmp=*ng.wordp(1); *ng.wordp(1)=*ng.wordp(2); *ng.wordp(2)=tmp; } lambda=beta[2] * (double) entries(2)/(double)totfreq(); if (get(ng,2,2)) { fstar=(double)((double)ng.freq - beta[2])/ (totfreq() * prunig); } else { fstar=0; } } else { fstar=unigr(ng); lambda=0.0; } return 1; }
Object* MethodTable::store(STATE, Symbol* name, Object* exec, Symbol* vis) { unsigned int num_entries, num_bins, bin; MethodTableBucket* entry; MethodTableBucket* last = NULL; Executable* method; if(exec->nil_p()) { method = reinterpret_cast<Executable*>(Qnil); } else { if(Alias* alias = try_as<Alias>(exec)) { method = alias->original_exec(); } else { method = as<Executable>(exec); } } num_entries = entries_->to_native(); num_bins = bins_->to_native(); if(max_density_p(num_entries, num_bins)) { redistribute(state, num_bins <<= 1); } bin = find_bin(key_hash(name), num_bins); entry = try_as<MethodTableBucket>(values_->at(state, bin)); while(entry) { if(entry->name() == name) { entry->method(state, method); entry->visibility(state, vis); return name; } last = entry; entry = try_as<MethodTableBucket>(entry->next()); } if(last) { last->next(state, MethodTableBucket::create(state, name, method, vis)); } else { values_->put(state, bin, MethodTableBucket::create(state, name, method, vis)); } entries(state, Fixnum::from(num_entries + 1)); return name; }
Object* MethodTable::alias(STATE, Symbol* name, Symbol* vis, Symbol* orig_name, Executable* orig_method, Module* orig_mod) { unsigned int num_entries, num_bins, bin; MethodTableBucket* entry; MethodTableBucket* last = NULL; if(Alias* alias = try_as<Alias>(orig_method)) { orig_method = alias->original_exec(); orig_mod = alias->original_module(); orig_name = alias->original_name(); } Alias* method = Alias::create(state, orig_name, orig_mod, orig_method); num_entries = entries_->to_native(); num_bins = bins_->to_native(); if(max_density_p(num_entries, num_bins)) { redistribute(state, num_bins <<= 1); } bin = find_bin(key_hash(name), num_bins); entry = try_as<MethodTableBucket>(values_->at(state, bin)); while(entry) { if(entry->name() == name) { entry->method(state, method); entry->visibility(state, vis); return name; } last = entry; entry = try_as<MethodTableBucket>(entry->next()); } if(last) { last->next(state, MethodTableBucket::create(state, name, method, vis)); } else { values_->put(state, bin, MethodTableBucket::create(state, name, method, vis)); } entries(state, Fixnum::from(num_entries + 1)); return name; }
Path Directory::find(const Path& fileName, SensType sens) const { if( fileName.toString().empty() ) { Logger::warning( "!!! WARNING: Directory: cannot try find zero lenght name" ); return ""; } Entries files = entries(); files.setSensType( sens ); int index = files.findFile( fileName.baseName() ); if( index >= 0 ) { return files.item( index ).fullpath; } return ""; }
bool KonqHistoryManager::loadHistory() { clearPending(); m_pCompletion->clear(); if (!KonqHistoryProvider::loadHistory()) { return false; } QListIterator<KonqHistoryEntry> it(entries()); while (it.hasNext()) { const KonqHistoryEntry &entry = it.next(); const QString prettyUrlString = entry.url.toDisplayString(); addToCompletion(prettyUrlString, entry.typedUrl, entry.numberOfTimesVisited); } return true; }
void bcp_implementation::scan_cvs_path(const fs::path& p) { // // scan through the cvs admin files to build a list // of all the files under cvs version control // and whether they are text or binary: // static const char* file_list[] = { "CVS/Entries", "CVS/Entries.Log" }; static const boost::regex file_expression("^(?:A\\s+)?/([^/\\n]+)/[^/\\n]*/[^/\\n]*/[^k/\\n]*(kb[^/\\n]*)?/[^/\\n]*"); static const boost::regex dir_expression("^(?:A\\s+)?D/([^/\\n]+)/"); static const int file_subs[] = {1,2,}; for(int entry = 0; entry < sizeof(file_list)/sizeof(file_list[0]); ++entry) { fs::path entries(m_boost_path / p / file_list[entry]); if(fs::exists(entries)) { fileview view(entries); boost::regex_token_iterator<const char*> i(view.begin(), view.end(), dir_expression, 1); boost::regex_token_iterator<const char*> j; while(i != j) { fs::path recursion_dir(p / i->str()); scan_cvs_path(recursion_dir); ++i; } #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)) std::vector<int> v(file_subs, file_subs + 2); i = boost::regex_token_iterator<const char*>(view.begin(), view.end(), file_expression, v); #else i = boost::regex_token_iterator<const char*>(view.begin(), view.end(), file_expression, file_subs); #endif while(i != j) { fs::path file = p / i->str(); ++i; bool binary = i->length() ? true : false; ++i; m_cvs_paths[file] = binary; } } } }
ULng32 NAColumnArray::getMaxTrafHbaseColQualifier() const { NAColumn *column; char * colQualPtr; Lng32 colQualLen; Int64 colQVal; ULng32 maxVal = 0; for (CollIndex i = 0; i < entries(); i++) { column = (*this)[i]; colQualPtr = (char*)column->getHbaseColQual().data(); colQualLen = column->getHbaseColQual().length(); colQVal = str_atoi(colQualPtr, colQualLen); if (colQVal > maxVal) maxVal = colQVal ; } return maxVal; }
/** \brief Change the compression level to the specified value. * * This function changes the compression level of all the entries in * this collection to the specified value. * * The size limit is used to know which compression level to use: * small_compression_level for any file that has a size smaller or * equal to the specified limit and large_compression_level for the * others. * * \param[in] limit The threshold to use to define the compression level. * \param[in] small_compression_level The compression level for smaller files. * \param[in] large_compression_level The compression level for larger files. */ void FileCollection::setLevel(size_t limit, FileEntry::CompressionLevel small_compression_level, FileEntry::CompressionLevel large_compression_level) { // make sure the entries were loaded if necessary entries(); mustBeValid(); for(auto it(m_entries.begin()); it != m_entries.end(); ++it) { if((*it)->getSize() > limit) { (*it)->setLevel(large_compression_level); } else { (*it)->setLevel(small_compression_level); } } }
//Dump Function int MGPosition_list::dump(MGOfstream& buf) const{ int len = -1; try { size_t len = entries(); buf << len; const_iterator i; for(i = begin(); i != end(); i++) { (*i).dump(buf); } len = dump_size(); } catch (...) { throw; } return len; }
HeapVector<FormDataEntryValue> FormData::getAll(const String& name) { HeapVector<FormDataEntryValue> results; const CString encodedName = encodeAndNormalize(name); for (const auto& entry : entries()) { if (entry->name() != encodedName) continue; FormDataEntryValue value; if (entry->isString()) { value.setUSVString(decode(entry->value())); } else { ASSERT(entry->isFile()); value.setFile(entry->file()); } results.append(value); } return results; }