|
||||||||||
| 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
| 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(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)
|
static JDFDuration |
createDuration(String duration)
does some heuristics to create a duration if duration is purely numeric, we guess days |
boolean |
equals(Object other)
Compares two JDFDuration objects for equality. |
int |
getDuration()
the duration in seconds |
String |
getDurationISO()
Format and return the duration set by 'setDuration(int i)' or 'setDurationString(String a_aDuration)' as an ISO conforming String. |
int |
hashCode()
hashCode: complements equals() to fulfill the equals/hashCode contract |
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(String a_aDuration)
Set a duration. |
String |
toString()
for debug purposes |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| 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(String strDuration)
throws DataFormatException
JDFDuration object and initializes it with a value of strDuration, represented as a formatted duration string.
strDuration - - formatted duration
DataFormatException - if strDuration is not a valid string representation of JDFDuration| Method Detail |
|---|
public static JDFDuration createDuration(String duration)
duration -
public double addSeconds(double seconds)
seconds - number of seconds to add
public String toString()
toString in class Objectpublic String getDurationISO()
public boolean setDurationISO(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(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 Objectpublic int hashCode()
hashCode in class Objectpublic int compareTo(JDFDuration arg0)
compareTo in interface Comparable<JDFDuration>arg0 -
Comparable.compareTo(java.lang.Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||