Class FloatRangeModel

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

public class FloatRangeModel extends Object implements RangeModel<Float>
An implementation of RangeModel that returns a floating-point range.
Author:
Matthew Tropiano
  • Constructor Details

    • FloatRangeModel

      public FloatRangeModel(float min, float 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 Float getMinValue()
      Specified by:
      getMinValue in interface RangeModel<Float>
      Returns:
      the minimum value of this model.
    • getMaxValue

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

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

      public double getScalarForValue(Float 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<Float>
      Parameters:
      value - a value that could conceivably fit in the model.
      Returns:
      the scalar result.
    • isInRange

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