Rule Execution Server API

ilog.rules.xml.types
Class IlrDuration

java.lang.Object
  extended by ilog.rules.xml.types.IlrDuration
All Implemented Interfaces:
Serializable

public class IlrDuration
extends Object
implements Serializable

This class represents a duration specified by the W3C recommendation (http://www.w3.org/TR/xmlschema-2/#duration).

See Also:
Serialized Form

Constructor Summary
IlrDuration()
          Build a null duration.
IlrDuration(boolean positive, short year, short month, short day, short hour, short minute, short second)
          Build a duration defined by year/month/day/hour/minute/second.
IlrDuration(String str)
          Build a duration from a string.
 
Method Summary
 int compareTo(IlrDuration date)
          Compare two durations.
 boolean equals(Object obj)
           
 short getDay()
          Get the day.
 short getHour()
          Get the hour.
 short getMinute()
          Get the minute.
 short getMonth()
          Get the month.
 short getSeconds()
          Get the second.
 short getYear()
          Get the year.
 boolean isEqual(IlrDuration d)
          Determine if two duration objects are equal.
 boolean isNegative()
          Determine if the duration is negative.
 boolean isPositive()
          Determine if the duration is positive.
static IlrDuration parse(String str)
          Create a duration from a string.
 void setDay(short day)
          Set the day.
 void setHour(short hour)
          Set the hour.
 void setMinute(short minute)
          Set the minute.
 void setMonth(short month)
          Set the month.
 void setSecond(short second)
          set the second.
 void setSign(boolean positive)
          Set the sign of the duration.
 void setValue(boolean isPositive, short year, short month, short day, short hour, short minute, short second)
          Set the duration.
 void setYear(short year)
          Set the year.
 String toString()
           
static IlrDuration valueOf(String str)
          Create a duration from a string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlrDuration

public IlrDuration()
Build a null duration.


IlrDuration

public IlrDuration(boolean positive,
                   short year,
                   short month,
                   short day,
                   short hour,
                   short minute,
                   short second)
Build a duration defined by year/month/day/hour/minute/second.


IlrDuration

public IlrDuration(String str)
            throws IlrDateFormatException
Build a duration from a string.

Throws:
IlrDateFormatException - when the string has an invalid format.
Method Detail

setYear

public void setYear(short year)
Set the year.


setMonth

public void setMonth(short month)
Set the month.


setDay

public void setDay(short day)
Set the day.


setHour

public void setHour(short hour)
Set the hour.


setMinute

public void setMinute(short minute)
Set the minute.


setSecond

public void setSecond(short second)
set the second.


setSign

public void setSign(boolean positive)
Set the sign of the duration.


setValue

public void setValue(boolean isPositive,
                     short year,
                     short month,
                     short day,
                     short hour,
                     short minute,
                     short second)
Set the duration.


getYear

public short getYear()
Get the year.


getMonth

public short getMonth()
Get the month.


getDay

public short getDay()
Get the day.


getHour

public short getHour()
Get the hour.


getMinute

public short getMinute()
Get the minute.


getSeconds

public short getSeconds()
Get the second.


isPositive

public boolean isPositive()
Determine if the duration is positive.


isNegative

public boolean isNegative()
Determine if the duration is negative.


toString

public String toString()
Overrides:
toString in class Object

isEqual

public boolean isEqual(IlrDuration d)
Determine if two duration objects are equal. Note that this comparison is not compliant with the W3C specification. It is equivalent to converting the IlrDate to Date and comparing them.


equals

public boolean equals(Object obj)
Overrides:
equals in class Object

compareTo

public int compareTo(IlrDuration date)
Compare two durations. Note that this comparison is not compliant with the W3C specification.

Returns:
EQUAL if equal, GREATER or LOWER, or NOT_COMPARABLE.

parse

public static IlrDuration parse(String str)
                         throws IlrDateFormatException
Create a duration from a string.

Throws:
IlrDateFormatException - when the string format is invalid.

valueOf

public static IlrDuration valueOf(String str)
Create a duration from a string.

Throws:
IlrDateFormatException - when the string format is invalid.

Rule Execution Server API

© Copyright IBM Corp. 1987, 2013