Class FiniteBound<T extends Comparable<? super T>>

java.lang.Object
org.miaixz.bus.core.lang.range.FiniteBound<T>
Type Parameters:
T - 边界值类型
All Implemented Interfaces:
Comparable<Bound<T>>, Predicate<T>, Bound<T>

public class FiniteBound<T extends Comparable<? super T>> extends Object implements Bound<T>
由一个有限值构成的边界
Since:
Java 17+
Author:
Kimi Liu
  • Method Details

    • getValue

      public T getValue()
      获取边界值
      Specified by:
      getValue in interface Bound<T extends Comparable<? super T>>
      Returns:
      边界值
    • getType

      public BoundType getType()
      获取边界类型
      Specified by:
      getType in interface Bound<T extends Comparable<? super T>>
      Returns:
      边界类型
    • test

      public boolean test(T t)
      检验指定值是否在当前边界表示的范围内
      Specified by:
      test in interface Bound<T extends Comparable<? super T>>
      Specified by:
      test in interface Predicate<T extends Comparable<? super T>>
      Parameters:
      t - 要检验的值,不允许为null
      Returns:
      是否
    • compareTo

      public int compareTo(Bound<T> bound)

      比较另一边界与当前边界在坐标轴上位置的先后顺序。 若令当前边界为t1,另一边界为t2,则有

      • -1:t1t2的左侧;
      • 0:t1t2的重合;
      • -1:t1t2的右侧;
      Specified by:
      compareTo in interface Bound<T extends Comparable<? super T>>
      Specified by:
      compareTo in interface Comparable<T extends Comparable<? super T>>
      Parameters:
      bound - 边界
      Returns:
      位置
    • descBound

      public String descBound()
      获取"[value""(value"格式的字符串
      Specified by:
      descBound in interface Bound<T extends Comparable<? super T>>
      Returns:
      字符串
    • negate

      public Bound<T> negate()
      对当前边界取反
      Specified by:
      negate in interface Bound<T extends Comparable<? super T>>
      Specified by:
      negate in interface Predicate<T extends Comparable<? super T>>
      Returns:
      取反后的边界
    • toRange

      public BoundedRange<T> toRange()
      将当前实例转为一个区间
      Specified by:
      toRange in interface Bound<T extends Comparable<? super T>>
      Returns:
      区间
    • equals

      public boolean equals(Object o)
      两实例是否相等
      Overrides:
      equals in class Object
      Parameters:
      o - 另一实例
      Returns:
      是否
    • hashCode

      public int hashCode()
      获取哈希值
      Overrides:
      hashCode in class Object
      Returns:
      哈希值
    • toString

      public String toString()
      获得当前实例对应的{x| x >= xxx}格式的不等式字符串
      Specified by:
      toString in interface Bound<T extends Comparable<? super T>>
      Overrides:
      toString in class Object
      Returns:
      字符串