org.micropsi.comp.console
Class DefaultAnswerQueue

java.lang.Object
  extended byorg.micropsi.comp.console.AbstractAnswerQueue
      extended byorg.micropsi.comp.console.DefaultAnswerQueue
All Implemented Interfaces:
AnswerQueueIF, java.lang.Runnable

public class DefaultAnswerQueue
extends AbstractAnswerQueue
implements AnswerQueueIF

See Also:
Classes who want to dispatch answers should do it the following way:
      //                ...
 	    Display.getCurrent().asyncExec (answerQueue);
 
or
 		// ...
 		Display.getCurrent().syncExec(answerQueue);
 
Normally you would use the first way, but if you have a more sophisticated
, method and you have to wait for its execution, use the latter one.

Field Summary
protected  java.util.ArrayList answers
          The answers as an ArrayList of @see org.micropsi.common.consoleservice.AnswerIF
protected  java.lang.reflect.Method handle
          The method which should handle the question.
protected  AnswerHandlerIF part
          The part which sent the question.
 
Constructor Summary
DefaultAnswerQueue(AnswerHandlerIF part)
          Method AnswerQueue.
 
Method Summary
 void dispatchAnswer(AnswerIF answer)
          Method dispatchAnswer
 java.lang.reflect.Method getHandle()
           
 AnswerHandlerIF getHandler()
           
 void handleAnswers()
          Method handleAnswers.
 void run()
           
 
Methods inherited from class org.micropsi.comp.console.AbstractAnswerQueue
equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

part

protected AnswerHandlerIF part
The part which sent the question.


handle

protected java.lang.reflect.Method handle
The method which should handle the question.


answers

protected java.util.ArrayList answers
The answers as an ArrayList of @see org.micropsi.common.consoleservice.AnswerIF

Constructor Detail

DefaultAnswerQueue

public DefaultAnswerQueue(AnswerHandlerIF part)
Method AnswerQueue.

Parameters:
part -
Method Detail

dispatchAnswer

public void dispatchAnswer(AnswerIF answer)
Method dispatchAnswer

Specified by:
dispatchAnswer in interface AnswerQueueIF
Parameters:
answer -
See Also:
This method is called from @see de.artificialemotion.comp.consoleapp.plugin.eclipseconsole.AnswerDispatcher Normally you don't want to override this method.

run

public final void run()
Specified by:
run in interface java.lang.Runnable
See Also:
Please don't override this method. Use @see #handleAnswers instead.

handleAnswers

public void handleAnswers()
Method handleAnswers. Delivers the answers. This method is called everytime the AnswerDispatcher thinks, it is time to handle answers (actually it calls the run method). Inheritants should override this method to use their own clever way of answer delivering. You have to ensure, that @see #answers always contains only the answers which are not yet consumed by the @see #part. The default method is to dispatch all answers at once.

Specified by:
handleAnswers in interface AnswerQueueIF

getHandle

public java.lang.reflect.Method getHandle()
See Also:
This method is called, when the we are the part.

getHandler

public AnswerHandlerIF getHandler()
Overrides:
getHandler in class AbstractAnswerQueue
Returns:
AnswerHandlerIF

(c) by Micropsi Project: http://www.cognitive-agents.org

.