アットウィキロゴ

ぽ987

package op;
 
import tool.*;
 import java.io.*;
public class pro {
 
    int s,datanumber;
    String[] data=new String[500000];
     String[] bus=new String[5000];
     String[] com=new String[5000];
     int[] code=new int[50000];
     String[] dic_bus=new String[50000];
     String[] dic_com=new String[50000];
     String[] code_bus=new String[50000];
     String[] code_com=new String[50000];
     String[] month=new String[50000];
     String[] year=new String[50000];
     double[] v=new double[50000];
     double[] vs=new double[50000];
    String[] date=new String[50000];
     int number,number_com;
   int[] point=new int[1000];  
 
 
 
      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(){
 
 
        creditnumber=5;
        creditp[1]="year";
        creditp[2]="month";
        creditp[3]="bus";
        creditp[4]="com";
        creditp[5]="value"; 
        style[1]="INTEGER";
        style[2]="INTEGER";
        style[3]="VARCHAR";
        style[4]="VARCHAR";
       style[5]="VARCHAR";
 
        strlong[3]=20;
        strlong[4]=20;
strlong[5]=20;
 
        String db,tab;
 
        db="power";
        tab="power";
 
 
        table sub7=new table();
        sub7.credit=creditp;
        sub7.creditnumber=creditnumber;
        sub7.style=style;
        sub7.strlong=strlong;
        sub7.makedata(db,tab);
 
 
 
        number=0;
        number_com=0;
 
          String file,str;
 
          int tr;
 
          for(tr=1;tr<135;tr++){
 
              file="data/"+tr+".txt";
           readx(file);
 
           System.out.println(tr);
 
           double d;
           int y1,m1;
           String c;
 
         for(s=1;s<datanumber+1;s++){
         catchword sub=new catchword();
         bus[s]=sub.makedata(data[s],"bus");
         com[s]=sub.makedata(data[s],"com");
         date[s]=sub.makedata(data[s],"date");
         str=sub.makedata(data[s],"value");
         v[s]=num(str);
 
         }
 
 
         for(s=1;s<datanumber+1;s++){
         int p1=date[s].indexOf("年");
         int p2=date[s].indexOf("月");
         year[s]=date[s].substring(0,p1);
         month[s]=date[s].substring(p1+1,p2);
         }
 
    int h,sx;
 
         for(s=1;s<datanumber+1;s++){
         h=0;   
         for(sx=1;sx<number+1;sx++){
         if(bus[s].equals(dic_bus[sx]))h=100;
         } 
         if(h<50)number=number+1;
         if(h<50)dic_bus[number]=bus[s];
         }
 
 
        for(s=1;s<datanumber+1;s++){
         h=0;   
         for(sx=1;sx<number+1;sx++){
         if(com[s].equals(dic_com[sx]))h=100;
         } 
         if(h<50)number_com=number_com+1;
         if(h<50)dic_com[number_com]=com[s];
         }
 
         for(s=1;s<datanumber+1;s++){
         for(sx=1;sx<number_com+1;sx++){
         if(com[s].equals(dic_com[sx]))code_com[s]="c"+sx;
         }}
 
 
 
         for(s=1;s<datanumber+1;s++){
         for(sx=1;sx<number+1;sx++){
         if(bus[s].equals(dic_bus[sx]))code_bus[s]="b"+sx;
         }}
 
 
         for(s=1;s<datanumber+1;s++){
 
        datax[s][1]=""+year[s];
        datax[s][3]=""+code_bus[s];
        datax[s][2]=""+month[s];
        datax[s][5]=""+v[s];
        datax[s][4]=""+code_com[s];
        }
 
 
         insert sub5=new insert();
        sub5.creditnumber=creditnumber;
        sub5.style=style;
        sub5.data=datax;
        sub5.datanumber=datanumber;
        sub5.makedata(db,tab);
 
 
 
    }
 
 
 
 
 
 
    }
 
 
   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日 09:56