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

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

?? spreadsheetdate.java

?? 水晶 ? ?  報(bào)表 ? ? ? 源碼
?? JAVA
字號(hào):
/* ===================================================
 * JCommon : a free general purpose Java class library
 * ===================================================
 *
 * Project Info:  http://www.jfree.org/jcommon/index.html
 * Project Lead:  David Gilbert (david.gilbert@object-refinery.com);
 *
 * (C) Copyright 2000-2003, by Object Refinery Limited and Contributors.
 *
 * 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.
 *
 * --------------------
 * SpreadsheetDate.java
 * --------------------
 * (C) Copyright 2000-2003, by Object Refinery Limited and Contributors.
 *
 * Original Author:  David Gilbert (for Object Refinery Limited);
 * Contributor(s):   -;
 *
 * $Id: SpreadsheetDate.java,v 1.2 2003/06/05 08:07:07 mungady Exp $
 *
 * Changes
 * -------
 * 11-Oct-2001 : Version 1 (DG);
 * 05-Nov-2001 : Added getDescription() and setDescription() methods (DG);
 * 12-Nov-2001 : Changed name from ExcelDate.java to SpreadsheetDate.java (DG);
 *               Fixed a bug in calculating day, month and year from serial number (DG);
 * 24-Jan-2002 : Fixed a bug in calculating the serial number from the day, month and year.  Thanks
 *               to Trevor Hills for the report (DG);
 * 29-May-2002 : Added equals(Object) method (SourceForge ID 558850) (DG);
 * 03-Oct-2002 : Fixed errors reported by Checkstyle (DG);
 * 13-Mar-2003 : Implemented Serializable (DG);
 *
 */

package org.jfree.date;

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

/**
 * Represents a date using an integer, in a similar fashion to the
 * implementation in Microsoft Excel.  The range of dates supported is
 * 1-Jan-1900 to 31-Dec-9999.
 * <P>
 * Be aware that there is a deliberate bug in Excel that recognises the year
 * 1900 as a leap year when in fact it is not a leap year. You can find more
 * information on the Microsoft website in article Q181370:
 * <P>
 * http://support.microsoft.com/support/kb/articles/Q181/3/70.asp
 * <P>
 * Excel uses the convention that 1-Jan-1900 = 1.  This class uses the
 * convention 1-Jan-1900 = 2.
 * The result is that the day number in this class will be different to the
 * Excel figure for January and February 1900...but then Excel adds in an extra
 * day (29-Feb-1900 which does not actually exist!) and from that point forward
 * the day numbers will match.
 *
 * @author David Gilbert
 */

public class SpreadsheetDate extends SerialDate implements Serializable {

    /** The day number (1-Jan-1900 = 2, 2-Jan-1900 = 3, ..., 31-Dec-9999 = 2958465). */
    private int serial;

    /** The day of the month (1 to 28, 29, 30 or 31 depending on the month). */
    private int day;

    /** The month of the year (1 to 12). */
    private int month;

    /** The year (1900 to 9999). */
    private int year;

    /** An optional description for the date. */
    private String description;

    /**
     * Constructs a new spreadsheet date.
     *
     * @param day  the day.
     * @param month  the month (1-12).
     * @param year  the year (in the range 1900 to 9999).
     */
    public SpreadsheetDate(int day, int month, int year) {

        if ((year >= 1900) && (year <= 9999)) {
            this.year = year;
        }
        else {
            throw new IllegalArgumentException(
                "SpreadsheetDate: Year must be in range 1900 to 9999.");
        }

        if ((month >= SerialDate.JANUARY) && (month <= SerialDate.DECEMBER)) {
            this.month = month;
        }
        else {
            throw new IllegalArgumentException("SpreadsheetDate: Invalid month.");
        }

        if ((day >= 1) && (day <= SerialDate.lastDayOfMonth(month, year))) {
            this.day = day;
        }
        else {
            throw new IllegalArgumentException("SpreadsheetDate: Invalid day.");
        }

        // the serial number needs to be synchronised with the day-month-year...
        this.serial = calcSerial(day, month, year);

        this.description = null;

    }

    /**
     * Standard constructor - creates a new date object representing the
     * specified day number (which should be in the range 2 to 2958465.
     *
     * @param serial  the serial number for the day (range: 2 to 2958465).
     */
    public SpreadsheetDate(int serial) {

        if ((serial >= SERIAL_LOWER_BOUND) && (serial <= SERIAL_UPPER_BOUND)) {
            this.serial = serial;
        }
        else {
            throw new IllegalArgumentException(
                "SpreadsheetDate: Serial must be in range 2 to 2958465.");
        }

        // the day-month-year needs to be synchronised with the serial number...
        calcDayMonthYear();

    }

