|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmicrosoft.exchange.webservices.data.TimeSpan
public class TimeSpan
The Class TimeSpan.
Field Summary | |
---|---|
static int |
DAYS
Constant for days unit and conversion. |
static int |
HOURS
Constant for hours unit and conversion. |
static TimeSpan |
MAX_VALUE
Represents the Maximum TimeSpan value. |
static int |
MILLISECONDS
Constant for milliseconds unit and conversion. |
static TimeSpan |
MIN_VALUE
Represents the Minimum TimeSpan value. |
static int |
MINUTES
Constant for minutes unit and conversion. |
static int |
SECONDS
Constant for seconds unit and conversion. |
static TimeSpan |
ZERO
Represents the TimeSpan with a value of zero. |
Constructor Summary | |
---|---|
TimeSpan(int units,
long value)
Creates a new TimeSpan object based on the unit and value entered. |
|
TimeSpan(long time)
Creates a new instance of TimeSpan based on the number of milliseconds entered. |
Method Summary | |
---|---|
void |
add(int units,
long value)
Adds a number of units to this TimeSpan. |
void |
add(TimeSpan timespan)
Adds a TimeSpan to this TimeSpan. |
java.lang.Object |
clone()
Returns a clone of this TimeSpan. |
static int |
compare(TimeSpan first,
TimeSpan second)
Compares two TimeSpan objects. |
int |
compareTo(java.lang.Object o)
Compares this object with the specified object for order. |
TimeSpan |
duration()
Returns a TimeSpan whose value is the absolute value of this TimeSpan. |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one. |
long |
getDays()
Gets the number of days (truncated). |
long |
getHours()
Gets the number of hours (truncated). |
long |
getMilliseconds()
Gets the number of milliseconds. |
long |
getMinutes()
Gets the number of minutes (truncated). |
long |
getSeconds()
Gets the number of seconds (truncated). |
double |
getTotalDays()
Gets the number of days including fractional days. |
double |
getTotalHours()
Gets the number of hours including fractional hours. |
long |
getTotalMilliseconds()
Gets the number of milliseconds. |
double |
getTotalMinutes()
Gets the number of minutes including fractional minutes. |
double |
getTotalSeconds()
Gets the number of seconds including fractional seconds. |
int |
hashCode()
Returns a hash code value for the object. |
boolean |
isNegative()
Indicates whether the value of the TimeSpan is negative. |
boolean |
isPositive()
Indicates whether the value of the TimeSpan is positive. |
boolean |
isZero()
Indicates whether the value of the TimeSpan is zero. |
TimeSpan |
negate()
Returns a TimeSpan whose value is the negated value of this TimeSpan. |
static TimeSpan |
parse(java.lang.String s)
|
static TimeSpan |
subtract(java.util.Date date1,
java.util.Date date2)
Subtracts two Date objects creating a new TimeSpan object. |
void |
subtract(int units,
long value)
Subtracts a number of units from this TimeSpan. |
void |
subtract(TimeSpan timespan)
Subtracts a TimeSpan from this TimeSpan. |
java.lang.String |
toString()
Returns a string representation of the object in the format. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MILLISECONDS
public static final int SECONDS
public static final int MINUTES
public static final int HOURS
public static final int DAYS
public static final TimeSpan MAX_VALUE
public static final TimeSpan MIN_VALUE
public static final TimeSpan ZERO
Constructor Detail |
---|
public TimeSpan(long time)
time
- the number of milliseconds for this TimeSpan.public TimeSpan(int units, long value)
units
- the type of unit to use to create a TimeSpan instance.value
- the number of units to use to create a TimeSpan instance.Method Detail |
---|
public static TimeSpan subtract(java.util.Date date1, java.util.Date date2)
date1
- Date to use as the base value.date2
- Date to subtract from the base value.
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
o
- the Object to be compared.
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to compare.
public int hashCode()
java.util.Hashtable
. The method uses the same algorithm as
found in the Long class.
hashCode
in class java.lang.Object
Object.equals(java.lang.Object)
,
Hashtable
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object
public boolean isPositive()
public boolean isNegative()
public boolean isZero()
public long getMilliseconds()
public long getTotalMilliseconds()
public long getSeconds()
public double getTotalSeconds()
public long getMinutes()
public double getTotalMinutes()
public long getHours()
public double getTotalHours()
public long getDays()
public double getTotalDays()
public void add(TimeSpan timespan)
timespan
- the TimeSpan to add to this TimeSpan.public void add(int units, long value)
units
- the type of unit to add to this TimeSpan.value
- the number of units to add to this TimeSpan.public static int compare(TimeSpan first, TimeSpan second)
first
- first TimeSpan to use in the compare.second
- second TimeSpan to use in the compare.
public TimeSpan duration()
public TimeSpan negate()
public void subtract(TimeSpan timespan)
timespan
- the TimeSpan to subtract from this TimeSpan.public void subtract(int units, long value)
units
- the type of unit to subtract from this TimeSpan.value
- the number of units to subtract from this TimeSpan.public static TimeSpan parse(java.lang.String s) throws java.lang.Exception
java.lang.Exception
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |