アットウィキロゴ

vcxみh

import java.io.*;
import java.net.URLEncoder;

class ren{

int[] x=new int[5000];
int[] y=new int[5000];
String urlx;
String[] data=new String[5000];
String[] author=new String[2000];
String[] credit=new String[5000];
String[] mu=new String[5000];
int s,sx,datanumber,authornumber;  
String word,str,bun;
int xmlnumber,p1,p2,mnumber;

public static void main(String [] args) {
        ren test=new ren();
            }

ren(){

readfile("db.txt");

authornumber=datanumber;

for(s=1;s<datanumber+1;s++){
author[s]=data[s];
}

word=author[1];

urlx="";

try{

str = URLEncoder.encode(word,"utf-8");

urlx="http://ja.wikipedia.org/wiki/";
urlx=urlx+str;

}catch(Exception e) { System.err.println(e); }  

getdata g=new getdata();
g.makedata(urlx);
bun=g.data;

xymaker();

for(s=1;s<xmlnumber;s++){
p1=y[s];
p2=x[s+1];
if(p1==p2)credit[s]="△";
if(p1>p2)credit[s]="△";
if(p2>p1)credit[s]=bun.substring(p1+1,p2);
}

sx=0;
for(s=1;s<xmlnumber;s++){
if(credit[s].length()>1)sx=sx+1;
if(credit[s].length()>1)mu[sx]=credit[s];
}

mnumber=sx;

for(s=200;s<400;s++){
System.out.println(mu[s]);
}





}

void xymaker(){
int s,p1;
s=1;
p1=bun.indexOf("<");
x[s]=p1;
while(p1>-1){
p1=bun.indexOf("<",p1+1);
if(p1>-1)s=s+1;
if(p1>-1)x[s]=p1;
}
xmlnumber=s;
for(s=1;s<xmlnumber+1;s++){
y[s]=bun.indexOf(">",x[s]);
}

}

void readfile(String file){

String str;
BufferedReader br;  

s=0;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file),"SJIS"));  
while((str = br.readLine()) != null) {  
s=s+1;
data[s]=str;  
}
br.close();
} catch (IOException e) {System.out.println(e);}  

datanumber=s;

}

}
最終更新:2011年07月05日 05:20