package mario;
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];
String[] v1=new String[50000];
String[] v2=new String[50000];
String[] v3=new String[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];
String[] dic_area=new String[500];
public static void main(String[] args) {
pro test=new pro();
}
pro(){
creditnumber=5;
creditp[1]="year";
creditp[2]="month";
creditp[3]="mono";
creditp[4]="ton";
creditp[5]="tonkilo";
style[1]="INTEGER";
style[2]="INTEGER";
style[4]="VARCHAR";
style[3]="VARCHAR";
style[5]="VARCHAR";
strlong[4]=20;
strlong[5]=20;
String db,tab;
db="ship";
tab="ship";
table sub7=new table();
sub7.credit=creditp;
sub7.creditnumber=creditnumber;
sub7.style=style;
sub7.strlong=strlong;
sub7.makedata(db,tab);
String file,str;
int page;
number=0;
for(page=1;page<152;page++){
file="gdata/"+page+".txt";
readx(file);
for(s=1;s<datanumber+1;s++){
catchword sub=new catchword();
credit[s]=sub.makedata(data[s],"mono");
str=sub.makedata(data[s],"year");
year[s]=numx(str);
str=sub.makedata(data[s],"month");
month[s]=numx(str);
str=sub.makedata(data[s],"ton");
v1[s]=str;
str=sub.makedata(data[s],"tonkilo");
v2[s]=str;
}
int sx,h;
for(s=1;s<datanumber+1;s++){
h=0;
for(sx=1;sx<number+1;sx++){
if(credit[s].equals(dic_area[sx]))h=100;
}
if(h<50)number=number+1;
if(h<50)dic_area[number]=credit[s];
}
}
int sx;
for(sx=1;sx<number+1;sx++){
System.out.println("m"+sx+","+dic_area[sx]);
}
for(page=1;page<152;page++){
file="gdata/"+page+".txt";
readx(file);
for(s=1;s<datanumber+1;s++){
catchword sub=new catchword();
credit[s]=sub.makedata(data[s],"mono");
str=sub.makedata(data[s],"year");
year[s]=numx(str);
str=sub.makedata(data[s],"month");
month[s]=numx(str);
str=sub.makedata(data[s],"ton");
v1[s]=str;
str=sub.makedata(data[s],"tonkilo");
v2[s]=str;
}
for(s=1;s<datanumber+1;s++){
for(sx=1;sx<number+1;sx++){
if(credit[s].equals(dic_area[sx]))code[s]=sx;
}
}
for(s=1;s<datanumber+1;s++){
datax[s][1]=""+year[s];
datax[s][2]=""+month[s];
datax[s][3]="m"+code[s];
datax[s][4]=""+v1[s];
datax[s][5]=""+v2[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年08月23日 11:08