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

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

?? quarter.java

?? java圖形資料
?? JAVA
字號:
/* ===========================================================
 * JFreeChart : a free chart library for the Java(tm) platform
 * ===========================================================
 *
 * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
 *
 * Project Info:  http://www.jfree.org/jfreechart/index.html
 *
 * This library is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU Lesser General Public License as published by 
 * the Free Software Foundation; either version 2.1 of the License, or 
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
 * USA.  
 *
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
 * in the United States and other countries.]
 *
 * ------------
 * Quarter.java
 * ------------
 * (C) Copyright 2001-2005, by Object Refinery Limited.
 *
 * Original Author:  David Gilbert (for Object Refinery Limited);
 * Contributor(s):   -;
 *
 * $Id: Quarter.java,v 1.6.2.1 2005/10/25 21:35:24 mungady Exp $
 *
 * Changes
 * -------
 * 11-Oct-2001 : Version 1 (DG);
 * 18-Dec-2001 : Changed order of parameters in constructor (DG);
 * 19-Dec-2001 : Added a new constructor as suggested by Paul English (DG);
 * 29-Jan-2002 : Added a new method parseQuarter(String) (DG);
 * 14-Feb-2002 : Fixed bug in Quarter(Date) constructor (DG);
 * 26-Feb-2002 : Changed getStart(), getMiddle() and getEnd() methods to 
 *               evaluate with reference to a particular time zone (DG);
 * 19-Mar-2002 : Changed API for TimePeriod classes (DG);
 * 24-Jun-2002 : Removed main method (just test code) (DG);
 * 10-Sep-2002 : Added getSerialIndex() method (DG);
 * 07-Oct-2002 : Fixed errors reported by Checkstyle (DG);
 * 10-Jan-2003 : Changed base class and method names (DG);
 * 13-Mar-2003 : Moved to com.jrefinery.data.time package, and implemented 
 *               Serializable (DG);
 * 21-Oct-2003 : Added hashCode() method (DG);
 *
 */

package org.jfree.data.time;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

import org.jfree.date.MonthConstants;
import org.jfree.date.SerialDate;

/**
 * Defines a quarter (in a given year).  The range supported is Q1 1900 to 
 * Q4 9999.  This class is immutable, which is a requirement for all 
 * {@link RegularTimePeriod} subclasses.
 */
public class Quarter extends RegularTimePeriod implements Serializable {

    /** For serialization. */
    private static final long serialVersionUID = 3810061714380888671L;
    
    /** Constant for quarter 1. */
    public static final int FIRST_QUARTER = 1;

    /** Constant for quarter 4. */
    public static final int LAST_QUARTER = 4;

    /** The first month in each quarter. */
    public static final int[] FIRST_MONTH_IN_QUARTER = {
        0, MonthConstants.JANUARY, MonthConstants.APRIL, MonthConstants.JULY, 
        MonthConstants.OCTOBER
    };

    /** The last month in each quarter. */
    public static final int[] LAST_MONTH_IN_QUARTER = {
        0, MonthConstants.MARCH, MonthConstants.JUNE, MonthConstants.SEPTEMBER, 
        MonthConstants.DECEMBER
    };

    /** The year in which the quarter falls. */
    private Year year;

    /** The quarter (1-4). */
    private int quarter;

    /**
     * Constructs a new Quarter, based on the current system date/time.
     */
    public Quarter() {
        this(new Date());
    }

    /**
     * Constructs a new quarter.
     *
     * @param year  the year (1900 to 9999).
     * @param quarter  the quarter (1 to 4).
     */
    public Quarter(int quarter, int year) {
        this(quarter, new Year(year));
    }

    /**
     * Constructs a new quarter.
     *
     * @param quarter  the quarter (1 to 4).
     * @param year  the year (1900 to 9999).
     */
    public Quarter(int quarter, Year year) {
        if ((quarter < FIRST_QUARTER) && (quarter > LAST_QUARTER)) {
            throw new IllegalArgumentException("Quarter outside valid range.");
        }
        this.year = year;
        this.quarter = quarter;
    }

    /**
     * Constructs a new Quarter, based on a date/time and the default time zone.
     *
     * @param time  the date/time.
     */
    public Quarter(Date time) {
        this(time, RegularTimePeriod.DEFAULT_TIME_ZONE);
    }

