アットウィキロゴ

p2398

package op;
 
import tool.*;
 import java.io.*;
public class pro {
 
    int s,datanumber;
    String[] data=new String[500000];
     String[] name=new String[5000];
     int[] code=new int[50000];
     String[] credit=new String[50000];
     int[] month=new int[50000];
     int[] year=new int[50000];
     double[] v=new double[50000];
    String[] memo=new String[500];
     int number;
 
     int creditnumber;
String[] creditp=new String[50];
String[] style=new String[50];
int[] strlong=new int[50];
     String[][] datax=new String[500000][10];
 
     public static void main(String[] args) {
        pro test=new pro();
    }
 
    pro(){
 
          String file,str;
 
          file="boj.txt";
 
 
           readx(file);
 
           double d;
           int y1,m1;
           String c;
 
         for(s=1;s<datanumber+1;s++){
         catchword sub=new catchword();
         credit[s]=sub.makedata(data[s],"code_credit");
         str=sub.makedata(data[s],"year");
         year[s]=Integer.parseInt(str);
         str=sub.makedata(data[s],"month");
         month[s]=Integer.parseInt(str);
         str=sub.makedata(data[s],"value");
         v[s]=num(str);
         }
 
 
        creditnumber=4;
        creditp[1]="year";
        creditp[2]="month";
        creditp[3]="bus";
        creditp[4]="value"; 
        style[1]="INTEGER";
        style[2]="INTEGER";
        style[3]="VARCHAR";
        style[4]="VARCHAR";
 
        strlong[3]=20;
        strlong[4]=20;
 
        String db,tab;
 
        db="bp";
        tab="bp";
 
 
        table sub7=new table();
        sub7.credit=creditp;
        sub7.creditnumber=creditnumber;
        sub7.style=style;
        sub7.strlong=strlong;
        sub7.makedata(db,tab);
 
 
         for(s=1;s<datanumber+1;s++){
 
        datax[s][1]=""+year[s];
        datax[s][3]="b"+credit[s];
        datax[s][2]=""+month[s];
        datax[s][4]=""+v[s];
 
        }
 
 
        insert sub5=new insert();
        sub5.creditnumber=creditnumber;
        sub5.style=style;
        sub5.data=datax;
        sub5.datanumber=datanumber;
        sub5.makedata(db,tab);
 
 
 
 
 
 
 
    }
 
     void writexml(String file){ 
 
    int s,sx;
 
try{ 
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file))); 
 
pw.println("年月,鉄鋼業");
for(s=1;s<number+1;s++){  
pw.println(memo[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;
 
}
 
 
double num(String str){
    double nx;
    nx=0;
 try{
    nx=Double.parseDouble(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;
 
} 
 
 
 
}
 
最終更新:2015年07月30日 13:56