resultiterator.java

来自「cwbbs 云网论坛源码」· Java 代码 · 共 74 行

JAVA
74
字号
package cn.js.fan.db;import java.util.*;public class ResultIterator implements Iterator,java.io.Serializable {    HashMap mapIndex;    Vector result;    int curRowIndex = 0;    int rows = 0;    Vector curRow;    long total = 0;       public ResultIterator() {    }    public ResultIterator(Vector result, HashMap mapIndex) {        if (result==null)            return;        this.result = result;        rows = result.size();        this.mapIndex = mapIndex;    }    public ResultIterator(Vector result, HashMap mapIndex, long total) {        if (result==null)            return;        this.result = result;        this.total = total;        rows = result.size();        this.mapIndex = mapIndex;    }        public int size() {        return rows;    }    public int getRows() {        return rows;    }    public void setTotal(long t) {        this.total = t;    }    public long getTotal() {        return this.total;    }        public boolean hasNext() {        if (result==null) return false;        if (curRowIndex<=rows-1)            return true;        else            return false;    }        public Object next() {        curRow = (Vector)result.elementAt(curRowIndex);        curRowIndex ++;        return new ResultRecord(curRow, mapIndex);    }        public void remove() throws RuntimeException {        throw new RuntimeException("This operate is not suported!");    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?