de.ls5.jlearn.interfaces
Interface Cache

All Superinterfaces:
Oracle, Serializable
All Known Implementing Classes:
CacheOracle

public interface Cache
extends Oracle

A cache records queries and corresponding answers. Queries which are already included in the cache will be answered by the cached response, saving queries to the actual target system.

Author:
merten

Method Summary
 void addEntry(Word query, Word answer)
          Adds a query/answer pair to the cache
 boolean isCached(Word trace)
          Checks if a given query is already included in the cache
 void setOracle(Oracle o)
          Specifies Oracle to be called if a cache-miss is encountered
 
Methods inherited from interface de.ls5.jlearn.interfaces.Oracle
processQuery
 

Method Detail

addEntry

void addEntry(Word query,
              Word answer)
              throws ObservationConflictException
Adds a query/answer pair to the cache

Parameters:
query - query to be cached
answer - response for the query to be cached
Throws:
ObservationConflictException - will be thrown if the query is already included in the cache, but with a different answer

isCached

boolean isCached(Word trace)
Checks if a given query is already included in the cache

Parameters:
trace - query to be checked
Returns:
boolean value indicating if the provided query would give a cache hit

setOracle

void setOracle(Oracle o)
Specifies Oracle to be called if a cache-miss is encountered

Parameters:
o - Oracle to be consulted if a query is not included in the cache


Copyright © 2011. All Rights Reserved.