Skip to content

Commit

Permalink
feat(spgroup#31): add support for markup in multiple classes
Browse files Browse the repository at this point in the history
  • Loading branch information
barbosamaatheus committed Jul 29, 2021
1 parent 91a3089 commit 19987fa
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/test/java/br/unc/cic/analysis/test/DefinitionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import br.unb.cic.analysis.AbstractMergeConflictDefinition;

import java.util.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class DefinitionFactory {
Expand Down Expand Up @@ -30,4 +33,27 @@ protected Map<String, List<Integer>> sinkDefinitions() {
}
};
}
public static AbstractMergeConflictDefinition definition(List<Marking> markings) {
return new AbstractMergeConflictDefinition(false) {
@Override
protected Map<String, List<Integer>> sourceDefinitions() {
Map<String, List<Integer>> res = new HashMap<>();
for(Marking m: markings){
List<Integer> lines = Arrays.stream(m.getSourceLines()).boxed().collect(Collectors.toList());
res.put(m.getClassName(), lines);
}
return res;
}

@Override
protected Map<String, List<Integer>> sinkDefinitions() {
Map<String, List<Integer>> res = new HashMap<>();
for(Marking m: markings) {
List<Integer> lines = Arrays.stream(m.getSinkLines()).boxed().collect(Collectors.toList());
res.put(m.getClassName(), lines);
}
return res;
}
};
}
}
37 changes: 37 additions & 0 deletions src/test/java/br/unc/cic/analysis/test/Marking.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package br.unc.cic.analysis.test;

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

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

public String getClassName() {
return className;
}

public void setClassName(String className) {
this.className = className;
}

public int[] getSourceLines() {
return sourceLines;
}

public void setSourceLines(int[] sourceLines) {
this.sourceLines = sourceLines;
}

public int[] getSinkLines() {
return sinkLines;
}

public void setSinkLines(int[] sinkLines) {
this.sinkLines = sinkLines;
}
}

0 comments on commit 19987fa

Please sign in to comment.