class SimpleModel(val what: String, val max: Long) extends Model;
+class DetailedModel(what: String, max: Long) extends SimpleModel(what, max) {
+ var detail: String = null;
+ override def format(cur: Long): String = {
+ val sb = new StringBuilder;
+ sb ++= super.format(cur);
+ if (detail != null) { sb += ' '; sb ++= detail; }
+ sb.result
+ }
+}
+
private val UDATA = Seq("kB", "MB", "GB", "TB", "PB", "EB");
trait DataModel extends Model {
def step(detail: String);
}
-def withReporter[T, P <: BaseReporter]
- (rep: P, body: P => T): T = {
+def withReporter[T, P <: BaseReporter](rep: P, body: P => T): T = {
val ret = try { body(rep) }
catch { case e: Exception => rep.failed(e); throw e; }
rep.done();