SequenceNumberGenerator
public class SequenceNumberGenerator
源码Source
io/agentscope/runtime/engine/schemas/SequenceNumberGenerator.java:25–65Sequence 数量 Generator,承载智能体的部署、调度与服务化运行。位于 io.agentscope.runtime.engine.schemas 包。核心成员包括 next、yieldWithSequence、SequenceNumberGenerator。
A simple sequence number generator for streaming events.
This class encapsulates the logic for generating sequential numbers, making the code more maintainable and less error-prone.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public SequenceNumberGenerator() | 初始化 `SequenceNumberGenerator` 实例。 Initialize the generator with a starting number. |
public SequenceNumberGenerator(int start) | 初始化 `SequenceNumberGenerator` 实例。 Initialize the generator with a starting number. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public int next() | 返回下一个。 Get the next sequence number and increment the counter. |
public Event yieldWithSequence(Event event) | 设置该参数。 Set the sequence number on an event and increment the counter. |
构造器详情Constructor Detail
SequenceNumberGenerator
public SequenceNumberGenerator()
初始化 SequenceNumberGenerator 实例。
Initialize the generator with a starting number.
源码Source
io/agentscope/runtime/engine/schemas/SequenceNumberGenerator.java:31–33SequenceNumberGenerator
public SequenceNumberGenerator(int start)
初始化 SequenceNumberGenerator 实例。
Initialize the generator with a starting number.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
start | int | 启动(类型 `int`)。The starting sequence number |
源码Source
io/agentscope/runtime/engine/schemas/SequenceNumberGenerator.java:40–42方法详情Method Detail
next
public int next()
返回下一个。
Get the next sequence number and increment the counter.
int返回数值结果。The current sequence number before incrementing
源码Source
io/agentscope/runtime/engine/schemas/SequenceNumberGenerator.java:49–53yieldWithSequence
public Event yieldWithSequence(Event event)
设置该参数。
Set the sequence number on an event and increment the counter.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
event | Event | 事件(类型 `Event`)。The event to set the sequence number on |
Event返回事件。The same event with sequence number set
源码Source
io/agentscope/runtime/engine/schemas/SequenceNumberGenerator.java:61–64