Documentation of 'sgtplot.util.GeoDate' Java class
GeoDate
sgtplot.util

Class GeoDate

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<java.util.Date>


    public class GeoDate
    extends java.util.Date
    implements java.io.Serializable
    GeoDate extends the capabilities of Date. Additional features of GeoDate include methods for incrementing and decrementing, adding and substracting GeoDate objects. All GeoDate objects share the same GregorianCalendar set to a "GMT" time zone. Thus, all GeoDate times are in "GMT". This simplifies the conversion to and from String representations of time.
    Since:
    sgtplot 1.0
    See Also:
    GregorianCalendar, Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int DAYS
      Increment or decrement in days.
      static int HOURS
      Increment or decrement in hours.
      static int MINUTES
      Increment or decrement in minutes
      static int MONTHS
      Increment or decrement in months.
      static int MSEC
      Increment or decrement in milliseconds
      static long MSECS_IN_DAY
      Number of milliseconds in a day.
      static int SECONDS
      Increment or decrement in seonds
      static int YEARS
      Increment or decrement in years.
    • Constructor Summary

      Constructors 
      Constructor and Description
      GeoDate()
      Construct a new GeoDate.
      GeoDate(java.util.Date date)
      Construct a new GeoDate from a Date object.
      GeoDate(GeoDate t)
      Constructs a new GeoDate from an existing GeoDate.
      GeoDate(int jday, int msec)
      Construct a new GeoDate from EPIC double integers.
      GeoDate(int mon, int day, int year, int hour, int min, int sec, int msec)
      Construct a new GeoDate from values.
      GeoDate(long date)
      Allocates a GeoDate object and initializes it to represent the specified number of milliseconds since the standard base time know as "the epoch", namely January 1, 1970, 00:00:00 GMT.
      GeoDate(java.lang.String time, java.lang.String format)
      Construct a new GeoDate from a String.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method and Description
      GeoDate add(GeoDate time)
      Add time to current GeoDate.
      int compareTo(GeoDate anotherDate)
      Tests to see if the current GeoDate is less than, equal, or greater than.
      GeoDate decrement(double val, int tu)
      Decrement current GeoDate by SECONDS, MINUTES, HOURS, DAYS, MONTHS, or YEARS
      GeoDate decrement(float val, int tu)
      Decrement current GeoDate by SECONDS, MINUTES, HOURS, DAYS, MONTHS, or YEARS
      GeoDate divide(double val)
      Divide by value.
      java.util.Calendar getCalendar()
      Get a reference to the GregorianCalendar set to the current GeoDate time.
      int getDay()
      Deprecated. 
      Overrides a deprecated method, replaced by getGMTDay().
      int getDaysInMonth()
      Get the number of days in the current month.
      int getGMTDay()
      Get day
      int getGMTHours()
      Get hours
      int getGMTMinutes()
      Get minutes
      int getGMTMonth()
      Get month
      double getGMTSeconds()
      Get seconds and fraction of seconds.
      int getGMTYear()
      Get year.
      int getHours()
      Deprecated. 
      Overrides a deprecated method, replaced by getGMTHours().
      int getJDay()
      get EPIC Julian Day
      int getMinutes()
      Deprecated. 
      Overrides a deprecated method, replaced by getGMTMinutes().
      int getMonth()
      Deprecated. 
      Overrides a deprecated method, replaced by getGMTMonth().
      int getMSec()
      get milliseconds since midnight
      double getSecondss()
      Deprecated. 
      replaced by getGMTSeconds().
      int getYear()
      Deprecated. 
      Overrides a deprecated method, replaced by getGMTYear().
      int getYearday()
      Get year-day number (Jan 1 = 1)
      GeoDate increment(double val, int tu)
      Increment current GeoDate by SECONDS, MINUTES, HOURS, DAYS, MONTHS, or YEARS
      GeoDate increment(float val, int tu)
      Increment current GeoDate by SECONDS, MINUTES, HOURS, DAYS, MONTHS, or YEARS
      boolean isMissing()
      Tests to see if value represents missing data.
      boolean isRelativeTime()
      Tests the relativeTime flag.
      void now()
      Set to current time.
      double offset(GeoDate ref)
      Time offset from reference GeoDate
      void set(int jday, int msec)
      Change value of GeoDate from EPIC double integers.
      void set(int mon, int day, int year, int hour, int min, int sec, int msec)
      Change value of GeoDate from values.
      void setRelativeTime(boolean relative)
      Set the relativeTime flag.
      void setYearYearDay(int year, int yearday)
      Set a GeoDate from year and year-day.
      GeoDate subtract(GeoDate time2)
      Subtract time2 from current GeoDate.
      java.lang.String toString()
      Convert GeoDate to String using standard format "yyyy-MM-dd HH:mm:ss z" and "GMT" time zone.
      java.lang.String toString(java.lang.String format)
      Convert GeoDate to String using provided format.
      • Methods inherited from class java.util.Date

        after, before, clone, compareTo, equals, from, getDate, getSeconds, getTime, getTimezoneOffset, hashCode, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setTime, setYear, toGMTString, toInstant, toLocaleString, UTC
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • GeoDate

        public GeoDate()
        Construct a new GeoDate.
      • GeoDate

        public GeoDate(java.lang.String time,
                       java.lang.String format)
                throws IllegalTimeValue
        Construct a new GeoDate from a String. Formatting is done using SimpleDateFormat. The specified time is taken to be "GMT".
        Parameters:
        time - character representation of time
        format - codes used to read time
        Throws:
        IllegalTimeValue
      • GeoDate

        public GeoDate(GeoDate t)
        Constructs a new GeoDate from an existing GeoDate.
        Parameters:
        t - GeoDate
      • GeoDate

        public GeoDate(int mon,
                       int day,
                       int year,
                       int hour,
                       int min,
                       int sec,
                       int msec)
                throws IllegalTimeValue
        Construct a new GeoDate from values. The specified time is taken to be "GMT".
        Parameters:
        mon - month
        day - day of the month
        year - year (no offset!)
        hour - hour
        min - minutes
        sec - seconds
        msec - milliseconds
        Throws:
        IllegalTimeValue - The constructor was called with a set of parameters that does not constitute a legitimate time value.
      • GeoDate

        public GeoDate(java.util.Date date)
        Construct a new GeoDate from a Date object. No time zone conversion is done.
        Parameters:
        date - Date object
      • GeoDate

        public GeoDate(int jday,
                       int msec)
        Construct a new GeoDate from EPIC double integers. Time zone for conversion is "GMT".
        Parameters:
        jday - julian day
        msec - milliseconds since midnight
      • GeoDate

        public GeoDate(long date)
        Allocates a GeoDate object and initializes it to represent the specified number of milliseconds since the standard base time know as "the epoch", namely January 1, 1970, 00:00:00 GMT.
    • Method Detail

      • setRelativeTime

        public void setRelativeTime(boolean relative)
        Set the relativeTime flag. The relativeTime flag indicates that the GeoDate object does not represent an actual absolute time, but a temporal duration.
      • isRelativeTime

        public boolean isRelativeTime()
        Tests the relativeTime flag.
        Returns:
        if true, time is a duration
      • set

        public void set(int jday,
                        int msec)
        Change value of GeoDate from EPIC double integers. Time zone for conversion is "GMT".
        Parameters:
        jday - julian day
        msec - milliseconds since midnight
      • set

        public void set(int mon,
                        int day,
                        int year,
                        int hour,
                        int min,
                        int sec,
                        int msec)
                 throws IllegalTimeValue
        Change value of GeoDate from values. Time zone for conversion is "GMT".
        Parameters:
        mon - month (1=January, 12=December)
        day - day of the month
        year - year (no offset!)
        hour - hour
        min - minutes
        sec - seconds
        msec - milliseconds
        Throws:
        IllegalTimeValue - The parameters passed to this method represent a time value that is invalid
      • getDaysInMonth

        public int getDaysInMonth()
        Get the number of days in the current month.
        Returns:
        number of days in current month
      • now

        public void now()
        Set to current time.
      • add

        public GeoDate add(GeoDate time)
        Add time to current GeoDate. This operation only makes since if time is a relative time value, i.e. the result of a GeoDate subrtraction.
        Parameters:
        time - GeoDate
        Returns:
        new GeoDate
      • subtract

        public GeoDate subtract(GeoDate time2)
        Subtract time2 from current GeoDate.
        Parameters:
        time2 - subtracthend
        Returns:
        new GeoDate
      • divide

        public GeoDate divide(double val)
        Divide by value. Current time should the result of adding two times or subtracting two times to be a meaningful calculation.
        Parameters:
        val - divisor
        Returns:
        new GeoDate
      • increment

        public GeoDate increment(float val,
                                 int tu)
        Increment current GeoDate by SECONDS, MINUTES, HOURS, DAYS, MONTHS, or YEARS
        Parameters:
        val - amount to increment
        tu - time units (SECONDS, MINUTES, HOURS, DAYS, MONTHS, or YEARS) operation.
      • increment

        public GeoDate increment(double val,
                                 int tu)
        Increment current GeoDate by SECONDS, MINUTES, HOURS, DAYS, MONTHS, or YEARS
        Parameters:
        val - amount to increment
        tu - time units (SECONDS, MINUTES, HOURS, DAYS, MONTHS, or YEARS) operation.
      • decrement

        public GeoDate decrement(float val,
                                 int tu)
        Decrement current GeoDate by SECONDS, MINUTES, HOURS, DAYS, MONTHS, or YEARS
        Parameters:
        val - amount to decrement
        tu - time units (SECONDS, MINUTES, HOURS, DAYS, MONTHS, or YEARS) operation.
      • decrement

        public GeoDate decrement(double val,
                                 int tu)
        Decrement current GeoDate by SECONDS, MINUTES, HOURS, DAYS, MONTHS, or YEARS
        Parameters:
        val - amount to decrement
        tu - time units (SECONDS, MINUTES, HOURS, DAYS, MONTHS, or YEARS) operation.
      • offset

        public double offset(GeoDate ref)
        Time offset from reference GeoDate
        Parameters:
        ref - reference GeoDate
        Returns:
        offset in days
      • setYearYearDay

        public void setYearYearDay(int year,
                                   int yearday)
        Set a GeoDate from year and year-day.
        Parameters:
        year - year
        yearday - year-day number (Jan 1 = 1) parameters that does not constitute a legitimate time value.
      • getCalendar

        public java.util.Calendar getCalendar()
        Get a reference to the GregorianCalendar set to the current GeoDate time.
        Returns:
        Calendar
      • getYearday

        public int getYearday()
        Get year-day number (Jan 1 = 1)
      • getYear

        public int getYear()
        Deprecated. Overrides a deprecated method, replaced by getGMTYear().
        Get year
        Overrides:
        getYear in class java.util.Date
      • getGMTYear

        public int getGMTYear()
        Get year.
      • getMonth

        public int getMonth()
        Deprecated. Overrides a deprecated method, replaced by getGMTMonth().
        Get month
        Overrides:
        getMonth in class java.util.Date
      • getGMTMonth

        public int getGMTMonth()
        Get month
      • getDay

        public int getDay()
        Deprecated. Overrides a deprecated method, replaced by getGMTDay().
        Get day
        Overrides:
        getDay in class java.util.Date
      • getGMTDay

        public int getGMTDay()
        Get day
      • getHours

        public int getHours()
        Deprecated. Overrides a deprecated method, replaced by getGMTHours().
        Get hours
        Overrides:
        getHours in class java.util.Date
      • getGMTHours

        public int getGMTHours()
        Get hours
      • getMinutes

        public int getMinutes()
        Deprecated. Overrides a deprecated method, replaced by getGMTMinutes().
        Get minutes
        Overrides:
        getMinutes in class java.util.Date
      • getGMTMinutes

        public int getGMTMinutes()
        Get minutes
      • getSecondss

        public double getSecondss()
        Deprecated. replaced by getGMTSeconds().
        Get secondss
      • getGMTSeconds

        public double getGMTSeconds()
        Get seconds and fraction of seconds.
      • getJDay

        public int getJDay()
        get EPIC Julian Day
      • getMSec

        public int getMSec()
        get milliseconds since midnight
      • toString

        public java.lang.String toString()
        Convert GeoDate to String using standard format "yyyy-MM-dd HH:mm:ss z" and "GMT" time zone.
        Overrides:
        toString in class java.util.Date
        Returns:
        date
      • toString

        public java.lang.String toString(java.lang.String format)
        Convert GeoDate to String using provided format. The SimpleDateFormat and the GregorianCalendar is used to format the GeoDate. A format of "decade" will create a string of the form 1990 or 1980.
        Parameters:
        format - String containing codes used to write time.
        See Also:
        SimpleDateFormat
      • isMissing

        public boolean isMissing()
        Tests to see if value represents missing data. A value from the getTime() method of Long.MIN_VALUE represents a missing observation.
        See Also:
        SGTData.getXRange()
      • compareTo

        public int compareTo(GeoDate anotherDate)
        Tests to see if the current GeoDate is less than, equal, or greater than. another GeoDate

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.