package mamo;
import java.io.*;
public class pro {
int s,datanumber;
String[] data=new String[500000];
String[] subdate=new String[5000];
String[] date=new String[500000];
String[] code=new String[500000];
String[] name=new String[500000];
int number;
String[] id=new String[5000];
int[] point=new int[500000];
int[] v1=new int[500000];
int[] v2=new int[500000];
int[] v3=new int[500000];
int[] vs1=new int[500000];
int[] vs2=new int[500000];
int[] vs3=new int[500000];
int[] p1=new int[500000];
int[] p2=new int[500000];
int[] p3=new int[500000];
int dicnumber=0;
String[] dic=new String[5000];
int[] p=new int[5000];
int[] rank=new int[5000];
int delta=0;
String[] dic_code=new String[5000];
String[] dic_name=new String[5000];
String title="";
String file="";
String[] namex=new String[5000];
String[] datex=new String[5000];
int number_date;
String pp,cc;
public static void main(String[] args) {
pro re=new pro();
}
pro(){
readx("data.csv");
for(s=2;s<datanumber+1;s++){
String[] x=data[s].split(",");
date[s-1]=x[0]+"年"+x[1]+"月"+x[2]+"日";
v1[s-1]=numx(x[6]);
v2[s-1]=numx(x[7]);
v3[s-1]=numx(x[8]);
code[s-1]="";
if(x.length>9)code[s-1]=x[9];
if(code[s-1].equals("null"))code[s-1]="";
}
number=datanumber-1;
int sx;
dic[0]="";
for(s=1;s<number+1;s++){
int h=0;
for(sx=0;sx<delta+1;sx++){
if(code[s].equals(dic[sx]))h=100;
}
if(h<60)delta=delta+1;
if(h<60)dic[delta]=code[s];
}
System.out.println(delta);
int tr;
for(tr=1;tr<delta+1;tr++){
String str=dic[tr];
sx=0;
for(s=1;s<number+1;s++){
if(code[s].equals(str))sx=sx+1;
if(code[s].equals(str))subdate[sx]=date[s];
if(code[s].equals(str))p1[sx]=v1[s];
if(code[s].equals(str))p2[sx]=v2[s];
if(code[s].equals(str))p3[sx]=v3[s];
}
int subnumber=sx;
System.out.println(subnumber);
number_date=0;
for(s=1;s<subnumber+1;s++){
int h=0;
for(sx=1;sx<number_date+1;sx++){
if(subdate[s].equals(datex[sx]))h=100;
}
if(h<50)number_date=number_date+1;
if(h<50)datex[number_date]=subdate[s];
}
System.out.println(number_date);
for(s=1;s<number_date+1;s++){
vs1[s]=0;
vs2[s]=0;
vs3[s]=0;
}
for(s=1;s<subnumber+1;s++){
for(sx=1;sx<number_date+1;sx++){
if(subdate[s].equals(datex[sx]))vs1[sx]=vs1[sx]+p1[s];
if(subdate[s].equals(datex[sx]))vs2[sx]=vs2[sx]+p2[s];
if(subdate[s].equals(datex[sx]))vs3[sx]=vs3[sx]+p3[s];
}
}
check sub2=new check();
pp=sub2.makedata(str);
cc=str;
System.out.println(pp);
writexml("data/"+tr+".txt");
}
}
void writexml(String file){
int s,sx;
try{
PrintWriter pw = new PrintWriter (new BufferedWriter(new FileWriter(file)));
for(s=1;s<number_date+1;s++){
pw.println(pp+","+cc+","+datex[s]+","+vs1[s]+","+vs2[s]+","+vs3[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;
}
}
package mamo;
import tool.getdata;
public class check {
int s,datanumber;
String[] data=new String[6000];
String makedata(String d2){
String urlx="http://movie.walkerplus.com/"+d2+"/";
getdata sub7=new getdata();
sub7.makedata(urlx,"UTF-8");
data=sub7.data;
datanumber=sub7.datanumber;
String ss="aria-label=\"検索結果";
String kk="";
for(s=1;s<datanumber+1;s++){
if(data[s].indexOf("<title>")>-1)kk=data[s];
}
kk=kk.replace("| Movie Walker</title>","");
kk=kk.replace("<title>","");
return kk;
}
}
最終更新:2016年08月30日 17:13