アットウィキロゴ

TSE01

import java.awt.*;
import java.awt.event.*;

class ren extends Frame{

int[] oprice=new int[10000];
int[] hprice=new int[10000];
int[] lprice=new int[10000];
int[] cprice=new int[10000];
int[] volume=new int[10000];
int[] rprice=new int[10000];
int[] year=new int[100000];
int[] month=new int[10000];
int[] day=new int[10000];
int[][][] h=new int[200][13][32];
int[][][] l=new int[200][13][32];
int[][][] o=new int[200][13][32];
int[][][] c=new int[200][13][32];
int[][][] r=new int[200][13][32];
int[][][] v=new int[200][13][32];

int[] price= new int[1000];

int pnumber,sx,maxp;
String urlx,str,strx;
String[] data=new String[100000];
int y,m,d;
int s,datanumber,p1,p2;
int xlong;

public static void main(String [] args) {
        Frame f=new ren();
        f.setTitle("TSE");
        f.setSize(700,700);
        f.setBackground(Color.yellow);
        f.setVisible(true);  
            }

ren(){

urlx="http://www11.atpages.jp/ce00582/tss.php?code=9505";

getdata sub=new getdata();
sub.makedata(urlx);    
data=sub.data;
datanumber=sub.datanumber;

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

p1=str.indexOf("<code>");
str=str.substring(p1,str.length());

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

xlong=x.length;
for(s=0;s<xlong;s++){
str=x[s];
p1=str.indexOf("<high>");
p2=str.indexOf("</high>");
strx=str.substring(p1,p2);
strx=strx.replace("<high>","");
hprice[s+1]=Integer.parseInt(strx);
str=x[s];
p1=str.indexOf("<low>");
p2=str.indexOf("</low>");
strx=str.substring(p1,p2);
strx=strx.replace("<low>","");
lprice[s+1]=Integer.parseInt(strx);
str=x[s];
p1=str.indexOf("<open>");
p2=str.indexOf("</open>");
strx=str.substring(p1,p2);
strx=strx.replace("<open>","");
oprice[s+1]=Integer.parseInt(strx);
str=x[s];
p1=str.indexOf("<close>");
p2=str.indexOf("</close>");
strx=str.substring(p1,p2);
strx=strx.replace("<close>","");
cprice[s+1]=Integer.parseInt(strx);

str=x[s];
p1=str.indexOf("<rev>");
p2=str.indexOf("</rev>");
strx=str.substring(p1,p2);
strx=strx.replace("<rev>","");
rprice[s+1]=Integer.parseInt(strx);

str=x[s];
p1=str.indexOf("<volume>");
p2=str.indexOf("</volume>");
strx=str.substring(p1,p2);
strx=strx.replace("<volume>","");
volume[s+1]=Integer.parseInt(strx);

str=x[s];
p1=str.indexOf("<year>");
p2=str.indexOf("</year>");
strx=str.substring(p1,p2);
strx=strx.replace("<year>","");
year[s+1]=Integer.parseInt(strx);

str=x[s];
p1=str.indexOf("<month>");
p2=str.indexOf("</month>");
strx=str.substring(p1,p2);
strx=strx.replace("<month>","");
month[s+1]=Integer.parseInt(strx);
str=x[s];
p1=str.indexOf("<day>");
p2=str.indexOf("</day>");
strx=str.substring(p1,p2);
strx=strx.replace("<day>","");
day[s+1]=Integer.parseInt(strx);
}

for(s=1;s<xlong+1;s++){
y=year[s]-1900;
m=month[s];
d=day[s];
h[y][m][d]=hprice[s];
l[y][m][d]=lprice[s];
o[y][m][d]=oprice[s];
c[y][m][d]=cprice[s];
v[y][m][d]=volume[s];
r[y][m][d]=rprice[s];
}

sx=0;
for(m=1;m<13;m++){
for(d=1;d<32;d++){
if(r[111][m][d]>0)sx=sx+1;
if(r[111][m][d]>0)price[sx]=r[111][m][d];
}
}

pnumber=sx;

for(s=1;s<pnumber+1;s++){
if(price[s]>maxp)maxp=price[s];
}

addWindowListener(new stopwin());

}

class stopwin extends WindowAdapter{
    public void windowClosing(WindowEvent we){System.exit(0);}
}  


public void paint(Graphics g){
int pp;
  
g.drawLine(100,600,600,600);
g.drawLine(100,600,100,100);

for(s=1;s<pnumber+1;s++){
pp=price[s]*500/maxp;
g.drawLine(100+2*s,600,100+2*s,600-pp);
}


}

}
最終更新:2011年08月14日 23:23