drop unused 'original' field from task info

This commit is contained in:
Mark Harrah 2011-09-21 22:54:46 -04:00
parent baee7b0f61
commit 97028cb7f8
1 changed files with 5 additions and 6 deletions

View File

@ -22,14 +22,13 @@ object Task
type Results[HL <: HList] = KList[Result, HL] type Results[HL <: HList] = KList[Result, HL]
} }
final case class Task[T](info: Info[T], work: Action[T]) final case class Task[T](info: Info, work: Action[T])
{ {
def original = info.original getOrElse this override def toString = info.name getOrElse ("Task(" + info + ")")
override def toString = info.name orElse original.info.name getOrElse ("Task(" + info + ")")
override def hashCode = info.hashCode override def hashCode = info.hashCode
} }
/** `original` is used during transformation only.*/ /** `original` is used during transformation only.*/
final case class Info[T](attributes: AttributeMap = AttributeMap.empty, original: Option[Task[T]] = None) final case class Info(attributes: AttributeMap = AttributeMap.empty)
{ {
import Info._ import Info._
def name = attributes.get(Name) def name = attributes.get(Name)
@ -39,10 +38,10 @@ final case class Info[T](attributes: AttributeMap = AttributeMap.empty, original
def set[T](key: AttributeKey[T], value: T) = copy(attributes = this.attributes.put(key, value)) def set[T](key: AttributeKey[T], value: T) = copy(attributes = this.attributes.put(key, value))
override def toString = override def toString =
if(attributes.isEmpty && original.isEmpty) if(attributes.isEmpty)
"_" "_"
else else
attributes.toString + (original match { case Some(o) => ", original: " + o; case None => "" }) attributes.toString
} }
object Info object Info
{ {