Class IntRangeModel
java.lang.Object
com.blackrook.gui.model.range.IntRangeModel
- All Implemented Interfaces:
RangeModel<Integer>
An implementation of
RangeModel that returns an integer range.- Author:
- Matthew Tropiano
-
Constructor Summary
ConstructorsConstructorDescriptionIntRangeModel(int min, int max) Creates a new model with the provided minimum and maximum values. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetScalarForValue(Integer value) Returns a scalar from 0 to 1 using a value that could be in this model.getValueForScalar(double scalar) Returns a value in this model using a variable scalar.booleanReturns if the input value is in the range.
-
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
- Specified by:
getMinValuein interfaceRangeModel<Integer>- Returns:
- the minimum value of this model.
-
getMaxValue
- Specified by:
getMaxValuein interfaceRangeModel<Integer>- Returns:
- the maximum value of this model.
-
getValueForScalar
Description copied from interface:RangeModelReturns a value in this model using a variable scalar.- Specified by:
getValueForScalarin interfaceRangeModel<Integer>- Parameters:
scalar- a value from 0 to 1, inclusive.- Returns:
- the closest value.
-
getScalarForValue
Description copied from interface:RangeModelReturns a scalar from 0 to 1 using a value that could be in this model.- Specified by:
getScalarForValuein interfaceRangeModel<Integer>- Parameters:
value- a value that could conceivably fit in the model.- Returns:
- the scalar result.
-
isInRange
Description copied from interface:RangeModelReturns if the input value is in the range.- Specified by:
isInRangein interfaceRangeModel<Integer>- Parameters:
value- the value to test.- Returns:
- true if so, false if not.
-