Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

toStrings for some concurrent restrictions

  • Loading branch information...
commit feffe4feb0ea2f8b1fdfeb62377fb93dbea37c64 1 parent 8c0a2fb
@harrah authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 main/Tags.scala
View
4 main/Tags.scala
@@ -32,10 +32,12 @@ object Tags
private[this] final class Single(tag: Tag, max: Int) extends Rule {
checkMax(max)
def apply(m: TagMap) = getInt(m, tag) <= max
+ override def toString = "Limit " + tag.name + " to " + max
}
private[this] final class Sum(tags: Seq[Tag], max: Int) extends Rule {
checkMax(max)
- def apply(m: TagMap) = (0 /: tags)((sum, t) => sum + getInt(m, t)) <= max
+ def apply(m: TagMap) = (0 /: tags)((sum, t) => sum + getInt(m, t)) <= max
+ override def toString = tags.mkString("Limit sum of ", ", ", " to " + max)
}
private[this] def checkMax(max: Int): Unit = assert(max >= 1, "Limit must be at least 1.")
Please sign in to comment.
Something went wrong with that request. Please try again.