package org.josast.util.date;

/**
 * 
 * <b>Description : generic container for a date. </b> 
 * 
 * 
 * <p>Projet : JOSAST <BR>
 * 
 * <br>
 * 
 * @author  <a href="mailto:mercier.josast@avmdti.org">mercier</a>
 * @version 1.0
 * <p><b><i> Source Update </b></i></p>
 * <br> Version : date 		: name 		: comments 
 * <br> V1      : 1 avr. 2005	: C. Mercier 	: create file
 * <p>
 * 
 */
public class GenericDate {
    //~ Instance fields ---------------------------------------------------

    /** DOCUMENT ME! */
    private int _year;

    /** DOCUMENT ME! */
    private int _month;

    /** DOCUMENT ME! */
    private int _day;

    /** DOCUMENT ME! */
    private int _hour;

    /** DOCUMENT ME! */
    private int _minute;

    /** DOCUMENT ME! */
    private int _seconde;

    //~ Constructors ------------------------------------------------------

    /**
     * Creates a new GenericDate object.
     * <br> no verification on the input value <br>
     * 
     * @param year 4 digit
     *            
     * @param month 1 to 12
     *            
     * @param day 1 to 31
     *           
     * @param hour 1 to 24
     *           
     * @param minute 1 to 59
     *            !
     * @param seconde 1 to 59
     *            
     */
    public GenericDate(int year, int month, int day, int hour, int minute,
        int seconde) {
        _year = year;
        _month = month;
        _day = day;
        _hour = hour;
        _minute = minute;
        _seconde = seconde;
    }

    /**
     * Creates a new GenericDate object.
     * 
     * @param JulianDate julian day
     *           
     */
    public GenericDate(double JulianDate) {
        GenericDate Gd = JulianDay.convertToGenericDate(JulianDate);
        _year = Gd._year;
        _month = Gd._month;
        _day = Gd._day;
        _hour = Gd._hour;
        _minute = Gd._minute;
        _seconde = Gd._seconde;
    }

    //~ Methods -----------------------------------------------------------

    /**
     * return the julian day
     * 
     * @return return julian day
     */
    public double getJulianDay() {
        return (JulianDay.convertToJulianDay(_year, _month, _day, _hour,
            _minute, _seconde));
    }

    /**
     * 
     * @return day
     */
    public int get_day() {
        return _day;
    }

    /**
     *
     * 
     * @return hours
     */
    public int get_hour() {
        return _hour;
    }

    /**
  
     * 
     * @return minute
     */
    public int get_minute() {
        return _minute;
    }

    /**
     * 
     * @return month
     */
    public int get_month() {
        return _month;
    }

    /**

     * 
     * @return seconde
     */
    public int get_seconde() {
        return _seconde;
    }

    /**
     *
     * 
     * @return year
     */
    public int get_year() {
        return _year;
    }

    /**

     * 
     * @param _day day
     *           
     */
    public void set_day(int _day) {
        this._day = _day;
    }

    /**
     * 
     * 
     * @param _hour hour
     *          
     */
    public void set_hour(int _hour) {
        this._hour = _hour;
    }

    /**
     * 
     * @param _minute minute
     */
    public void set_minute(int _minute) {
        this._minute = _minute;
    }

    /**
     * 
     * @param _month month
     */
    public void set_month(int _month) {
        this._month = _month;
    }

    /**
     *  
     * @param _seconde seconde 
     */
    public void set_seconde(int _seconde) {
        this._seconde = _seconde;
    }

    /**

     * 
     * @param _year year
     *           
     */
    public void set_year(int _year) {
        this._year = _year;
    }

    /**
     *  print generic date with the following format  dd mm yy hh mn ss 
     * @return string
     */
    public String toString() {
        return (" " + _day + " " + _month + " " + _year + " " + _hour
        + " " + _minute + " " + _seconde);
    }
}
