Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/BruceEckel/OnJava8-Examples
/ runAll
Method
runAll
patterns/state/StateMachineDemo.java:19–22 ·
view source on GitHub ↗
()
Source
from the content-addressed store, hash-verified
17
protected
abstract boolean changeState();
18
// Template method:
19
protected
final
void
runAll() {
20
while
(changeState())
21
currentState.run();
22
}
23
}
24
25
// A different subclass for each state:
Callers
1
Washer
Method · 0.80
Calls
2
changeState
Method · 0.95
run
Method · 0.65
Tested by
no test coverage detected