oetzi/echo — Issue #37: Behaviours should have `when` function
Author: oetzi
Created: 2011-11-28 17:14:17+00:00
State: open

This should take in a `T => Boolean` function and return a constant Event[Boolean] that:

val event = new Behaviour(time => time).when(time => time == 5)
event.occs.length mustBe 1
event.occs.first.time mustBe 5
event.occs.first.value mustBe true

It should be noted that it should be the first occurrence time where the function is true. There should also be a function of the same name that is semantically similar but instead takes in an additional `Time` paramater and produces an Event[Boolean] with an occurrence after this.