AR System Java API

com.bmc.arsys.api
Class DateInfo

java.lang.Object
  extended by com.bmc.arsys.api.DateInfo
All Implemented Interfaces:
Serializable, Cloneable

public class DateInfo
extends Object
implements Cloneable, Serializable

The DateInfo class represents the days elapsed since January 1, 4713 B.C.

See Also:
Serialized Form

Constructor Summary
DateInfo()
          construct an empty DateInfo object
DateInfo(int num_of_days)
          Construct a DateInfo object using the Julian day, which is the number of days that have elapsed since January 1, 4713 B.C.
DateInfo(int year, int month, int day)
          Construct a DateInfo with the year, month and day info provided
DateInfo(String num_of_days)
          Construct a DateInfo object using the string representation of the number of days since January 1, 4713 B.C.
 
Method Summary
 Object clone()
          Clone implementation that returns an Object with data cloned from self.
static int dateToJulianDate(int year, int month, int day)
          convert the given year, month and day info into Julian Date
static int dateToJulianDate(String pattern, String date_str)
          convert the given date string into Julian Date
 boolean equals(Object obj)
          Use this method for checking equality between the current object and the provided one.
 GregorianCalendar GetDate()
          Return GregorianCalendar date for the current DateInfo object.
 int getValue()
          Returns the number of days since January 1, 4713 B.C.
 int hashCode()
          Returns the hash code value for this instance of the current class.
 void setDate(int year, int month, int day)
          Set the date with the year, month and day info provided
 void setValue(DateInfo dt)
          Sets the date using the given DateInfo object.
 void setValue(int num_of_days)
          Sets the number of days since January 1, 4713 B.C.
 String toString()
          Returns a string description of the object.
 boolean validateDate()
          Checks whether this date is a valid date or not.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateInfo

public DateInfo()
construct an empty DateInfo object


DateInfo

public DateInfo(int num_of_days)
Construct a DateInfo object using the Julian day, which is the number of days that have elapsed since January 1, 4713 B.C.

Parameters:
num_of_days -

DateInfo

public DateInfo(String num_of_days)
Construct a DateInfo object using the string representation of the number of days since January 1, 4713 B.C.

Parameters:
num_of_days -

DateInfo

public DateInfo(int year,
                int month,
                int day)
Construct a DateInfo with the year, month and day info provided

Parameters:
year - the year
month - the month
day - the day
Method Detail

setValue

public void setValue(int num_of_days)
Sets the number of days since January 1, 4713 B.C.


setValue

public void setValue(DateInfo dt)
Sets the date using the given DateInfo object.


getValue

public int getValue()
Returns the number of days since January 1, 4713 B.C.


equals

public boolean equals(Object obj)
Use this method for checking equality between the current object and the provided one. The result is true only if the argument is not null, is of the same type and represents the same content.

Overrides:
equals in class Object
Parameters:
obj - the object that we are comparing to
Returns:
returns a boolean that tells if the two objects equal

clone

public Object clone()
             throws CloneNotSupportedException
Clone implementation that returns an Object with data cloned from self.

Overrides:
clone in class Object
Throws:
CloneNotSupportedException

toString

public String toString()
Returns a string description of the object.

Overrides:
toString in class Object

GetDate

public GregorianCalendar GetDate()
Return GregorianCalendar date for the current DateInfo object. The detail of GregorianCalendar can be found in java.util.GregorianCalendar


setDate

public void setDate(int year,
                    int month,
                    int day)
Set the date with the year, month and day info provided


validateDate

public boolean validateDate()
Checks whether this date is a valid date or not.


dateToJulianDate

public static int dateToJulianDate(int year,
                                   int month,
                                   int day)
convert the given year, month and day info into Julian Date

Parameters:
year - the year
month - the month
day - the day
Returns:
the Julian date (the integer number of days that have elapsed since January 1, 4713 BC)

dateToJulianDate

public static int dateToJulianDate(String pattern,
                                   String date_str)
                            throws ARException
convert the given date string into Julian Date

Parameters:
pattern - the pattern describing the date format
date_str - the date string in the pattern specified above
Returns:
the Julian date (the integer number of days that have elapsed since January 1, 4713 BC)
Throws:
ARException

hashCode

public int hashCode()
Returns the hash code value for this instance of the current class. This method is supported as required by the general contract of Object.hashCode, for the benefit of hash tables such as those provided by java.util.Hashtable.

Overrides:
hashCode in class Object
Returns:
returns the hash code for this instance

AR System Java API

© Copyright 2006, 2007 BMC Software, Inc.