亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dbforumiterator.java

?? 這是學習Java必須讀懂兩套源代碼
?? JAVA
字號:
/**
 * Copyright (C) 2001 Yasna.com. All rights reserved.
 *
 * ===================================================================
 * The Apache Software License, Version 1.1
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        Yasna.com (http://www.yasna.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Yazd" and "Yasna.com" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact yazd@yasna.com.
 *
 * 5. Products derived from this software may not be called "Yazd",
 *    nor may "Yazd" appear in their name, without prior written
 *    permission of Yasna.com.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL YASNA.COM OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of Yasna.com. For more information
 * on Yasna.com, please see <http://www.yasna.com>.
 */

/**
 * Copyright (C) 2000 CoolServlets.com. All rights reserved.
 *
 * ===================================================================
 * The Apache Software License, Version 1.1
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        CoolServlets.com (http://www.coolservlets.com)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The names "Jive" and "CoolServlets.com" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please
 *    contact webmaster@coolservlets.com.
 *
 * 5. Products derived from this software may not be called "Jive",
 *    nor may "Jive" appear in their name, without prior written
 *    permission of CoolServlets.com.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL COOLSERVLETS.COM OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CoolServlets.com. For more information
 * on CoolServlets.com, please see <http://www.coolservlets.com>.
 */

package com.Yasna.forum.database;

import java.util.*;
//JDK1.1// import com.sun.java.util.collections.*;
import java.sql.*;

import com.Yasna.util.*;
import com.Yasna.forum.*;

/**
 * Database implementation to iterate through threads in a forum.
 * At the moment, threads are always ordered by creationDate. Obviously,
 * various skins will probably want different iterators. The solution will
 * probably be to pass in various flags to forum.iterator() in order to get
 * different types of iterators. That will require small changes to this
 * class.
 */
public class DbForumIterator implements Iterator, ListIterator {

    /** DATABASE QUERIES **/
    private static final String GET_THREADS =
        "SELECT threadID, creationDate FROM yazdThread WHERE forumID=? " +
        "ORDER BY creationDate DESC";

    //A reference to the forum object that the iterator was created from.
    //This is used to load thread objects.
    private DbForum forum;
    //maintain an array of thread ids to iterator through.
    private int [] threads;
    //points to the current thread id that the user has iterated to.
    private int currentIndex = -1;

    DbForumFactory factory;

    public DbForumIterator(DbForum forum, DbForumFactory factory)
    {
        this.forum = forum;
        this.factory = factory;
        //We don't know how many results will be returned, so store them
        //in an ArrayList.
        ArrayList tempThreads = new ArrayList();
        Connection con = null;
        PreparedStatement pstmt = null;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(GET_THREADS);
            pstmt.setInt(1,forum.getID());
            ResultSet rs = pstmt.executeQuery();

            while (rs.next()) {
                tempThreads.add(new Integer(rs.getInt("threadID")));
            }
        }
        catch( SQLException sqle ) {
            System.err.println("Error in DbThreadIterator:constructor()-" + sqle);
        }
        finally {
            try {  pstmt.close(); }
            catch (Exception e) { e.printStackTrace(); }
            try {  con.close();   }
            catch (Exception e) { e.printStackTrace(); }
        }
        threads = new int[tempThreads.size()];
        for (int i=0; i<threads.length; i++) {
            threads[i] = ((Integer)tempThreads.get(i)).intValue();
        }
    }

    public DbForumIterator(DbForum forum, DbForumFactory factory,
            int startIndex, int numResults)
    {
        this.forum = forum;
        this.factory = factory;

        int[] tempThreads = new int[numResults];
        //It's very possible that there might not be as many threads to get
        //as we requested. Therefore, we keep track of how many threads we
        //get by keeping a threadCount.
        int threadCount = 0;

        Connection con = null;
        PreparedStatement pstmt = null;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(GET_THREADS);
            pstmt.setInt(1,forum.getID());
            ResultSet rs = pstmt.executeQuery();

            //Move to start of index
            for (int i=0; i<startIndex; i++) {
                rs.next();
            }
            //Now read in desired number of results
            for (int i=0; i<numResults; i++) {
                if (rs.next()) {
                    tempThreads[threadCount] = rs.getInt("threadID");
                    threadCount++;
                }
                else {
                    break;
                }
            }
        }
        catch( SQLException sqle ) {
            System.err.println("Error in DbThreadIterator:constructor()-" + sqle);
        }
        finally {
            try {  pstmt.close(); }
            catch (Exception e) { e.printStackTrace(); }
            try {  con.close();   }
            catch (Exception e) { e.printStackTrace(); }
        }
        threads = new int[threadCount];
        for (int i=0; i<threadCount; i++) {
            threads[i] = tempThreads[i];
        }
    }

    public void add(Object o) throws UnsupportedOperationException {
        throw new UnsupportedOperationException();
    }

    public boolean hasNext() {
        return (currentIndex+1 < threads.length);
    }

    public boolean hasPrevious() {
        return (currentIndex > 0);
    }

    public Object next() throws java.util.NoSuchElementException {
        ForumThread thread = null;
        currentIndex++;
        if (currentIndex >= threads.length) {
            currentIndex--;
            throw new java.util.NoSuchElementException();
        }
        try {
            thread = forum.getThread(threads[currentIndex]);
        }
        catch (ForumThreadNotFoundException tnfe) {
            System.err.println(tnfe);
        }
        return thread;
    }

    public int nextIndex() {
        return currentIndex+1;
    }

    public Object previous() throws java.util.NoSuchElementException {
        ForumThread thread = null;
        currentIndex--;
        if (currentIndex < 0) {
            currentIndex++;
            throw new java.util.NoSuchElementException();
        }
        try {
            thread = forum.getThread(threads[currentIndex]);
        }
        catch (ForumThreadNotFoundException tnfe) {
            System.err.println(tnfe);
        }
        return thread;
    }

    public int previousIndex() {
        return currentIndex-1;
    }

    public void remove() throws UnsupportedOperationException {
        throw new UnsupportedOperationException();
    }

    public void set(Object o) throws UnsupportedOperationException {
        throw new UnsupportedOperationException();
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
激情五月婷婷综合| 亚洲一区二区精品久久av| 韩国三级中文字幕hd久久精品| 欧美日韩午夜在线视频| 日韩精品成人一区二区在线| 91精品国产综合久久国产大片| 久热成人在线视频| 欧美精品一区二区三区在线 | 久久精品男人天堂av| 国产米奇在线777精品观看| 国产欧美日韩不卡免费| 色综合天天综合网国产成人综合天 | 国产精品乱子久久久久| 91在线观看美女| 亚洲国产综合在线| 欧美tk—视频vk| 99在线精品一区二区三区| 一区二区三区不卡在线观看 | 国产精品视频看| 在线观看不卡视频| 另类中文字幕网| 亚洲日韩欧美一区二区在线| 7777精品伊人久久久大香线蕉超级流畅| 久久国产精品色婷婷| 国产精品乱码一区二三区小蝌蚪| 在线亚洲精品福利网址导航| 久久er精品视频| 亚洲日本中文字幕区| 日韩欧美不卡在线观看视频| 99视频精品在线| 免费xxxx性欧美18vr| 国产精品久久久久久久久晋中| 欧美精品v国产精品v日韩精品 | 蜜桃一区二区三区四区| 国产精品美女www爽爽爽| 6080日韩午夜伦伦午夜伦| 国产很黄免费观看久久| 日韩在线一区二区| 国产精品久久久久久亚洲伦| 欧美一区日本一区韩国一区| 99国产精品久久久久| 麻豆国产精品777777在线| 一区二区三区免费观看| 久久久国际精品| 日韩欧美精品三级| 精品视频免费在线| 色呦呦一区二区三区| 国产二区国产一区在线观看 | 狠狠色丁香久久婷婷综| 亚洲一二三四在线观看| 国产精品毛片大码女人| 久久中文娱乐网| 日韩一级免费观看| 在线观看亚洲成人| 99国产精品久| 国产91富婆露脸刺激对白| 久久疯狂做爰流白浆xx| 亚洲高清中文字幕| 国产精品久久久久久久浪潮网站| 日韩欧美黄色影院| 欧美一区二区三区啪啪| 欧美日韩黄色一区二区| 91网页版在线| aaa欧美色吧激情视频| 国产一区二区导航在线播放| 美女视频网站黄色亚洲| 日韩精品每日更新| 日韩不卡在线观看日韩不卡视频| 亚洲国产日韩综合久久精品| 亚洲私人黄色宅男| 亚洲欧美色一区| 亚洲色图在线播放| 亚洲精品自拍动漫在线| 亚洲你懂的在线视频| 亚洲欧美一区二区不卡| 亚洲久草在线视频| 亚洲图片欧美综合| 午夜精品久久久久久久| 午夜成人免费视频| 男男视频亚洲欧美| 老司机一区二区| 韩国女主播一区| 高清国产午夜精品久久久久久| 国产 欧美在线| 波多野结衣中文一区| 99久久久无码国产精品| 99久久99久久免费精品蜜臀| 97精品电影院| 欧美三区在线视频| 777午夜精品免费视频| 91精品国产色综合久久不卡蜜臀| 欧美xxxx在线观看| 亚洲国产精品黑人久久久| 国产精品拍天天在线| 中文字幕日韩av资源站| 亚洲成a人片在线不卡一二三区| 午夜精品福利在线| 久久国产夜色精品鲁鲁99| 国产精品一区二区x88av| 99这里只有久久精品视频| 欧美日韩国产精选| 国产亚洲精品aa午夜观看| 亚洲视频香蕉人妖| 免费在线观看日韩欧美| 国产高清久久久久| 欧美性猛片aaaaaaa做受| 欧美一区二区黄色| 国产精品网站一区| 亚洲va欧美va人人爽| 国产又粗又猛又爽又黄91精品| 成年人国产精品| 欧美福利视频一区| 国产欧美va欧美不卡在线| 亚洲一区二区在线播放相泽| 久久99最新地址| 成人97人人超碰人人99| 欧美精品乱码久久久久久 | 日本道色综合久久| 日韩亚洲欧美成人一区| 日韩毛片在线免费观看| 全部av―极品视觉盛宴亚洲| 高清beeg欧美| 欧美精品1区2区3区| 国产人妖乱国产精品人妖| 亚洲一区二区三区四区在线观看 | av毛片久久久久**hd| 6080午夜不卡| 亚洲三级电影网站| 国产成人综合视频| 91.xcao| 亚洲日本一区二区三区| 久久精品国产成人一区二区三区| 91片黄在线观看| 久久久www免费人成精品| 天天综合天天做天天综合| 91在线国产观看| 国产性色一区二区| 免费看欧美美女黄的网站| 色噜噜狠狠成人中文综合| 国产无一区二区| 久久国产婷婷国产香蕉| 欧美美女一区二区| 亚洲蜜桃精久久久久久久| 国产成人av一区| 亚洲精品一区二区三区在线观看 | 亚洲色大成网站www久久九九| 极品少妇xxxx精品少妇| 欧美艳星brazzers| 亚洲码国产岛国毛片在线| 粉嫩欧美一区二区三区高清影视 | 国产精品不卡在线| 国产精品1区2区3区在线观看| 欧美一区二区三区四区视频| 亚洲自拍偷拍网站| 日本韩国欧美在线| 中文字幕综合网| 99视频一区二区| 中文字幕一区二区三区不卡在线| 国产a视频精品免费观看| 精品国偷自产国产一区| 麻豆91精品视频| 日韩女优毛片在线| 精品一区二区三区影院在线午夜| 欧美电影在线免费观看| 五月激情六月综合| 欧美精品色一区二区三区| 亚洲成精国产精品女| 欧美日韩免费观看一区三区| 亚洲国产aⅴ成人精品无吗| 欧美三级日本三级少妇99| 亚洲国产欧美在线| 欧美福利视频导航| 蜜臀av在线播放一区二区三区| 日韩亚洲欧美中文三级| 九色综合狠狠综合久久| 国产亚洲午夜高清国产拍精品| 国产成人h网站| 一色屋精品亚洲香蕉网站| 91视视频在线观看入口直接观看www | 日韩欧美资源站| 精品伊人久久久久7777人| 久久综合资源网| 成人午夜av在线| 亚洲丝袜自拍清纯另类| 欧美日韩一区成人| 久久99精品久久只有精品| 国产亚洲综合色| 91视频xxxx| 五月激情综合婷婷| 精品国产乱码久久久久久图片| 国产高清成人在线| 一区二区三区日本| 91精品国产色综合久久不卡蜜臀| 精品一区二区三区久久| 国产精品灌醉下药二区| 欧美日本一道本在线视频| 国内精品久久久久影院一蜜桃| 1区2区3区精品视频| 欧美精品高清视频| 国产精品白丝jk黑袜喷水|