    /**
     * Constructs a Quarter, based on a date/time and time zone.
     *
     * @param time  the date/time.
     * @param zone  the zone.
     */
    public Quarter(Date time, TimeZone zone) {

        Calendar calendar = Calendar.getInstance(zone);
        calendar.setTime(time);
        int month = calendar.get(Calendar.MONTH) + 1;
        this.quarter = SerialDate.monthCodeToQuarter(month);
        this.year = new Year(calendar.get(Calendar.YEAR));

    }

    /**
     * Returns the quarter.
     *
     * @return The quarter.
     */
    public int getQuarter() {
        return this.quarter;
    }

    /**
     * Returns the year.
     *
     * @return The year.
     */
    public Year getYear() {
        return this.year;
    }

    /**
     * Returns the quarter preceding this one.
     *
     * @return The quarter preceding this one (or null if this is Q1 1900).
     */
    public RegularTimePeriod previous() {

        Quarter result;
        if (this.quarter > FIRST_QUARTER) {
            result = new Quarter(this.quarter - 1, this.year);
        }
        else {
            Year prevYear = (Year) this.year.previous();
            if (prevYear != null) {
                result = new Quarter(LAST_QUARTER, prevYear);
            }
            else {
                result = null;
            }
        }
        return result;

    }

    /**
     * Returns the quarter following this one.
     *
     * @return The quarter following this one (or null if this is Q4 9999).
     */
    public RegularTimePeriod next() {

        Quarter result;
        if (this.quarter < LAST_QUARTER) {
            result = new Quarter(this.quarter + 1, this.year);
        }
        else {
            Year nextYear = (Year) this.year.next();
            if (nextYear != null) {
                result = new Quarter(FIRST_QUARTER, nextYear);
            }
            else {
                result = null;
            }
        }
        return result;

    }

    /**
     * Returns a serial index number for the quarter.
     *
     * @return The serial index number.
     */
    public long getSerialIndex() {
        return this.year.getYear() * 4L + this.quarter;
    }

    /**
     * Tests the equality of this Quarter object to an arbitrary object.
     * Returns true if the target is a Quarter instance representing the same
     * quarter as this object.  In all other cases, returns false.
     *
     * @param obj  the object.
     *
     * @return <code>true</code> if quarter and year of this and the object are
     *         the same.
     */
    public boolean equals(Object obj) {

        if (obj != null) {
            if (obj instanceof Quarter) {
                Quarter target = (Quarter) obj;
                return (
                    (this.quarter == target.getQuarter()) 
                    && (this.year.equals(target.getYear()))
                );
            }
            else {
                return false;
            }
        }
        else {
            return false;
        }

    }

    /**
     * Returns a hash code for this object instance.  The approach described by
     * Joshua Bloch in "Effective Java" has been used here:
     * <p>
     * <code>http://developer.java.sun.com/developer/Books/effectivejava
     * /Chapter3.pdf</code>
     * 
     * @return A hash code.
     */
    public int hashCode() {
        int result = 17;
        result = 37 * result + this.quarter;
        result = 37 * result + this.year.hashCode();
        return result;
    }

    /**
     * Returns an integer indicating the order of this Quarter object relative
     * to the specified object:
     *
     * negative == before, zero == same, positive == after.
     *
     * @param o1  the object to compare
     *
     * @return negative == before, zero == same, positive == after.
     */
    public int compareTo(Object o1) {

        int result;

        // CASE 1 : Comparing to another Quarter object
        // --------------------------------------------
        if (o1 instanceof Quarter) {
            Quarter q = (Quarter) o1;
            result = this.year.getYear() - q.getYear().getYear();
            if (result == 0) {
                result = this.quarter - q.getQuarter();
            }
        }

        // CASE 2 : Comparing to another TimePeriod object
        // -----------------------------------------------
        else if (o1 instanceof RegularTimePeriod) {
            // more difficult case - evaluate later...
            result = 0;
        }

        // CASE 3 : Comparing to a non-TimePeriod object
        // ---------------------------------------------
        else {
            // consider time periods to be ordered after general objects
            result = 1;
        }

        return result;

    }

    /**
     * Returns a string representing the quarter (e.g. "Q1/2002").
     *
     * @return A string representing the quarter.
     */
    public String toString() {
        return "Q" + this.quarter + "/" + this.year;
    }

