de.ls5.jlearn.oracles
Class CacheOracle

java.lang.Object
  extended by de.ls5.jlearn.oracles.CacheOracle
All Implemented Interfaces:
Cache, FilterStickyOutput, Oracle, Serializable

public class CacheOracle
extends Object
implements Oracle, Cache, FilterStickyOutput

Author:
merten
See Also:
Serialized Form

Constructor Summary
CacheOracle(Oracle oracle)
           
 
Method Summary
 void addEntry(Word word, Word symbols)
          Adds a query/answer pair to the cache
 void addStickySymbol(Symbol symbol)
          Specify output symbols that once encountered by a prefix will stay the same despite any possible suffix
 Word getEntries(Word word)
           
 boolean isCached(Word trace)
          Checks if a given query is already included in the cache
 Word processQuery(Word trace)
          Process an incoming sequence (word) of input symbols and return a sequence (word) of output symbols produced as reacion to the input symbols.
 void setDFAModeEnabled(boolean dfaMode)
           
 void setOracle(Oracle oracle)
          Specifies Oracle to be called if a cache-miss is encountered
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheOracle

public CacheOracle(Oracle oracle)
Method Detail

setOracle

public void setOracle(Oracle oracle)
Description copied from interface: Cache
Specifies Oracle to be called if a cache-miss is encountered

Specified by:
setOracle in interface Cache
Parameters:
oracle - Oracle to be consulted if a query is not included in the cache

processQuery

public Word processQuery(Word trace)
                  throws LearningException
Description copied from interface: Oracle
Process an incoming sequence (word) of input symbols and return a sequence (word) of output symbols produced as reacion to the input symbols.

Specified by:
processQuery in interface Oracle
Parameters:
trace - Word object respresenting the query the system is supposed to process
Returns:
Word object with the system's response to the provide query
Throws:
LearningException

addEntry

public void addEntry(Word word,
                     Word symbols)
              throws ObservationConflictException
Description copied from interface: Cache
Adds a query/answer pair to the cache

Specified by:
addEntry in interface Cache
Parameters:
word - query to be cached
symbols - 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

getEntries

public Word getEntries(Word word)

addStickySymbol

public void addStickySymbol(Symbol symbol)
Description copied from interface: FilterStickyOutput
Specify output symbols that once encountered by a prefix will stay the same despite any possible suffix

Specified by:
addStickySymbol in interface FilterStickyOutput

isCached

public boolean isCached(Word trace)
Description copied from interface: Cache
Checks if a given query is already included in the cache

Specified by:
isCached in interface Cache
Parameters:
trace - query to be checked
Returns:
boolean value indicating if the provided query would give a cache hit

setDFAModeEnabled

public void setDFAModeEnabled(boolean dfaMode)


Copyright © 2011. All Rights Reserved.