bool Dynamic::LastFmBias::trackMatches( int position, const Meta::TrackList& playlist, int contextCount ) const { Q_UNUSED( contextCount ); if( position <= 0 || position >= playlist.count()) return false; // determine the last track and artist Meta::TrackPtr lastTrack = playlist[position-1]; Meta::ArtistPtr lastArtist = lastTrack->artist(); QString lastTrackName = lastTrack->name(); QString lastArtistName = lastArtist ? lastArtist->name() : QString(); Meta::TrackPtr currentTrack = playlist[position]; Meta::ArtistPtr currentArtist = currentTrack->artist(); QString currentTrackName = currentTrack->name(); QString currentArtistName = currentArtist ? currentArtist->name() : QString(); { QMutexLocker locker( &m_mutex ); if( m_match == SimilarArtist ) { if( lastArtistName.isEmpty() ) return true; if( currentArtistName.isEmpty() ) return false; if( lastArtistName == currentArtistName ) return true; if( m_similarArtistMap.contains( lastArtistName ) ) return m_similarArtistMap.value( lastArtistName ).contains( currentArtistName ); } else if( m_match == SimilarTrack ) { if( lastTrackName.isEmpty() ) return true; if( currentTrackName.isEmpty() ) return false; if( lastTrackName == currentTrackName ) return true; TitleArtistPair lastKey( lastTrackName, lastArtistName ); TitleArtistPair currentKey( currentTrackName, currentArtistName ); if( m_similarTrackMap.contains( lastKey ) ) return m_similarTrackMap.value( lastKey ).contains( currentKey ); } } debug() << "didn't have a cached suggestions for track:" << lastTrackName; return false; }
BNetworkCookie* BNetworkCookieJar::UrlIterator::Remove() { if (!fLastElement) return NULL; BNetworkCookie* result = fLastElement; fLastList->RemoveItem(fLastIndex); if (fLastList->CountItems() == 0) { HashString lastKey(fLastElement->Domain(), fLastElement->Domain().Length()); delete fCookieJar->fCookieHashMap->fHashMap.Remove(lastKey); } fLastElement = NULL; return result; }