Trait

org.apache.daffodil.processors

ManuallyCachedEvaluatable

Related Doc: package processors

Permalink

trait ManuallyCachedEvaluatable[T <: AnyRef] extends AnyRef

This is a method of caching that requires the parsers to create new cache slots, evaluate, then invalidate the cache slots when it goes out of scope. This differs from the InfosetCachedEvaluatable, which caches values in the infoset and relies on backtracking and removal of infoset nodes to invalidate the cache.

The Evaluatable implementing this must have an MStack stored in the PState or UState, and getCacheStack will be used to retrieve that stack. Before calling evaluate for the first time, the parser must call newCache. All other calls to evaluate will use this evaluated value. When the evaluatable goes out of scope, the parser must then invalidate this cache by calling invalidateCace.

The motivating use case for this is for DFAFieldEV and EscapeEschemeEV. DFAField is dependent on the escape scheme. The logical way to handle is to make the EscapeSchemeEv a runtime dependent on the DFAFieldEv. This is convenient since if the EscapeSchemeEv is constant, we can calcuclate the DFAFieldEv at compile time.

However, say the EscapeSchemeEv is not constant. The problem is that it needs to be evaluated in a different scope than when the DFAFieldEv is evaluated. So this manual caching thing is a way to force evaluation of the Ev at the appropriate time (via the DynamicEscapeSchemeParser), and cache it in the PState. Then when the DFAField is evaluated it can use that cached value. Note that the problem with storing the cached value in the infoset (ala InfosetCachedEvaluatable) is that the current infoset element may have changed in between the time the EscapeSchemeEv was evaluated and the time the DFAField is evaluated. So if we cached on the infoset, when the DFAField asks for the EscapeSchemeEv, it will look at the currentInfoset cache and it wouldn't be there, and then evaluate the escape scheme again in the wrong scope.

Self Type
ManuallyCachedEvaluatable[T] with Evaluatable[T]
Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ManuallyCachedEvaluatable
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def getCacheStack(state: (ManuallyCachedEvaluatable.this)#State): MStackOfMaybe[T]

    Permalink
    Attributes
    protected

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. def getCachedOrComputeAndCache(state: (ManuallyCachedEvaluatable.this)#State): T

    Permalink
    Attributes
    protected
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  12. def invalidateCache(state: (ManuallyCachedEvaluatable.this)#State): Unit

    Permalink
  13. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. def newCache(state: (ManuallyCachedEvaluatable.this)#State): Unit

    Permalink
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  19. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped