|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.onebusaway.gtfs.model.calendar.ServiceDate
public class ServiceDate
A general representation of a year-month-day tuple not tied to any locale and
used by the GTFS entities ServiceCalendar and
ServiceCalendarDate to represent service date ranges. A service date
is a particular date when a particular GTFS service id is active.
| Constructor Summary | |
|---|---|
ServiceDate()
|
|
ServiceDate(java.util.Calendar calendar)
|
|
ServiceDate(java.util.Date date)
Construct a ServiceDate from the specified Date object, using the
default TimeZone object for the current VM to localize the date |
|
ServiceDate(int year,
int month,
int day)
Construct a new ServiceDate by specifying the numeric year, month, and day |
|
ServiceDate(ServiceDate o)
|
|
| Method Summary | |
|---|---|
int |
compareTo(ServiceDate o)
|
boolean |
equals(java.lang.Object obj)
|
java.util.Calendar |
getAsCalendar(java.util.TimeZone timeZone)
Constructs a Calendar object such that the Calendar will be at
"midnight" (12:00am) at the start of the day specified by this service date
and the target timezone. |
java.util.Date |
getAsDate()
|
java.util.Date |
getAsDate(java.util.TimeZone timeZone)
See getAsCalendar(TimeZone) for more details. |
java.lang.String |
getAsString()
|
int |
getDay()
|
int |
getMonth()
|
int |
getYear()
|
int |
hashCode()
|
static void |
moveCalendarToServiceDate(java.util.Calendar c)
Adjust the supplied Calendar object such that the calendar will be
at "midnight" (12:00am) at the start of the day specified by the current
calendar date and locale. |
ServiceDate |
next(java.util.TimeZone timeZone)
|
static ServiceDate |
parseString(java.lang.String value)
Parse a service date from a string in "YYYYMMDD" format. |
ServiceDate |
previous(java.util.TimeZone timeZone)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ServiceDate(int year,
int month,
int day)
year - - numeric year (ex. 2010)month - - numeric month of the year, where Jan = 1, Feb = 2, etcday - - numeric day of monthpublic ServiceDate(ServiceDate o)
public ServiceDate(java.util.Calendar calendar)
public ServiceDate(java.util.Date date)
Date object, using the
default TimeZone object for the current VM to localize the date
date - public ServiceDate()
| Method Detail |
|---|
public static ServiceDate parseString(java.lang.String value)
value - a string of the form "YYYYMMDD"
public int getYear()
public int getMonth()
public int getDay()
public java.util.Date getAsDate()
getAsDate(TimeZone) with the default timezone for
this VMpublic java.util.Calendar getAsCalendar(java.util.TimeZone timeZone)
Calendar object such that the Calendar will be at
"midnight" (12:00am) at the start of the day specified by this service date
and the target timezone. Note that we take the GTFS convention of
calculating midnight by setting the target date to noon (12:00pm) for the
service date and timezone specified and then subtracting twelve hours.
Normally that would be equivalent to midnight, except on Daylight Saving
Time days, in which case it can be an hour ahead or behind. This behavior
ensures correct calculation of StopTime arrival and departure time
when the second offset is added to the localized service date.
timeZone - the target timezone to localize the service date to
public java.util.Date getAsDate(java.util.TimeZone timeZone)
getAsCalendar(TimeZone) for more details.
timeZone - the target timezone to localize the service date to
public java.lang.String getAsString()
public ServiceDate next(java.util.TimeZone timeZone)
timeZone -
public ServiceDate previous(java.util.TimeZone timeZone)
timeZone -
public int compareTo(ServiceDate o)
compareTo in interface java.lang.Comparable<ServiceDate>public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic static void moveCalendarToServiceDate(java.util.Calendar c)
Calendar object such that the calendar will be
at "midnight" (12:00am) at the start of the day specified by the current
calendar date and locale. Note that we take the GTFS convention of
calculating midnight by setting the target date to noon (12:00pm) for the
service date and timezone specified and then subtracting twelve hours.
Normally that would be equivalent to midnight, except on Daylight Saving
Time days, in which case it can be an hour ahead or behind. This behavior
ensures correct calculation of StopTime arrival and departure time
when the second offset is added to the localized service date.
c - the target calendar, already to some time on the target date
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||