class Memoization[I, K, O] extends (I) ⇒ O
Represents a generic form of memoization. Modified from Pathikrit Bhowmick's copy of Scala Memoization.
- I
Represents the input to the memoized function
- K
Represents the type of key to use for cached results
- O
Represents the output of the memoized function
- See also
https://github.com/pathikrit/scalgos/blob/master/src/main/scala/com/github/pathikrit/scalgos/Memo.scala
- Alphabetic
- By Inheritance
- Memoization
- Function1
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
Memoization(memoFunc: (I) ⇒ O, cacheInvalidFunc: (K) ⇒ Boolean = (_: K) => false, cache: Map[K, O] = MutableMap.empty[K, O])(implicit convertToKey: (I) ⇒ K)
- memoFunc
Represents the function that will be memoized
- cacheInvalidFunc
Represents a function that, if it yields true, will mark the current cache element represented by K as invalid and rerun the memo function
- cache
The map used to store the cache of results to be fed back as a result of memoization
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
andThen[A](g: (O) ⇒ A): (I) ⇒ A
- Definition Classes
- Function1
- Annotations
- @unspecialized()
-
def
apply(input: I): O
Executes the memoized function if the given input is new, otherwise returns the result from a previous execution.
Executes the memoized function if the given input is new, otherwise returns the result from a previous execution.
- input
The input to execute upon
- returns
The result of the execution
- Definition Classes
- Memoization → Function1
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clear(): Unit
Clears the internal memoization, allowing new results to be calculated from previously-used input.
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
compose[A](g: (A) ⇒ I): (A) ⇒ O
- Definition Classes
- Function1
- Annotations
- @unspecialized()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- Function1 → AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )