Class SegmentAllocator.Segment
java.lang.Object
cloud.opencode.base.id.segment.SegmentAllocator.Segment
- Enclosing interface:
SegmentAllocator
Segment definition
号段定义
- Since:
- JDK 25, opencode-base-id V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongend()Gets the end value 获取结束值longGets the current value (same as start) 获取当前值(与start相同)longGets the maximum value (same as end) 获取最大值(与end相同)longGets the remaining count 获取剩余数量longstart()Gets the start value 获取起始值intstep()Gets the step size 获取步长toString()
-
Constructor Details
-
Segment
public Segment(long start, long end, int step) Creates a segment 创建号段- Parameters:
start- the start value (inclusive) | 起始值(包含)end- the end value (exclusive) | 结束值(不包含)step- the step size | 步长- Throws:
IllegalArgumentException- if start is negative, end < start, or step <= 0
-
-
Method Details
-
start
public long start()Gets the start value 获取起始值- Returns:
- start value | 起始值
-
end
public long end()Gets the end value 获取结束值- Returns:
- end value | 结束值
-
step
public int step()Gets the step size 获取步长- Returns:
- step size | 步长
-
getMaxValue
public long getMaxValue()Gets the maximum value (same as end) 获取最大值(与end相同)- Returns:
- max value | 最大值
-
getCurrentValue
public long getCurrentValue()Gets the current value (same as start) 获取当前值(与start相同)- Returns:
- current value | 当前值
-
remaining
public long remaining()Gets the remaining count 获取剩余数量- Returns:
- remaining count | 剩余数量
-
toString
-