Class IntRangeModel

java.lang.Object
com.blackrook.gui.model.range.IntRangeModel
All Implemented Interfaces:
RangeModel<Integer>

public class IntRangeModel extends Object implements RangeModel<Integer>
An implementation of RangeModel that returns an integer range.
Author:
Matthew Tropiano
  • Constructor Details

    • IntRangeModel

      public IntRangeModel(int min, int max)
      Creates a new model with the provided minimum and maximum values.
      Parameters:
      min - the minimum value.
      max - the maximum value.
  • Method Details

    • getMinValue

      public Integer getMinValue()
      Specified by:
      getMinValue in interface RangeModel<Integer>
      Returns:
      the minimum value of this model.
    • getMaxValue

      public Integer getMaxValue()
      Specified by:
      getMaxValue in interface RangeModel<Integer>
      Returns:
      the maximum value of this model.
    • getValueForScalar

      public Integer getValueForScalar(double scalar)
      Description copied from interface: RangeModel
      Returns a value in this model using a variable scalar.
      Specified by:
      getValueForScalar in interface RangeModel<Integer>
      Parameters:
      scalar - a value from 0 to 1, inclusive.
      Returns:
      the closest value.
    • getScalarForValue

      public double getScalarForValue(Integer value)
      Description copied from interface: RangeModel
      Returns a scalar from 0 to 1 using a value that could be in this model.
      Specified by:
      getScalarForValue in interface RangeModel<Integer>
      Parameters:
      value - a value that could conceivably fit in the model.
      Returns:
      the scalar result.
    • isInRange

      public boolean isInRange(Integer value)
      Description copied from interface: RangeModel
      Returns if the input value is in the range.
      Specified by:
      isInRange in interface RangeModel<Integer>
      Parameters:
      value - the value to test.
      Returns:
      true if so, false if not.