Ignore:
Timestamp:
11/02/22 11:40:27 (2 years ago)
Author:
Wouter Pasman
Message:

#87 added code to auto translate the issuevalues package. Not yet working because of translator limitation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • autotranslator/src/main/java/Try.java

    r98 r99  
     1import java.io.File;
     2import java.io.FileNotFoundException;
     3import java.io.FilenameFilter;
     4import java.nio.file.Path;
     5import java.nio.file.Paths;
     6import java.util.LinkedList;
     7import java.util.List;
     8
     9import tudelft.utilities.j2p.PyModule;
     10import tudelft.utilities.j2p.PyProgram;
    111
    212/**
     
    616public class Try {
    717
     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        }
    838}
Note: See TracChangeset for help on using the changeset viewer.