com.novell.admin.ns
Class IntegerStrategy

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

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

Abstract class that may be extended for syntax strategies that use integer as the value type.

Methods in this class and any subclasses are not intended to be used directly by an application. These methods are intended to be use by ValueComponent and syntax classes.


Field Summary
protected static int WITHIN_BOUNDS
          Internal Error
 
Constructor Summary
IntegerStrategy()
           
 
Method Summary
 boolean canCreateValue(java.lang.Object obj)
          Tests to see if a LongValue can be created.
 long compare(ValueComponent component1, ValueComponent component2)
          Compares two value objects.
 ValueComponent createValueComponent()
          Creates a new LongValue using zero as the default initial data.
 ValueComponent createValueComponent(java.lang.Object obj)
          Creates a new LongValue using specified initial data.
 boolean equals(ValueComponent component1, ValueComponent component2)
          Tests to see if two LongValue objects are equal.
 boolean isWithinBounds(ValueComponent comp, long lowerBound, long upperBound)
          Algorithm to test if a LongValue is within bounds.
 java.lang.String toString(ValueComponent obj)
          Converts a LongValue object 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

IntegerStrategy

public IntegerStrategy()
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 the 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

toString

public java.lang.String toString(ValueComponent obj)
Converts a LongValue object to a String.
Parameters:
obj - Component to convert. Should be a LongValue instance.
Returns:
If component is a LongValue the Value converted to a string.

canCreateValue

public boolean canCreateValue(java.lang.Object obj)
Tests to see if a LongValue can be created.
Specified by:
canCreateValue in interface ValueStrategy
Parameters:
obj - An Object to create the value from.
Returns:
True if 'obj' is instance of Number or String, false otherwise.

createValueComponent

public ValueComponent createValueComponent(java.lang.Object obj)
                                    throws ComponentCreationException
Creates a new LongValue using specified initial data.
Parameters:
obj - Must be either a Number or String instance.
Returns:
new LongValue
Throws:
ComponentCreationException - if 'obj' is not a Number nor a String that can be parsed to a long.

createValueComponent

public ValueComponent createValueComponent()
Creates a new LongValue using zero as the default initial data.
Returns:
new LongValue

isWithinBounds

public boolean isWithinBounds(ValueComponent comp,
                              long lowerBound,
                              long upperBound)
Algorithm to test if a LongValue is within bounds.
Parameters:
comp - The ValueComponent to check.
lowerBound - The lower limit to check.
upperLimit - The upper limit to check.
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.