-
Notifications
You must be signed in to change notification settings - Fork 0
/
synapse.java
39 lines (29 loc) · 1.29 KB
/
synapse.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.io.File;
import java.io.PrintWriter;
public class synapse{
public static void main(String[] args) {
if(args.length != 0) {
switch(args[0]) {
case "create:model":
System.out.println("Creating Model " + args[1]);
File f = new File("Model/" + args[1]);
try{
if(!f.exists()){
f.createNewFile();
}
PrintWriter pw = new PrintWriter(f);
String filename = f.getName().substring(0, f.getName().lastIndexOf("."));
String text = "package Model" + (f.getParentFile().getName().equals("Model") ? "" : "." + f.getParentFile().getName()) + "; \n\n public class " + filename + " extends Synapse.Model {\n\n public " + filename + "() { \n\n } \n\n}";
pw.println(text);
pw.close();
System.out.println("Model Successfully created");
}catch(Exception e){
//Catch block
}
break;
default:
break;
}
}
}
}