Просмотр исходного кода

Changed a parameter in the interface from String to File for more consistency

Pascal Krieg 4 лет назад
Родитель
Сommit
cb615a7deb

+ 4 - 3
languages/cpp/src/main/java/de/jplag/cpp/experimental/GCCSourceAnalysis.java

@@ -15,9 +15,10 @@ public class GCCSourceAnalysis implements SourceAnalysis {
     public static final String COMPILE_COMMAND = "gcc -Wall -fsyntax-only %s";
     private Map<String, List<Integer>> linesToDelete = new HashMap<>();
 
-    public boolean isTokenIgnored(de.jplag.cpp.Token token, String file) {
-        if (linesToDelete.containsKey(file)) {
-            var ignoredLineNumbers = linesToDelete.get(file);
+    public boolean isTokenIgnored(de.jplag.cpp.Token token, File file) {
+        String fileName = file.getName();
+        if (linesToDelete.containsKey(fileName)) {
+            var ignoredLineNumbers = linesToDelete.get(fileName);
             return ignoredLineNumbers.contains(token.beginLine);
         }
         return false;

+ 1 - 1
languages/cpp/src/main/java/de/jplag/cpp/experimental/SourceAnalysis.java

@@ -16,7 +16,7 @@ public interface SourceAnalysis {
      * @param file The file the token was scanned in
      * @return True, if the token should not be added to a TokenList, false if it should
      */
-    boolean isTokenIgnored(de.jplag.cpp.Token token, String file);
+    boolean isTokenIgnored(de.jplag.cpp.Token token, File file);
 
     /**
      * Executes the source analysis on the files of a submission.