State refactor

This commit is contained in:
momania 2010-07-20 16:08:31 +02:00
parent 9687bf829e
commit 6485ba83db
2 changed files with 3 additions and 2 deletions

View file

@ -32,6 +32,7 @@ trait Fsm[S] { self: Actor =>
currentState match {
case State(Reply, _, _, _, reply) => reply.foreach(this.self.reply)
case _ => () // ignore for now
}
}
}

View file

@ -17,7 +17,7 @@ object FsmActorSpec {
unlockedLatch: StandardLatch,
lockedLatch: StandardLatch) extends Actor with Fsm[CodeState] {
def initialState = State(NextState, locked, CodeState("", "33221"))
def initialState = State(NextState, locked, CodeState("", code))
def locked: StateFunction = {
case Event(digit: Char, CodeState(soFar, code)) => {
@ -26,7 +26,7 @@ object FsmActorSpec {
State(NextState, locked, CodeState(incomplete, code))
case codeTry if (codeTry == code) => {
doUnlock
new State(NextState, open, CodeState("", code), Some(timeout))
State(NextState, open, CodeState("", code), Some(timeout))
}
case wrong => {
log.error("Wrong code %s", wrong)