symplik.flower
Class Answer

java.lang.Object
  extended by symplik.flower.Answer
All Implemented Interfaces:
Constants

public class Answer
extends java.lang.Object
implements Constants

This singleton class is responsible for storing answer for each question. There're two types of answer:
(1) responses from user input (e.g. multiple choice answer, free-text input)
(2) derived values from (1)
Answer(1) can be retrieved anyhere by using getA([class alias | name]). Answer(2) can be retrieved anyhere by using getB([class alias | name]). In this class, getA and putA methods are used to store and retrieve direct answer values for a Question class; while getB and putB are used for derived values. putA([key], null) and putB([key], null) will remove [key] from lookup. In recording mode, only the values stored in putA() method will be saved in the response.xml.

Version:
$Revision: 5 $
Author:
$Author: Christopher Ho $

Field Summary
private static Answer allAnswers
           
(package private)  java.util.Properties answerValue
           
static java.lang.String RCS_ID
           
 
Fields inherited from interface symplik.flower.Constants
CLASS_DEFAULT_START, CLASS_DIR_BROWSER, CLASS_FILE_BROWSER, DISPLAY_MODE, DISPLAY_MODE_CONSOLE, DISPLAY_MODE_GUI, DISPLAY_MODE_SLIENT, FILE_BROWSER_CURR_DIR, FILE_BROWSER_DIR, FILE_BROWSER_FILE, FLOWER_CONFIG, FLOWER_CONFIG_FILE, FLOWER_LAST_QUESTION, FLOWER_LOG_FILE, FLOWER_LOG_LEVEL, FLOWER_LOG_OUTPUT, FLOWER_RESPONSES, FLOWER_RESPONSES_FILE, LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_OUTPUT_FILE, LOG_OUTPUT_SYSTEM_OUT, LOG_WARN, SORT_AS_IS, SORT_BY_DESC, SORT_BY_DESC_CI, SORT_BY_KEY, SORT_BY_KEY_CI
 
Constructor Summary
protected Answer()
          Constructor
 
Method Summary
 void clearAll()
          remove all answer entries.
 java.lang.String getA(Question question)
          Retrieve answer from a Question boject
 java.lang.String getA(java.lang.String questionAlias)
          Retrieve answer from questionAlias or full-qualified class name
 java.lang.String getB(java.lang.String key)
          retrieve derived values
static Answer getInstance()
          get an instance of this class by using Answer.getInstance().get....
 void putA(Question question, java.lang.String aValue)
          Store Question response using question object
 void putA(java.lang.String questionAlias, java.lang.String aValue)
          Store Question response using class alias or full qualified class name
 void putB(java.lang.String key, java.lang.String aValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RCS_ID

public static final java.lang.String RCS_ID
See Also:
Constant Field Values

allAnswers

private static Answer allAnswers

answerValue

java.util.Properties answerValue
Constructor Detail

Answer

protected Answer()
Constructor

Method Detail

getInstance

public static Answer getInstance()
get an instance of this class by using Answer.getInstance().get....

Returns:
this class

getA

public java.lang.String getA(java.lang.String questionAlias)
Retrieve answer from questionAlias or full-qualified class name

Parameters:
questionAlias -
Returns:
answer value

getA

public java.lang.String getA(Question question)
Retrieve answer from a Question boject

Parameters:
question -
Returns:
answer value

putA

public void putA(Question question,
                 java.lang.String aValue)
Store Question response using question object

Parameters:
question - Question object
aValue - choice key or free-text. Null to remove this entry.

putA

public void putA(java.lang.String questionAlias,
                 java.lang.String aValue)
Store Question response using class alias or full qualified class name

Parameters:
questionAlias - Question alis or full qualified class name
aValue - choice key or free-text. Null to remove this entry.

getB

public java.lang.String getB(java.lang.String key)
retrieve derived values

Parameters:
key -
Returns:
null if this key is not defined

putB

public void putB(java.lang.String key,
                 java.lang.String aValue)
Parameters:
key -
aValue -

clearAll

public void clearAll()
remove all answer entries. Used for rerun the application from start



Copyright © 2010 Symplik Tech. Co. Ltd. All Rights Reserved.