Last change
on this file since 99 was 99, checked in by Wouter Pasman, 20 months ago |
#87 added code to auto translate the issuevalues package. Not yet working because of translator limitation
|
File size:
1.0 KB
|
Line | |
---|
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;
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * First attempt at translating a original geniusweb package to python
|
---|
14 | * automatically
|
---|
15 | */
|
---|
16 | public class Try {
|
---|
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 | }
|
---|
38 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.