备忘录模式
NewState
+ start(StateContext)
聚合
状态模式
Originator
- state
+ save():Memento+ load(Memento):void
TerminatedState
RunningState
+ wait(StateContext)+ stop(StateContext)
IThreadState
依赖
BlockedState
+ notify(StateContext)
RunnableState
+ getCpu(StateContext)
Memento
StateContext
+ state:IThreadState
+ setState(IThreadState)+ start()+ getCpu()+ block()+ stop()+ notify()
Client
+ main():void
CareTaker
- mementos:Stack<Memento>
+ push(Memento):void+ pop():Memento