maprowseq.java
来自「java xml开发指南(初学者推荐)Java Xml 编程指南书籍源码」· Java 代码 · 共 44 行
JAVA
44 行
package MyNa.xml;
import java.util.*;
import java.io.*;
import MyNa.utils.*;
public class MapRowSeq extends RowSeq {
RowSeq innerRows;
String fieldName; int fieldNum; String val;
// used in most common case, in which a field
// is set to be a particular value. May be
// used for other purposes with mapFunction
// overridden.
public MapRowSeq(RowSeq re)throws Exception{
super();
innerRows=re; shallowClone(re);
fieldName=null; fieldNum=-1; val=null;
}
public MapRowSeq(String field,String val,RowSeq re)
throws Exception{
super();
innerRows=re; shallowClone(re);
fieldName=field; this.val=val;
if(theColumnLabels!=null)
for(int i=0;i<theColumnLabels.length;i++)
if(theColumnLabels[i].equals(field))
{fieldNum=i; return;}
}
public void mapFunction(){ // applied to each Env.
if(fieldNum>=0)theColumnValues[fieldNum]=val;
theEnv.put(fieldName,val);
}
public boolean next(){
if(!innerRows.next())return false;
mapFunction();
return true;
}
} // end MapRowEnum
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?