T - 边界值类型public interface Bound<T extends Comparable<? super T>> extends Predicate<T>, Comparable<Bound<T>>
边界对象,描述具有特定上界或下界的单侧无界的区间。
边界的类型
边界根据其getType()所获得的类型,可用于描述基于边界值t的不等式:
noneLowerBound():{x | x > -∞};noneUpperBound():{x | x < +∞};greaterThan(T):{x | x > t};atLeast(T):{x | x >= t};lessThan(T):{x | x < t};atMost(T):{x | x <= t};Predicate使用时,可用于判断入参对象是否能满足当前实例所对应的不等式。
边界的比较
边界对象本身实现了Comparable接口,
当使用Comparable.compareTo(T)比较两个边界对象时,
返回的比较值表示两个边界对象对应的点在实数轴上从左到右的先后顺序。
比如:
若令当前边界点为t1,另一边界点为t2,则有
BoundType,
BoundedRange| Modifier and Type | Field and Description |
|---|---|
static String |
INFINITE_MAX
无穷大的藐视
|
static String |
INFINITE_MIN
无穷小的描述
|
| Modifier and Type | Method and Description |
|---|---|
static <T extends Comparable<? super T>> |
atLeast(T min)
{x | x >= min} |
static <T extends Comparable<? super T>> |
atMost(T max)
{x | x <= max} |
int |
compareTo(Bound<T> bound)
比较另一边界与当前边界在坐标轴上位置的先后顺序。
|
String |
descBound()
获取
"[value"或"(value"格式的字符串 |
BoundType |
getType()
获取边界类型
|
T |
getValue()
获取边界值
|
static <T extends Comparable<? super T>> |
greaterThan(T min)
{x | x > min} |
static <T extends Comparable<? super T>> |
lessThan(T max)
{x | x < max} |
Bound<T> |
negate()
对当前边界取反
|
static <T extends Comparable<? super T>> |
noneLowerBound()
{x | x > -∞} |
static <T extends Comparable<? super T>> |
noneUpperBound()
{x | x < +∞} |
boolean |
test(T t)
检验指定值是否在当前边界表示的范围内
|
BoundedRange<T> |
toRange()
将当前实例转为一个区间
|
String |
toString()
获得当前实例对应的
{x| x >= xxx}格式的不等式字符串 |
static final String INFINITE_MIN
static final String INFINITE_MAX
static <T extends Comparable<? super T>> Bound<T> noneLowerBound()
{x | x > -∞}T - 边界值类型static <T extends Comparable<? super T>> Bound<T> noneUpperBound()
{x | x < +∞}T - 边界值类型static <T extends Comparable<? super T>> Bound<T> greaterThan(T min)
{x | x > min}T - 边界值类型min - 最小值static <T extends Comparable<? super T>> Bound<T> atLeast(T min)
{x | x >= min}T - 边界值类型min - 最小值static <T extends Comparable<? super T>> Bound<T> lessThan(T max)
{x | x < max}T - 边界值类型max - 最大值static <T extends Comparable<? super T>> Bound<T> atMost(T max)
{x | x <= max}T - 边界值类型max - 最大值T getValue()
BoundType getType()
boolean test(T t)
test in interface Predicate<T extends Comparable<? super T>>t - 要检验的值,不允许为nullint compareTo(Bound<T> bound)
比较另一边界与当前边界在坐标轴上位置的先后顺序。
若令当前边界为t1,另一边界为t2,则有
compareTo in interface Comparable<Bound<T extends Comparable<? super T>>>bound - 边界String descBound()
"[value"或"(value"格式的字符串Bound<T> negate()
negate in interface Predicate<T extends Comparable<? super T>>BoundedRange<T> toRange()
Copyright © 2025. All rights reserved.