net.percederberg.mibble.type

## Class ValueRangeConstraint

- java.lang.Object
- - net.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

    Constructors
    Constructor and Description
    `ValueRangeConstraint(MibFileRef fileRef, MibValue lower, boolean strictLower, MibValue upper, boolean strictUpper)` Creates a new value range constraint.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `MibValue` | `getLowerBound()` Returns the lower bound value.
    `MibValue` | `getUpperBound()` Returns the upper bound value.
    `void` | `initialize(MibType type, 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.
    `boolean` | `isCompatible(java.lang.Number 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(MibFileRef fileRef,
                              MibValue lower,
                              boolean strictLower,
                              MibValue upper,
                              boolean strictUpper)

      Creates a new value range constraint.
      Parameters:
        `fileRef` - the constraint MIB file location
        `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(MibType type,
                        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:
        `type` - the type to constrain
        `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

    - #### isCompatible

          public boolean isCompatible(java.lang.Number value)

      Checks if the specified value is compatible with this constraint.
      Parameters:
        `value` - the (integer) value to check
      Returns:
        true if the value is compatible, or false otherwise
      Since:
        2.9

    - #### 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.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representation of this object