Or

com.phasmidsoftware.lascala.Or
class Or[T](r1: Rule[T], r2: => Rule[T]) extends BaseRule[T]

"Or" sub-class of Rule giving the disjunction of r1 and r2. Not a case class so that we can have a call-by-name parameter

Type parameters

T

the underlying type of this Rule

Value parameters

r1

the rule which is always evaluated

r2

the rule which may not be evaluated

Attributes

Graph
Supertypes
class BaseRule[T]
trait Rule[T]
trait () => Try[Boolean]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def apply(): Try[Boolean]

Applies the body of this function to the arguments.

Applies the body of this function to the arguments.

Attributes

Returns

the result of function application.

def liftTransform[U : Ordering](lf: T => Try[U], rf: T => Try[U]): Try[Or[U]]

Method to transform this Rule[T] into a Try[Rule[U]]. Somewhat similar to flatMap.

Method to transform this Rule[T] into a Try[Rule[U]]. Somewhat similar to flatMap.

The primary purpose of this method is to allow a lookup to occur (the xf functions). Typically, T will be String and U will be Double or Int.

CONSIDER it would be much nicer if there were only one function parameter to this method

Type parameters

U

the type of the resulting Rule

Value parameters

lf

T=>Try[U] function to be applied to the lhs of the rule (the variable)

rf

T=>Try[U] function to be applied to the rhs of the rule (the predicate)

Attributes

Returns

a Try[Rule[T] which is equivalent (truth-wise) to this Rule.

def transform[U : Ordering](f: T => U, g: T => U): Rule[U]

TODO implement this method in terms of liftTransform

TODO implement this method in terms of liftTransform

Method to transform this Rule[T] into a Rule[U].

The primary purpose of this method is to allow a lookup to occur (the xf functions). Typically, T will be String and U will be Double or Int.

CONSIDER it would be much nicer if there were only one function parameter to this method

Type parameters

U

the type of the resulting Rule

Value parameters

lf

T=>U function to be applied to the lhs of the rule (the variable)

rf

T=>U function to be applied to the rhs of the rule (the predicate)

Attributes

Returns

a Rule[T] which is equivalent (truth-wise) to this Rule.

Inherited methods

def &:(r: => Rule[T]): Rule[T]

Conjunctive combination of self with another Rule.

Conjunctive combination of self with another Rule.

Associates to the right.

Self will not be evaluated if c evaluates as false

Value parameters

r

the other Rule

Attributes

Returns

a Rule which is the conjunctive (and) combination of r with self

Inherited from:
Rule
def :&(r: => Rule[T]): Rule[T]

Conjunctive combination of self with another Rule.

Conjunctive combination of self with another Rule.

Associates to the left.

Value parameters

r

the other Rule (r will not be evaluated if self evaluates as false)

Attributes

Returns

a Rule which is the conjunctive (and) combination of self with r

Inherited from:
Rule
def :|(r: => Rule[T]): Rule[T]

Disjunctive combination of self with another Rule.

Disjunctive combination of self with another Rule.

Associates to the left.

Value parameters

r

the other Rule (r will not be evaluated if self evaluates as true)

Attributes

Returns

a Rule which is the disjunctive (or) combination of self with r

Inherited from:
Rule
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
BaseRule -> Function0 -> Any
Inherited from:
BaseRule
def |:(r: => Rule[T]): Rule[T]

Disjunctive combination of self with another Rule.

Disjunctive combination of self with another Rule.

Associates to the right.

Self will not be evaluated if r evaluates as true

Value parameters

r

the other Rule

Attributes

Returns

a Rule which is the disjunctive (or) combination of r with self

Inherited from:
Rule