scala

trait PartialFunction

[source: scala/PartialFunction.scala]

trait PartialFunction[-A, +B]
extends (A) => B
A partial function of type PartialFunction[A, B] is a unary function where the domain does not include all values of type A. The function isDefinedAt allows to test dynamically, if a value is in the domain of the function.
Author
Martin Odersky
Version
1.0, 16/07/2003
Direct Known Subclasses:
Seq, Map, MutableList, Reactions.Wrapper, Reactions

Method Summary
override def andThen [C](k : (B) => C) : PartialFunction[A, C]
(f andThen g)(x) == g(f(x))
abstract def isDefinedAt (x : A) : Boolean
Checks if a value is contained in the functions domain.
def orElse [A1 <: A, B1 >: B](that : PartialFunction[A1, B1]) : PartialFunction[A1, B1]
Methods inherited from Function1
apply (abstract), toString, compose
Methods inherited from AnyRef
getClass, hashCode, equals, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
abstract def isDefinedAt(x : A) : Boolean
Checks if a value is contained in the functions domain.
Parameters
x - the value to test
Returns
true, iff x is in the domain of this function.

def orElse[A1 <: A, B1 >: B](that : PartialFunction[A1, B1]) : PartialFunction[A1, B1]

override def andThen[C](k : (B) => C) : PartialFunction[A, C]
(f andThen g)(x) == g(f(x))
Overrides
Function1.andThen