Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright (C) 2009-2014 Typesafe Inc.
*/
package akka.japi
import java.util.Collections.{ emptyList, singletonList }
import akka.util.Collections.EmptyImmutableSeq
import scala.collection.immutable
import scala.language.implicitConversions
import scala.reflect.ClassTag
import scala.runtime.AbstractPartialFunction
import scala.util.control.NoStackTrace
/**
* A Function interface. Used to create first-class-functions is Java.
*/
trait Function[T, R] {
@throws(classOf[Exception])
def apply(param: T): R
}
/**
* A Function interface. Used to create 2-arg first-class-functions is Java.
*/
trait Function2[T1, T2, R] {
@throws(classOf[Exception])
def apply(arg1: T1, arg2: T2): R
}
/**
* A Procedure is like a Function, but it doesn't produce a return value.
*/
trait Procedure[T] {
@throws(classOf[Exception])
def apply(param: T): Unit
}
/**
* An executable piece of code that takes no parameters and doesn't return any value.
*/
trait Effect {
@throws(classOf[Exception])
def apply(): Unit
}
/**
* Java API: Defines a criteria and determines whether the parameter meets this criteria.
*/
trait Predicate[T] {
def test(param: T): Boolean
}
/**
* Java API
* Represents a pair (tuple) of two elements.
*
* Additional tuple types for 3 to 22 values are defined in the `akka.japi.tuple` package, e.g. [[akka.japi.tuple.Tuple3]].
*/
@SerialVersionUID(1L)
case class Pair[A, B](first: A, second: B) {
def toScala: (A, B) = (first, second)
}
object Pair {
def create[A, B](first: A, second: B): Pair[A, B] = new Pair(first, second)
}
/**
* A constructor/factory, takes no parameters but creates a new value of type T every call.
*/
@SerialVersionUID(1L)
trait Creator[T] extends Serializable {
/**
* This method must return a different instance upon every call.
*/
@throws(classOf[Exception])
def create(): T
}
object JavaPartialFunction {
sealed abstract class NoMatchException extends RuntimeException with NoStackTrace
case object NoMatch extends NoMatchException
final def noMatch(): RuntimeException = NoMatch
}
/**
* Helper for implementing a *pure* partial function: it will possibly be
* invoked multiple times for a single “application”, because its only abstract
* method is used for both isDefinedAt() and apply(); the former is mapped to
* `isCheck == true` and the latter to `isCheck == false` for those cases where
* this is important to know.
*
* Failure to match is signaled by throwing `noMatch()`, i.e. not returning
* normally (the exception used in this case is pre-allocated, hence not
* that expensive).
*
* {{{
* new JavaPartialFunction