fr.lifl.magique.util
Class QuestionTable

java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byfr.lifl.magique.util.QuestionTable
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class QuestionTable
extends java.util.Hashtable

such a table associates a question name (String) with an AnswerVector object. So an Agent can know when the answer to a question has arrived and what it is, and multiple answer can be managed.

See Also:
AnswerVector, Serialized Form

Constructor Summary
QuestionTable()
           
QuestionTable(ConcurrencyPolicy theConcurrencyPolicy)
           
 
Method Summary
 AnswerVector getAnswerVector(java.lang.String question)
          give the answer vector associated to the question
 Answer getTheAnswer(java.lang.String question)
          give the answer to the question (this may have been selected among multiple answers)
 boolean isAnswerReceived(java.lang.String question)
          tells if the answer to the question has been received
 void newQuestion(Request question)
          add a question to the table
 void removeQuestion(java.lang.String question)
          remove a question entry from the table
 Answer selectTheAnswer(java.lang.String question)
          give the answer to the question (this may have been selected among multiple answers if question was aconcurrent one)
 void setAnAnswer(java.lang.String question, java.lang.Object answer, java.lang.String answerer, int pathLength)
          an answer to question has been received, this method adds it to the vector of answer associated to the question
 void setConcurrencyPolicy(ConcurrencyPolicy theConcurrencyPolicy)
          set the concurrency policy
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QuestionTable

public QuestionTable()

QuestionTable

public QuestionTable(ConcurrencyPolicy theConcurrencyPolicy)
Method Detail

setConcurrencyPolicy

public void setConcurrencyPolicy(ConcurrencyPolicy theConcurrencyPolicy)
set the concurrency policy


newQuestion

public void newQuestion(Request question)
add a question to the table

Parameters:
question - the question to add

getAnswerVector

public AnswerVector getAnswerVector(java.lang.String question)
give the answer vector associated to the question

Parameters:
question - the question you want the answer to
Returns:
the answer vector associated to the question

getTheAnswer

public Answer getTheAnswer(java.lang.String question)
give the answer to the question (this may have been selected among multiple answers)

Parameters:
question - the question you want the answer to
Returns:
the answer vector associated to the question

isAnswerReceived

public boolean isAnswerReceived(java.lang.String question)
tells if the answer to the question has been received

Parameters:
question - the question you want to test
Returns:
true if the anwsered has been received

selectTheAnswer

public Answer selectTheAnswer(java.lang.String question)
give the answer to the question (this may have been selected among multiple answers if question was aconcurrent one)

Parameters:
question - the question you want the answer to
Returns:
the answer vector associated to the question

setAnAnswer

public void setAnAnswer(java.lang.String question,
                        java.lang.Object answer,
                        java.lang.String answerer,
                        int pathLength)
an answer to question has been received, this method adds it to the vector of answer associated to the question

Parameters:
question - the question that has been answered
answer - the value of the answer to question
answerer - the full name of the agent who answered to question
pathLength - the length of the path to reach the answerer
Returns:
no return value

removeQuestion

public void removeQuestion(java.lang.String question)
remove a question entry from the table

Parameters:
question - the question to remove
Returns:
no return value