package cap;
import tool.*;
public class pro {
String[] data=new String[50000];
int s,datanumber;
String[] v=new String[50000];
String[] credit=new String[50000];
String[] bus=new String[50000];
String[] code_credit=new String[50000];
String[] code_bus=new String[50000];
int number;
String[] name_credit=new String[50000];
String[] name_bus=new String[50000];
double[][] vs=new double[50][50];
int number_bus;
int number_credit;
public static void main(String[] args) {
pro t=new pro();
}
pro(){
catchdata sub=new catchdata();
sub.makedata();
vs=sub.vs;
number_credit=sub.number_credit;
number_bus=sub.number_bus;
name_credit=sub.name_credit;
name_bus=sub.name_bus;
for(s=1;s<number_bus+1;s++){
System.out.println("b"+s+","+name_bus[s]);
}
for(s=1;s<number_credit+1;s++){
System.out.println("c"+s+","+name_credit[s]);
}
String[] link_credit=new String[50];
for(s=1;s<number_credit+1;s++){
link_credit[s]="";
}
link_credit[2]="建設";
link_credit[3]="建設";
link_credit[4]="建設";
link_credit[5]="輸送";
link_credit[6]="輸送";
link_credit[7]="電気";
link_credit[8]="精密";
link_credit[9]="一般機械";
link_credit[12]="情報通信";
int[] link_bus=new int[50];
for(s=1;s<number_bus+1;s++){
link_bus[s]=0;
}
for(s=3;s<27;s++){
link_bus[s]=s-2;
}
link_bus[27]=23;
link_bus[28]=1;
link_bus[30]=17;
link_bus[31]=18;
}
}
package cap;
import tool.*;
public class catchdata {
String[] data=new String[50000];
int s,datanumber;
String[] v=new String[50000];
String[] credit=new String[50000];
String[] bus=new String[50000];
String[] code_credit=new String[50000];
String[] code_bus=new String[50000];
int number;
String[] name_credit=new String[50000];
String[] name_bus=new String[50000];
double[][] vs=new double[50][50];
int number_bus=0;
int number_credit=0;
void makedata(){
readfile sub=new readfile();
sub.makedata("data.csv","UTF-8");
data=sub.data;
datanumber=sub.datanumber;
int sx=0;
for(s=2;s<datanumber+1;s++){
String[] x=data[s].split(",");
if(x[0].indexOf("2010")>-1)sx=sx+1;
if(x[0].indexOf("2010")>-1)credit[sx]=x[4];
if(x[0].indexOf("2010")>-1)bus[sx]=x[2];
if(x[0].indexOf("2010")>-1)code_credit[sx]=x[3];
if(x[0].indexOf("2010")>-1)code_bus[sx]=x[1];
if(x[0].indexOf("2010")>-1)v[sx]=x[5];
}
number=sx;
int h;
for(s=1;s<50;s++){
h=0;
String str="b"+s;
for(sx=1;sx<number+1;sx++){
if(code_bus[sx].equals(str))h=100;
}
if(h>50)number_bus=s;
}
number_credit=0;
for(s=1;s<50;s++){
h=0;
String str="c"+s;
for(sx=1;sx<number+1;sx++){
if(code_credit[sx].equals(str))h=100;
}
if(h>50)number_credit=s;
}
for(s=1;s<number_credit+1;s++){
h=0;
String str="c"+s;
for(sx=1;sx<number+1;sx++){
if(code_credit[sx].equals(str))name_credit[s]=credit[sx];
}
}
for(s=1;s<number_bus+1;s++){
h=0;
String str="b"+s;
for(sx=1;sx<number+1;sx++){
if(code_bus[sx].equals(str))name_bus[s]=bus[sx];
}
}
int tx;
for(s=1;s<number_bus+1;s++){
for(sx=1;sx<number_credit+1;sx++){
for(tx=1;tx<number+1;tx++){
h=0;
String str1="b"+s;
if(code_bus[tx].equals(str1))h=h+1;
String str2="c"+sx;
if(code_credit[tx].equals(str2))h=h+1;
if(h==2)vs[s][sx]=num(v[tx]);
}
}
}
}
double num(String str){
double nx;
nx=0;
try{
nx=Double.parseDouble(str);
}catch (Exception e) {}
return nx;
}
}
最終更新:2016年05月29日 09:39