public class Survey extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
Map<String,Block> |
blocks
Map of all block identifiers to
Block objects. |
Map<String,List<Question>> |
correlationMap
Map from correlation labels to the Questions that are correlated.
|
String |
encoding
Source string encoding.
|
String[] |
otherHeaders
Array of headers not contained in
knownHeaders . |
List<Question> |
questions
Top level list of all questions in this survey.
|
String |
sid
Internal survey identifier.
|
String |
source
Source input url.
|
String |
sourceName
Name of this survey derived from the source input URL
|
List<Block> |
topLevelBlocks
List of all top-level blocks.
|
Constructor and Description |
---|
Survey() |
Survey(Question... surveyQuestions) |
Modifier and Type | Method and Description |
---|---|
void |
addBlock(Block b) |
void |
addQuestion(Question q) |
void |
addQuestions(Question... surveyQuestions)
Adds the questions provided in the arguments to a top level block and adds this block to the survey.
|
boolean |
equals(Object o) |
Set<Block> |
getAllBlocks()
Gets all blocks (top level and subblocks) in this survey.
|
String |
getCorrelationLabel(Question q)
Returns the correlation label associated with the input question.
|
Question |
getQuestionById(String quid)
Returns the
Question object associated with the input question identifier. |
Question |
getQuestionByLineNo(int lineno)
Returns the
Question that contains the associated input line number. |
Question |
getQuestionByText(String text)
Returns the
Question whose surface text corresponds with the input. |
Question[] |
getQuestionListByIndex() |
Set<Question> |
getVariantSet(Question thisQ)
If the input question belongs to a Block having
Block.BranchParadigm equal
to ALL , it is part of a question variant set. |
String |
jsonize() |
org.supercsv.cellprocessor.ift.CellProcessor[] |
makeProcessorsForResponse()
Returns the
CellProcessor s needed to parse the output of a deployed
SurveyMan survey. |
boolean |
permitsBreakoff()
Indicates whether any breakoff is permitted in this survey.
|
String |
toString()
A string representation of the survey is an indented illustration of the blocks and their questions.
|
public String sid
public Map<String,Block> blocks
Block
objects. Includes top level blocks,
sub-blocks, and "phantom" blocks.public String encoding
public String[] otherHeaders
knownHeaders
.public String sourceName
public String source
public Survey()
public Survey(Question... surveyQuestions) throws SurveyException
SurveyException
public Question getQuestionById(String quid) throws SurveyException
Question
object associated with the input question identifier.
If the input identifier matches a known ad hoc custom question id, it will return a new
Question
object with the idenfier "q_-1_-1".quid
- A question identifier.Question
object.QuestionNotFoundException
- if a question with this identifier is
not found in this survey.SurveyException
public Question getQuestionByLineNo(int lineno) throws SurveyException
Question
that contains the associated input line number.lineno
- The input line number.Question
object.QuestionNotFoundException
- if none of the questions associated
with this survey span the input line number.SurveyException
public Question getQuestionByText(String text) throws SurveyException
Question
whose surface text corresponds with the input.
Matches exactly. Only works on questions whose contents are strings, not those that are specified by HTML.SurveyException
public Question[] getQuestionListByIndex()
public Set<Block> getAllBlocks()
public boolean permitsBreakoff()
true
if at least one question permits breakoff.public Set<Question> getVariantSet(Question thisQ)
Block.BranchParadigm
equal
to ALL
, it is part of a question variant set.thisQ
- Input question that may belong to a variant set.null
.public org.supercsv.cellprocessor.ift.CellProcessor[] makeProcessorsForResponse()
CellProcessor
s needed to parse the output of a deployed
SurveyMan survey. See the SurveyMan Runtime.public String getCorrelationLabel(Question q)
q
- The question whose correlation label we would like.public String jsonize() throws SurveyException, IOException
SurveyException
IOException
public void addBlock(Block b)
public void addQuestions(Question... surveyQuestions) throws SurveyException
surveyQuestions
- The questions to be added to the top-level block of the survey.SurveyException
public void addQuestion(Question q) throws SurveyException
SurveyException
public String toString()
Copyright © 2015. All rights reserved.