You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2011/10/03 16:24:02 UTC
svn commit: r1178416 -
/incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnit.scala
Author: andy
Date: Mon Oct 3 14:24:02 2011
New Revision: 1178416
URL: http://svn.apache.org/viewvc?rev=1178416&view=rev
Log: (empty)
Modified:
incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnit.scala
Modified: incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnit.scala
URL: http://svn.apache.org/viewvc/incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnit.scala?rev=1178416&r1=1178415&r2=1178416&view=diff
==============================================================================
--- incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnit.scala (original)
+++ incubator/jena/Experimental/JenaPerf/trunk/src/main/scala/org/apache/jena/perf/PerfUnit.scala Mon Oct 3 14:24:02 2011
@@ -6,6 +6,8 @@ class PerfUnit {
}
+// ?? Extends to add the what to do about the action/
+// ActionProcessor
trait RunListener {
def startAction(action:Action) : Unit
def finishAction(action:Action, outcome:Outcome) : Unit
@@ -25,11 +27,19 @@ trait Reporter {
def report(collector: Collector): Unit
}
+abstract class ActionProcessor(listener:RunListener) {
+ def process(action: Action):Unit
+}
+
+class ActionProcessorPerform(listener:RunListener) extends ActionProcessor(listener:RunListener) {
+ def process(action: Action):Unit = action.enact(listener)
+}
+
trait ActionBase extends Action {
final def enact(listener: RunListener):Unit = {
listener.startAction(this)
- // Hardwires the perform as the action handler.
+ // ******* Hardwires the perform as the action handler.
val outcome = perform()
listener.finishAction(this, outcome)
}
@@ -39,9 +49,28 @@ trait ActionBase extends Action {
}
class ActionN(actions:Seq[Action]) extends Action {
+
+ def comp(out1:Outcome, out2:Outcome): Outcome = {
+ // Success < NoOutcome < Failure
+ /*
+ * (?,F) => F 2
+ * (F,?) => F 2
+ * (O, O or S) => O 2
+ * (O or S, O) => O 2
+ * (S, S) => S 1
+ */
+
+ if ( out1 == Failure ) Failure
+ if ( out2 == Failure ) Failure
+ if ( out1 == NoOutcome ) NoOutcome
+ if ( out2 == NoOutcome ) NoOutcome
+ Success
+ }
+
def name = "ActionN"
def enact(listener: RunListener): Unit = {
listener.startAction(this)
+ // Listener to monitor outcomes
val x = actions.map(_.enact(listener))
val r = Success
listener.finishAction(this, r)