アットウィキロゴ

sakuhi

package db;
 
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.*;
 
 
public class pro {
 
    int creditnumber;
String[] creditp=new String[50];
String[] style=new String[50];
int[] strlong=new int[50];
     String[][] datax=new String[500000][20];
 
 
 
     int[] year=new int[5000000];
    int[] month=new int[5000000];
    int[] day=new int[5000000];
    String[] th=new String[5000000];
    String[] v1=new String[5000000];
    String[] v2=new String[5000000];
    String[] v3=new String[5000000];
     String[] time=new String[5000000];
     String[] code=new String[5000000];
      String[] name=new String[5000000];
 
      int s,datanumber;
       String[] data=new String[5000000];
         String[] subdata=new String[5000000];
       String[] dic_code=new String[5000000];
      String[] dic_name=new String[5000000];
 
    public static void main(String[] args) {
        pro t=new pro();
    }
    pro(){
 
 
 
 
 
 
 
        int tr,sx=0;
        for(tr=6;tr<12;tr++){
            readx(tr+".csv");
        for(s=2;s<datanumber+1;s++){
        sx=sx+1;    
        subdata[sx]=data[s];
        }
 
 
        }
 
        datanumber=sx;
 
 
      for(s=1;s<datanumber+1;s++){
 
 
          String[] x=subdata[s].split(",");
 
        name[s]=x[5];
        year[s]=numx(x[0]);
        month[s]=numx(x[1]);
        day[s]=numx(x[2]);
        th[s]=x[4];
        v1[s]=x[6];
        v2[s]=x[7];
        v3[s]=x[8];
        time[s]=x[3];
        code[s]="";
      if(x.length>9)code[s]=x[9];
      }
 
 
   for(s=2;s<datanumber;s++){
  if(code[s]==null)code[s]="";
  if(code[s].indexOf("mv")<0)code[s]="";    
   }      
 
   int dicnumber=0;
   dic_code[0]="";
   for(s=1;s<datanumber+1;s++){
   int h=0;
   for(sx=0;sx<dicnumber+1;sx++){
   if(code[s].equals(dic_code[sx]))h=100;    
   }    
   if(h<50)dicnumber=dicnumber+1;
   if(h<50)dic_code[dicnumber]=code[s];
   if(h<50)dic_name[dicnumber]=name[s];
   }
 
   System.out.println(dicnumber);
 
   for(s=1;s<dicnumber+1;s++){
   System.out.println(dic_name[s]+","+dic_code[s]);
   writexml("data/"+dic_code[s]+".txt",dic_code[s]);
   }    
 
 
 
 
 
    }
 
 
 
    void writexml(String file,String dd){ 
 
    int s,sx;
 
try{ 
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file))); 
 
for(s=1;s<datanumber+1;s++){  
if(code[s].equals(dd))pw.println(subdata[s]);  
}
 
 
System.out.println("ファイルに書きこみました。"); 
pw.close(); 
} catch(IOException ep){ System.out.println("入出力エラーです。"); } 
 
 
} 
 
       int numx(String str){
 
    int nx;
 
    nx=0;
 
 try{
 
    nx=Integer.parseInt(str);
 
 }catch (Exception e) {}
 
 return nx;
 
 
 
}
 
 
     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年12月11日 06:51