jcreek.reasoning
Class CBRReasoningStep

java.lang.Object
  extended byjcreek.reasoning.CBRReasoningStep
Direct Known Subclasses:
RetrieveResult, ReuseResult

public abstract class CBRReasoningStep
extends java.lang.Object

Title: CBRReasoningStep

Description: Abstract class used to implement a step in the Case-Based Reasoning process. This class and the classes it implemetns are not thread safe.

Version:
1.0
Author:
Frode Sørmo

Field Summary
static int ACTIVATED_STATE
           
protected  int counter
           
protected  int counterMax
           
static int EXPLAINED_STATE
           
static int FOCUSED_STATE
           
static int INITIAL_STATE
           
protected  KnowledgeModel km
           
protected  int state
           
protected  java.util.Vector updateListeners
           
 
Constructor Summary
CBRReasoningStep(KnowledgeModel model)
          Creates a new CBRReasoningStep using the model specified.
 
Method Summary
 void abort()
          If called, it aborts the current reasoning process and resets the status to INITIAL_STATE.
abstract  void activate()
          Runs the "activate" step in this reasoning step.
 void addReasoningUpdateListener(ReasoningUpdateListener listener)
          Adds a listener that will be notified when the reasoning status enters a new status or when it is restarted because of an update to the underlaying model.
abstract  void explain()
          Runs the "explain" step in this reasoning step.
abstract  void focus()
          Trims down the number of elements in the reasoning step, using information from the activate() and explani() methods.
 int getIteration()
          The activate/explain/focis step is usually excecuted on N cases, and this method returns how far the current task is progressed.
 int getIterationMax()
          The activate/explain/focis step is usually excecuted on N cases, and this method returns how many iterations the current task is performing.
 KnowledgeModel getKnowledgeModel()
          Returns the KnowledgeModel this reasoning is executed on.
 int getState()
          Returns the state of the reasoning step.
 boolean isAborted()
          This method may be used to check at intervals during the reasoning process if another thread has requested that the reasoning is aborted.
 boolean isActivated()
          Returns true if this reasoning step has been activated.
 boolean isExplained()
          Returns true if this reasoning step has been explained.
 boolean isFocused()
          Returns true if this reasoning step has been focused.
 void removeReasoningUpdateListener(ReasoningUpdateListener listener)
          Removes a listener from the list.
abstract  void reset()
          Resets the reasoning to the initial step.
protected  void setState(int state)
           
 void update()
          Updates the reasoning, e.g. when there has been a change in the case-base.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

km

protected KnowledgeModel km

state

protected volatile int state

updateListeners

protected java.util.Vector updateListeners

counter

protected volatile int counter

counterMax

protected volatile int counterMax

INITIAL_STATE

public static final int INITIAL_STATE
See Also:
Constant Field Values

ACTIVATED_STATE

public static final int ACTIVATED_STATE
See Also:
Constant Field Values

EXPLAINED_STATE

public static final int EXPLAINED_STATE
See Also:
Constant Field Values

FOCUSED_STATE

public static final int FOCUSED_STATE
See Also:
Constant Field Values
Constructor Detail

CBRReasoningStep

public CBRReasoningStep(KnowledgeModel model)
Creates a new CBRReasoningStep using the model specified.

Method Detail

reset

public abstract void reset()
Resets the reasoning to the initial step.


update

public void update()
Updates the reasoning, e.g. when there has been a change in the case-base.


activate

public abstract void activate()
Runs the "activate" step in this reasoning step. In general, this step use an heuristic that is computationally inexpensive to provide a rough sort of the elements of this reasoning step. The subclass implementing this subclass should have the contents synchronized over the 'this' object.


explain

public abstract void explain()
Runs the "explain" step in this reasoning step. Use a more computationally expensive method to further compare the most interesting elements from the activate() step. The subclass implementing this subclass should have the contents synchronized over the 'this' object.


focus

public abstract void focus()
Trims down the number of elements in the reasoning step, using information from the activate() and explani() methods. The subclass implementing this subclass should have the contents synchronized over the 'this' object.


setState

protected void setState(int state)

getState

public int getState()
Returns the state of the reasoning step. T


isActivated

public boolean isActivated()
Returns true if this reasoning step has been activated.


isExplained

public boolean isExplained()
Returns true if this reasoning step has been explained.


isFocused

public boolean isFocused()
Returns true if this reasoning step has been focused.


getKnowledgeModel

public KnowledgeModel getKnowledgeModel()
Returns the KnowledgeModel this reasoning is executed on.


getIterationMax

public int getIterationMax()
The activate/explain/focis step is usually excecuted on N cases, and this method returns how many iterations the current task is performing. Useful for making progressbars etc. The value from this method can be used as the value for setMaximum() in JProgressBar for example. Minimum is always 0.


getIteration

public int getIteration()
The activate/explain/focis step is usually excecuted on N cases, and this method returns how far the current task is progressed. Useful for making progressbars etc. The value from this method can be used to set the value of setValue() of JProgressBar for example.


abort

public void abort()
If called, it aborts the current reasoning process and resets the status to INITIAL_STATE. The call does not return until the reasoning method currently active (if any) exists.


isAborted

public boolean isAborted()
This method may be used to check at intervals during the reasoning process if another thread has requested that the reasoning is aborted.


addReasoningUpdateListener

public void addReasoningUpdateListener(ReasoningUpdateListener listener)
Adds a listener that will be notified when the reasoning status enters a new status or when it is restarted because of an update to the underlaying model.

Parameters:
listener - The listener to add.

removeReasoningUpdateListener

public void removeReasoningUpdateListener(ReasoningUpdateListener listener)
Removes a listener from the list.

Parameters:
listener - The listener to remove.


Created at IDI, NTNU by the Artificial Intelligence and Learning group