com.novell.admin.ns
Class TimeStrategy

java.lang.Object
  |
  +--com.novell.admin.ns.TimeStrategy
All Implemented Interfaces:
Strategy, ValueStrategy

public abstract class TimeStrategy
extends java.lang.Object
implements ValueStrategy

Final class that implements the strategy for most TIME syntaxes.

This class is not intended to by used directly by applications.


Field Summary
protected static int WITHIN_BOUNDS
          Internal Error
 
Constructor Summary
TimeStrategy()
           
 
Method Summary
 boolean canCreateValue(java.lang.Object obj)
          Test to see if a Time can be created from the specified object.
 long compare(ValueComponent component1, ValueComponent component2)
          Compares two value objects.
 ValueComponent createValueComponent()
          Creates a new ValueComponent using default values.
 ValueComponent createValueComponent(java.lang.Object obj)
          Creates a new ValueComponent.
 boolean equals(ValueComponent component1, ValueComponent component2)
          Tests to see if two LongValue objects are equal.
abstract  Syntax getSyntax()
          Returns the syntax associated with this strategy.
 boolean isWithinBounds(ValueComponent comp, long lowerBound, long upperBound)
          Checks if a DateValue is within bounds.
 java.lang.String toString(ValueComponent obj)
          Converts the value to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WITHIN_BOUNDS

protected static final int WITHIN_BOUNDS
Internal Error
Constructor Detail

TimeStrategy

public TimeStrategy()
Method Detail

equals

public boolean equals(ValueComponent component1,
                      ValueComponent component2)
Tests to see if two LongValue objects are equal. This function is intended to be used by the LongValue class.
Parameters:
component1 - First Value used in test which must be LongValue.
component2 - Second Value used in test.
Returns:
true if both objects are LongValue, the syntaxes are identical and thier values are equal, false otherwise.

compare

public long compare(ValueComponent component1,
                    ValueComponent component2)
Compares two value objects. This function is intended to be used by the LongValue class. It not intended for finding the difference between two ValueComponents but for sorting the ValueComponents.
Parameters:
component1 - First value used in comparison which must be a LongValue.
component2 - Second value used in comparison which must be a LongValue.
Returns:
0 if equal, greater than 1 for component1>component2 or less than 1 for component1

canCreateValue

public boolean canCreateValue(java.lang.Object obj)
Test to see if a Time can be created from the specified object.
Specified by:
canCreateValue in interface ValueStrategy
Parameters:
obj - Must be an instance of a Number, Date, or String.
Returns:
True if the creation will succeed, false otherwise.

createValueComponent

public ValueComponent createValueComponent()
Creates a new ValueComponent using default values.
Returns:
The new Time value.

createValueComponent

public ValueComponent createValueComponent(java.lang.Object obj)
                                    throws ComponentCreationException
Creates a new ValueComponent.
Parameters:
obj - Must be a Date, Number (meaning milliseconds), or String.
Returns:
The new Time value.
Throws:
ComponentCreationException - A bad date string passed in.

toString

public java.lang.String toString(ValueComponent obj)
Converts the value to a string.
Parameters:
obj - A DateValue object.
Returns:
The string representing the Date/Time value.

getSyntax

public abstract Syntax getSyntax()
Returns the syntax associated with this strategy.
Specified by:
getSyntax in interface ValueStrategy

isWithinBounds

public boolean isWithinBounds(ValueComponent comp,
                              long lowerBound,
                              long upperBound)
Checks if a DateValue is within bounds.
Parameters:
comp - The ValueComponent to check.
lowerBound - The lower limit to check in milliseconds.
upperLimit - The upper limit to check in milliseconds.
Returns:
True if within limits (inclusively), false otherwise.


API Documentation Copyright © 1998-2003 Novell, Inc. All rights reserved.
NDS is a registered trademark of Novell, Inc. in the United States and other countries.
Generated December 17 2003 1746.