Search in sources :

Example 1 with PackedMemoryCloneIndex

use of org.sonar.duplications.index.PackedMemoryCloneIndex in project sonarqube by SonarSource.

the class IntegrateCrossProjectDuplications method computeCpd.

public void computeCpd(Component component, Collection<Block> originBlocks, Collection<Block> duplicationBlocks) {
    CloneIndex duplicationIndex = new PackedMemoryCloneIndex();
    populateIndex(duplicationIndex, originBlocks);
    populateIndex(duplicationIndex, duplicationBlocks);
    List<CloneGroup> duplications = SuffixTreeCloneDetectionAlgorithm.detect(duplicationIndex, originBlocks);
    Iterable<CloneGroup> filtered = from(duplications).filter(getNumberOfUnitsNotLessThan(component.getFileAttributes().getLanguageKey()));
    addDuplications(component, filtered);
}
Also used : PackedMemoryCloneIndex(org.sonar.duplications.index.PackedMemoryCloneIndex) CloneIndex(org.sonar.duplications.index.CloneIndex) CloneGroup(org.sonar.duplications.index.CloneGroup) PackedMemoryCloneIndex(org.sonar.duplications.index.PackedMemoryCloneIndex)

Example 2 with PackedMemoryCloneIndex

use of org.sonar.duplications.index.PackedMemoryCloneIndex in project sonarqube by SonarSource.

the class PmdBridgeTest method setUp.

@Before
public void setUp() {
    index = new PackedMemoryCloneIndex();
    bridge = new TokenizerBridge(new JavaTokenizer(), "UTF-8", 10);
}
Also used : JavaTokenizer(net.sourceforge.pmd.cpd.JavaTokenizer) PackedMemoryCloneIndex(org.sonar.duplications.index.PackedMemoryCloneIndex) Before(org.junit.Before)

Aggregations

PackedMemoryCloneIndex (org.sonar.duplications.index.PackedMemoryCloneIndex)2 JavaTokenizer (net.sourceforge.pmd.cpd.JavaTokenizer)1 Before (org.junit.Before)1 CloneGroup (org.sonar.duplications.index.CloneGroup)1 CloneIndex (org.sonar.duplications.index.CloneIndex)1