Skip to content

Commit

Permalink
feat(spgroup#31): resolve PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
barbosamaatheus committed Aug 2, 2021
1 parent 229683f commit febb6e5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
34 changes: 13 additions & 21 deletions src/test/java/br/unc/cic/analysis/test/DefinitionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,22 @@ public static AbstractMergeConflictDefinition definition(String className, int s
}

public static AbstractMergeConflictDefinition definition(String className, int sourceLines[], int sinkLines[], boolean recursive) {
return new AbstractMergeConflictDefinition(recursive) {
@Override
protected Map<String, List<Integer>> sourceDefinitions() {
Map<String, List<Integer>> res = new HashMap<>();
List<Integer> lines = Arrays.stream(sourceLines).boxed().collect(Collectors.toList());
res.put(className, lines);
return res;
}
return definition(Arrays.asList(new MarkingClass(className, sourceLines, sinkLines)), recursive);
};

@Override
protected Map<String, List<Integer>> sinkDefinitions() {
Map<String, List<Integer>> res = new HashMap<>();
List<Integer> lines = Arrays.stream(sinkLines).boxed().collect(Collectors.toList());
res.put(className, lines);
return res;
}
};
}
public static AbstractMergeConflictDefinition definition(List<Marking> markings) {
return new AbstractMergeConflictDefinition(false) {
/**
*
* @param markingClassList It is a list of tags. Each tag as lines marked as source and as lines marked as sink
* and the name of the class where the lines were marked.
* @param recursive Indicates whether the loading of statements will be done recursively or not.
* @return
*/
public static AbstractMergeConflictDefinition definition(List<MarkingClass> markingClassList, boolean recursive) {
return new AbstractMergeConflictDefinition(recursive) {
@Override
protected Map<String, List<Integer>> sourceDefinitions() {
Map<String, List<Integer>> res = new HashMap<>();
for(Marking m: markings){
for(MarkingClass m: markingClassList){
List<Integer> lines = Arrays.stream(m.getSourceLines()).boxed().collect(Collectors.toList());
res.put(m.getClassName(), lines);
}
Expand All @@ -48,7 +40,7 @@ protected Map<String, List<Integer>> sourceDefinitions() {
@Override
protected Map<String, List<Integer>> sinkDefinitions() {
Map<String, List<Integer>> res = new HashMap<>();
for(Marking m: markings) {
for(MarkingClass m: markingClassList) {
List<Integer> lines = Arrays.stream(m.getSinkLines()).boxed().collect(Collectors.toList());
res.put(m.getClassName(), lines);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package br.unc.cic.analysis.test;

public class Marking {
public class MarkingClass {
String className;
int sourceLines[];
int sinkLines[];

public Marking(String className, int[] sourceLines, int[] sinkLines) {
public MarkingClass(String className, int[] sourceLines, int[] sinkLines) {
this.className = className;
this.sourceLines = sourceLines;
this.sinkLines = sinkLines;
Expand Down

0 comments on commit febb6e5

Please sign in to comment.