com.novell.service.nds
Class NdsTime

java.lang.Object
  |
  +--com.novell.service.nds.NdsInteger
        |
        +--com.novell.service.nds.NdsTime

public class NdsTime
extends NdsInteger
implements NdsAttributeValue, java.lang.Cloneable, java.io.Serializable

Provides access to values of the Time attribute. It is used for attributes whose values represent time. A Time value consists of a whole number of seconds, where zero equals 12:00 midnight, January 1, 1970, UTC. Two Time values are compared by comparing the Integer_T values.

Matching Rules: Equality and Ordering

See Also:
NdsSyntaxId

Constructor Summary
NdsTime(java.util.Date value)
          Constructs an NdsTime object based on the specified Date value parameter.
NdsTime(long value)
          Constructs an NdsTime object based on the specified long value parameter.
 
Method Summary
 java.lang.Object clone()
          Creates a new object of the same class as this object.
 int compareTo(java.lang.Object anObject)
          Compares two objects for ordering, or compares two strings lexicographically.
 boolean equals(java.lang.Object anObject)
          Compares two Objects for equality.
 java.util.Date getDate()
          Returns the time Date value stored in the object data member.
 java.util.GregorianCalendar getGregorianCalendar()
          Returns the GregorianCalendar value stored in the object data member.
 int getNdsSyntaxId()
          Returns the int that represents the NDS syntax ID.
 long getTime()
          Returns the time stored as a long value in the object data member.
 boolean supportsMatchingRules(int matchingRules)
          Checks to see if this object supports the specified matching rules.
 
Methods inherited from class com.novell.service.nds.NdsInteger
approximate, byteValue, doubleValue, floatValue, getInteger, intValue, longValue, shortValue, toString
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NdsTime

public NdsTime(long value)
Constructs an NdsTime object based on the specified long value parameter.
Parameters:
value - The time in a whole number of seconds to be stored as a long value.

NdsTime

public NdsTime(java.util.Date value)
Constructs an NdsTime object based on the specified Date value parameter. It converts time from milliseconds to seconds.
Parameters:
value - The NdsTime Date value to be stored.
Method Detail

compareTo

public int compareTo(java.lang.Object anObject)
              throws java.lang.Exception
Compares two objects for ordering, or compares two strings lexicographically. For the Time syntax, the compareTo method compares this NDS Object with a reference NDS Object contained in the anObject parameter. The comparison is done according to the ordering matching rule for this syntax.
Parameters:
anObject - The reference NDS Object with which to compare.
Returns:
An int set to 0 if the reference Object is equal to this Object; an int <0 if the reference Object is less than this Object; an int >0 if the reference Object is greater than this Object.
Throws:
java.lang.IllegalArgumentException - The passed-in object is of a different type than this NDS Object.
Overrides:
compareTo in class NdsInteger

equals

public boolean equals(java.lang.Object anObject)
Compares two Objects for equality. The equals method compares this object value with the value of the reference object in the anObject parameter.

The equals method implements the most discriminating possible equivalence relation on objects; that is, for any reference values X and Y, this method returns TRUE if and only if X and Y refer to the same object (X==Y has the value TRUE).

Parameters:
anObject - The reference object with which to compare.
Returns:
A boolean set to TRUE if and only if the argument is not NULL and is an NDS integer object that contains the same value as this object, otherwise set to FALSE.
Overrides:
equals in class NdsInteger

getNdsSyntaxId

public int getNdsSyntaxId()
Returns the int that represents the NDS syntax ID.
Specified by:
getNdsSyntaxId in interface NdsAttributeValue
Returns:
The syntax ID as an int.
Overrides:
getNdsSyntaxId in class NdsInteger

supportsMatchingRules

public boolean supportsMatchingRules(int matchingRules)
Checks to see if this object supports the specified matching rules.

The NdsTime syntax supports the equality and ordering matching rules.

Specified by:
supportsMatchingRules in interface NdsAttributeValue
Parameters:
matchingRules - The set of matching rules to check.
Returns:
A Boolean set to TRUE if the matching rules for this object are equal to the matchingRules parameter.
Overrides:
supportsMatchingRules in class NdsInteger

clone

public java.lang.Object clone()
Creates a new object of the same class as this object. It then initializes each of the new object's fields by assigning them the same value as the corresponding fields in this object. No constructor is called.
Returns:
A clone of this object instance containing the cloned syntax.
Overrides:
clone in class NdsInteger

getTime

public long getTime()
Returns the time stored as a long value in the object data member.
Returns:
The time stored as a long value.

getDate

public java.util.Date getDate()
Returns the time Date value stored in the object data member. It converts time from milliseconds to seconds.
Returns:
The Date value with time in seconds.

getGregorianCalendar

public java.util.GregorianCalendar getGregorianCalendar()
Returns the GregorianCalendar value stored in the object data member. It converts the date from standard calendar to Gregorian calendar.
Returns:
The GregorianCalendar date value.