    /**
     * Returns the description that is attached to the date.
     * <P>
     * It is not required that a date have a description, but for some applications it is useful.
     *
     * @return the description that is attached to the date.
     */
    public String getDescription() {
        return this.description;
    }

    /**
     * Sets the description for the date.
     *
     * @param description  the description for this date.
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * Returns the serial number for the date, where 1 January 1900 = 2
     * (this corresponds, almost, to the numbering system used in Microsoft
     * Excel for Windows and Lotus 1-2-3).
     *
     * @return the serial number of this date.
     */
    public int toSerial() {
        return this.serial;
    }

    /**
     * Returns a java.util.Date equivalent to this date.
     *
     * @return this as <code>java.util.Date</code>.
     */
    public Date toDate() {

        Calendar calendar = Calendar.getInstance();
        calendar.set(getYYYY(), getMonth() - 1, getDayOfMonth(), 0, 0, 0);
        return calendar.getTime();

    }

    /**
     * Returns the year (assume a valid range of 1900 to 9999).
     *
     * @return the year.
     */
    public int getYYYY() {
        return this.year;
    }

    /**
     * Returns the month (January = 1, February = 2, March = 3).
     *
     * @return the month of the year.
     */
    public int getMonth() {
        return this.month;
    }

    /**
     * Returns the day of the month.
     *
     * @return the day of the month.
     */
    public int getDayOfMonth() {
        return this.day;
    }

    /**
     * Returns a code representing the day of the week.
     * <P>
     * The codes are defined in the SerialDate class as: SUNDAY, MONDAY,
     * TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, and SATURDAY.
     *
     * @return a code representing the day of the week.
     */
    public int getDayOfWeek() {
        return (this.serial + 6) % 7 + 1;
    }

    /**
     * Tests the equality of this SpreadsheetDate with an arbitrary Object.
     * <P>
     * This method will return true ONLY if the object is an instance of the
     * SerialDate base class, and it represents the same day as this
     * SpreadsheetDate.
     *
     * @param object  the object to compare.
     *
     * @return <code>true</code> if this is equal to object.
     */
    public boolean equals(Object object) {

        if (object instanceof SerialDate) {
            SerialDate s = (SerialDate) object;
            return (s.toSerial() == this.toSerial());
        }
        else {
            return false;
        }

    }

    /**
     * Returns the difference (in days) between this date and the specified 'other' date.
     *
     * @param other  the date being compared to.
     *
     * @return the difference (in days) between this date and the specified 'other' date.
     */
    public int compare(SerialDate other) {
        return this.serial - other.toSerial();
    }

    /**
     * Returns true if this SerialDate represents the same date as the
     * specified SerialDate.
     *
     * @param other  the date being compared to.
     *
     * @return <code>true</code> if this SerialDate represents the same date as the
     *         specified SerialDate.
     */
    public boolean isOn(SerialDate other) {
        return (this.serial == other.toSerial());
    }

    /**
     * Returns true if this SerialDate represents an earlier date compared to
     * the specified SerialDate.
     *
     * @param other  the date being compared to.
     *
     * @return <code>true</code> if this SerialDate represents an earlier date
     *         compared to the specified SerialDate.
     */
    public boolean isBefore(SerialDate other) {
        return (this.serial < other.toSerial());
    }

    /**
     * Returns true if this SerialDate represents the same date as the
     * specified SerialDate.
     *
     * @param other  the date being compared to.
     *
     * @return <code>true</code> if this SerialDate represents the same date
     *         as the specified SerialDate.
     */
    public boolean isOnOrBefore(SerialDate other) {
        return (this.serial <= other.toSerial());
    }

    /**
     * Returns true if this SerialDate represents the same date as the
     * specified SerialDate.
     *
     * @param other  the date being compared to.
     *
     * @return <code>true</code> if this SerialDate represents the same date
     *         as the specified SerialDate.
     */
    public boolean isAfter(SerialDate other) {
        return (this.serial > other.toSerial());
    }

    /**
     * Returns true if this SerialDate represents the same date as the
     * specified SerialDate.
     *
     * @param other  the date being compared to.
     *
     * @return <code>true</code> if this SerialDate represents the same date as
     *         the specified SerialDate.
     */
    public boolean isOnOrAfter(SerialDate other) {
        return (this.serial >= other.toSerial());
    }

    /**
     * Returns true if this SerialDate is within the specified range
     * (INCLUSIVE).  The order of d1 d2 is not important.
     *
     * @param d1  one boundary date for the range.
     * @param d2  a second boundary date for the range.
     *
     * @return <code>true</code> if this SerialDate is within the specified range.
     */
    public boolean isInRange(SerialDate d1, SerialDate d2) {
        return false;
    }

