Changeset 99 for autotranslator/src/main/java
- Timestamp:
- 11/02/22 11:40:27 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
autotranslator/src/main/java/Try.java
r98 r99 1 import java.io.File; 2 import java.io.FileNotFoundException; 3 import java.io.FilenameFilter; 4 import java.nio.file.Path; 5 import java.nio.file.Paths; 6 import java.util.LinkedList; 7 import java.util.List; 8 9 import tudelft.utilities.j2p.PyModule; 10 import tudelft.utilities.j2p.PyProgram; 1 11 2 12 /** … … 6 16 public class Try { 7 17 18 private static final Path dir = Paths.get("downloads/geniusweb/issuevalue"); 19 20 public static void main(String[] args) throws FileNotFoundException { 21 File[] javafiles = dir.toFile().listFiles(new FilenameFilter() { 22 @Override 23 public boolean accept(File dir, String name) { 24 return name.endsWith(".java"); 25 } 26 }); 27 28 List<PyModule> modules = new LinkedList<>(); 29 for (File file : javafiles) { 30 // re-relativize as listFiles gives absolute paths 31 file = dir.relativize(file.toPath()).toFile(); 32 modules.add(PyModule.fromJavaFile(dir, file)); 33 } 34 35 PyProgram program = new PyProgram(modules); 36 System.out.println(program); 37 } 8 38 }
Note:
See TracChangeset
for help on using the changeset viewer.