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

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

?? quarter.java

?? jfreechart安裝程序和使用說明
?? JAVA
字號:
/* ===========================================================
 * JFreeChart : a free chart library for the Java(tm) platform
 * ===========================================================
 *
 * (C) Copyright 2000-2004, 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., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 
 * in the United States and other countries.]
 *
 * ------------
 * Quarter.java
 * ------------
 * (C) Copyright 2001-2003, by Object Refinery Limited.
 *
 * Original Author:  David Gilbert (for Object Refinery Limited);
 * Contributor(s):   -;
 *
 * $Id: Quarter.java,v 1.1 2004/08/31 15:34:17 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.SerialDate;

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

    /** 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, SerialDate.JANUARY, SerialDate.APRIL, SerialDate.JULY, SerialDate.OCTOBER};

    /** The last month in each quarter. */
    public static final int[] LAST_MONTH_IN_QUARTER 
        = {0, SerialDate.MARCH, SerialDate.JUNE, SerialDate.SEPTEMBER, SerialDate.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(final int quarter, final 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(final int quarter, final Year year) {

        if ((quarter < FIRST_QUARTER) && (quarter > LAST_QUARTER)) {
            throw new IllegalArgumentException("Quarter(int, Year): 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(final 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(final Date time, final TimeZone zone) {

        final Calendar calendar = Calendar.getInstance(zone);
        calendar.setTime(time);
        final 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() {

        final Quarter result;
        if (this.quarter > FIRST_QUARTER) {
            result = new Quarter(this.quarter - 1, this.year);
        }
        else {
            final 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() {

        final Quarter result;
        if (this.quarter < LAST_QUARTER) {
            result = new Quarter(this.quarter + 1, this.year);
        }
        else {
            final 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(final Object obj) {

        if (obj != null) {
            if (obj instanceof Quarter) {
                final 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.
     * <p>
     * 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(final Object o1) {

        int result;

        // CASE 1 : Comparing to another Quarter object
        // --------------------------------------------
        if (o1 instanceof Quarter) {
            final 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(final Calendar calendar) {

        final int month = Quarter.FIRST_MONTH_IN_QUARTER[this.quarter];
        final 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(final Calendar calendar) {

        final int month = Quarter.LAST_MONTH_IN_QUARTER[this.quarter];
        final int eom = SerialDate.lastDayOfMonth(month, this.year.getYear());
        final 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(final String s) {

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

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

        final String qstr = s.substring(i + 1, i + 2);
        final 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...
        final Year year = Year.parseYear(remaining.trim());
        final Quarter result = new Quarter(quarter, year);
        return result;

    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美午夜精品一区二区三区| 亚洲一区二三区| 欧洲精品一区二区| 成人av动漫网站| 成人开心网精品视频| 国产69精品久久99不卡| 国产精品一区二区三区乱码| 国产成人精品综合在线观看| 国产成人精品影院| 99久久777色| 一道本成人在线| 欧美这里有精品| 欧美精品丝袜中出| 欧美一区二区视频免费观看| 日韩精品专区在线影院重磅| 国产日韩影视精品| 1000部国产精品成人观看| 一区二区三区不卡视频| 亚洲精品大片www| 日韩成人一区二区三区在线观看| 日韩—二三区免费观看av| 美女mm1313爽爽久久久蜜臀| 粉嫩一区二区三区在线看| 色综合久久久久久久久久久| 欧美一级片免费看| 欧美国产综合一区二区| 一区二区三区免费网站| 日韩精品电影一区亚洲| 国产乱妇无码大片在线观看| 91免费视频大全| 337p亚洲精品色噜噜| 亚洲国产精品t66y| 亚洲一级电影视频| 国产成人鲁色资源国产91色综| 91久久精品一区二区二区| 日韩视频中午一区| 国产精品久久久久毛片软件| 午夜欧美在线一二页| 国产一区二区在线视频| 欧洲一区二区三区在线| 欧美精品一区二区三区久久久| 亚洲欧美日韩综合aⅴ视频| 奇米色777欧美一区二区| 91小视频在线观看| 2014亚洲片线观看视频免费| 夜夜精品视频一区二区| 国产99久久久国产精品免费看| 欧美日韩一区国产| 国产精品毛片无遮挡高清| 秋霞成人午夜伦在线观看| 99国产精品国产精品毛片| 精品久久久久久亚洲综合网| 亚洲激情第一区| 成人一级视频在线观看| 91精品国产手机| 一区二区三区精品视频在线| 国产精品77777| 日韩免费高清视频| 五月天欧美精品| 欧美三级韩国三级日本一级| 中文字幕精品一区| 国产大陆亚洲精品国产| 日韩欧美黄色影院| 亚洲综合精品久久| 91视频一区二区| 中文字幕一区二区三区在线不卡 | 国产精品123区| 欧美成人vr18sexvr| 天堂va蜜桃一区二区三区漫画版| 97成人超碰视| 亚洲视频一二区| 99精品久久免费看蜜臀剧情介绍| 国产日韩欧美综合在线| 国产自产高清不卡| 久久蜜桃一区二区| 国产一区二区日韩精品| 久久午夜电影网| 国产精品77777| 国产精品乱码一区二区三区软件 | 亚洲欧美另类图片小说| 9人人澡人人爽人人精品| 国产精品午夜在线观看| 激情五月激情综合网| 2024国产精品| 成人久久18免费网站麻豆| 亚洲裸体在线观看| 欧美最猛黑人xxxxx猛交| 亚洲一区二区综合| 日韩欧美亚洲另类制服综合在线| 午夜国产不卡在线观看视频| 7777精品久久久大香线蕉| 免费精品视频最新在线| 久久免费视频一区| 一本色道a无线码一区v| 亚洲国产中文字幕| 欧美丰满少妇xxxxx高潮对白 | 国产精品三级电影| 99久久99久久久精品齐齐| 亚洲综合一区二区三区| 欧美日韩综合一区| 亚洲一区视频在线观看视频| 欧美一级国产精品| 九九精品视频在线看| 久久精品一区八戒影视| 91色视频在线| 全国精品久久少妇| 国产精品欧美久久久久无广告| 欧美亚洲国产一区在线观看网站| 日本欧美韩国一区三区| 国产精品你懂的在线欣赏| 欧美三级视频在线观看 | 久久久午夜精品| 成人午夜电影网站| 亚洲成人av中文| 精品成人a区在线观看| 色综合久久综合网| 国产一区二区三区最好精华液| 亚洲蜜臀av乱码久久精品 | 黑人精品欧美一区二区蜜桃| 成人欧美一区二区三区白人| 欧美一级高清片| 日本韩国欧美一区| 国产成人一区二区精品非洲| 午夜精品免费在线| 国产精品成人一区二区三区夜夜夜| 欧美另类变人与禽xxxxx| 成人精品一区二区三区中文字幕| 日韩电影在线观看一区| 一区二区三区中文字幕精品精品| 精品国产人成亚洲区| 欧美性大战久久久| 成人激情图片网| 狠狠色综合日日| 日本不卡1234视频| 亚洲国产裸拍裸体视频在线观看乱了 | 欧美精品久久一区二区三区| 波多野结衣的一区二区三区| 国产综合成人久久大片91| 日精品一区二区三区| 一区二区三区欧美激情| 依依成人综合视频| 中文字幕人成不卡一区| 国产精品无遮挡| 久久色.com| ww亚洲ww在线观看国产| 久久亚洲精华国产精华液| 欧美一区二区在线免费播放| 欧美日韩在线三级| 欧美性高清videossexo| 欧美影院一区二区三区| 91丨九色丨黑人外教| 91一区一区三区| 一本大道久久精品懂色aⅴ| 91视频一区二区三区| 91视频观看免费| 精品视频资源站| 欧美日韩在线播放一区| 欧美怡红院视频| 91黄色激情网站| 欧洲av一区二区嗯嗯嗯啊| 欧美男女性生活在线直播观看| 欧美中文字幕不卡| 91麻豆精品国产自产在线观看一区| 欧美人牲a欧美精品| 欧美日韩一区二区三区不卡| 欧美日韩国产系列| 日韩精品一区二区三区老鸭窝| 精品久久一区二区| 国产欧美精品一区二区色综合朱莉| 国产日韩欧美麻豆| 日本一区二区免费在线 | 欧美群妇大交群中文字幕| 欧美日韩国产高清一区二区| 91麻豆精品91久久久久久清纯 | 国产精品久久免费看| 玉足女爽爽91| 日本三级亚洲精品| 国产一区在线观看麻豆| 成人免费三级在线| 欧美色精品天天在线观看视频| 91精品国产综合久久香蕉麻豆| 久久综合色8888| 日韩毛片一二三区| 热久久一区二区| 成a人片国产精品| 91精品国产入口在线| 久久久久久久国产精品影院| 亚洲免费观看高清完整版在线观看| 日日欢夜夜爽一区| 成人免费看的视频| 欧美一区二区福利在线| 国产精品久久久久久久蜜臀| 日韩主播视频在线| 成人黄色小视频| 欧美一区欧美二区| 国产精品美女久久久久久久久久久| 丝瓜av网站精品一区二区| 成人免费的视频| 精品久久久久久久久久久院品网 | 日本在线不卡视频|