Skip to content
Snippets Groups Projects
Commit 4028db4f authored by dgelessus's avatar dgelessus
Browse files

Simplify file name filtering in AbstractParseMachineTest

parent 88804102
No related branches found
No related tags found
No related merge requests found
package de.tlc4b.util; package de.tlc4b.util;
import java.io.File; import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
...@@ -10,23 +9,10 @@ import de.tlc4b.tlc.TLCResults.TLCResult; ...@@ -10,23 +9,10 @@ import de.tlc4b.tlc.TLCResults.TLCResult;
import de.tlc4b.util.PolySuite.Configuration; import de.tlc4b.util.PolySuite.Configuration;
public abstract class AbstractParseMachineTest { public abstract class AbstractParseMachineTest {
private static final String MCH_SUFFIX = ".mch";
private static final class MachineFilenameFilter implements FilenameFilter {
private static final String[] MACHINE_SUFFIX = { ".mch" };
public boolean accept(final File dir, final String name) {
for (String machineSuffix : MACHINE_SUFFIX) {
if (name.endsWith(machineSuffix)) {
return true;
}
}
return false;
}
}
protected static File[] getMachines(String path) { protected static File[] getMachines(String path) {
final File dir = new File(path); return new File(path).listFiles((dir, name) -> name.endsWith(MCH_SUFFIX));
return dir.listFiles(new MachineFilenameFilter());
} }
protected static File[] getMachinesRecursively(String path, ArrayList<String> ignoreList) { protected static File[] getMachinesRecursively(String path, ArrayList<String> ignoreList) {
...@@ -60,7 +46,7 @@ public abstract class AbstractParseMachineTest { ...@@ -60,7 +46,7 @@ public abstract class AbstractParseMachineTest {
} else { } else {
String name = f.getName(); String name = f.getName();
if (name.endsWith(".mch")) { if (name.endsWith(MCH_SUFFIX)) {
files.add(f); files.add(f);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment