org.sblim.wbem.cim

Class CIMDateTime

Implemented Interfaces:
Cloneable, Serializable
Known Direct Subclasses:
CIMSimpleDateTime, CIMTimeInterval

public class CIMDateTime
extends java.lang.Object
implements Serializable, Cloneable

CIMDateTime.java (C) Copyright IBM Corp. 2005, 2006 THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. You can obtain a current copy of the Common Public License from http://www.opensource.org/licenses/cpl1.0.php

Field Summary

static int
DAY_PRESICION
static int
FULL_PRESICION
static int
HOUR_PRESICION
static int
MILLI_FIVE_DIGIT_PRESICION
static int
MILLI_FOUR_DIGIT_PRESICION
static int
MILLI_ONE_DIGIT_PRESICION
static int
MILLI_SIX_DIGIT_PRESICION
static int
MILLI_THREE_DIGIT_PRESICION
static int
MILLI_TWO_DIGIT_PRESICION
static int
MINUTE_PRESICION
static int
MONTH_PRESICION
static int
SECOND_PRESICION
static int
YEAR_PRESICION
protected Calendar
iCalendar
protected String
iDateString
protected int
iDay
protected int
iHour
protected boolean
iInterval
protected int
iMicrosecond
protected int
iMillisecond
protected int
iMinute
protected int
iMonth
protected int
iOffsetMinute
protected int
iPresicion
protected int
iSecond
protected int
iYear

Constructor Summary

CIMDateTime()
CIMDateTime(Calendar pCalendar)
Deprecated. this constructor was marked as deprecated because the dual nature of this object.
CIMDateTime(String pDateString)
Deprecated. this constructor was marked as deprecated because the dual nature of this object.

Method Summary

boolean
after(CIMDateTime pThat)
Determines if the current date time ocurrs after the date type from the specified object.
boolean
before(CIMDateTime pThat)
Determines if the current date time ocurrs after the date type from the specified object.
Object
clone()
protected CIMDateTime
clone(CIMDateTime pClone)
boolean
equals(Object o)
Calendar
getCalendar()
Returns a calendar representation of this object.
int
getDay()
Gets the number of days specified for this CIMDateTime.
int
getHour()
Gets the number of hours specified for this CIMDateTime.
int
getMicrosecond()
Gets the number of microseconds specified for this CIMDateTime.
int
getMillisecodsPresicion()
Returns the number of presicion digits defined for milliseconds.
int
getMillisecond()
Gets the number of milliseconds specified for this CIMDateTime.
int
getMinute()
Gets the number of minutes specified for this CIMDateTime.
int
getOffsetMinute()
Gets the number of offset minutes specified for this CIMDateTime.
int
getPresicion()
Gets the presicion level of this CIMDateTime.
int
getSeconds()
Gets the number of seconds specified for this CIMDateTime.
int
hashCode()
boolean
isDayPresicion()
Determines if this CIMDateTime has day presicion.
boolean
isHourPresicion()
Determines if this CIMDateTime has houre presicion.
boolean
isInterval()
Determines if the current object is represents an interval.
boolean
isMinutePresicion()
Determines if this CIMDateTime has minute presicion.
boolean
isMonthPresicion()
Determines if this CIMDateTime has month presicion.
boolean
isSecondPresicion()
Determines if this CIMDateTime has minute presicion.
boolean
isYearPresicion()
Determines if this CIMDateTime has year presicion.
static void
main(String[] args)
void
setHour(int pHour)
Specifies the number of hours for this CIMDateTime.
void
setMicroseconds(int pMicrosecond)
Gets the number of microseconds specified this CIMDateTime.
void
setMilliseconds(int pMillisecond)
Gets the number of milliseconds specified this CIMDateTime.
void
setMinute(int pMinute)
Specifies the number of minutes for this CIMDateTime.
void
setOffsetMinute(int pOffsetMinutes)
Sets the number of offset minutes associated with this CIMDateTime.
void
setPresicion(int pPrecision)
Specifies the presicion level for this CIMDateTime.
void
setSecond(int pSecond)
Sets the number of seconds for this CIMDateTime.
protected String
starPadding(int pDigits)
String
toMOF()
Returns the MOF representation of this object.
String
toString()
static CIMDateTime
valueOf(String pDateString)
Creates an CIMDateTime object from the specified String argument.
protected static CIMDateTime
valueOf(CIMDateTime pDatetime, String pDateString)
protected String
zeroPadding(int pValue, int pDigits)

