Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sealed case class IntervalVal(val value : IdealInt) extends IntervalInt
- {
- override def toString = value.toString
- }
- case object IntervalNegInf extends IntervalInt
- {
- override def toString = "IntervalNegInf"
- }
- case object IntervalPosInf extends IntervalInt
- {
- override def toString = "IntervalNegInf"
- }
- abstract class IntervalInt
- {
- ...
- def isPositive : Boolean =
- {
- println("isPositive(" + this + ")")
- val result = this match
- {
- case (IntervalPosInf) => true
- case (IntervalNegInf) => false
- case IntervalVal(v) => v > 0
- }
- println("Result: " + result)
- result
- }
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement