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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? dbthreaditerator.java

?? 這是學(xué)習(xí)Java必須讀懂兩套源代碼
?? JAVA
字號(hào):
/**
 * 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.Iterator;
import java.sql.*;

import com.Yasna.forum.*;

/**
 * Database implementation of Iterator for ForumMesages in a ForumThread.
 */
public class DbThreadIterator implements Iterator {

    /** DATABASE QUERIES **/
    private static final String MESSAGE_COUNT =
        "SELECT count(messageID) FROM yazdMessage WHERE threadID=?";
    private static final String GET_MESSAGES =
        "SELECT messageID, creationDate FROM yazdMessage WHERE threadID=? " +
        "ORDER BY creationDate ASC";

    private ForumThread thread;
    private int [] messages;
    private int currentIndex = -1;

    private ForumMessage nextMessage = null;

    protected DbThreadIterator(ForumThread thread) {
        this.thread = thread;
        Connection con = null;
        PreparedStatement pstmt = null;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(MESSAGE_COUNT);
            pstmt.setInt(1, thread.getID());
            ResultSet rs = pstmt.executeQuery();
            rs.next();
            messages = new int[rs.getInt(1)];
            pstmt.close();

            pstmt = con.prepareStatement(GET_MESSAGES);
            pstmt.setInt(1, thread.getID());
            rs = pstmt.executeQuery();
            for (int i=0; i<messages.length; i++) {
                rs.next();
                messages[i] = rs.getInt(1);
            }
        }
        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(); }
        }
    }

    protected DbThreadIterator(ForumThread thread, int startIndex, int numResults)
    {
        this.thread = thread;

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

        Connection con = null;
        PreparedStatement pstmt = null;

        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(GET_MESSAGES);
            pstmt.setInt(1, thread.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()) {
                    tempMessages[messageCount] = rs.getInt("messageID");
                    messageCount++;
                }
                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(); }
        }
        messages = new int[messageCount];
        for (int i=0; i<messageCount; i++) {
            messages[i] = tempMessages[i];
        }
    }

    /**
     * Returns true if there are more messages in the list.
     *
     * @return true if the iterator has more elements.
     */
    public boolean hasNext() {
        //If we are at the end of the list, there can't be any more messages
        //to iterate through.
        if (currentIndex+1 >= messages.length) {
            return false;
        }
        return true;

        /*
        BUG: this code calls getNextMessage() which will increment the
        currentIndex variable as a result of calling this message!

        //Otherwise, see if nextMessage is null. If so, try to load the next
        //message to make sure it exists.

        // hmm, do we really need to do this here? i think it should be left up
        // to the next() method -- BL

        if (nextMessage == null) {
            nextMessage = getNextMessage();
            if (nextMessage == null) {
                return false;
            }
        }
        return true;
        */
    }

    /**
     * Returns the next message in the interation.
     *
     * @return the next message in the interation.
     * @throws NoSuchElementException if the iteration has no more elements.
     */
    public Object next() throws java.util.NoSuchElementException {
        ForumMessage message = null;
        if (nextMessage != null) {
            message = nextMessage;
            nextMessage = null;
        }
        else {
            message = getNextMessage();
            if (message == null) {
                throw new java.util.NoSuchElementException();
            }
        }
        return message;
    }

    /**
     * Not supported for security reasons. Use the deleteMessage method in the
     * ForumThread class instead.
     *
     * @see ForumThread#deleteMessage(ForumMessage)
     */
    public void remove() throws UnsupportedOperationException {
        throw new UnsupportedOperationException();
    }

    /**
     * Returns the next available message, or null if there are no more
     * messages to return.
     */
    private ForumMessage getNextMessage() {
        while (currentIndex+1 < messages.length) {
            currentIndex++;
            try {
                ForumMessage message = thread.getMessage(messages[currentIndex]);
                return message;
            }
            catch (ForumMessageNotFoundException mnfe) { }
        }
        return null;
    }
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美美女黄视频| 日韩一区二区三区精品视频| 国产精品综合视频| 激情综合亚洲精品| 国产一区二区免费在线| 99热在这里有精品免费| 欧美三级日韩在线| 欧美一区午夜精品| 国产精品传媒视频| 日韩高清在线电影| 国产一区二区三区四区五区入口| 成人一二三区视频| 在线成人高清不卡| 亚洲日本成人在线观看| 久久99国产精品免费网站| 国产精品99久久久久久久女警| 日本大香伊一区二区三区| 欧美无砖专区一中文字| 中文字幕第一页久久| 久久99精品国产麻豆婷婷| 91丨porny丨蝌蚪视频| 久久综合色天天久久综合图片| 亚洲精品免费一二三区| 国产久卡久卡久卡久卡视频精品| 欧美调教femdomvk| 日本一区二区三级电影在线观看| 日韩电影免费在线看| 色欲综合视频天天天| 久久久久久久国产精品影院| 丝袜美腿一区二区三区| 欧美精品三级在线观看| 天天射综合影视| 91精品国产综合久久久久| 日韩精品电影一区亚洲| 日韩欧美国产系列| 国产麻豆欧美日韩一区| 欧美国产一区视频在线观看| 成人黄动漫网站免费app| 国产精品丝袜黑色高跟| 97精品久久久午夜一区二区三区| 日韩一区中文字幕| 欧美亚洲动漫精品| 蜜臀久久99精品久久久久久9| 日韩亚洲欧美中文三级| 经典三级在线一区| 国产精品麻豆视频| 色中色一区二区| 天堂蜜桃一区二区三区| 欧美成人r级一区二区三区| 国产精品综合一区二区三区| 国产精品情趣视频| 色av成人天堂桃色av| 偷拍自拍另类欧美| 久久久综合精品| 99这里只有久久精品视频| 亚洲精品久久久蜜桃| 欧美男男青年gay1069videost| 久久精品国产亚洲高清剧情介绍| 久久综合成人精品亚洲另类欧美| 成人性生交大合| 亚洲国产另类av| 久久免费视频色| 91国产免费观看| 国内成+人亚洲+欧美+综合在线| 国产精品久久久久久一区二区三区 | 国产精品久久久久久妇女6080 | 国产精品99久久久| 一区av在线播放| 精品久久久久久亚洲综合网| 成人18视频日本| 奇米综合一区二区三区精品视频| 久久久久久久久久久久久久久99 | 国产a视频精品免费观看| 亚洲国产日日夜夜| 久久精品亚洲乱码伦伦中文| 色婷婷精品久久二区二区蜜臀av| 久久成人免费日本黄色| 亚洲精品中文字幕乱码三区| 久久综合色鬼综合色| 欧洲精品一区二区三区在线观看| 精品一区二区免费| 亚洲国产精品久久人人爱蜜臀| 国产清纯在线一区二区www| 欧美日本乱大交xxxxx| 丁香婷婷综合色啪| 极品少妇一区二区三区精品视频 | 国产精品久久久久久久久晋中| 日韩精品一区二区三区老鸭窝 | 一区二区三区在线免费观看| 久久男人中文字幕资源站| 91精选在线观看| 色噜噜狠狠成人网p站| 国产成人午夜视频| 精品一区二区三区不卡| 日韩avvvv在线播放| 亚洲一区二区3| 综合欧美一区二区三区| 国产日韩亚洲欧美综合| 日韩欧美aaaaaa| 欧美日韩情趣电影| 欧美亚洲免费在线一区| 色综合天天综合网国产成人综合天| 国产在线不卡一区| 久久电影网站中文字幕| 精品在线你懂的| 狠狠色丁香久久婷婷综| 久久激情五月婷婷| 精品亚洲免费视频| 看电视剧不卡顿的网站| 奇米在线7777在线精品| 免费在线看一区| 久久成人av少妇免费| 美女爽到高潮91| 激情成人综合网| 国产乱对白刺激视频不卡| 国产精品1区二区.| 国产精品综合二区| 成人精品小蝌蚪| av午夜一区麻豆| 欧美在线高清视频| 欧美在线观看视频一区二区| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| www.视频一区| 欧美亚洲禁片免费| 日韩午夜在线播放| 久久九九全国免费| 亚洲欧美中日韩| 夜夜嗨av一区二区三区四季av| 亚洲gay无套男同| 美女视频黄 久久| 国产不卡一区视频| 91首页免费视频| 91官网在线观看| 欧美一区二区三区思思人| 久久婷婷综合激情| 国产精品久久久久久久久快鸭| 亚洲老妇xxxxxx| 日韩二区在线观看| 粉嫩av一区二区三区| 在线一区二区视频| 91精品婷婷国产综合久久竹菊| 26uuu另类欧美| 亚洲三级在线播放| 亚洲成a人在线观看| 久久99精品久久久久| 91麻豆高清视频| 欧美一级高清片| 国产精品短视频| 青青国产91久久久久久| 成人丝袜视频网| 欧美一级日韩免费不卡| 亚洲视频小说图片| 久久av中文字幕片| 色拍拍在线精品视频8848| 91精品在线免费观看| 国产精品理论片在线观看| 亚洲综合精品久久| 国产91精品一区二区| 91精品免费观看| 亚洲欧洲韩国日本视频| 久久国产精品99久久久久久老狼 | 国产成人综合在线播放| 欧美日韩在线直播| 国产精品久久看| 精品一区二区精品| 欧美日韩精品专区| 亚洲欧洲精品一区二区三区不卡| 久久国产免费看| 欧美精品成人一区二区三区四区| 日本一区二区成人在线| 精品在线播放免费| 91精品国产色综合久久ai换脸| 国产精品国模大尺度视频| 国产制服丝袜一区| 91精品免费观看| 亚洲永久精品国产| 国产69精品一区二区亚洲孕妇| 日韩精品一区二区在线| 香蕉影视欧美成人| 在线免费一区三区| 一区视频在线播放| 国产成人精品午夜视频免费| 日韩欧美中文一区二区| 日韩精品成人一区二区三区 | 4438x亚洲最大成人网| 一区二区成人在线观看| 97国产精品videossex| 久久久久久久精| 国产精品一线二线三线| 精品国产区一区| 免费成人美女在线观看| 欧美日韩高清在线| 五月天一区二区三区| 在线观看视频一区二区 | 国产精品丝袜91| 丰满亚洲少妇av| 日本一区二区视频在线观看| 国产美女精品在线| 欧美激情一区二区三区全黄| 成人免费看视频|