tablesubsetrecorditerator.java

来自「openmap java写的开源数字地图程序. 用applet实现,可以像g」· Java 代码 · 共 67 行

JAVA
67
字号
// **********************************************************************// <copyright>//  BBN Technologies//  10 Moulton Street//  Cambridge, MA 02138//  (617) 873-8000// //  Copyright (C) BBNT Solutions LLC. All rights reserved.// </copyright>// **********************************************************************// $Source: /cvs/distapps/openmap/src/vpfservlet/WEB-INF/src/com/bbn/openmap/vpfservlet/TableSubsetRecordIterator.java,v $// $Revision: 1.2.2.2 $ $Date: 2005/08/11 21:03:07 $ $Author: dietrick $// **********************************************************************package com.bbn.openmap.vpfservlet;import java.util.ArrayList;import java.util.Iterator;import java.util.List;import com.bbn.openmap.io.FormatException;import com.bbn.openmap.layer.vpf.DcwRecordFile;/** * An iterator that will return a subset of the rows in a table. */public class TableSubsetRecordIterator implements Iterator {    final private int vals[];    final DcwRecordFile drf;    final List l;    private int current = 0;    public TableSubsetRecordIterator(int vals[], DcwRecordFile drf, List l) {        this.vals = vals;        this.drf = drf;        this.l = l;    }    /**     * Constructor     *      * @param drf the table to parse     * @param vals the row numbers to be returned     */    public TableSubsetRecordIterator(int vals[], DcwRecordFile drf) {        this(vals, drf, new ArrayList(drf.getColumnCount()));    }    public boolean hasNext() {        return (current < vals.length);    }    public Object next() {        boolean gotit;        try {            gotit = drf.getRow(l, vals[current++]);        } catch (FormatException fe) {            System.out.println("fe: " + fe);            gotit = false;        }        return gotit ? l : null;    }    public void remove() {        throw new UnsupportedOperationException();    }}

⌨️ 快捷键说明

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