java.lang.NullPointerException的问题请大家帮忙
public FastVector freq_2()//fre-2
{
FastVector vtemp=new FastVector();
vectoralltemp.removeAllElements();
Item temp1=new Item();
Item temp2=new Item();
Item temp3=new Item();
String key1,key2;
String key="";
int tempcon=0;
boolean b1=false,b2=false;
for(int i=0;i<fullFreq[1].size();i++)
{
temp1=(Item)fullFreq[1].elementAt(i);
key1=temp1.getKey();
for(int j=i+1;j<fullFreq[1].size();j++)
{ Item temp=new Item();
temp2=(Item)fullFreq[1].elementAt(j);
tempcon=0;
key2=temp2.getKey();
///////////////////////////////////////////////////////
for(int h=0;h<vectorall.size();h++)//2项的支持度
{
temp3=(Item)vectorall.elementAt(h);
key=temp3.getKey();
if(key.equals("%"))
{
if(b1&&b2)
{
tempcon++;
b1=false;
b2=false;
}
}
else if(key1.equals(key))
{
b1=true;
}
else if(key2.equals(key))
{
b2=true;
}
}
/////////////////////////////////////////////
temp.setcon(tempcon);//setcon
String con=temp1.getKey()+","+temp2.getKey()+",";
temp.setKey(con);//sekey
vectoralltemp.addElement(temp);//add item
}
}
fullFreq[2]=vectoralltemp;
return vectoralltemp;
}
public FastVector ck(FastVector freq_k,int k) {
FastVector temp=new FastVector();
FastVector temp1=new FastVector();
FastVector temp2=new FastVector();
temp=freq_k;
for(int i=0;i<temp.size();i++)
{
String s1="",s2="",s3="",s4="",s11="",s22="";
char c1,c2;
Item I1=new Item();
I1=(Item)temp.elementAt(i);
s11=I1.getKey();
//txt=txt+s11+"^";
for(int j=i+1;j<temp.size();j++)
{
Item I2=new Item();
I2=(Item)temp.elementAt(j);
s22=I2.getKey();
///////////////////////////////判断他们字符串是否相
int k2=0,k3=0;
int t1,t2;
t1=s11.length();
t2=s22.length();
for(int x=0;x<t1;x++)
{
if(s11.charAt(x)==',')
{
k2++;
if(k2<=k-1)
{
s3=s3+s1+",";
}
if(k2!=k)
{
s1="";
}
}
else
{
s1=s1+String.valueOf(s11.charAt(x));
}
}
////////////////
for(int x=0;x<t2;x++)
{
if(s22.charAt(x)==',')
{
k3++;
if(k3<=k-1)
{
s4=s4+s2+",";
}
if(k3!=k)
{
s2="";
}
}
else
{
s2=s2+String.valueOf(s22.charAt(x));
}
}
//////////////////////////////////
if(s3.equals(s4))
{
Item I3=new Item();
if(s1.equals(s2))
{s1=s2=s3=s4="";}
else
{
if(s1.compareTo(s2)>0)
{
I3.setKey(s3+s2+","+s1+",");
temp1.addElement(I3);
s1=s2=s3=s4="";
}
else
{
I3.setKey(s3+s1+","+s2+",");
temp1.addElement(I3);
s1=s2=s3=s4="";
}
txt=txt+I3.getKey()+"PP ";
}
}
else
{s1=s2=s3=s4="";}
}
}
return temp1;
}
public FastVector odd(FastVector c_k2,FastVector freq_k,int k2)//c_k2为c_k+1的侯选集freq_k为k阶频繁集 k2为k+1 item里面含有的个数
{
FastVector ck2=new FastVector();
FastVector fk=new FastVector();
FastVector fk2=new FastVector();
boolean isfk=false;
ck2=c_k2;
fk=freq_k;
//fk=fullFreq[2];
int count=0;
for(int i=0;i<c_k2.size();i++)
{
Item Itemp=new Item();
String istr="";
Itemp=(Item)c_k2.elementAt(i);
istr=Itemp.getKey();
//int size=k2;
for(int j=0;j<=k2-2;j++)//////??///
{
int k=0;
String strtemp="",strtemp1="";
for(int x=0;x<istr.length();x++)
{
if(istr.charAt(x)==',')
{
k=k+1;
if(k!=j)
{
strtemp1=strtemp1+strtemp+",";
//txt=txt+strtemp1+"--";
strtemp="";
}
else
{strtemp="";}
}
else
{
strtemp=strtemp+String.valueOf(istr.charAt(x));
}
}
for(int p=0;p<fk.size();p++)
{
Item hh=new Item();
String s1="";
hh=(Item)fk.elementAt(p);
s1=hh.getKey();
if(s1.equals(strtemp1))
{
//txt=txt+s1+"Ss ";
isfk=true;
strtemp1="";
s1="";
}
else
{
s1="";
}
}
}
int strnum=0;
for(int h=0;h<vectorall.size();h++)//setcon
{
Item temp3=new Item();
temp3=(Item)vectorall.elementAt(h);
String key="";
key=temp3.getKey();
String strcon[]=new String[k2];
String stemp="";
int num=0;
for(int j=0;j<istr.length();j++)//count String
{
if(istr.charAt(j)==',')
{
// num++;
strcon[num]=stemp;
num++;
stemp="";
}
else
{
stemp=stemp+String.valueOf(istr.charAt(j));
}
}
if(key.equals("%"))
{
if(strnum==k2)
{
count++;
strnum=0;
}
}
else
{
for(int k=0;k<k2;k++)
{
if(key.equals(strcon[k])||strcon[k].equals(key))/////////////错误提示处
{
strnum++;
}
}
}
}
if(isfk)
{
//设置con
if(count>=1)//set minsup没有设置用1先代替
{
Itemp.setcon(count);
count=0;
fk2.addElement(Itemp);
}
//Itemp.removekey();
//txt=txt+Itemp.getKey()+"pp\n";
isfk=false;
count=0;
}
else
{
count=0;
}
}
fullFreq[k2]=fk2;
return fullFreq[k2];
}
public FastVector freq_k(FastVector freq_k,int k )//fre_k---->fre_k+1
{//由ck 与odd完成\
int k2=k;
k2++;
freq_1();
FastVector c_k2=new FastVector();
FastVector freq_k2=new FastVector();
FastVector f_k=new FastVector();
f_k=freq_k;
c_k2=ck(f_k,k);
freq_k2=odd(c_k2,f_k,k2);//////////////////////////////////////////////////错误提示处
fullFreq[k+1]=freq_k2;
Item kk=new Item();
for(int x=0;x<fullFreq[k+1].size();x++)
{
kk=(Item)fullFreq[k+1].elementAt(x);
}
return freq_k2;
}
public void freq_allk()
{
int k2=2;
int key=2;
freq_1();
//fullFreq[k2]=
FastVector temp=new FastVector();
temp=freq_2();
fullFreq[2]=freq_2();
while(temp.size()>=1)
{
temp=freq_k(fullFreq[k2],key);///////////////////////////错误提示处
k2++;
fullFreq[k2]=temp;
kfullSet=k2;
key++;
txt=txt+k2+"s"+key+" YY";
Item kk=new Item();
txt=txt+"WWWWW"+fullFreq[k2].size()+"WWWWW";
for(int x=0;x<fullFreq[k2].size();x++)
{
kk=(Item)fullFreq[k2].elementAt(x);
txt=txt+kk.getKey()+"--"+kk.getcon()+"OO ";//测试用
}
txt=txt+"gh"+" ";
}
}
}
这里是代码