Predicate

com.phasmidsoftware.lascala.predicate.Predicate
See thePredicate companion object
trait Predicate[T] extends T => Try[Boolean]

This trait extends the function class T=>Try[Boolean]. Predicates are intended to combine and form rules. At present, a Predicate is a Functor but not a Monad.

Created by robinhillyard on 5/24/16.

Attributes

Companion
object
Graph
Supertypes
trait T => Try[Boolean]
class Object
trait Matchable
class Any
Known subtypes
class BasePredicate[T]
object Always
class And[T]
class EQ[T]
class Func[T]
class GE[T]
class GT[T]
class In[A]
class InBounds[T]
class InRange
class LE[T]
class LT[T]
class Matches[T]
class NE[T]
object Never
class Or[T]
class Pred[T, V]
Show all
Self type

Members list

Value members

Abstract methods

def tryMap[U : Ordering](f: T => Try[U]): Try[Predicate[U]]

The tryMap function for Predicate. This is something like flatMap, although strictly speaking, not the same. As with map, note that for operators such as >, Predicate[U]

The tryMap function for Predicate. This is something like flatMap, although strictly speaking, not the same. As with map, note that for operators such as >, Predicate[U]

Type parameters

U

the underlying type of the resulting Predicate

Attributes

Returns

a Try[Predicate[U]

Concrete methods

def &:(p: T => Try[Boolean]): And[T]

Conjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Conjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Associates to the right.

Self will not be evaluated if p evaluates as false

Value parameters

p

the other Predicate

Attributes

Returns

a Predicate which is the conjunctive (and) combination of p with self

def &:(p: Predicate[T]): And[T]

Conjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Conjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Associates to the right.

Self will not be evaluated if p evaluates as false

Value parameters

p

the other Predicate

Attributes

Returns

a Predicate which is the conjunctive (and) combination of p with self

def &^:(f: T => Boolean): And[T]

Conjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Conjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Associates to the right.

Self will not be evaluated if f evaluates as false

Value parameters

f

the other function T=>Boolean (f will not be evaluated if self evaluates as false)

Attributes

Returns

a Predicate which is the conjunctive (and) combination of f with self

def :&(p: T => Try[Boolean]): And[T]

Conjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Conjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Associates to the left.

Value parameters

p

the other Predicate (p will not be evaluated if self evaluates as false)

Attributes

Returns

a Predicate which is the conjunctive (and) combination of self with p

def :^&(f: T => Boolean): And[T]

Conjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Conjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Associates to the left.

Value parameters

f

the other Predicate (p will not be evaluated if self evaluates as false)

Attributes

Returns

a Predicate which is the conjunctive (and) combination of self with p

def :^|(f: T => Boolean): Or[T]

Disjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Disjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Associates to the left.

Value parameters

f

the other function T=>Boolean (f will not be evaluated if self evaluates as true)

Attributes

Returns

a Predicate which is the disjunctive (or) combination of self with f

def :|(p: T => Try[Boolean]): Or[T]

Disjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Disjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Associates to the left.

Value parameters

p

the other Predicate (p will not be evaluated if self evaluates as true)

Attributes

Returns

a Predicate which is the disjunctive (or) combination of self with p

def asFunction: T => Try[Boolean]
def map[U : Ordering](f: T => U): Predicate[U]

The map function for Predicate. Note that for operators such as >, U

The map function for Predicate. Note that for operators such as >, U

Type parameters

U

the underlying type of the resulting Predicate

Attributes

Returns

a Predicate[U]

def |:(p: T => Try[Boolean]): Or[T]

Disjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Disjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Associates to the right.

Self will not be evaluated if p evaluates as true

Value parameters

p

the other Predicate

Attributes

Returns

a Predicate which is the disjunctive (or) combination of p with self

def |^:(f: T => Boolean): Or[T]

Disjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Disjunctive combination of self with another Predicate such that the inputs to both predicates are the same single parameter.

Associates to the right.

Self will not be evaluated if f evaluates as true

Value parameters

f

a T=>Boolean function

Attributes

Returns

a Predicate which is the disjunctive (or) combination of p with self

Inherited methods

def andThen[A](g: Try[Boolean] => A): T => A

Composes two instances of Function1 in a new Function1, with this function applied first.

Composes two instances of Function1 in a new Function1, with this function applied first.

Type parameters

A

the result type of function g

Value parameters

g

a function R => A

Attributes

Returns

a new function f such that f(x) == g(apply(x))

Inherited from:
Function1
def compose[A](g: A => T): A => Try[Boolean]

Composes two instances of Function1 in a new Function1, with this function applied last.

Composes two instances of Function1 in a new Function1, with this function applied last.

Type parameters

A

the type to which function g can be applied

Value parameters

g

a function A => T1

Attributes

Returns

a new function f such that f(x) == apply(g(x))

Inherited from:
Function1
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Function1 -> Any
Inherited from:
Function1

Inherited and Abstract methods

def apply(v1: T): Try[Boolean]

Applies the body of this function to the argument.

Applies the body of this function to the argument.

Value parameters

v1

the function argument

Attributes

Returns

the result of function application.

Inherited from:
Function1