Class DefaultQuestionSet2
- All Implemented Interfaces:
QuestionSet
A QuestionSet that work on a static list of Questions and BuildPoints to satisfy the
API contract
-
Field Summary
Fields inherited from class nz.org.riskscape.wizard.BaseQuestionSet
discriminator, id, name, surveyFields inherited from interface nz.org.riskscape.wizard.QuestionSet
FINAL_QUESTION, SKIP, UNASSIGNED -
Constructor Summary
ConstructorsConstructorDescriptionDefaultQuestionSet2(String name, String discriminator, Phase phase) DefaultQuestionSet2(String id, Phase phase) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBuildPoint(BuildPoint point) Adds a potential build point to the question set, i.e.addHiddenQuestion(String name) Adds a hidden question (Question.hidden()) to the set<T> AddQuestion<T>addQuestion(String name, Class<T> parameterType) Start adding a question to this question set.booleanA default location that gets assigned to Questions added via theaddQuestionmethod when they are added to this set.List<nz.org.riskscape.engine.bind.Parameter>Returns Parameters that represent this set of questions.getPhase()getPipelineChange(IncrementalBuildState buildState, Answer answer) Returns aPipelineChangethat is created by applying an answer a build state.The list of questions that this question set contains.booleanvoidsetDefaultLocation(ChangeLocation defaultLocation) A default location that gets assigned to Questions added via theaddQuestionmethod when they are added to this set.toString()Methods inherited from class nz.org.riskscape.wizard.BaseQuestionSet
canEqual, equals, getDescription, getId, getName, getSurvey, getTitle, hashCode
-
Constructor Details
-
DefaultQuestionSet2
-
DefaultQuestionSet2
-
-
Method Details
-
addBuildPoint
Adds a potential build point to the question set, i.e. if certain conditions are met then apply a given pipeline change.
-
addQuestion
Start adding a question to this question set. Note that
AddQuestion.then must be called to actually add it- Parameters:
name- the name of the questionparameterType- the type of the response wanted for this question
-
addHiddenQuestion
Adds a hidden question (
Question.hidden()) to the set -
get
-
remove
-
contains
-
getParameters
Returns Parameters that represent this set of questions. Note that this is the full set of Questions (i.e. it doesn't exclude any mutually exclusive questions).
-
getQuestions
Description copied from interface:QuestionSetThe list of questions that this question set contains.
These questions should be partially ordered such that if question
bcomes after questionathen they should be ordered so thatais 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.
-
getPipelineChange
Description copied from interface:QuestionSetReturns a
PipelineChangethat 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
-
toString
-
getPhase
- Returns:
- the phase this QuestionSet belongs to
-
getBuildPoints
-
getDefaultLocation
A default location that gets assigned to Questions added via the
addQuestionmethod when they are added to this set. Defaults to the same thing as Question defaults to -
setDefaultLocation
A default location that gets assigned to Questions added via the
addQuestionmethod when they are added to this set. Defaults to the same thing as Question defaults to
-