devplugin

## Class Date

- java.lang.Object
- - devplugin.Date

- All Implemented Interfaces:
    java.lang.Comparable<Date>

      public class Date
      extends java.lang.Object
      implements java.lang.Comparable<Date>

  the date of a program. it holds year, month and day.
  Author:
    Martin Oberhauser

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Date()` Constructs a new Date object, initialized with the current date.
    `Date(java.util.Calendar cal)` constructs a new date from a calendar object.
    `Date(java.io.DataInput in)` Deprecated. since 3.0. use readData instead.
    `Date(Date d)` Constructs a new date from a date object, ie clones it.
    `Date(int year, int month, int dayOfMonth)` constructs a new date initialized with the given arguments.
    `Date(java.io.ObjectInputStream in)` Deprecated. since 3.0, use readData instead
    `Date(short year, byte month, byte dayOfMonth)` constructs a new date initialized with the given arguments.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Date` | `addDays(int days)`
    `int` | `compareTo(Date otherDate)`
    `static Date` | `createDateFromValue(long value)` create a date from a value (see getValue).
    `static Date` | `createDDMMYYYY(java.lang.String date, java.lang.String separator)` creates a date from a formatted string of the form DD<separator>MM<separator>YYYY.
    `static Date` | `createYYMMDD(java.lang.String date, java.lang.String separator)` creates a date from a formatted string of the form YY<separator>MM<separator>DD.
    `static Date` | `createYYYYMMDD(java.lang.String date, java.lang.String separator)` creates a date from a formatted string of the form YYYY<separator>MM<separator>DD.
    `boolean` | `equals(java.lang.Object obj)`
    `java.util.Calendar` | `getCalendar()`
    `java.util.Calendar` | `getCalendar(java.util.Locale locale)`
    `static Date` | `getCurrentDate()` do not call this method repeatedly!
    `java.lang.String` | `getDateString()` return the textual representation of this date with abbreviated day of week and abbreviated month name.
    `int` | `getDayOfMonth()`
    `int` | `getDayOfWeek()` get the day of the week for this date.
    `java.lang.String` | `getFormattedString(java.lang.String pattern)` Returns a string of the date according to SimpleDateFormat
    `java.lang.String` | `getFormattedString(java.lang.String pattern, java.util.Locale locale)` Returns a string of the date according to SimpleDateFormat
    `java.lang.String` | `getLongDateString()` return the textual representation of this date with full day of week and full month name (neither abbreviated).
    `int` | `getMonth()`
    `int` | `getNumberOfDaysSince(Date date)`
    `java.lang.String` | `getShortDayLongMonthString()` returns the textual representation of this date with abbreviated day of week, but full month.
    `long` | `getValue()` TODO is that correct?
    `int` | `getWeekOfYear()` Returns the week number within the current year.
    `int` | `getWeekOfYear(java.util.Locale locale)` Returns the week number within the current year.
    `int` | `getYear()`
    `int` | `hashCode()` A hash code implementation that returns the same code for equal Dates.
    `boolean` | `isFirstDayOfWeek()` is this a Monday?
    `boolean` | `isFirstDayOfWeek(java.util.Locale locale)` is this the first day of the week?
    `static Date` | `readData(java.io.DataInput in)` reads an instance from a DataInput.
    `static void` | `resetLocalizer()`
    `java.lang.String` | `toString()`
    `void` | `writeData(java.io.DataOutput out)` Writes this instance to a DataOutput.
    `void` | `writeData(java.io.ObjectOutputStream out)` Deprecated. since 3.0
    `void` | `writeToDataFile(java.io.RandomAccessFile out)` Deprecated. since 3.0, use writeData instead

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Date

          public Date()

      Constructs a new Date object, initialized with the current date.

    - #### Date

          public Date(short year,
              byte month,
              byte dayOfMonth)

      constructs a new date initialized with the given arguments.
      Parameters:
        `year` - Calendar.get(Calendar.YEAR)
        `month` - Calendar.get(Calendar.MONTH) + 1
        `dayOfMonth` - Calendar.get(Calendar.DAY_OF_MONTH)

    - #### Date

          public Date(int year,
              int month,
              int dayOfMonth)

      constructs a new date initialized with the given arguments. This is a convenience method hiding the internal storage format.
      Parameters:
        `year` - Calendar.get(Calendar.YEAR)
        `month` - Calendar.get(Calendar.MONTH) + 1
        `dayOfMonth` - Calendar.get(Calendar.DAY_OF_MONTH)

    - #### Date

          public Date(java.util.Calendar cal)

      constructs a new date from a calendar object.
      Parameters:
        `cal` - the calendar to create a date from.

    - #### Date

          public Date(Date d)

      Constructs a new date from a date object, ie clones it.
      Parameters:
        `d` - the date to clone

    - #### Date

          @Deprecated
          public Date(java.io.DataInput in)
               throws java.io.IOException,
                      java.lang.ClassNotFoundException

      Deprecated. since 3.0. use readData instead.
      Creates a new instance from a RandomAccessFile. IMPORTANT: This is needed for loading Date from the tv data files and cannot be replaced with serialisation.
      Parameters:
        `in` - the input to read from
      Throws:
        `java.io.IOException` - if the stream could not be read
        `java.lang.ClassNotFoundException` - if the date could not be restored
      Since:
        2.2

    - #### Date

          @Deprecated
          public Date(java.io.ObjectInputStream in)
               throws java.io.IOException,
                      java.lang.ClassNotFoundException

      Deprecated. since 3.0, use readData instead
      Creates a new instance from a stream.
      Parameters:
        `in` - the input to read from
      Throws:
        `java.io.IOException` - if the stream could not be read
        `java.lang.ClassNotFoundException` - if the date could not be restored

  - ### Method Detail

    - #### getCurrentDate

          public static Date getCurrentDate()

      do not call this method repeatedly! always cache this value because this is a very slow function!
      Returns:
        the current date

    - #### createDateFromValue

          public static Date createDateFromValue(long value)

      create a date from a value (see getValue).
      Parameters:
        `value` - the value to create a date from
      Returns:
        the date

    - #### createYYYYMMDD

          public static Date createYYYYMMDD(java.lang.String date,
                            java.lang.String separator)

      creates a date from a formatted string of the form YYYY<separator>MM<separator>DD.
      Parameters:
        `date` - the string to parse.
        `separator` - the separator separating the year, month and day sections of the string
      Returns:
        null if the parsing failed

    - #### createDDMMYYYY

          public static Date createDDMMYYYY(java.lang.String date,
                            java.lang.String separator)

      creates a date from a formatted string of the form DD<separator>MM<separator>YYYY.
      Parameters:
        `date` - the string to parse.
        `separator` - the separator separating the year, month and day sections of the string
      Returns:
        null if the parsing failed

    - #### createYYMMDD

          public static Date createYYMMDD(java.lang.String date,
                          java.lang.String separator)

      creates a date from a formatted string of the form YY<separator>MM<separator>DD. this method assumes that the date is in the 21st century, ie 20XX.
      Parameters:
        `date` - the string to parse.
        `separator` - the separator separating the year, month and day sections of the string
      Returns:
        null if the parsing failed

    - #### getNumberOfDaysSince

          public int getNumberOfDaysSince(Date date)

      Parameters:
        `date` - The date to check for days since.
      Returns:
        The days since the given date.
      Since:
        0.9.7.4 This method may not return the exactly number of days since the calculation is confounded by daylight savings time switchovers... Around midnight the result may not be correct.

    - #### getYear

          public int getYear()

      Returns:
        the year (4 digits)

    - #### getMonth

          public int getMonth()

      Returns:
        the month (2 digits, starting with 1 for january)

    - #### getDayOfMonth

          public int getDayOfMonth()

      Returns:
        the day of month (2 digits, starting with 1)

    - #### getWeekOfYear

          public int getWeekOfYear()

      Returns the week number within the current year. Should not be used since value depends on default locale and thus changes from machine to machine. Since 3.0 better use getWeekOfYear(Locale locale) instead.
      Returns:
        The week number.
      Since:
        2.5.1

    - #### getWeekOfYear

          public int getWeekOfYear(java.util.Locale locale)

      Returns the week number within the current year.
      Parameters:
        `locale` - The locale to be used
      Returns:
        The week number.
      Since:
        3.0

    - #### writeToDataFile

          @Deprecated
          public void writeToDataFile(java.io.RandomAccessFile out)
                               throws java.io.IOException

      Deprecated. since 3.0, use writeData instead
      Writes this instance to a RandomAccessFile. IMPORTANT: This is needed for writing Date to the tv data files and cannot be replaced with serialisation.
      Parameters:
        `out` - the file to write to
      Throws:
        `java.io.IOException` - if something went wrong
      Since:
        2.2

    - #### writeData

          @Deprecated
          public void writeData(java.io.ObjectOutputStream out)
                         throws java.io.IOException

      Deprecated. since 3.0
      Writes this instance to a stream.
      Parameters:
        `out` - the stream to write to
      Throws:
        `java.io.IOException` - if something went wrong

    - #### hashCode

          public int hashCode()

      A hash code implementation that returns the same code for equal Dates.
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        the hash code

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`
      See Also:
        `Object.equals(java.lang.Object)`

    - #### getDateString

          public java.lang.String getDateString()

      return the textual representation of this date with abbreviated day of week and abbreviated month name. TODO the description does not fit the code. change code or change description?
      Returns:
        date string

    - #### getFormattedString

          public java.lang.String getFormattedString(java.lang.String pattern)

      Returns a string of the date according to SimpleDateFormat
      Parameters:
        `pattern` - the pattern describing the date and time format
      Returns:
        the formatted date string.
      Since:
        3.0.2

    - #### getFormattedString

          public java.lang.String getFormattedString(java.lang.String pattern,
                                            java.util.Locale locale)

      Returns a string of the date according to SimpleDateFormat
      Parameters:
        `pattern` - the pattern describing the date and time format
        `locale` - the locale whose date format symbols should be used
      Returns:
        the formatted date string.
      Since:
        3.0.2

    - #### getLongDateString

          public java.lang.String getLongDateString()

      return the textual representation of this date with full day of week and full month name (neither abbreviated).
      Returns:
        date string

    - #### getShortDayLongMonthString

          public java.lang.String getShortDayLongMonthString()

      returns the textual representation of this date with abbreviated day of week, but full month.
      Returns:
        date as string

    - #### getValue

          public long getValue()

      TODO is that correct? its like hashCode.
      Returns:
        the value as in hashCode

    - #### getCalendar

          public java.util.Calendar getCalendar()

      Returns:
        the corresponding calendar for this date

    - #### getCalendar

          public java.util.Calendar getCalendar(java.util.Locale locale)

      Parameters:
        `locale` -
      Returns:
        the corresponding calendar for this date
      Since:
        3.0

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### addDays

          public Date addDays(int days)

      Parameters:
        `days` - the days to add
      Returns:
        a new created date object

    - #### compareTo

          public int compareTo(Date otherDate)

      Specified by:
        `compareTo` in interface `java.lang.Comparable<Date>`
      See Also:
        `Comparable.compareTo(java.lang.Object)`

    - #### getDayOfWeek

          public int getDayOfWeek()

      get the day of the week for this date.
      Returns:
        day of week, as Calendar.MONDAY and so on
      Since:
        2.6

    - #### isFirstDayOfWeek

          public boolean isFirstDayOfWeek()

      is this a Monday?
      Returns:
        `true`, if this is a Monday
      Since:
        2.6

    - #### isFirstDayOfWeek

          public boolean isFirstDayOfWeek(java.util.Locale locale)

      is this the first day of the week?
      Parameters:
        `locale` - The locale to be used
      Returns:
        `true`, if this is the first day of the week
      Since:
        3.0

    - #### writeData

          public void writeData(java.io.DataOutput out)
                         throws java.io.IOException

      Writes this instance to a DataOutput.
      Parameters:
        `out` - the output to write to
      Throws:
        `java.io.IOException` - if something went wrong

    - #### readData

          public static Date readData(java.io.DataInput in)
                               throws java.io.IOException

      reads an instance from a DataInput.
      Parameters:
        `in` - the input to read from
      Returns:
        the new created instance
      Throws:
        `java.io.IOException` - if somethin went wrong

    - #### resetLocalizer

          public static void resetLocalizer()

TV-Browser 3.4.3, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)