-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Blame: Experiment with both options (considering and ignoring whitesp…
…aces)
- Loading branch information
1 parent
a117bd4
commit 1185982
Showing
6 changed files
with
152 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/org/codetracker/blame/benchmark/BlameDifferOneWithMany.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.codetracker.blame.benchmark; | ||
|
||
import org.codetracker.blame.model.LineBlameResult; | ||
import org.eclipse.jgit.lib.Repository; | ||
|
||
import java.util.EnumMap; | ||
import java.util.EnumSet; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/* Created by pourya on 2024-09-03*/ | ||
public class BlameDifferOneWithMany extends BlameDiffer { | ||
|
||
protected final BlamerFactory subject; | ||
public BlameDifferOneWithMany(EnumSet<BlamerFactory> blamerFactories, BlamerFactory subject) { | ||
super(blamerFactories); | ||
this.subject = subject; | ||
} | ||
|
||
@Override | ||
protected Map<Integer, EnumMap<BlamerFactory, String>> process(Repository repository, String commitId, String filePath, Map<Integer, EnumMap<BlamerFactory, String>> table) { | ||
table.entrySet().removeIf(entry -> { | ||
EnumMap<BlamerFactory, String> factories = entry.getValue(); | ||
String subject_value = factories.get(subject); | ||
return factories.values().stream().filter(value -> value.equals(subject_value)).count() > 1; | ||
}); | ||
return table; | ||
} | ||
|
||
@Override | ||
protected boolean verify(EnumMap<BlamerFactory, List<LineBlameResult>> results) { | ||
return true; //TODO: | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/org/codetracker/blame/benchmark/BlameDifferResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.codetracker.blame.benchmark; | ||
|
||
import org.codetracker.api.CodeElement; | ||
|
||
import java.util.EnumMap; | ||
import java.util.Map; | ||
|
||
public class BlameDifferResult{ | ||
private final Map<Integer, EnumMap<BlamerFactory, String>> table; | ||
private final Map<Integer, CodeElement> codeElementMap; | ||
private final int legitSize; | ||
|
||
public BlameDifferResult(Map<Integer, EnumMap<BlamerFactory, String>> table, Map<Integer, CodeElement> codeElementMap, int legitSize) { | ||
this.table = table; | ||
this.codeElementMap = codeElementMap; | ||
this.legitSize = legitSize; | ||
} | ||
|
||
public Map<Integer, EnumMap<BlamerFactory, String>> getTable() { | ||
return table; | ||
} | ||
|
||
public Map<Integer, CodeElement> getCodeElementMap() { | ||
return codeElementMap; | ||
} | ||
|
||
public int getLegitSize() { | ||
return legitSize; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters