net.percederberg.mibble.type
Class ValueRangeConstraint

java.lang.Object
  extended bynet.percederberg.mibble.type.ValueRangeConstraint
All Implemented Interfaces:
Constraint

public class ValueRangeConstraint
extends java.lang.Object
implements Constraint

A MIB type value range constraint. This class represents a value range in a set of value constraints.

Since:
2.0

Constructor Summary
ValueRangeConstraint(MibValue lower, boolean strictLower, MibValue upper, boolean strictUpper)
          Creates a new value range constraint.
 
Method Summary
 MibValue getLowerBound()
          Returns the lower bound value.
 MibValue getUpperBound()
          Returns the upper bound value.
 void initialize(MibLoaderLog log)
          Initializes the constraint.
 boolean isCompatible(MibType type)
          Checks if the specified type is compatible with this constraint.
 boolean isCompatible(MibValue value)
          Checks if the specified value is compatible with this constraint.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValueRangeConstraint

public ValueRangeConstraint(MibValue lower,
                            boolean strictLower,
                            MibValue upper,
                            boolean strictUpper)
Creates a new value range constraint.

Parameters:
lower - the lower bound, or null for minimum
strictLower - the strict lower bound (less than) flag
upper - the upper bound, or null for maximum
strictUpper - the strict upper bound (greater than) flag
Method Detail

initialize

public void initialize(MibLoaderLog log)
                throws MibException
Initializes the constraint. This will remove all levels of indirection present, such as references to types or values. No constraint information is lost by this operation. This method may modify this object as a side-effect, and will be called by the MIB loader.

Specified by:
initialize in interface Constraint
Parameters:
log - the MIB loader log
Throws:
MibException - if an error was encountered during the initialization

isCompatible

public boolean isCompatible(MibType type)
Checks if the specified type is compatible with this constraint.

Specified by:
isCompatible in interface Constraint
Parameters:
type - the type to check
Returns:
true if the type is compatible, or false otherwise

isCompatible

public boolean isCompatible(MibValue value)
Checks if the specified value is compatible with this constraint.

Specified by:
isCompatible in interface Constraint
Parameters:
value - the value to check
Returns:
true if the value is compatible, or false otherwise

getLowerBound

public MibValue getLowerBound()
Returns the lower bound value.

Returns:
the lower bound value, or null for minimum

getUpperBound

public MibValue getUpperBound()
Returns the upper bound value.

Returns:
the upper bound value, or null for maximum

toString

public java.lang.String toString()
Returns a string representation of this object.

Returns:
a string representation of this object