Package org.openurp.base.util
Class FloatRange
java.lang.Object
org.openurp.base.util.FloatRange
- All Implemented Interfaces:
org.beangle.commons.entity.Component
区间,默认两端都是闭区间
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newFloatRange, which is [0, 0].FloatRange(float number) Constructs a newFloatRange, which is [number, number].FloatRange(float min, boolean minInclusive, float max, boolean maxInclusive) FloatRange(float min, float max) Constructs a newFloatRangewith the specified minimum and maximum numbers (both inclusive). -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsFloat(float value) booleancontainsRange(FloatRange range) booleanvoidfloatfloatgetMax()floatgetMin()inthashCode()voidbooleanbooleanvoidvoidvoidvoidbooleanoverlapsRange(FloatRange range) voidsetMax(float max) voidsetMaxInclusive(boolean maxInclusive) voidsetMin(float min) voidsetMinInclusive(boolean minInclusive) toString()
-
Constructor Details
-
FloatRange
public FloatRange()Constructs a new
FloatRange, which is [0, 0]. -
FloatRange
public FloatRange(float number) Constructs a new
FloatRange, which is [number, number].- Parameters:
number- the number to use for this range- Throws:
IllegalArgumentException- if the number isNaN
-
FloatRange
public FloatRange(float min, float max) Constructs a new
FloatRangewith the specified minimum and maximum numbers (both inclusive).The arguments may be passed in the order (min,max) or (max,min). The getMinimum and getMaximum methods will return the correct values.
- Parameters:
min- first number that defines the edge of the range, inclusivemax- second number that defines the edge of the range, inclusive- Throws:
IllegalArgumentException- if either number isNaN
-
FloatRange
public FloatRange(float min, boolean minInclusive, float max, boolean maxInclusive)
-
-
Method Details
-
minInclusive
public void minInclusive() -
minExclusive
public void minExclusive() -
inclusive
public void inclusive() -
exclusive
public void exclusive() -
maxInclusive
public void maxInclusive() -
maxExclusive
public void maxExclusive() -
getMin
public float getMin() -
setMin
public void setMin(float min) -
isMinInclusive
public boolean isMinInclusive() -
setMinInclusive
public void setMinInclusive(boolean minInclusive) -
getMax
public float getMax() -
setMax
public void setMax(float max) -
isMaxInclusive
public boolean isMaxInclusive() -
setMaxInclusive
public void setMaxInclusive(boolean maxInclusive) -
containsFloat
public boolean containsFloat(float value) -
containsRange
-
overlapsRange
-
getDistance
public float getDistance() -
hashCode
public int hashCode() -
equals
-
toString
-