CPD Results

The following document contains the results of PMD's CPD 3.9.

Duplications

File Line
org/musicontroller/service/McServiceImpl.java 110
org/musicontroller/service/McServiceImpl.java 206
		Set<AIRelation> relationsToDelete = BagAndKeywordUtils.createRelations(artistfirstname,artistlastname,null,instruments);
		
		/*
		 * Construct a map of all PS contracts in the playlist sharing the same set of AI relations. We will
		 * use this map to retrieve the AIBag for each different set of AI relations only once and then setting
		 * it in all songs with that set of AI relations. This is needed because getAIBag() is implemented
		 * inefficiently. Songs that are not in the track list are ignored.
		 */
		Map<Set<AIRelation>,Set<Contract_PS>> songRelationMap = new HashMap<Set<AIRelation>,Set<Contract_PS>>();
		for(Contract_PS contract : playlist.getSongs()) {
			if(tracklist.contains(contract.getRowno())) {
				Song song = contract.getSong();
				Set<AIRelation> relations = new HashSet<AIRelation>();
				if (song.getAibag()!=null) {
					relations.addAll(song.getAibag().getRelations());
				}
				Set<Contract_PS> songSet = null;
				if(songRelationMap.containsKey(relations)) {
					songSet = songRelationMap.get(relations);
				} else {
					songSet = new HashSet<Contract_PS>();
					songRelationMap.put(relations, songSet);
				}
				songSet.add(contract);
			}
		}

		for(Entry<Set<AIRelation>,Set<Contract_PS>> entry : songRelationMap.entrySet()) {
			Set<AIRelation> targetSet = new HashSet<AIRelation>();
			targetSet.addAll(entry.getKey());
			targetSet.removeAll(relationsToDelete);