Rule Execution Server API

ilog.rules.xml.types
Class IlrDateTime

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

public class IlrDateTime
extends IlrTimeZone

This class represents the time as defined by its date and its time information. The dateTime built-in type is specified by the W3C XML Schema Recommendation (http://www.w3.org/TR/xmlschema-2/#dateTime).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class ilog.rules.xml.types.IlrTimeZone
EQUAL, GREATER, LOWER
 
Constructor Summary
IlrDateTime()
          Builds a dateTime structure without any time zone.
IlrDateTime(Date date)
          Build an instance from a date without any time zone.
IlrDateTime(Date date, TimeZone timeZone)
          Build an instance from a date and a time zone information.
IlrDateTime(long l)
          Builds an IlrDateTime from a long.
IlrDateTime(String str)
          Build an instance from a string.
 
Method Summary
 int compareTo(IlrDateTime date)
          Compares two dateTimes.
 boolean equals(Object obj)
           
 short getCentury()
          Get the century.
 short getDay()
          Get the day.
 short getHour()
          Get the hour.
 short getMillisecond()
          Get the remaining millisecond.
 short getMinute()
          Get the minute.
 short getMonth()
          Get the month of the date.
 short getSecond()
          Get the second.
 short getYear()
          Get the year.
 boolean isEqual(IlrDateTime dt)
          Determines if two dateTime objects are equal.
 boolean isPositive()
          Determines if the dateTime is positive.
static IlrDateTime parse(String str)
          Create an IlrDateTime from a string.
 void set(Date date)
          Set an instance from a date without time zone support.
 void set(Date date, TimeZone timeZone)
          Set an instance from a date and a time zone.
 void setDate(short century, short year, short month, short day)
          Sets the date part of an instance as century/year/month/day/.
 void setPositive(boolean positive)
          Sets as a positive dateTime.
 void setTime(short hour, short minute, short second, short millisecond)
          Sets the time part of a dateTime as hour/minute/second/millisecond.
 Date toDate()
          Converts the dateTime to a date instance.
 String toString()
           
static IlrDateTime valueOf(String str)
          Create an IlrDateTime from a string.
 
Methods inherited from class ilog.rules.xml.types.IlrTimeZone
formatToString, formatToString, getTimeZoneInMillis, getZoneHour, getZoneMinute, isEqual, isUTC, isZonePositive, setTimeZone, setTimeZoneInMillis, setUTC, toTimeZone, unsetUTC
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlrDateTime

public IlrDateTime()
Builds a dateTime structure without any time zone.


IlrDateTime

public IlrDateTime(long l)
Builds an IlrDateTime from a long.

Parameters:
l - The long parameter

IlrDateTime

public IlrDateTime(Date date)
Build an instance from a date without any time zone.


IlrDateTime

public IlrDateTime(Date date,
                   TimeZone timeZone)
Build an instance from a date and a time zone information.


IlrDateTime

public IlrDateTime(String str)
            throws IlrDateFormatException
Build an instance from a string.

Throws:
IlrDateFormatException - raised when the string format is invalid.
Method Detail

set

public void set(Date date)
Set an instance from a date without time zone support.


set

public void set(Date date,
                TimeZone timeZone)
Set an instance from a date and a time zone.


setPositive

public void setPositive(boolean positive)
Sets as a positive dateTime.


setDate

public void setDate(short century,
                    short year,
                    short month,
                    short day)
Sets the date part of an instance as century/year/month/day/. All the fields must be positive.


setTime

public void setTime(short hour,
                    short minute,
                    short second,
                    short millisecond)
Sets the time part of a dateTime as hour/minute/second/millisecond. All the fields must be positive.


isPositive

public boolean isPositive()
Determines if the dateTime is positive.


getCentury

public short getCentury()
Get the century. As an example, the century of 1914 is 19.


getYear

public short getYear()
Get the year. As an example, the year of 1914 is 14.


getMonth

public short getMonth()
Get the month of the date.


getDay

public short getDay()
Get the day.


getHour

public short getHour()
Get the hour.


getMinute

public short getMinute()
Get the minute.


getSecond

public short getSecond()
Get the second.


getMillisecond

public short getMillisecond()
Get the remaining millisecond.


toDate

public Date toDate()
            throws IlrDateFormatException
Converts the dateTime to a date instance.

Throws:
IlrDateFormatException

toString

public String toString()
Overrides:
toString in class IlrTimeZone

isEqual

public boolean isEqual(IlrDateTime dt)
Determines if two dateTime objects are equal. Note that this comparison is not compliant with the W3C specification. It is equivalent to converting the IlrDateTime to Date and comparing them.


equals

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

compareTo

public int compareTo(IlrDateTime date)
Compares two dateTimes. Note that this comparison is not compliant with the W3C specification.

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

parse

public static IlrDateTime parse(String str)
                         throws IlrDateFormatException
Create an IlrDateTime from a string.

Throws:
IlrDateFormatException - when the format is not valid.

valueOf

public static IlrDateTime valueOf(String str)
Create an IlrDateTime from a string.

Throws:
IlrDateFormatException - when the format is not valid.

Rule Execution Server API

© Copyright IBM Corp. 1987, 2013