    /**
     * Returns the first millisecond in the Quarter, evaluated using the
     * supplied calendar (which determines the time zone).
     *
     * @param calendar  the calendar.
     *
     * @return The first millisecond in the Quarter.
     */
    public long getFirstMillisecond(Calendar calendar) {

        int month = Quarter.FIRST_MONTH_IN_QUARTER[this.quarter];
        Day first = new Day(1, month, this.year.getYear());
        return first.getFirstMillisecond(calendar);

    }

    /**
     * Returns the last millisecond of the Quarter, evaluated using the
     * supplied calendar (which determines the time zone).
     *
     * @param calendar  the calendar.
     *
     * @return The last millisecond of the Quarter.
     */
    public long getLastMillisecond(Calendar calendar) {

        int month = Quarter.LAST_MONTH_IN_QUARTER[this.quarter];
        int eom = SerialDate.lastDayOfMonth(month, this.year.getYear());
        Day last = new Day(eom, month, this.year.getYear());
        return last.getLastMillisecond(calendar);

    }

    /**
     * Parses the string argument as a quarter.
     * <P>
     * This method should accept the following formats: "YYYY-QN" and "QN-YYYY",
     * where the "-" can be a space, a forward-slash (/), comma or a dash (-).
     * @param s A string representing the quarter.
     *
     * @return The quarter.
     */
    public static Quarter parseQuarter(String s) {

        // find the Q and the integer following it (remove both from the
        // string)...
        int i = s.indexOf("Q");
        if (i == -1) {
            throw new TimePeriodFormatException("Missing Q.");
        }

        if (i == s.length() - 1) {
            throw new TimePeriodFormatException("Q found at end of string.");
        }

        String qstr = s.substring(i + 1, i + 2);
        int quarter = Integer.parseInt(qstr);
        String remaining = s.substring(0, i) + s.substring(i + 2, s.length());

        // replace any / , or - with a space
        remaining = remaining.replace('/', ' ');
        remaining = remaining.replace(',', ' ');
        remaining = remaining.replace('-', ' ');

        // parse the string...
        Year year = Year.parseYear(remaining.trim());
        Quarter result = new Quarter(quarter, year);
        return result;

    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲人成精品久久久久| 亚洲精品在线免费观看视频| 国产精品免费人成网站| 老司机精品视频导航| 欧美日韩国产一级片| 亚洲精选免费视频| 99精品国产99久久久久久白柏| 精品1区2区在线观看| 精品亚洲成av人在线观看| 日韩三级中文字幕| 日本不卡一区二区三区| 日韩一区二区精品在线观看| 香蕉加勒比综合久久| 欧美日本乱大交xxxxx| 一区二区三区免费观看| 99综合电影在线视频| 亚洲欧美一区二区视频| 岛国精品在线观看| 国产精品护士白丝一区av| 成+人+亚洲+综合天堂| 国产精品久久久久一区二区三区 | 午夜私人影院久久久久| 欧美亚洲尤物久久| 亚洲综合一区二区三区| 欧美性色综合网| 婷婷综合在线观看| 欧美一区二区成人6969| 久久se这里有精品| 国产三级一区二区三区| 成人性色生活片| 亚洲色图欧美在线| 欧美少妇一区二区| 免费在线看一区| 久久综合久久综合九色| 国产成人av电影在线观看| 国产精品情趣视频| 91色视频在线| 亚洲愉拍自拍另类高清精品| 欧美欧美欧美欧美| 久久狠狠亚洲综合| 中文字幕不卡的av| 97久久超碰国产精品| 亚洲午夜私人影院| 日韩欧美高清一区| 国产白丝精品91爽爽久久| 亚洲日本中文字幕区| 欧美午夜在线观看| 久久精品国产**网站演员| 久久精品夜色噜噜亚洲aⅴ| 99精品欧美一区二区蜜桃免费 | 秋霞影院一区二区| 久久久综合激的五月天| 99久久er热在这里只有精品66| 一区二区视频在线| 日韩欧美国产综合| 波多野结衣精品在线| 亚洲www啪成人一区二区麻豆| 欧美白人最猛性xxxxx69交| 国产98色在线|日韩| 亚洲最大成人网4388xx| 日韩精品一区二区三区四区视频| 国产成人亚洲精品狼色在线 | 亚洲欧美日韩国产手机在线| 欧美日韩中文另类| 国产一区二区不卡在线| 亚洲免费色视频| 日韩免费成人网| 99re热这里只有精品免费视频 | 亚洲色图视频网| 欧美电影一区二区| 丁香一区二区三区| 午夜伊人狠狠久久| 国产无遮挡一区二区三区毛片日本| 91麻豆产精品久久久久久| 日本成人在线不卡视频| 日韩理论电影院| 欧美电影精品一区二区| 一本久久综合亚洲鲁鲁五月天 | 国产精品99久| 亚洲风情在线资源站| 久久久一区二区三区捆绑**| 欧美午夜精品理论片a级按摩| 国产河南妇女毛片精品久久久 | 天天操天天干天天综合网| 欧美高清在线一区二区| 欧美日本在线播放| 91免费看`日韩一区二区| 看国产成人h片视频| 一区二区在线观看不卡| 国产欧美精品一区二区三区四区| 欧美日韩精品一区二区三区四区 | 一区二区三区91| 国产亚洲欧美日韩在线一区| 欧美精品久久一区| 99国产精品一区| 国产一区二区三区最好精华液| 性欧美大战久久久久久久久| 中文字幕亚洲成人| 久久综合久久综合久久| 在线综合+亚洲+欧美中文字幕| 色综合久久久久综合99| 国产电影一区在线| 理论片日本一区| 亚洲成人免费av| 亚洲精品国产第一综合99久久| 久久网站最新地址| 日韩欧美一卡二卡| 欧美日韩精品一区视频| 91国偷自产一区二区使用方法| 成人综合日日夜夜| 国产一区二区精品久久91| 久久精品999| 日本成人在线不卡视频| 亚洲福利一二三区| 洋洋成人永久网站入口| 综合激情成人伊人| 国产精品情趣视频| 国产精品视频一二三区| 久久久精品中文字幕麻豆发布| 日韩午夜av电影| 欧美一级片在线观看| 欧美日韩国产一级片| 在线观看91视频| 91国内精品野花午夜精品| 91麻豆精品秘密| 色国产综合视频| 日本韩国一区二区三区| 91在线免费播放| 91在线视频观看| 色一情一伦一子一伦一区| 99国产精品久久久久久久久久久 | 91在线精品一区二区| 成人黄色在线视频| 懂色av一区二区三区蜜臀| 国产成人在线观看免费网站| 国内外成人在线视频| 激情综合色综合久久综合| 激情文学综合网| 国产一区视频网站| 国产激情精品久久久第一区二区 | 高潮精品一区videoshd| 国产精品77777竹菊影视小说| 国产精品一区二区黑丝| 国产成人午夜片在线观看高清观看| 国产一区二区视频在线播放| 国产精品一二三四区| 国产成人综合在线观看| 不卡视频一二三四| av中文字幕亚洲| 91激情五月电影| 欧美美女一区二区三区| 欧美一区二区女人| 精品奇米国产一区二区三区| 精品av久久707| 日本一区二区电影| 亚洲日本青草视频在线怡红院| 亚洲美女少妇撒尿| 亚州成人在线电影| 美女网站一区二区| 国产成人免费视频网站| 99精品视频免费在线观看| 欧美色图一区二区三区| 91精品国产综合久久蜜臀| wwwwxxxxx欧美| 国产精品麻豆一区二区| 亚洲综合色噜噜狠狠| 丝袜亚洲精品中文字幕一区| 理论片日本一区| 成人三级伦理片| 欧美影视一区在线| 日韩欧美一区二区三区在线| 国产欧美一区二区精品性色超碰| 亚洲欧洲国产日韩| 日韩中文字幕亚洲一区二区va在线| 久久99国产乱子伦精品免费| 成人一级片网址| 欧美三片在线视频观看| 精品国产1区2区3区| 亚洲欧洲精品一区二区三区不卡| 亚洲成人午夜电影| 国产精品一区二区三区网站| 色婷婷狠狠综合| 日韩色在线观看| ...中文天堂在线一区| 亚洲成人你懂的| 国产成人鲁色资源国产91色综| 一本大道久久a久久精二百| 日韩午夜激情av| 最近日韩中文字幕| 免费日本视频一区| 波多野结衣欧美| 精品免费日韩av| 亚洲乱码国产乱码精品精小说| 捆绑调教一区二区三区| 色综合久久天天| 久久亚洲一区二区三区明星换脸 | 激情成人综合网| 一本在线高清不卡dvd| 精品国产污网站| 亚洲免费在线看|