|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.cip4.jdflib.util.JDFDuration
public class JDFDuration
| Field Summary | |
|---|---|
private double |
m_lDuration
|
private static java.lang.String |
REGEX_DURATION
|
private static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
JDFDuration()
Allocates a JDFDuration object and initializes it with 0 |
|
JDFDuration(double s)
Allocates a JDFDuration object and initializes it with 's' |
|
JDFDuration(int s)
Allocates a JDFDuration object and initializes it with 's' |
|
JDFDuration(JDFDate start,
JDFDate end)
creates a duration from two dates; may be negative if start later end |
|
JDFDuration(JDFDuration d)
Makes a copy of the JDFDuration object 'd' |
|
JDFDuration(java.lang.String strDuration)
Allocates a JDFDuration object and initializes it with a value of strDuration, represented as a formatted duration string. |
|
| Method Summary | |
|---|---|
double |
addSeconds(double seconds)
add seconds to a duration |
int |
compareTo(JDFDuration arg0)
|
boolean |
equals(java.lang.Object other)
Compares two JDFDuration objects for equality. The result is true if and only if the argument is not null and is a JDFDuration object that represents the same
duration, as this object. |
int |
getDuration()
the duration in seconds |
java.lang.String |
getDurationISO()
Format and return the duration set by 'setDuration(int i)' or 'setDurationString(String a_aDuration)' as an ISO conforming String. For example: 'P1Y2M3DT10H30M' |
int |
hashCode()
hashCode: complements equals() to fulfill the equals/hashCode contract |
private void |
init(java.lang.String strDuration)
Method init handles Strings of type: "P1Y2M3DT10H30M" "PM8T12M" "PT30M" "PT30M40S" "PT30M40.3333S" |
boolean |
isLonger(JDFDuration x)
isLess - tests if the duration of this JDFDuration is longer than the duration of the specified JDFDuration. |
boolean |
isShorter(JDFDuration x)
isShorter - tests if the duration of this JDFDuration is less than the duration of the specified JDFDuration. |
void |
setDuration(double seconds)
setDuration: sets a duration for this in seconds, including fractions. |
void |
setDuration(int seconds)
setDuration: sets a duration for this in seconds. |
boolean |
setDurationISO(java.lang.String a_aDuration)
Set a duration. |
java.lang.String |
toString()
for debug purposes |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private double m_lDuration
private static final java.lang.String REGEX_DURATION
| Constructor Detail |
|---|
public JDFDuration()
JDFDuration object and initializes it with 0
public JDFDuration(JDFDuration d)
JDFDuration object 'd'
d - the duration
public JDFDuration(JDFDate start,
JDFDate end)
start - the starting pointend - the end pointpublic JDFDuration(double s)
JDFDuration object and initializes it with 's'
s - duration in seconds s may be fractionalpublic JDFDuration(int s)
JDFDuration object and initializes it with 's'
s - duration in seconds s may be fractional
public JDFDuration(java.lang.String strDuration)
throws java.util.zip.DataFormatException
JDFDuration object and initializes it with a value of strDuration, represented as a formatted duration string.
strDuration - - formatted duration
java.util.zip.DataFormatException - if strDuration is not a valid string representation of JDFDuration| Method Detail |
|---|
public double addSeconds(double seconds)
seconds - number of seconds to add
public java.lang.String toString()
toString in class java.lang.Object
private void init(java.lang.String strDuration)
throws java.util.zip.DataFormatException
strDuration -
java.util.zip.DataFormatExceptionpublic java.lang.String getDurationISO()
public boolean setDurationISO(java.lang.String a_aDuration)
a_aDuration - formatted duration string 'P1Y2M3DT10H30M'
public void setDuration(int seconds)
this in seconds. This duration is used in multiple classes of the JDF (e.g. Heating time).
seconds - the duration in seconds.public void setDuration(double seconds)
this in seconds, including fractions. This duration is used in multiple classes of the JDF (e.g. Heating
time).
seconds - the duration in seconds.public int getDuration()
public boolean isLonger(JDFDuration x)
x - the JDFDuration object to compare to this
public boolean isShorter(JDFDuration x)
x - the JDFDuration object to compare to this
public boolean equals(java.lang.Object other)
true if and only if the argument is not null and is a JDFDuration object that represents the same
duration, as this object.
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic int compareTo(JDFDuration arg0)
compareTo in interface java.lang.Comparable<JDFDuration>arg0 -
Comparable.compareTo(java.lang.Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||