GameTestTicker.java
net.minecraft.gametest.framework.GameTestTicker
信息
- 全限定名:net.minecraft.gametest.framework.GameTestTicker
- 类型:public class
- 包:net.minecraft.gametest.framework
- 源码路径:src/main/java/net/minecraft/gametest/framework/GameTestTicker.java
- 起始行号:L10
- 职责:
TODO
字段/常量
-
SINGLETON- 类型:
GameTestTicker - 修饰符:
public static final - 源码定位:
L11 - 说明:
TODO
- 类型:
-
LOGGER- 类型:
Logger - 修饰符:
private static final - 源码定位:
L12 - 说明:
TODO
- 类型:
-
testInfos- 类型:
Collection<GameTestInfo> - 修饰符:
private final - 源码定位:
L13 - 说明:
TODO
- 类型:
-
runner- 类型:
GameTestRunner - 修饰符:
private - 源码定位:
L14 - 说明:
TODO
- 类型:
-
state- 类型:
GameTestTicker.State - 修饰符:
private - 源码定位:
L15 - 说明:
TODO
- 类型:
内部类/嵌套类型
net.minecraft.gametest.framework.GameTestTicker.State- 类型:
enum - 修饰符:
private static - 源码定位:
L57 - 说明:
TODO
- 类型:
构造器
private GameTestTicker() @ L17
- 构造器名:GameTestTicker
- 源码定位:L17
- 修饰符:private
参数:
- 无
说明:
TODO
方法
下面的方法块按源码顺序生成。
public void add(GameTestInfo testInfo) @ L20
- 方法名:add
- 源码定位:L20
- 返回类型:void
- 修饰符:public
参数:
- testInfo: GameTestInfo
说明:
TODO
public void clear() @ L24
- 方法名:clear
- 源码定位:L24
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
public void setRunner(GameTestRunner runner) @ L36
- 方法名:setRunner
- 源码定位:L36
- 返回类型:void
- 修饰符:public
参数:
- runner: GameTestRunner
说明:
TODO
public void tick() @ L44
- 方法名:tick
- 源码定位:L44
- 返回类型:void
- 修饰符:public
参数:
- 无
说明:
TODO
代码
public class GameTestTicker {
public static final GameTestTicker SINGLETON = new GameTestTicker();
private static final Logger LOGGER = LogUtils.getLogger();
private final Collection<GameTestInfo> testInfos = Lists.newCopyOnWriteArrayList();
private @Nullable GameTestRunner runner;
private GameTestTicker.State state = GameTestTicker.State.IDLE;
private GameTestTicker() {
}
public void add(GameTestInfo testInfo) {
this.testInfos.add(testInfo);
}
public void clear() {
if (this.state != GameTestTicker.State.IDLE) {
this.state = GameTestTicker.State.HALTING;
} else {
this.testInfos.clear();
if (this.runner != null) {
this.runner.stop();
this.runner = null;
}
}
}
public void setRunner(GameTestRunner runner) {
if (this.runner != null) {
Util.logAndPauseIfInIde("The runner was already set in GameTestTicker");
}
this.runner = runner;
}
public void tick() {
if (this.runner != null) {
this.state = GameTestTicker.State.RUNNING;
this.testInfos.forEach(i -> i.tick(this.runner));
this.testInfos.removeIf(GameTestInfo::isDone);
GameTestTicker.State finishingState = this.state;
this.state = GameTestTicker.State.IDLE;
if (finishingState == GameTestTicker.State.HALTING) {
this.clear();
}
}
}
private static enum State {
IDLE,
RUNNING,
HALTING;
}
}引用的其他类
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
Util.logAndPauseIfInIde()
- 引用位置: