アットウィキロゴ

sijitu

package tv3;
 
import tool.*;
import java.io.*;
 
public class pro {
 
    int s,datanumber;
    String[] data=new String[5000];
String[] week=new String[50];
    String[] subdata=new String[5000];
 
     String[] name=new String[5000];
      String[] t1=new String[5000];
       String[] t2=new String[5000];
 
       String[] tab=new String[600];
       String[] w=new String[600];
       String[] sta=new String[600];
 
        String[] date=new String[6000];
        int c;
    public static void main(String[] args) {
        pro te=new pro();
    }
 
    pro(){
 
        int y1=2010;
      int m1=4;
        int m2;
        c=0;
    for(y1=1998;y1<2010;y1++){  
    for(m2=1;m2<5;m2++){    
 
        m1=3*m2-2;
 
    week[1]="月";
    week[2]="火";
      week[3]="水";
    week[4]="木";
      week[5]="金";
    week[6]="土";
      week[7]="日";   
 
      for(s=1;s<8;s++){
      week[s]="("+week[s]+"曜日)";    
      }
 
      sta[1]="NHK";
      sta[2]="日本";
      sta[3]="TBS";
      sta[4]="フジ";
      sta[5]="朝日";
      sta[6]="東京";
 
         int k=0;
         int tr,de;
  for(tr=1;tr<8;tr++){    
  for(de=1;de<7;de++){    
 
 
      String str=y1+"年"+m1+"月";
 
        readfile sub2=new readfile();
        sub2.makedata("data.csv","UTF-8");
        data=sub2.data;
        datanumber=sub2.datanumber;
 
        int sx=0;
        for(s=1;s<datanumber+1;s++){
        int h=0;
        if(data[s].indexOf(str)>-1)h=h+1;    
        if(data[s].indexOf(week[tr])>-1)h=h+1; 
         if(data[s].indexOf(","+sta[de]+",")>-1)h=h+1; 
        if(h==3)sx=sx+1;
         if(h==3)subdata[sx]=data[s];
 
        }
 
 
        int number=sx;
 
   for(s=1;s<number+1;s++){     
 
   String[] x=subdata[s].split(",");
   name[s]=x[4];
    t1[s]=x[2]+"時"+x[3]+"分";
   t2[s]=x[5]+"時"+x[6]+"分";
   if(t2[s].indexOf("△")>-1)t2[s]="不明";
 
   }
 
   String strx="<table>";
   strx=strx+"<tr>";
 
   strx=strx+"<th>";
   strx=strx+"開始時刻";
   strx=strx+"</th>";
   strx=strx+"<th>";
   strx=strx+"終了時刻";
   strx=strx+"</th>";
   strx=strx+"<th>";
   strx=strx+"番組名";
   strx=strx+"</th>";
   strx=strx+"</tr>";
   for(s=1;s<number+1;s++){
   strx=strx+"<tr>";
   strx=strx+"<td>";
   strx=strx+t1[s];
   strx=strx+"</td>";
   strx=strx+"<td>";
   strx=strx+t2[s];
   strx=strx+"</td>";
   strx=strx+"<td>";
   strx=strx+name[s];
   strx=strx+"</td>";
   strx=strx+"</tr>";
   }
   strx=strx+"</table>";
   k=k+1;
   w[k]=sta[de]+week[tr];
   tab[k]=strx; 
  }
  }
 
  c=c+1;
  date[c]=y1+"年"+m1+"月期";
 
  writehtml("data/"+c+".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.println("</head>");
pw.println("<title>"); 
pw.println(date[c]); 
pw.println("</title>"); 
pw.println("<body>"); 
for(s=1;s<43;s++){
pw.println("<h2>"+w[s]+"</h2>");   
pw.println(tab[s]);   
}
pw.println("</body>");
pw.println("</html>");
 
System.out.println("ファイルに書きこみました。"); 
pw.close(); 
} catch(IOException ep){ System.out.println("入出力エラーです。"); } 
 
 
} 
 
 
 
 
}
 
最終更新:2016年08月23日 15:58