Interface QuestionSet
- All Known Implementing Classes:
BaseQuestionSet
,DefaultQuestionSet2
,EmptyQuestionSet
A QuestionSet
is a part of a Survey
that groups together some questions that can apply a
functionally similar set of changes to a PipelineDeclaration
. The QuestionSet
'drives' the survey
by offering Question
s to the user and then plugging the answers in to update the PipelineDeclaration
,
via the IncrementalBuildState
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Question
Used as a unique question to act as a place for a final change to hang from - it needs a unique question for the change to hang from, otherwiseIncrementalBuildState.append(PipelineChange, nz.org.riskscape.pipeline.ast.PipelineDeclaration, nz.org.riskscape.engine.pipeline.RealizedPipeline)
will complain.static final QuestionSet
Presented to the user as a choice when optional QuestionSets can be skipped.static final QuestionSet
Used when a Question belongs to nothing (yet) -
Method Summary
Modifier and TypeMethodDescriptiongetDescription
(Locale locale) A human-friendly description for this QuestionSetgetId()
default String
getName()
getPhase()
getPipelineChange
(IncrementalBuildState buildState, Answer answer) Returns aPipelineChange
that is created by applying an answer a build state.The list of questions that this question set contains.A human-friendly title for this QuestionSet
-
Field Details
-
FINAL_QUESTION
Used as a unique question to act as a place for a final change to hang from - it needs a unique question for the change to hang from, otherwise
IncrementalBuildState.append(PipelineChange, nz.org.riskscape.pipeline.ast.PipelineDeclaration, nz.org.riskscape.engine.pipeline.RealizedPipeline)
will complain. -
UNASSIGNED
Used when a Question belongs to nothing (yet)
-
SKIP
Presented to the user as a choice when optional QuestionSets can be skipped.
-
-
Method Details
-
getId
String getId()- Returns:
- a String that uniquely identifies this QuestionSet TODO this might become a name and end up being a weak identifier, as the name is probably only unique within the context of a survey
-
getTitle
A human-friendly title for this QuestionSet
-
getDescription
A human-friendly description for this QuestionSet
-
getPipelineChange
Returns a
PipelineChange
that is created by applying an answer a build state.- Parameters:
buildState
- the build state to get a change to.answer
- the answer to apply. This answer must be for a question that came back from#getNextQuestions(IncrementalBuildState)
using the given build state, or weird things might happen
-
getSurvey
Survey getSurvey()- Returns:
- the survey to which this set belongs
-
getQuestions
The list of questions that this question set contains.
These questions should be partially ordered such that if question
b
comes after questiona
then they should be ordered so thata
is before b in the list.Previously, there was potential for this list to change as the build state changed, and so this method was removed from the QuestionSet interface. But this possibility is being dropped with the new survey2 api in favour of a static list of questions per set, but allowing a dynamic set of question sets.
-
getName
-
getPhase
Phase getPhase()- Returns:
- the phase this QuestionSet belongs to
-