com.supermap.data
Class TimeSpan
- java.lang.Object
-
- com.supermap.data.TimeSpan
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<TimeSpan>
public class TimeSpan extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<TimeSpan>
The time interval class.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description TimeSpan()
Constructs a new TimeSpan objectTimeSpan(int hours, int minutes, int seconds)
Initializes the TimeSpan object to a specified hours, minutes, and seconds.TimeSpan(int days, int hours, int minutes, int seconds)
Initializes the TimeSpan object to a specified days, hours, minutes, and seconds.TimeSpan(long milliseconds)
Initializes the TimeSpan object to a specified milliseconds.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
add(TimeSpan anotherTimeSpan)
Adds the input value of the TimeSpan object to the current TimeSpan object.java.util.Date
addToDate(java.util.Date date)
Returns a Date object.int
compareTo(TimeSpan anotherTimeSpan)
Compares the TimeSpan object with another specified TimeSpan object and returns an integer.boolean
equals(java.lang.Object object)
Determines whether the value of the TimeSpan object is equal to the value of the TimeSpan object.int
getDays()
Returns the days part of the time interval represented by the TimeSpan object.int
getHours()
Returns the hours part of the time interval represented by the TimeSpan object.int
getMinutes()
Returns the minutes part of the time interval represented by the TimeSpan object.int
getSeconds()
Returns the seconds part of the time interval represented by the TimeSpan object.long
getTimeSpan()
Returns the milliseconds part of the time interval represented by the TimeSpan object.int
getTotalHours()
Returns the value of whole hours of the TimeSpan objectint
getTotalMinutes()
Returns the value of whole minutes of the TimeSpan objectint
getTotalSeconds()
Returns the value of whole seconds of the TimeSpan objectint
hashCode()
void
setTimeSpan(long timeSpan)
Sets the milliseconds part of.the time interval represented by the TimeSpan object.
-
-
-
Constructor Detail
-
TimeSpan
public TimeSpan()
Constructs a new TimeSpan object
-
TimeSpan
public TimeSpan(long milliseconds)
Initializes the TimeSpan object to a specified milliseconds.- Parameters:
milliseconds
-
-
TimeSpan
public TimeSpan(int hours, int minutes, int seconds)
Initializes the TimeSpan object to a specified hours, minutes, and seconds.- Parameters:
hours
-minutes
-seconds
-
-
TimeSpan
public TimeSpan(int days, int hours, int minutes, int seconds)
Initializes the TimeSpan object to a specified days, hours, minutes, and seconds.- Parameters:
days
-hours
-minutes
-seconds
-
-
-
Method Detail
-
getTimeSpan
public long getTimeSpan()
Returns the milliseconds part of the time interval represented by the TimeSpan object.- Returns:
- Returns the milliseconds part of.the time interval represented by the TimeSpan object.
-
setTimeSpan
public void setTimeSpan(long timeSpan)
Sets the milliseconds part of.the time interval represented by the TimeSpan object.- Parameters:
timeSpan
- the specified milliseconds.
-
getDays
public int getDays()
Returns the days part of the time interval represented by the TimeSpan object.- Returns:
- Returns the days part of the time interval represented by the TimeSpan object.
-
getHours
public int getHours()
Returns the hours part of the time interval represented by the TimeSpan object.- Returns:
- Returns the hours part of the time interval represented by the TimeSpan object.
-
getTotalHours
public int getTotalHours()
Returns the value of whole hours of the TimeSpan object- Returns:
- Returns the value of whole hours of the TimeSpan object
-
getMinutes
public int getMinutes()
Returns the minutes part of the time interval represented by the TimeSpan object.- Returns:
- Returns the minutes of the time interval represented by the TimeSpan object.
-
getTotalMinutes
public int getTotalMinutes()
Returns the value of whole minutes of the TimeSpan object- Returns:
- Returns the value of the whole minutes of the TimeSpan object
-
getSeconds
public int getSeconds()
Returns the seconds part of the time interval represented by the TimeSpan object.- Returns:
- Returns the seconds part of the time interval represented by the TimeSpan object.
-
getTotalSeconds
public int getTotalSeconds()
Returns the value of whole seconds of the TimeSpan object- Returns:
- Returns the value of whole seconds of the TimeSpan object
-
compareTo
public int compareTo(TimeSpan anotherTimeSpan)
Compares the TimeSpan object with another specified TimeSpan object and returns an integer. The integer denotes the length of the current value is bigger, smaller, or equal to the specified TimeSpan object value.- Specified by:
compareTo
in interfacejava.lang.Comparable<TimeSpan>
-
addToDate
public java.util.Date addToDate(java.util.Date date)
Returns a Date object. The value is the sum of the current TimeSpan object and the input Date object.- Parameters:
date
- The specified Date object.- Returns:
- Returns a Date object. The value is the sum of the current TimeSpan object and the input Date object.
-
add
public void add(TimeSpan anotherTimeSpan)
Adds the input value of the TimeSpan object to the current TimeSpan object.- Parameters:
anotherTimeSpan
-
-
equals
public boolean equals(java.lang.Object object)
Determines whether the value of the TimeSpan object is equal to the value of the TimeSpan object.- Overrides:
equals
in classjava.lang.Object
- Parameters:
object
- - The specified TimeSpan object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-