net.percederberg.mib.type
Class ValueRangeConstraint

java.lang.Object
  |
  +--net.percederberg.mib.type.Constraint
        |
        +--net.percederberg.mib.type.ValueRangeConstraint

public class ValueRangeConstraint
extends Constraint

A class representing a value range constraint. Only the integer values of the numbers contained will be used.

Version:
1.0
Author:
Per Cederberg, per@percederberg.net

Field Summary
static java.lang.Number MAX
          The maximum unlimited value.
static java.lang.Number MIN
          The minimum unlimited value.
 
Constructor Summary
ValueRangeConstraint(java.lang.Number lower, boolean lowinc, java.lang.Number upper, boolean upinc)
          Creates a new value range constraint from the given boundaries.
ValueRangeConstraint(java.lang.Number lower, java.lang.Number upper)
          Creates a new value range constraint from the given boundaries.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Checks if this constraint equals another constraint.
protected  int maxValue()
          Returns the maximum integer value for this constraint.
protected  int minValue()
          Returns the minimum integer value for this constraint.
 java.lang.String toString()
          Returns a string description of this constraint.
 void transferConstraint(TypeConverter converter)
          Transfers the constraint information from this object to a type converter object.
 
Methods inherited from class net.percederberg.mib.type.Constraint
equalsValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MIN

public static final java.lang.Number MIN
The minimum unlimited value.

MAX

public static final java.lang.Number MAX
The maximum unlimited value.
Constructor Detail

ValueRangeConstraint

public ValueRangeConstraint(java.lang.Number lower,
                            java.lang.Number upper)
Creates a new value range constraint from the given boundaries. The value boundaries are considered inclusive.
Parameters:
lower - the lower boundary, or MIN for unlimited
upper - the upper boundary, or MAX for unlimited

ValueRangeConstraint

public ValueRangeConstraint(java.lang.Number lower,
                            boolean lowinc,
                            java.lang.Number upper,
                            boolean upinc)
Creates a new value range constraint from the given boundaries. The value boundaries can be made either inclusive or exclusive. Note that in the latter case a value of one is just added or subtracted to the value.
Parameters:
lower - the lower boundary, or MIN for unlimited
lowinc - true if lower boundary inclusive, false otherwise
upper - the upper boundary, or MAX for unlimited
upinc - true if upper boundary inclusive, false otherwise
Method Detail

equals

public boolean equals(java.lang.Object obj)
Checks if this constraint equals another constraint.
Overrides:
equals in class Constraint
Parameters:
obj - the object to compare with
Returns:
true if the objects are equal, or false otherwise

toString

public java.lang.String toString()
Returns a string description of this constraint.
Overrides:
toString in class Constraint
Returns:
a string description

transferConstraint

public void transferConstraint(TypeConverter converter)
Transfers the constraint information from this object to a type converter object. The calling conventions declared in the TypeConverter class are followed.
Overrides:
transferConstraint in class Constraint
Parameters:
converter - a type converter

minValue

protected int minValue()
Returns the minimum integer value for this constraint.
Returns:
the minium integer value

maxValue

protected int maxValue()
Returns the maximum integer value for this constraint.
Returns:
the maximum integer value