com.novell.admin.ns
Class TimeStrategy

java.lang.Object
  extended bycom.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 DateValue 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

See Also:
Constant Field Values
Constructor Detail

TimeStrategy

public TimeStrategy()
Method Detail

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.

compare

public long compare(ValueComponent component1,
                    ValueComponent component2)
Compares two value objects. This function is intended to be used by the DateValue class. It not intended for finding the difference between two ValueComponents but for sorting the ValueComponents.

Specified by:
compare in interface Strategy
Parameters:
component1 - First value used in comparison which must be a DateValue.
component2 - Second value used in comparison which must be a DateValue.
Returns:
0 if equal, greater than 1 for component1>component2 or less than 1 for component1See Also:
ValueComponent.compareTo(ValueComponent)

createValueComponent

public ValueComponent createValueComponent()
Creates a new ValueComponent using default values.

Specified by:
createValueComponent in interface Strategy
Returns:
The new DateValue containing the current time.

createValueComponent

public ValueComponent createValueComponent(java.lang.Object obj)
                                    throws ComponentCreationException
Creates a new ValueComponent.

Specified by:
createValueComponent in interface Strategy
Parameters:
obj - Must be a Date, Number (meaning milliseconds), or String.
Returns:
The new Time value.
Throws:
ComponentCreationException - A bad date string passed in.

equals

public boolean equals(ValueComponent component1,
                      ValueComponent component2)
Tests to see if two DateValue objects are equal. This function is intended to be used by the DateValue class.

Specified by:
equals in interface Strategy
Parameters:
component1 - First Value used in test which must be DateValue.
component2 - Second Value used in test.
Returns:
true if both objects are DateValue, the syntaxes are identical and their values are equal, false otherwise.
See Also:
ValueComponent.equals(Object)

getSyntax

public abstract Syntax getSyntax()
Returns the syntax associated with this strategy.

Specified by:
getSyntax in interface ValueStrategy
Returns:
Syntax specifically associated with this strategy.

isWithinBounds

public boolean isWithinBounds(ValueComponent comp,
                              long lowerBound,
                              long upperBound)
Checks if a DateValue is within bounds.

Specified by:
isWithinBounds in interface Strategy
Parameters:
comp - The ValueComponent to check.
lowerBound - The lower limit to check in milliseconds.
upperBound - The upper limit to check in milliseconds.
Returns:
True if within limits (inclusively), false otherwise.

toString

public java.lang.String toString(ValueComponent obj)
Converts the value to a string.

Specified by:
toString in interface Strategy
Parameters:
obj - A DateValue object.
Returns:
The string representing the Date/Time value.
See Also:
ValueComponent.toString()


API Documentation Copyright © 1998-2004 Novell, Inc. All rights reserved.
NDS is a registered trademark of Novell, Inc. in the United States and other countries.
Generated September 2 2004 0111.