    /**
     * Returns true if this SerialDate is within the specified range (caller
     * specifies whether or not the end-points are included).  The order of d1
     * and d2 is not important.
     *
     * @param d1  one boundary date for the range.
     * @param d2  a second boundary date for the range.
     * @param include   if <code>true</code> include d2 in the search.
     *
     * @return <code>true</code> if this SerialDate is within the specified range.
     */
    public boolean isInRange(SerialDate d1, SerialDate d2, int include) {
        return false;
    }

    /**
     * Calculate the serial number from the day, month and year.
     * <P>
     * 1-Jan-1900 = 2.
     *
     * @param day  the day.
     * @param month  the month.
     * @param year  the year.
     *
     * @return the serial number from the day, month and year.
     */
    private int calcSerial(int day, int month, int year) {

        int y = ((year - 1900) * 365) + SerialDate.leapYearCount(year - 1);
        int m = SerialDate.AGGREGATE_DAYS_TO_END_OF_PRECEDING_MONTH[month];
        if (month > SerialDate.FEBRUARY) {
            if (SerialDate.isLeapYear(year)) {
                m = m + 1;
            }
        }
        int d = day;
        return y + m + d + 1;

    }

    /**
     * Calculate the day, month and year from the serial number.
     */
    private void calcDayMonthYear() {

        // get the year from the serial date
        int days = this.serial - SERIAL_LOWER_BOUND;
        // overestimated because we ignored leap days
        int overestimatedYYYY = 1900 + (days / 365);
        int leaps = SerialDate.leapYearCount(overestimatedYYYY);
        int nonleapdays = days - leaps;
        // underestimated because we overestimated years
        int underestimatedYYYY = 1900 + (nonleapdays / 365);

        if (underestimatedYYYY == overestimatedYYYY) {
            this.year = underestimatedYYYY;
        }
        else {
            int ss1 = calcSerial(1, 1, underestimatedYYYY);
            while (ss1 <= this.serial) {
                underestimatedYYYY = underestimatedYYYY + 1;
                ss1 = calcSerial(1, 1, underestimatedYYYY);
            }
            this.year = underestimatedYYYY - 1;
        }

        int ss2 = calcSerial(1, 1, this.year);

        int[] daysToEndOfPrecedingMonth = AGGREGATE_DAYS_TO_END_OF_PRECEDING_MONTH;

        if (isLeapYear(this.year)) {
            daysToEndOfPrecedingMonth = LEAP_YEAR_AGGREGATE_DAYS_TO_END_OF_PRECEDING_MONTH;
        }

        // get the month from the serial date
        int mm = 1;
        int sss = ss2 + daysToEndOfPrecedingMonth[mm] - 1;
        while (sss < this.serial) {
            mm = mm + 1;
            sss = ss2 + daysToEndOfPrecedingMonth[mm] - 1;
        }
        this.month = mm - 1;

        // what's left is d(+1);
        this.day = this.serial - ss2 - daysToEndOfPrecedingMonth[this.month] + 1;

    }

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人免费av| 午夜精品久久久久久久99水蜜桃| 亚洲三级在线免费观看| 美洲天堂一区二卡三卡四卡视频 | 中文字幕av一区 二区| 午夜一区二区三区视频| 成人免费视频播放| 精品理论电影在线观看| 首页国产欧美久久| 色婷婷综合久久久久中文| 久久精子c满五个校花| 婷婷夜色潮精品综合在线| 91一区二区三区在线播放| 久久精品一区二区三区四区| 蜜桃视频在线一区| 欧美日韩极品在线观看一区| 亚洲男同1069视频| 波多野结衣精品在线| 久久久电影一区二区三区| 理论片日本一区| 制服丝袜一区二区三区| 亚洲综合视频网| 欧美日韩成人在线一区| 国产精品初高中害羞小美女文| 精品一区二区三区在线播放| 欧美欧美欧美欧美首页| 亚洲高清免费一级二级三级| 91福利在线播放| 亚洲精选视频在线| 一本一道久久a久久精品| 自拍偷拍国产精品| 99精品视频在线免费观看| 日本一区二区电影| 成人看片黄a免费看在线| 国产日本欧洲亚洲| 成人黄色国产精品网站大全在线免费观看 | 欧美白人最猛性xxxxx69交| 日本 国产 欧美色综合| 精品久久久久久久一区二区蜜臀| 美女视频网站久久| 久久久久免费观看| gogo大胆日本视频一区| 亚洲另类一区二区| 欧美日韩一本到| 日韩精品免费专区| 精品国产乱码久久久久久闺蜜| 韩国成人精品a∨在线观看| 国产日产欧美一区二区三区| 成人丝袜视频网| 一区二区不卡在线播放 | 久久99热这里只有精品| 精品三级av在线| 国产美女主播视频一区| 国产精品福利av| 欧美日韩国产一级片| 国内精品国产三级国产a久久| 久久影音资源网| 99久久精品情趣| 五月天激情综合网| 国产欧美日本一区视频| 91色porny蝌蚪| 捆绑调教美女网站视频一区| 中文字幕久久午夜不卡| 日本韩国一区二区三区视频| 日本大胆欧美人术艺术动态| 亚洲精品在线电影| 91精品办公室少妇高潮对白| 午夜欧美在线一二页| 欧美精品一区二区三区蜜桃视频| 成人免费视频一区| 日韩电影在线观看电影| 亚洲国产高清在线观看视频| 色国产综合视频| 蜜臀av亚洲一区中文字幕| 国产精品你懂的| 欧美一级生活片| 成人免费视频视频在线观看免费| 亚洲欧美激情视频在线观看一区二区三区 | 亚洲欧美韩国综合色| 欧美日本一道本| 懂色av中文字幕一区二区三区| 一区二区三区成人| 精品国产一区二区三区不卡| av电影在线观看完整版一区二区| 天天综合日日夜夜精品| 日本一区二区三区电影| 欧美酷刑日本凌虐凌虐| 成人av在线一区二区| 日韩精品福利网| 亚洲色图欧美激情| 国产欧美日韩麻豆91| 欧美日韩成人综合天天影院 | 欧美日韩一区二区在线视频| 丁香激情综合五月| 激情综合一区二区三区| 亚洲免费观看高清完整| 国产网红主播福利一区二区| 欧美大片日本大片免费观看| 欧美蜜桃一区二区三区| 欧美午夜精品一区| 成人动漫一区二区在线| 久久精品国产99国产精品| 五月天视频一区| 三级欧美在线一区| 亚洲超碰精品一区二区| 亚洲123区在线观看| 亚洲人成小说网站色在线| 日本一二三不卡| 日韩视频免费观看高清完整版| 国产精品一二二区| 另类小说色综合网站| 蜜臀av性久久久久av蜜臀妖精| 亚洲v日本v欧美v久久精品| 一区二区视频在线看| 亚洲主播在线播放| 樱桃国产成人精品视频| 亚洲人成在线观看一区二区| 亚洲免费av在线| 一区二区成人在线| 亚洲午夜一区二区| 亚洲成人三级小说| 午夜一区二区三区视频| 日韩成人伦理电影在线观看| 另类小说图片综合网| 九九视频精品免费| 国产乱理伦片在线观看夜一区| 国产美女主播视频一区| 成人av在线影院| 99精品视频在线观看| 91福利精品第一导航| 欧美精品日韩一本| 精品日韩欧美在线| 国产亚洲精品7777| 中文字幕欧美一| 亚洲精品国产精华液| 日韩黄色一级片| 黑人精品欧美一区二区蜜桃| 国产69精品久久久久毛片| 成人av在线观| 欧美另类高清zo欧美| 精品88久久久久88久久久| 中文字幕不卡在线观看| 一区二区三区丝袜| 精品一区二区三区香蕉蜜桃| 国产传媒欧美日韩成人| 91精彩视频在线| 91精品国产综合久久精品性色| 2020国产精品| 一区二区三区免费| 激情综合色播五月| 国产91精品露脸国语对白| 91视频一区二区| 在线日韩一区二区| 久久综合精品国产一区二区三区 | 欧美精品一二三四| 国产亚洲精品久| 亚洲成a天堂v人片| 国产91精品精华液一区二区三区 | 亚洲欧美日韩在线不卡| 天天色综合天天| 成人综合婷婷国产精品久久免费| 在线观看区一区二| 国产日本亚洲高清| 免费久久99精品国产| 91尤物视频在线观看| 精品免费视频.| 一区二区三区不卡在线观看| 国产精品99久久久久久久vr| 88在线观看91蜜桃国自产| 国产精品色哟哟| 极品少妇一区二区三区精品视频| 91麻豆swag| 国产精品初高中害羞小美女文| 免播放器亚洲一区| 在线视频国产一区| 国产精品国产三级国产普通话三级| 日本vs亚洲vs韩国一区三区| 91成人免费电影| 国产精品夫妻自拍| 国产综合色产在线精品| 91精品国产综合久久精品图片 | 一区在线观看免费| 亚洲成人中文在线| 在线观看国产日韩| 伊人开心综合网| 91美女在线观看| 国产精品成人一区二区三区夜夜夜 | 日韩av午夜在线观看| 色婷婷国产精品久久包臀| 国产日产欧美一区二区三区| 蜜桃精品在线观看| 69堂精品视频| 亚洲va国产天堂va久久en| 成人av先锋影音| 久久久国产午夜精品 | 91在线观看美女| 国产精品美女久久久久aⅴ国产馆| 国产精品一二三四区| 久久综合资源网| 国产成人aaa|