com.novell.nds.dirxml.driver.xds
Class RangeConstraint

java.lang.Object
  extended bycom.novell.nds.dirxml.driver.xds.Constraint
      extended bycom.novell.nds.dirxml.driver.xds.RangeConstraint

public final class RangeConstraint
extends Constraint

A constraint that defines the possible range of values for a Parameter. Ranges are inclusive, meaning the boundary values are included in the range.

e.g., [1...100]


Field Summary
static RangeConstraint NEGATIVE
          Numbers < 0.
static RangeConstraint NON_NEGATIVE
          Numbers >= 0
static RangeConstraint POSITIVE
          Numbers > 0.
 
Constructor Summary
RangeConstraint(char firstAndLast)
          Creates a new RangeConstraint object.
RangeConstraint(char first, char last)
          Creates a new character range constraint.
RangeConstraint(double firstAndLast)
          Creates a new RangeConstraint object.
RangeConstraint(double first, double last)
          Creates a new numeric range constraint.
RangeConstraint(double someNumber, EqualityOp someOp)
          Creates a new numeric range constraint.
RangeConstraint(long firstAndLast)
          Creates a new RangeConstraint object.
RangeConstraint(long someNumber, EqualityOp someOp)
          Creates a new numeric range constraint.
RangeConstraint(long first, long last)
          Creates a new numeric range constraint.
 
Method Summary
 boolean canBeAppliedToMultipleParams()
          Can this constraint be applied to multiple Parameters?
 boolean equals(Object o)
          Is the passed constraint equal to this constraint?
 boolean forScalar()
          Can this constrait be applied to a scalar Parameter?
 boolean forStructured()
          Can this constraint be applied to a structured Parameter?
 int hashCode()
          Returns this constraint's hashcode.
 void setNOT()
           
 
Methods inherited from class com.novell.nds.dirxml.driver.xds.Constraint
getNOT, getOperator, getType, getTypes, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

POSITIVE

public static final RangeConstraint POSITIVE
Numbers > 0.


NON_NEGATIVE

public static final RangeConstraint NON_NEGATIVE
Numbers >= 0


NEGATIVE

public static final RangeConstraint NEGATIVE
Numbers < 0.

Constructor Detail

RangeConstraint

public RangeConstraint(char first,
                       char last)
Creates a new character range constraint.

e.g. ['a'...'z']

Parameters:
first - the first character in the range
last - the last character in the range

RangeConstraint

public RangeConstraint(char firstAndLast)
Creates a new RangeConstraint object.

Parameters:
firstAndLast - the first and last character of the range

RangeConstraint

public RangeConstraint(long first,
                       long last)
Creates a new numeric range constraint.

e.g. [1...100]

Parameters:
first - the first number in the range
last - the last number in the range

RangeConstraint

public RangeConstraint(long firstAndLast)
Creates a new RangeConstraint object.

Parameters:
firstAndLast - the first and last number of the range

RangeConstraint

public RangeConstraint(double first,
                       double last)
Creates a new numeric range constraint.

e.g. [1.1...100.1]

Parameters:
first - the first number in the range
last - the last number in the range

RangeConstraint

public RangeConstraint(double firstAndLast)
Creates a new RangeConstraint object.

Parameters:
firstAndLast - the first and last number of the range

RangeConstraint

public RangeConstraint(long someNumber,
                       EqualityOp someOp)
Creates a new numeric range constraint.

e.g. [1...n] or [n...1]

Parameters:
someNumber - the lower or upper bound of the range
someOp - the equality operator (e.g. >,<,>=,<=); must not be null

RangeConstraint

public RangeConstraint(double someNumber,
                       EqualityOp someOp)
Creates a new numeric range constraint.

e.g. [1...n] or [n...1]

Parameters:
someNumber - the lower or upper bound of the range
someOp - the equality operator (e.g. >,<,>=,<=); must not be null
Method Detail

setNOT

public void setNOT()

hashCode

public int hashCode()
Returns this constraint's hashcode.

Returns:
the hashcode

equals

public boolean equals(Object o)
Is the passed constraint equal to this constraint?

Parameters:
o - may be null
Returns:
true if they're equal; false if they're not

forStructured

public boolean forStructured()
Description copied from class: Constraint
Can this constraint be applied to a structured Parameter?

A structured Parameter consists of multiple primitives or other structured Parameters.

Specified by:
forStructured in class Constraint
Returns:
true if it can; false if it can't

forScalar

public boolean forScalar()
Description copied from class: Constraint
Can this constrait be applied to a scalar Parameter?

A scalar Parmeter is a primitive (e.g., long, int, boolean) that has a single value.

Specified by:
forScalar in class Constraint
Returns:
true if it can; false if it can't

canBeAppliedToMultipleParams

public boolean canBeAppliedToMultipleParams()
Description copied from class: Constraint
Can this constraint be applied to multiple Parameters?

Specified by:
canBeAppliedToMultipleParams in class Constraint
Returns:
true if it can; false if it can't