public class FormEntryModel
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private FormIndex |
currentFormIndex |
private FormDef |
form |
static int |
REPEAT_STRUCTURE_LINEAR
Repeats should be a prompted linear set of questions, either
with a fixed set of repetitions, or a prompt for creating a
new one.
|
static int |
REPEAT_STRUCTURE_NON_LINEAR
Repeats should be a custom juncture point with centralized
"Create/Remove/Interact" hub.
|
private int |
repeatStructure
One of "REPEAT_STRUCUTRE_" in this class's static types,
represents what abstract structure repeat events should
be broadacast as.
|
Constructor and Description |
---|
FormEntryModel(FormDef form) |
FormEntryModel(FormDef form,
int repeatStructure)
Creates a new entry model for the form with the appropriate
repeat structure
|
Modifier and Type | Method and Description |
---|---|
private boolean |
containsRepeatGuesses(IFormElement parent)
This method does a recursive check of whether there are any repeat guesses
in the element or its subtree.
|
private void |
createModelIfNecessary(FormIndex index)
For the current index: Checks whether the index represents a node which
should exist given a non-interactive repeat, along with a count for that
repeat which is beneath the dynamic level specified.
|
private void |
decrementHelper(java.util.List<java.lang.Integer> indexes,
java.util.List<java.lang.Integer> multiplicities,
java.util.List<IFormElement> elements) |
FormIndex |
decrementIndex(FormIndex index) |
FormEntryCaption[] |
getCaptionHierarchy()
Returns a hierarchical list of FormEntryCaption objects for the current
FormIndex
|
FormEntryCaption[] |
getCaptionHierarchy(FormIndex index)
Returns a hierarchical list of FormEntryCaption objects for the given
FormIndex
|
FormEntryCaption |
getCaptionPrompt()
When you have a non-question event, a CaptionPrompt will have all the
information needed to display to the user.
|
FormEntryCaption |
getCaptionPrompt(FormIndex index)
When you have a non-question event, a CaptionPrompt will have all the
information needed to display to the user.
|
int |
getCompletedRelevantQuestionCount()
Not yet implemented
Should get the number of completed questions to this point.
|
FormIndex[] |
getCompoundIndices() |
FormIndex[] |
getCompoundIndices(FormIndex container) |
int |
getEvent() |
int |
getEvent(FormIndex index)
Given a FormIndex, returns the event this FormIndex represents.
|
FormDef |
getForm() |
FormIndex |
getFormIndex() |
java.lang.String |
getFormTitle() |
java.lang.String |
getLanguage() |
java.lang.String[] |
getLanguages() |
int |
getNumQuestions() |
FormEntryPrompt |
getQuestionPrompt() |
FormEntryPrompt |
getQuestionPrompt(FormIndex index) |
int |
getRepeatStructure() |
int |
getTotalRelevantQuestionCount()
Not yet implemented
Should get the total possible questions given the current path through the form.
|
protected TreeElement |
getTreeElement(FormIndex index) |
private void |
incrementHelper(java.util.List<java.lang.Integer> indexes,
java.util.List<java.lang.Integer> multiplicities,
java.util.List<IFormElement> elements,
boolean descend) |
FormIndex |
incrementIndex(FormIndex index) |
FormIndex |
incrementIndex(FormIndex index,
boolean descend) |
boolean |
isIndexCompoundContainer() |
boolean |
isIndexCompoundContainer(FormIndex index) |
boolean |
isIndexCompoundElement() |
boolean |
isIndexCompoundElement(FormIndex index) |
boolean |
isIndexReadonly() |
boolean |
isIndexReadonly(FormIndex index) |
boolean |
isIndexRelevant()
Determine if the current FormIndex is relevant.
|
boolean |
isIndexRelevant(FormIndex index)
Determine if the current FormIndex is relevant.
|
protected void |
setLanguage(java.lang.String language) |
void |
setQuestionIndex(FormIndex index)
Set the FormIndex for the current question.
|
private boolean |
setRepeatNextMultiplicity(java.util.List<IFormElement> elements,
java.util.List<java.lang.Integer> multiplicities) |
private FormDef form
private FormIndex currentFormIndex
private int repeatStructure
public static final int REPEAT_STRUCTURE_LINEAR
public static final int REPEAT_STRUCTURE_NON_LINEAR
public FormEntryModel(FormDef form)
public FormEntryModel(FormDef form, int repeatStructure)
form
- repeatStructure
- The structure of repeats (the repeat signals which should
be sent during form entry)java.lang.IllegalArgumentException
- If repeatStructure is not validpublic int getEvent(FormIndex index)
FormEntryController
protected TreeElement getTreeElement(FormIndex index)
index
- public int getEvent()
FormEntryController
public java.lang.String getFormTitle()
public FormEntryPrompt getQuestionPrompt(FormIndex index)
index
- public FormEntryPrompt getQuestionPrompt()
public FormEntryCaption getCaptionPrompt(FormIndex index)
index
- public FormEntryCaption getCaptionPrompt()
public java.lang.String[] getLanguages()
public int getCompletedRelevantQuestionCount()
public int getTotalRelevantQuestionCount()
public int getNumQuestions()
public FormIndex getFormIndex()
protected void setLanguage(java.lang.String language)
public java.lang.String getLanguage()
public void setQuestionIndex(FormIndex index)
index
- public FormDef getForm()
public FormEntryCaption[] getCaptionHierarchy(FormIndex index)
index
- public FormEntryCaption[] getCaptionHierarchy()
public boolean isIndexReadonly(FormIndex index)
index
- public boolean isIndexReadonly()
public boolean isIndexRelevant(FormIndex index)
index
- public boolean isIndexRelevant()
private void createModelIfNecessary(FormIndex index)
index
- The index to be evaluated as to whether the underlying model is
hinted to existpublic boolean isIndexCompoundContainer()
public boolean isIndexCompoundContainer(FormIndex index)
public boolean isIndexCompoundElement()
public boolean isIndexCompoundElement(FormIndex index)
public FormIndex[] getCompoundIndices()
public int getRepeatStructure()
private void incrementHelper(java.util.List<java.lang.Integer> indexes, java.util.List<java.lang.Integer> multiplicities, java.util.List<IFormElement> elements, boolean descend)
private void decrementHelper(java.util.List<java.lang.Integer> indexes, java.util.List<java.lang.Integer> multiplicities, java.util.List<IFormElement> elements)
private boolean setRepeatNextMultiplicity(java.util.List<IFormElement> elements, java.util.List<java.lang.Integer> multiplicities)
private boolean containsRepeatGuesses(IFormElement parent)
parent
- The form element to begin checking