de.ls5.jlearn.oracles
Class PrefixClosureFilter

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

public class PrefixClosureFilter
extends Object
implements Oracle

A prefix closure filter answers known prefixes that ends up with some specific output (contained in rejectedSymbols) with a special defines output. The special output futureError should not be contained within the output alphabet.

Author:
Oliver Bauer
See Also:
Serialized Form

Nested Class Summary
static class PrefixClosureFilter.AppliedAction
          For unit testing purposes.
 
Constructor Summary
PrefixClosureFilter(Oracle delegate, Symbol futureOutput)
          Default constructor.
 
Method Summary
 void addRejectedSymbol(Symbol symbol)
          Adds a rejecting symbol.
 Word addToFilter(Word trace, Word result)
          Adds the trace with the result to rejected prefixes if the trace contains a symbol that should be rejected.
 PrefixClosureFilter.AppliedAction getLastAppliedAction()
          For unit testing.
 Word lookupWord(Word trace)
          If there exists a prefix that already known and that ends up with some symbol in rejectedSymbols an answer is constructed.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrefixClosureFilter

public PrefixClosureFilter(Oracle delegate,
                           Symbol futureOutput)
Default constructor.

Parameters:
delegate - The Oracle to delegate queries to, if this filter can't answer received queries.
futureOutput - The symbol that act as a placeholder for suffix answers if the corresponding prefix ends with an rejected symbol.
See Also:
addRejectedSymbol(Symbol)
Method Detail

addRejectedSymbol

public void addRejectedSymbol(Symbol symbol)
Adds a rejecting symbol.

Parameters:
symbol -

lookupWord

public Word lookupWord(Word trace)
If there exists a prefix that already known and that ends up with some symbol in rejectedSymbols an answer is constructed. Otherwise this method returns null

Parameters:
trace -
Returns:

addToFilter

public Word addToFilter(Word trace,
                        Word result)
Adds the trace with the result to rejected prefixes if the trace contains a symbol that should be rejected.

Parameters:
trace -
result -

processQuery

public Word processQuery(Word trace)
                  throws LearningException
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

getLastAppliedAction

public PrefixClosureFilter.AppliedAction getLastAppliedAction()
For unit testing. Returns the last applied action this filter had used on the last received query.

Returns:


Copyright © 2011. All Rights Reserved.