Browse files

Compiles after merge

  • Loading branch information...
1 parent 9523854 commit 9923f84894e449f2bcca7ae1e02da73831b07750 @mslinn mslinn committed Oct 30, 2011
View
18 src/main/scala/net/interdoodle/hbe/domain/MonkeyVisor.scala
@@ -1,11 +1,11 @@
package net.interdoodle.hbe.domain
+import akka.config.Supervision.{OneForOneStrategy, Permanent}
import akka.event.EventHandler
import akka.stm.Ref
import akka.actor.{Actor, ActorRef}
-import net.interdoodle.hbe.message.{PageGenerated, TypingRequest, MonkeyResult}
import collection.mutable.HashMap
-import akka.config.Supervision.{Permanent, OneForOneStrategy}
+import net.interdoodle.hbe.message.{PageGenerated, TypingRequest, MonkeyResult}
import scala.collection.JavaConversions._
@@ -56,9 +56,17 @@ class MonkeyVisor(val simulationID:String,
}
case PageGenerated(monkeyActorRef, totalText, page) => {
- EventHandler.info(this, monkeyActorRef.uuid + " returned " + text)
- // TODO add last monkey's results to simulationResult.list and see if they are finished
- val monkeyResult = monkeyResultRefMap.get(monkeyActorRef.uuid.toString).get()
+ EventHandler.info(this, monkeyActorRef.uuid + " returned " + totalText)
+
+ val textAnalysis = new TextAnalysis()
+ textAnalysis.text = totalText
+ //textAnalysis.resultMap += // TODO figure this out
+ //textAnalysis.addTextMatch() // TODO figure this out
+
+ val monkeyResult = monkeyResultRefMap.getOrElse(monkeyActorRef.uuid.toString, Ref[MonkeyResult]).get()
+ monkeyResult.generatedText = totalText
+ monkeyResult.results = textAnalysis :: monkeyResult.results
+ monkeyResult.complete = false // TODO see if monkey is finished because they matched all the text
}
case _ => {
View
2 src/main/scala/net/interdoodle/hbe/domain/TextAnalysis.scala
@@ -7,7 +7,7 @@ import collection.mutable.HashMap
class TextAnalysis {
/** Contains all text generated by a Monkey; only grows in length, nothing is ever deleted */
- val text = ""
+ var text = ""
/** Maps startPos to (length, startPos, endPos)
* This makes it easy to update matches that grow between pages */
View
2 src/main/scala/net/interdoodle/hbe/message/MonkeyResult.scala
@@ -8,6 +8,6 @@ import net.interdoodle.hbe.domain.TextAnalysis
class MonkeyResult(
var generatedText:String="",
- val results:List[TextAnalysis]=Nil,
+ var results:List[TextAnalysis]=Nil,
var msg:String="",
var complete:Boolean = false)

0 comments on commit 9923f84

Please sign in to comment.