|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectworld.TravelTime
A class providing API for the time manipulations and counting a time of journey.
Field Summary | |
private static double |
AIRPLANE_SPEED
A speed of an airplane in units per minute. |
private static double |
BUS_SPEED
A speed of a bus in units per minute. |
private static double |
SHIP_SPEED
A speed of a ship in units per minute. |
private static double |
TRAIN_SPEED
A speed of a train in units per minute. |
Constructor Summary | |
TravelTime()
|
Method Summary | |
static int |
GetChangeTime(int meanOfTransportation)
Provides a time of change for the given mean of transportation. |
static int |
GetDatesDifference(java.util.Date dateA,
java.util.Date dateB)
Gets a difference of two dates in minutes. |
static java.lang.String |
GetShiftTime(int time)
Converts the given time in minutes to the `+hh:mm' format. |
static java.lang.String |
GetTime(int time)
Converts the given time in minutes since midnight to the `hh:mm' format. |
static int |
GetTimeSinceSunday(char dayOfWeek,
int dayTime)
Gets a time in minutes since Sunday 00:00. |
static java.util.ArrayList |
GetTimesPerDay(int startTime,
int repetitionTime,
int lowerLimit,
int upperLimit)
Gets a list of times of runs for a connection with the given start time of one of its runs and repetition time. |
static int |
GetTravelTime(Location x,
Location y,
int meanOfTransportation)
Counts a time of travel between two points using the given mean of transportation. |
static java.lang.String |
MinutesToString(int minutes)
Converts the given number of minutes into (dd days)(hh:)mm format. |
static int |
ParseDuration(java.lang.String time)
Converts the `+hh:mm' or `hh:mm' or `mm' to the duration time in minutes. |
static int |
ParseTime(java.lang.String time)
Converts the `hh:mm' or `mm' to the time in minutes. |
static void |
ShiftDate(java.util.Date date,
int minutes)
Shifts the given date by the given number of minutes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final double AIRPLANE_SPEED
private static final double TRAIN_SPEED
private static final double BUS_SPEED
private static final double SHIP_SPEED
Constructor Detail |
public TravelTime()
Method Detail |
public static int GetTravelTime(Location x, Location y, int meanOfTransportation)
x
- The starting point of travel.y
- The end poinf of th travel.meanOfTransportation
- A mean of transportation. This is required only to count the default times of travel.
MeanOfTransportation.AIRPLANE
,
MeanOfTransportation.BUS
,
MeanOfTransportation.TRAIN
,
MeanOfTransportation.SHIP
public static int GetChangeTime(int meanOfTransportation)
meanOfTransportation
- A mean of transportation. This is required only to count the default times of travel.
MeanOfTransportation.AIRPLANE
,
MeanOfTransportation.BUS
,
MeanOfTransportation.TRAIN
,
MeanOfTransportation.SHIP
public static java.lang.String GetShiftTime(int time)
time
- Duration in minutes.
public static java.lang.String GetTime(int time)
time
- Time in minutes.
public static int ParseDuration(java.lang.String time) throws java.text.ParseException
time
- A string to be converted.
java.text.ParseException
- Thrown if the given time string is not well formated.public static int ParseTime(java.lang.String time) throws java.text.ParseException
time
- A string to be converted.
java.text.ParseException
- Thrown if the given time string is not well formated.public static java.util.ArrayList GetTimesPerDay(int startTime, int repetitionTime, int lowerLimit, int upperLimit)
startTime
- A time one of the runs for the connection starts at (in minutes since midnight).repetitionTime
- A time between runs for the connection (in minutes).lowerLimit
- A lower limit of repetitions (in minutes since midnight).upperLimit
- An upper limit of repetitions (in minutes since midnight).
public static int GetTimeSinceSunday(char dayOfWeek, int dayTime)
dayOfWeek
- A day of week the reference point is on.dayTime
- A time in minutes since midnight on the given day of week.S
public static void ShiftDate(java.util.Date date, int minutes)
date
- A date to be shifted.minutes
- A number of minutes to shift the date by.public static int GetDatesDifference(java.util.Date dateA, java.util.Date dateB)
dateA
- First of the dates to be compared.dateB
- Second of the dates to be compared. Must not be earlier then the date A.
public static java.lang.String MinutesToString(int minutes)
minutes
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |