アットウィキロゴ

5010

import java.io.*;

class pro{

String data,file,datax,x1;
int page,s,sx,xlong;
int[] x=new int[1000];
int[] y=new int[1000];
String[] credit=new String[1000];
String[] p1=new String[500];
int[] type=new int[500];
int xmlnumber,pnumber;
int h;

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

pro(){

page=5000;

file="data/";
file=file+page;
file=file+".txt";

System.out.println(file);

readfile(file);

xymaker(data);

for(s=1;s<xmlnumber+1;s++){
credit[s]=data.substring(x[s]+4,y[s]);
}

datax=data.substring(0,x[1]);

String[] x=datax.split("<BR>");

sx=0;
for(s=1;s<x.length;s++){
xlong=x[s].length();
x1="△";
if(xlong>10)x1=x[s].substring(xlong-1,xlong);
if(x1.equals("君"))sx=sx+1;
if(x1.equals("君"))p1[sx]=x[s];
}

pnumber=sx;
for(s=1;s<pnumber+1;s++){
p1[s]=p1[s].replace(" ","△");
p1[s]=p1[s].replace(" ","△");
}


for(s=1;s<pnumber+1;s++){
h=0;
if(p1[s].indexOf("委員長")<10)h=h+1;
if(p1[s].indexOf("委員長")>2)h=h+1;
if(h==2)type[s]=1;
}

for(s=1;s<pnumber+1;s++){
if(p1[s].indexOf("君△")>5)type[s]=2;
}

for(s=1;s<pnumber+1;s++){
h=0;
if(type[s]==0)h=h+1;
if(p1[s].length()>20)h=h+1;
if(h==2)type[s]=3;
}

for(s=1;s<pnumber+1;s++){
if(type[s]==0)type[s]=4;
}


for(s=1;s<pnumber+1;s++){
p1[s]=p1[s].replace("委員長","△");
p1[s]=p1[s].replace("代理","△");
p1[s]=p1[s].replace("理事","△");
}

for(s=1;s<pnumber+1;s++){
if(type[s]==1)p1[s]=p1[s].replace("△","");
if(type[s]==4)p1[s]=p1[s].replace("△","");
}

for(s=1;s<pnumber+1;s++){
String[] y=p1[s].split("君△");
if(type[s]==2)p1[s]=y[0];
if(type[s]==2)p1[s]=p1[s].replace("△","");
}

for(s=1;s<pnumber+1;s++){;
if(type[s]==3)p1[s]=p1[s].substring(15,p1[s].length());
if(type[s]==3)p1[s]=p1[s].replace("△","");
}




for(s=1;s<pnumber+1;s++){
System.out.println(p1[s]);
System.out.println(type[s]);
}




}

void xymaker(String data){
int s,p1;
s=0;
p1=data.indexOf("<B>○");
if(p1>0)s=s+1;
if(p1>0)x[s]=p1;
while(p1>1){
p1=data.indexOf("<B>○",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]=data.indexOf("</B>",x[s]);
}

}

void readfile(String file){

String str;
BufferedReader br;  

data="";

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

}


}
最終更新:2011年06月29日 00:05