package graph;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class pro {
int s,datanumber;
String[] data=new String[40000];
String[][] datax=new String[300][50];
String[] name=new String[40000];
String[] memo=new String[40000];
String[] code=new String[5000];
String[] year=new String[5000];
String[] r=new String[5000];
String[] imx=new String[60];
int number;
int delta;
public static void main(String[] args) {
pro t=new pro();
}
pro(){
readx("n.txt");
for(s=1;s<151;s++){
memo[s]=data[s];
}
int tr=1;
for(tr=1;tr<151;tr++){
readx("sample.js");
for(s=1;s<datanumber+1;s++){
data[s]=data[s].replace("[num]","["+tr+"]");
}
writexml("data/sample"+tr+".js");
readx("index.html");
String de="sample"+tr+".js";
for(s=1;s<datanumber+1;s++){
data[s]=data[s].replace("sample.js",de);
data[s]=data[s].replace("消費活動指数",memo[tr]);
}
writexml("data/play"+tr+".html");
}
writehtml("data/index.html");
}
void writehtml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
pw.println("<html>");
pw.println("<head>");
pw.println("<meta charset=\"UTF-8\">");
pw.print("<title>鉱工業指数</title>");
pw.println("</head>");
pw.println("<body>");
pw.print("<table rules=\"all\">");
pw.print("<tr>");
pw.print("<th>");
pw.print("産業");
pw.print("</th>");
pw.print("<th>");
pw.print("グラフ");
pw.print("</th>");
pw.println("</tr>");
for(s=1;s<151;s++){
pw.print("<tr>");
pw.print("<th>");
pw.print(memo[s]);
pw.print("</th>");
pw.print("<td><a href=\"play");
pw.print(s);
pw.print(".html\">図<a></td>");
pw.println("</tr>");
}
pw.println("</table>");
pw.println("</body>");
pw.println("</html>");
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
void writexml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
for(s=1;s<datanumber+1;s++){
pw.println(data[s]);
}
System.out.println("ファイルに書きこみました。");
pw.close();
} catch(IOException ep){ System.out.println("入出力エラーです。"); }
}
void readx(String file){
String str;
BufferedReader br;
int s;
s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
while((str = br.readLine()) != null) {
s=s+1;
data[s]=str;
}
br.close();
} catch (IOException e) {System.out.println(e);}
datanumber=s;
} }
最終更新:2016年09月11日 12:52