org.argkit.dung
Class AbstractReasoner<C>

java.lang.Object
  extended by org.argkit.dung.AbstractReasoner<C>
Type Parameters:
C - (Argument's) claim class
All Implemented Interfaces:
Reasoner<C>
Direct Known Subclasses:
GroundedReasoner, PreferredCredulousReasoner

public abstract class AbstractReasoner<C>
extends java.lang.Object
implements Reasoner<C>

An abstract class that manages a Reasoner's argument source and defeat source, ready for a particular Reasoner implementation. To implement a Reasoner, create a class that subclasses this one, build the constructors you want and implement the calculate() method, see GroundedReasoner.

Author:
Matt South

Field Summary
protected  ArgumentSource<C> argumentSource
           
protected  DefeatSource<C> defeatSource
           
protected static java.util.logging.Logger logger
           
 
Constructor Summary
AbstractReasoner()
          Default Constructor.
AbstractReasoner(ArgumentSource<C> source)
          Typical constructor.
 
Method Summary
protected abstract  Dialogue<C> calculate(Dialogue<C> dialogue, int level)
           
protected  java.lang.String drawBranch(Branch<C> dialogue)
          Draw a version of the current line of reasoning.
 ArgumentSource<C> getArgumentSource()
          Access the Reasoner's argument source.
 DefeatSource<C> getDefeatSource()
          Access the Reasoner's defeat source.
protected  void log(java.lang.String message, int level)
          Write indented message to the logStream
 Dialogue<C> runArgumentGame(Argument<C> argument)
          Throw error if there is no ArgumentSource or DefeatSource attached.
 void setArgumentSource(ArgumentSource<C> argumentSource)
           
 void setDefeatSource(DefeatSource<C> defeatSource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static java.util.logging.Logger logger

argumentSource

protected ArgumentSource<C> argumentSource

defeatSource

protected DefeatSource<C> defeatSource
Constructor Detail

AbstractReasoner

public AbstractReasoner()
Default Constructor.


AbstractReasoner

public AbstractReasoner(ArgumentSource<C> source)
Typical constructor. Often the argument source and the defeat source will be the same object, so this constructor checks to see if the provided argument source object also implements the defeat source interface, and if it does, it sets the defeat source as well.

Parameters:
source - argument source
Method Detail

getArgumentSource

public ArgumentSource<C> getArgumentSource()
Description copied from interface: Reasoner
Access the Reasoner's argument source.

Specified by:
getArgumentSource in interface Reasoner<C>
Returns:
Reasoner's argument source.

setArgumentSource

public void setArgumentSource(ArgumentSource<C> argumentSource)

getDefeatSource

public DefeatSource<C> getDefeatSource()
Description copied from interface: Reasoner
Access the Reasoner's defeat source.

Specified by:
getDefeatSource in interface Reasoner<C>
Returns:
Reasoner's defeat source.

setDefeatSource

public void setDefeatSource(DefeatSource<C> defeatSource)

runArgumentGame

public Dialogue<C> runArgumentGame(Argument<C> argument)
Throw error if there is no ArgumentSource or DefeatSource attached. Throw error if the argument presented is not available in the ArgumentSource

Specified by:
runArgumentGame in interface Reasoner<C>
Parameters:
argument - to be evaluated
Returns:
the dialogue proof arising from the argument dialogue game

calculate

protected abstract Dialogue<C> calculate(Dialogue<C> dialogue,
                                         int level)

log

protected void log(java.lang.String message,
                   int level)
Write indented message to the logStream

Parameters:
message - The message to write
level - The level of indentation

drawBranch

protected java.lang.String drawBranch(Branch<C> dialogue)
Draw a version of the current line of reasoning. i.e. {[a, c], [b]} = "a < b < c".

Parameters:
dialogue -
Returns:
a description of the current line of reasoning.