Field Details

DAY_PRESICION

public static final int DAY_PRESICION
Field Value:
2

FULL_PRESICION

public static final int FULL_PRESICION
Field Value:
12

HOUR_PRESICION

public static final int HOUR_PRESICION
Field Value:
3

MILLI_FIVE_DIGIT_PRESICION

public static final int MILLI_FIVE_DIGIT_PRESICION
Field Value:
10

MILLI_FOUR_DIGIT_PRESICION

public static final int MILLI_FOUR_DIGIT_PRESICION
Field Value:
9

MILLI_ONE_DIGIT_PRESICION

public static final int MILLI_ONE_DIGIT_PRESICION
Field Value:
6

MILLI_SIX_DIGIT_PRESICION

public static final int MILLI_SIX_DIGIT_PRESICION
Field Value:
11

MILLI_THREE_DIGIT_PRESICION

public static final int MILLI_THREE_DIGIT_PRESICION
Field Value:
8

MILLI_TWO_DIGIT_PRESICION

public static final int MILLI_TWO_DIGIT_PRESICION
Field Value:
7

MINUTE_PRESICION

public static final int MINUTE_PRESICION
Field Value:
4

MONTH_PRESICION

public static final int MONTH_PRESICION
Field Value:
1

SECOND_PRESICION

public static final int SECOND_PRESICION
Field Value:
5

YEAR_PRESICION

public static final int YEAR_PRESICION
Field Value:
0

iCalendar

protected Calendar iCalendar

iDateString

protected String iDateString

iDay

protected int iDay

iHour

protected int iHour

iInterval

protected boolean iInterval

iMicrosecond

protected int iMicrosecond

iMillisecond

protected int iMillisecond

iMinute

protected int iMinute

iMonth

protected int iMonth

iOffsetMinute

protected int iOffsetMinute

iPresicion

protected int iPresicion

iSecond

protected int iSecond

iYear

protected int iYear

Constructor Details

CIMDateTime

protected CIMDateTime()

CIMDateTime

public CIMDateTime(Calendar pCalendar)

Deprecated. this constructor was marked as deprecated because the dual nature of this object. This object was used to represent point in time, as well as intervals. Instead of this constructor applications are encourage to use correspoding objects such as CIMDateTime, or CIMSimpleDateTime.

Construct an object of a CIMDateTime given a calendar.
Parameters:
pCalendar - The calendar

CIMDateTime

public CIMDateTime(String pDateString)

Deprecated. this constructor was marked as deprecated because the dual nature of this object. This object was used to represent point in time, as well as intervals. Instead of this constructor applications are encourage to use correspoding objects such as CIMTimeInterval, or CIMSimpleDateTime.

Creates an object of a CIMDateTime.
Parameters:
pDateString - A string representation of a datetime

Method Details

after

public boolean after(CIMDateTime pThat)
Determines if the current date time ocurrs after the date type from the specified object. Comparison of CIMSimpleDateTime and CIMIntervalTime are meaningless, for this reason always return false.
Parameters:
pThat - The datetime to compare with
Returns:
true if this occurs after pThat, false otherwise

before

public boolean before(CIMDateTime pThat)
Determines if the current date time ocurrs after the date type from the specified object.
Parameters:
pThat - The datetime to compare with
Returns:
true if this occurs before pThat, false otherwise

clone

public Object clone()

clone

protected CIMDateTime clone(CIMDateTime pClone)

equals

public boolean equals(Object o)

getCalendar

public Calendar getCalendar()
Returns a calendar representation of this object. If the object represent an interval, this method returns null.
Returns:
The calendar representation

getDay

public int getDay()
Gets the number of days specified for this CIMDateTime.
Returns:
The day

getHour

public int getHour()
Gets the number of hours specified for this CIMDateTime.
Returns:
The hours

getMicrosecond

public int getMicrosecond()
Gets the number of microseconds specified for this CIMDateTime.
Returns:
The microsenconds

getMillisecodsPresicion

public int getMillisecodsPresicion()
Returns the number of presicion digits defined for milliseconds. For instance, "19981207102059.10****-000" has 2 digits of presicion. "19981207102059.1*****-000" has 1 digit of presicion, and "199812071020**.******-000" has 0 digits of presicion.
Returns:
an integer representing the number of presicion digits for the milliseconds.

getMillisecond

public int getMillisecond()
Gets the number of milliseconds specified for this CIMDateTime.
Returns:
The milliseconds

getMinute

public int getMinute()
Gets the number of minutes specified for this CIMDateTime.
Returns:
The minutes

getOffsetMinute

public int getOffsetMinute()
Gets the number of offset minutes specified for this CIMDateTime.
Returns:
The offset minutes

getPresicion

public int getPresicion()
Gets the presicion level of this CIMDateTime.
Returns:
an integer value representing the precision level for this object.

getSeconds

public int getSeconds()
Gets the number of seconds specified for this CIMDateTime.
Returns:
The seconds

hashCode

public int hashCode()

isDayPresicion

public boolean isDayPresicion()
Determines if this CIMDateTime has day presicion.
Returns:
true if this CIMDateTime has day presicion, otherwise returns false.

isHourPresicion

public boolean isHourPresicion()
Determines if this CIMDateTime has houre presicion.
Returns:
true if this CIMDateTime has hour presicion, otherwise returns false.

isInterval

public boolean isInterval()
Determines if the current object is represents an interval.
Returns:
returns true if the datetime is an interval, otherwise returns false.

isMinutePresicion

public boolean isMinutePresicion()
Determines if this CIMDateTime has minute presicion.
Returns:
true if this CIMDateTime has month presicion, otherwise returns false.

isMonthPresicion

public boolean isMonthPresicion()
Determines if this CIMDateTime has month presicion.
Returns:
true if this CIMDateTime has month presicion, otherwise returns false.

isSecondPresicion

public boolean isSecondPresicion()
Determines if this CIMDateTime has minute presicion.
Returns:
true if this CIMDateTime has month presicion, otherwise returns false.

isYearPresicion

public boolean isYearPresicion()
Determines if this CIMDateTime has year presicion.
Returns:
true if this CIMDateTime has year presicion, otherwise returns false.

main

public static void main(String[] args)

setHour

public void setHour(int pHour)
Specifies the number of hours for this CIMDateTime.
Parameters:
pHour - The hour

setMicroseconds

public void setMicroseconds(int pMicrosecond)
Gets the number of microseconds specified this CIMDateTime.
Parameters:
pMicrosecond - The microsenconds

setMilliseconds

public void setMilliseconds(int pMillisecond)
Gets the number of milliseconds specified this CIMDateTime.
Parameters:
pMillisecond - The milliseconds

setMinute

public void setMinute(int pMinute)
Specifies the number of minutes for this CIMDateTime.
Parameters:
pMinute - The minutes

setOffsetMinute

public void setOffsetMinute(int pOffsetMinutes)
Sets the number of offset minutes associated with this CIMDateTime.
Parameters:
pOffsetMinutes - an integer value which species the number of offset minutes.

setPresicion

public void setPresicion(int pPrecision)
Specifies the presicion level for this CIMDateTime. The default value for this object is FULL_PRESICION.
Parameters:
pPrecision - specifies the presicion level for this object.

setSecond

public void setSecond(int pSecond)
Sets the number of seconds for this CIMDateTime.
Parameters:
pSecond - integer value which species the number of seconds.

starPadding

protected String starPadding(int pDigits)

toMOF

public String toMOF()
Returns the MOF representation of this object.
Returns:
The MOF representation

toString

public String toString()

valueOf

public static CIMDateTime valueOf(String pDateString)
Creates an CIMDateTime object from the specified String argument. This method returns a CIMSimpleDateTime or a CIMDateTime, depending on what type of CIMDataType is denoted by the string argument.
Parameters:
pDateString - The date string to parse
Returns:
a CIMDateTime or CIMSimpleDateTime object

valueOf

protected static CIMDateTime valueOf(CIMDateTime pDatetime,
                                     String pDateString)

zeroPadding

protected String zeroPadding(int pValue,
                             int pDigits)

Copyright © 2005, 2007 IBM Corporation. All Rights Reserved.