|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.pcauto.util.Quantity
com.pcauto.util.ElapsedTime
ElapsedTime
is used to store ElapsedTime
quantities. ElapsedTime
objects may be instantiated using
the ElapsedTimeFormat
class, or the ElapsedTime
constructor which is the difference of two input dates.
A set of arithmetic operations exists in order to compare, add and subtract
ElapsedTime
objects. All arithmetic operations have been
designed to be null
safe.
Field Summary | |
static ElapsedTime |
ZERO
Instance of ElapsedTime with zero value. |
Fields inherited from class com.pcauto.util.Quantity |
quantity, unit |
Constructor Summary | |
|
ElapsedTime(java.util.Date start,
java.util.Date end)
Creates new ElapsedTime as a difference between
start and end dates |
protected |
ElapsedTime(double quantity)
Creates new ElapsedTime with initial value of supplied
BigDecimal . |
Method Summary | |
ElapsedTime |
add(ElapsedTime quant)
Adds this ElapsedTime to the supplied
ElapsedTime . |
static ElapsedTime |
add(ElapsedTime a,
ElapsedTime b)
Adds supplied ElapsedTime to other supplied
ElapsedTime . |
static boolean |
areEqual(ElapsedTime quant1,
ElapsedTime quant2)
Determines if two supplied ElapsedTime objects are equal. |
java.lang.Object |
clone()
Creates new ElapsedTime identical to this
ElaspedTime . |
int |
compareTo(ElapsedTime quant)
Compares this ElapsedTime to the specified
ElapsedTime . |
boolean |
equals(ElapsedTime quant)
Compares this ElapsedTime to the specified
ElapsedTime . |
boolean |
greaterThan(ElapsedTime quant)
Compares this ElapsedTime to the specified
ElapsedTime . |
boolean |
lessThan(ElapsedTime quant)
Compares this ElapsedTime to the specified
ElapsedTime . |
ElapsedTime |
subtract(ElapsedTime quant)
Subtracts this ElapsedTime from supplied
ElapsedTime . |
java.lang.String |
toString()
Returns String representation of quantity of
ElapsedTime object. |
Methods inherited from class com.pcauto.util.Quantity |
add, add, areEqual, compareTo, compareTo, divide, equals, equals, getQuantity, getUnit, greaterThan, lessThan, myDivide, myMultiply, setQuantity, setUnit, setZERO, subtract |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final ElapsedTime ZERO
ElapsedTime
with zero value.
Constructor Detail |
protected ElapsedTime(double quantity)
ElapsedTime
with initial value of supplied
BigDecimal
.
quantity
- BigDecimal
public ElapsedTime(java.util.Date start, java.util.Date end)
ElapsedTime
as a difference between
start and end dates
start
- Date
end
- Date
Method Detail |
public java.lang.Object clone()
ElapsedTime
identical to this
ElaspedTime
.
clone
in class Quantity
ElapsedTime
objectpublic boolean equals(ElapsedTime quant)
this
ElapsedTime
to the specified
ElapsedTime
. The result is true
if and only
if the argument is not null
and is a ElapsedTime
object that has the same value. Different scales for the same value will
return false (e.g. 2.00 equals 2 returns false).
true
if times are equivalent;
false
othewise.public int compareTo(ElapsedTime quant)
this
ElapsedTime
to the specified
ElapsedTime
. Different scales for the same value will
return 0 (e.g. 2.00 compareTo 2 returns 0).
this
ElapsedTime
is larger.
-1 if this
ElapsedTime
is smaller.public boolean greaterThan(ElapsedTime quant)
this
ElapsedTime
to the specified
ElapsedTime
.
true
if this
is greater
than elt
; false
otherwisepublic boolean lessThan(ElapsedTime quant)
this
ElapsedTime
to the specified
ElapsedTime
.
true
if this
is
less than elt
; false
otherwisepublic static boolean areEqual(ElapsedTime quant1, ElapsedTime quant2)
ElapsedTime
objects are equal.
null
safe. Different scales for the same value will return
false (e.g. 2.00 areEqual 2 returns false).
true
if equal, false
otherwisepublic ElapsedTime add(ElapsedTime quant)
this
ElapsedTime
to the supplied
ElapsedTime
. null
parameter is considered equal
to ElapsedTime
with zero quantity.
ElapsedTime
object resulting from addition operationpublic static ElapsedTime add(ElapsedTime a, ElapsedTime b)
ElapsedTime
to other supplied
ElapsedTime
. null
parameter is considered equal
to ZERO ElapsedTime
zero quantity.
a
- first ElapsedTime
objectb
- second ElapsedTime
object
ElapsedTime
object resulting from addition of a and bpublic ElapsedTime subtract(ElapsedTime quant)
this
ElapsedTime
from supplied
ElapsedTime
. null
parameter is considered equal
to ElapsedTime
with zero quantity.
ElapsedTime
object resulting
from subtraction operationpublic java.lang.String toString()
String
representation of quantity of
ElapsedTime
object.
String
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |