临时变量表。
TemporaryTable.java:
package per.eyuan.util;
public class TemporaryTable {
Temporary table[]=new Temporary[20];
int count=0;
public TemporaryTable() {
super();
init();
}
public void init(){
for(int i=0;i<table.length;i++)
table[i]=new Temporary();
}
public int getCount(){
return count;
}
public Temporary getTemp(int index){
//获取Temporary表中指定索引的Temporary实例
return table[index];
}
//新增临时变量
public void addTemp(String val){
table[count].index=count;
table[count].value=val;
count++;
}
public void addTemp(){
table[count].index=count;
count++;
}
public Temporary[] getAllTemporary(){
Temporary atemp[]=new Temporary[count];
for(int i=0;i<count;i++)
atemp[i]=table[i];
return atemp;
}
}