Class DefaultQuestionSet2
- All Implemented Interfaces:
QuestionSet
A QuestionSet
that work on a static list of Question
s and BuildPoint
s to satisfy the
API contract
-
Field Summary
Fields inherited from class nz.org.riskscape.wizard.BaseQuestionSet
discriminator, id, name, survey
Fields inherited from interface nz.org.riskscape.wizard.QuestionSet
FINAL_QUESTION, SKIP, UNASSIGNED
-
Constructor Summary
ConstructorDescriptionDefaultQuestionSet2
(String name, String discriminator, Phase phase) DefaultQuestionSet2
(String id, Phase phase) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBuildPoint
(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.boolean
A default location that gets assigned to Questions added via theaddQuestion
method 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 aPipelineChange
that is created by applying an answer a build state.The list of questions that this question set contains.boolean
void
setDefaultLocation
(ChangeLocation defaultLocation) A default location that gets assigned to Questions added via theaddQuestion
method 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:QuestionSet
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.
-
getPipelineChange
Description copied from interface:QuestionSet
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
-
toString
-
getPhase
- Returns:
- the phase this QuestionSet belongs to
-
getBuildPoints
-
getDefaultLocation
A default location that gets assigned to Questions added via the
addQuestion
method 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
addQuestion
method when they are added to this set. Defaults to the same thing as Question defaults to
-