Esempio n. 1
0
File: Archive.cpp Progetto: bks/qz7
QList<ArchiveItem> Archive::normalizedItems() const
{
    typedef QMap<uint, ArchiveItem> ModificationMap;

    QList<ArchiveItem> ret;
    ModificationMap mods = mModifications;

    // go through all the preexisting items and add either them or their modification to
    // the normalized list
    for (int i = 0, size = mItems.size(); i < size; i++) {
        ModificationMap::iterator it = mods.find(i);

        if (it != mods.end()) {
            if (it.value().isValid())
                ret.append(it.value());
            mods.erase(it);
        } else {
            ret.append(mItems.at(i));
        }
    }

    // any remaining modifications are additions
    ret << mods.values();

    return ret;
}
Esempio n. 2
0
 inline void calculateMasses() const
 {
     if (dirty_)
     {
         dirty_ = false;
         monoDeltaMass_ = avgDeltaMass_ = 0;
         for (ModificationMap::const_iterator itr = mods_->begin(); itr != mods_->end(); ++itr)
         {
             const ModificationList& modList = itr->second;
             monoDeltaMass_ += modList.monoisotopicDeltaMass();
             avgDeltaMass_ += modList.averageDeltaMass();
         }
     }
 }
Esempio n. 3
0
PWIZ_API_DECL
bool ModificationMap::operator==(const ModificationMap& rhs) const
{
	if (size() != rhs.size())
        return false;

	ModificationMap::const_iterator itr, rhsItr;
	for (itr = begin(), rhsItr = rhs.begin();
         itr != end() && rhsItr != rhs.end();
         ++itr, ++rhsItr)
    {
		// compare positions and modification lists
		if (itr->first != rhsItr->first || !(itr->second == rhsItr->second))
			return false;
	}
    return true;
}
Esempio n. 4
0
PWIZ_API_DECL
bool ModificationMap::operator<(const ModificationMap& rhs) const
{
	if (size() < rhs.size())
	{
		ModificationMap::const_iterator itr, rhsItr;
		for (itr = begin(), rhsItr = rhs.begin();
			 itr != end() && rhsItr != rhs.end();
			 ++itr, ++rhsItr)
		{
			// compare positions
			if (itr->first == rhsItr->first)
			{
				// compare modification lists
				return itr->second < rhsItr->second;
			}
            else
				return itr->first < rhsItr->first;
		}
        return false;
	} 
	
	return size() < rhs.size();
}