Blame view

circus/src/jcircus/complexcomms/CCMapsGenerator.java 2.18 KB
8d0dc533f   Madiel de Souza Conserva Filho   first
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
  package jcircus.complexcomms;
  
  import java.io.BufferedWriter;
  import java.io.FileWriter;
  import java.io.IOException;
  
  public class CCMapsGenerator {
  	private String code = "";
  	private String packageDecl;
  	private String path;
  	private String procName;
  	private String paper;
  	private String src;
  	private String complement;
  	private int index;
  	public CCMapsGenerator (String paper, String src, String projectDir, String specName, String procName, int index, String complement) {
  		this.packageDecl = "package " + /*specName + "." +*/ paper + "." + src + "." + paper + "." + "ccmaps" + ";
  ";
  		//this.path = projectDir + "\\" + paper + "\\" + src + "\\" + paper + "\\ccmaps\\CCMaps_" + complement + procName + "_" + index + ".java";
  		this.path = projectDir + "/" + paper + "/" + src + "/" + paper + "/ccmaps/CCMaps_" + complement + procName + "_" + index + ".java";
  		this.procName = procName;
  		this.index = index;
  		this.paper = paper;
  		this.src = src;
  		this.complement = complement;
  	}
  	
  	public void concatCode (String str) {
  		this.code = this.code + str;
  	}
  	public String totalCode () {
  		return
  		this.packageDecl +
  		"import java.util.HashMap;
  " +
  		"import java.math.BigInteger;
  " +
  		"import java.util.Vector;
  " +
  		"import newjcircusutil.multisync.GeneralChannel;
  " +
  		"import " + this.paper + "." + src + "." + paper + ".channels.*;
  " +
  		"import " + this.paper + "." + src + "." + paper + ".typing.*;
  " +
  		"public class CCMaps_"  + complement +  procName + "_" + this.index + " {
  " +
  		"	/*public int abs (String chan, int element, BigInteger bi) {
  " +
  		"		return this.env_channels.get(chan).elementAt(element).indexOf(bi);
  " +
  		"	}*/
  " +
  		this.code
  		+ "}
  ";
  	}
  	public void generate() {
  		try {
  			BufferedWriter bw = new BufferedWriter (new FileWriter (this.path));
  			bw.write(this.totalCode());
  			bw.close();
  		} catch (IOException e) {
  			e.printStackTrace();
  		}
  	}
  	//Modelo do codigo que serĂ¡ gerado:
  	/*
  	 *	public class CCMaps {
  	 *		HashMap <String, Vector <Vector <BigInteger>>> env_channels = new HashMap <String, Vector <Vector <BigInteger>>> ();
  	 *		public void makeEnvChannels () {
  	 *			
  	 *		}
  	 *	}
  	 * */
  }