class CachedDynamicAttribute[T, U] extends CachedAttribute[T, U]
A cached dynamic attribute of a node type T with value of type U, supported
by a memo table and circularity test. The value of the attribute is initially
computed by the function f, but the definition can be augmented dynamically.
The result is memoised so that it is only evaluated once for a given definition.
The attribute definition should not itself require the value of this attribute.
If it does, a circularity error is reported by throwing an IllegalStateException.
This kind of attribute encapsulates state to keep track of the current definition,
so an instance should only be used from one thread at a time.
- Source
- AttributionCore.scala
- Alphabetic
- By Inheritance
- CachedDynamicAttribute
- CachedAttribute
- IdMemoised
- MemoisedBase
- Attribute
- Function1
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new CachedDynamicAttribute(name: String, f: (T) ⇒ U)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+=(g: ==>[T, U]): Unit
Add a new partial function to the definition of this attribute.
Add a new partial function to the definition of this attribute. Resets the memo table for this attribute.
-
def
-=(g: ==>[T, U]): Unit
Remove a partial function from the definition of this attribute, if it's there, otherwise have no effect.
Remove a partial function from the definition of this attribute, if it's there, otherwise have no effect. If
gappears more than once in the definition, just remove the first one. Resets the memo table for this attribute. -
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
andThen[A](g: (U) ⇒ A): (T) ⇒ A
- Definition Classes
- Function1
- Annotations
- @unspecialized()
-
def
apply(t: T): U
Return the value of this attribute for node
t, raising an error if it depends on itself.Return the value of this attribute for node
t, raising an error if it depends on itself. IF the value has been memoised, return it. Otherwise, the functions list is tried in order. The first partial function on that list that is defined will be used. If no partial function on this list is defined, thenfwill be used.- Definition Classes
- CachedDynamicAttribute → CachedAttribute → Function1
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
block(b: ⇒ Any): Unit
Execute a block and restore the state of this dynamic attribute after the block has executed.
Execute a block and restore the state of this dynamic attribute after the block has executed. The idea is that the block can add to the definition of the attribute for use within the block. Any definitions that are added will be automatically removed at the end of the block.
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
compose[A](g: (A) ⇒ T): (A) ⇒ U
- Definition Classes
- Function1
- Annotations
- @unspecialized()
-
def
dup(t1: T, t2: T, u: Option[U]): Unit
Duplicate an entry if possible.
Duplicate an entry if possible. If
t1has a memoised value associated with it, set the value associated witht2to the same value. If there is no value associated witht1, set the value associated witht2tou.- Definition Classes
- MemoisedBase
-
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] )
-
val
functions: ListBuffer[PartialFunction[T, U]]
List of functions that currently dynamically define this attribute.
-
def
get(t: T): Option[Option[U]]
Return the value stored at key
tas an option.Return the value stored at key
tas an option.- Definition Classes
- MemoisedBase
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
getWithDefault(t: T, u: Option[U]): Option[U]
Return the value stored at key
tif there is one, otherwise returnu.Return the value stored at key
tif there is one, otherwise returnu.- Definition Classes
- MemoisedBase
-
def
hasBeenComputedAt(t: T): Boolean
Has the value of this attribute at
talready been computed or not? If the table containsSome (u)then we've computed it and the value wasu.Has the value of this attribute at
talready been computed or not? If the table containsSome (u)then we've computed it and the value wasu. If the memo table containsNonewe are in the middle of computing it. Otherwise the memo table contains no entry fort.- Definition Classes
- CachedAttribute → MemoisedBase
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
val
memo: Cache[AnyRef, AnyRef]
The memo table.
The memo table.
- Definition Classes
- IdMemoised → MemoisedBase
-
val
name: String
- Definition Classes
- Attribute
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
put(t: T, u: Option[U]): Unit
Store the value
uunder the keyt.Store the value
uunder the keyt.- Definition Classes
- MemoisedBase
-
def
putIfNotPresent(t: T, u: Option[U]): Unit
Store the value
uunder the keytiftdoes not already have an associated value.Store the value
uunder the keytiftdoes not already have an associated value.- Definition Classes
- MemoisedBase
-
def
reportCycle(t: T): U
Report a cycle in the calculation of this attribute discovered when evaluating the attribute on value
t.Report a cycle in the calculation of this attribute discovered when evaluating the attribute on value
t. Throws anIllegalStateException.- Definition Classes
- Attribute
-
def
reset(): Unit
Immediately reset the memo table.
Immediately reset the memo table.
- Definition Classes
- MemoisedBase
-
def
resetAt(t: T): Unit
Immediately reset the memo table at
t.Immediately reset the memo table at
t.- Definition Classes
- MemoisedBase
-
def
resetIfRequested(): Unit
Check to see if a reset has been requested via the common memo version, and if so, do it.
Check to see if a reset has been requested via the common memo version, and if so, do it.
- Definition Classes
- MemoisedBase
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
The attribute's string representation is its name.
The attribute's string representation is its name.
- Definition Classes
- Attribute → 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( ... )