Package org.javarosa.core.model
Class Safe2014DagImpl
java.lang.Object
org.javarosa.core.model.IDag
org.javarosa.core.model.LatestDagBase
org.javarosa.core.model.Safe2014DagImpl
public class Safe2014DagImpl extends LatestDagBase
The safe (Latest_safest) eval logic for 2014
- Author:
- mitchellsundt@gmail.com, meletis@surveycto.com
-
Nested Class Summary
Nested classes/interfaces inherited from class org.javarosa.core.model.IDag
IDag.EventNotifierAccessor -
Field Summary
Fields inherited from class org.javarosa.core.model.IDag
accessor, conditionRepeatTargetIndex, triggerablesDAG, triggerIndex, unorderedTriggerables -
Constructor Summary
Constructors Constructor Description Safe2014DagImpl(IDag.EventNotifierAccessor accessor) -
Method Summary
Modifier and Type Method Description voidcopyItemsetAnswer(FormInstance mainInstance, EvaluationContext evalContext, TreeReference copyRef, TreeElement copyToElement, boolean midSurvey)Take actions related to changes of select-one and select-multiple itemsets.voidcreateRepeatGroup(FormInstance mainInstance, EvaluationContext evalContext, TreeReference createRef, TreeElement parentElement, TreeElement createdElement)Take whatever action is required when creating a repeat group.voiddeleteRepeatGroup(FormInstance mainInstance, EvaluationContext evalContext, TreeReference deleteRef, TreeElement parentElement, TreeElement deletedElement)Take whatever action is required when deleting a repeat group.voidfillTriggeredElements(FormInstance mainInstance, EvaluationContext evalContext, QuickTriggerable qt, Set<QuickTriggerable> destinationSet, Set<QuickTriggerable> newDestinationSet)Get all of the elements which will need to be evaluated (in order) when the triggerable is fired.voidfinalizeTriggerables(FormInstance mainInstance, EvaluationContext evalContext)Finalize the DAG associated with the form's triggered conditions.FormDef.EvalBehaviorgetEvalBehavior()The EvalBehavior that the implementation provides.QuickTriggerablegetTriggerableForRepeatGroup(TreeReference repeatRef)Used to obtain the triggerable that impacts the relevancy of the repeat group.Collection<QuickTriggerable>initializeTriggerables(FormInstance mainInstance, EvaluationContext evalContext, TreeReference rootRef, boolean midSurvey)Walks the current set of conditions, and evaluates each of them with the current context.booleanshouldTrustPreviouslyCommittedAnswer()Specifies if unchanged answers should be trusted (and not re-committed).Collection<QuickTriggerable>triggerTriggerables(FormInstance mainInstance, EvaluationContext evalContext, TreeReference ref, boolean midSurvey)The entry point for the DAG cascade after a value is changed in the model.Methods inherited from class org.javarosa.core.model.IDag
addTriggerable, getConditionExpressionForTrueAction, getConditions, getRecalculates, printTriggerables, publishSummary, publishSummary, reportDependencyCycles, validate
-
Constructor Details
-
Method Details
-
getEvalBehavior
Description copied from class:IDagThe EvalBehavior that the implementation provides.- Specified by:
getEvalBehaviorin classIDag- Returns:
-
getTriggerableForRepeatGroup
Description copied from class:IDagUsed to obtain the triggerable that impacts the relevancy of the repeat group.- Specified by:
getTriggerableForRepeatGroupin classIDag- Returns:
-
deleteRepeatGroup
public void deleteRepeatGroup(FormInstance mainInstance, EvaluationContext evalContext, TreeReference deleteRef, TreeElement parentElement, TreeElement deletedElement)Description copied from class:IDagTake whatever action is required when deleting a repeat group.- Specified by:
deleteRepeatGroupin classIDag
-
createRepeatGroup
public void createRepeatGroup(FormInstance mainInstance, EvaluationContext evalContext, TreeReference createRef, TreeElement parentElement, TreeElement createdElement)Description copied from class:IDagTake whatever action is required when creating a repeat group.- Specified by:
createRepeatGroupin classIDag
-
copyItemsetAnswer
public void copyItemsetAnswer(FormInstance mainInstance, EvaluationContext evalContext, TreeReference copyRef, TreeElement copyToElement, boolean midSurvey)Description copied from class:IDagTake actions related to changes of select-one and select-multiple itemsets.- Specified by:
copyItemsetAnswerin classIDag
-
finalizeTriggerables
public void finalizeTriggerables(FormInstance mainInstance, EvaluationContext evalContext) throws IllegalStateExceptionFinalize the DAG associated with the form's triggered conditions. This will create the appropriate ordering and dependencies to ensure the conditions will be evaluated in the appropriate orders.- Specified by:
finalizeTriggerablesin classIDag- Throws:
IllegalStateException- - If the trigger ordering contains an illegal cycle and the triggers can't be laid out appropriately
-
fillTriggeredElements
public void fillTriggeredElements(FormInstance mainInstance, EvaluationContext evalContext, QuickTriggerable qt, Set<QuickTriggerable> destinationSet, Set<QuickTriggerable> newDestinationSet)Get all of the elements which will need to be evaluated (in order) when the triggerable is fired.- Parameters:
qt-destinationSet- where to store the triggerables
-
initializeTriggerables
public Collection<QuickTriggerable> initializeTriggerables(FormInstance mainInstance, EvaluationContext evalContext, TreeReference rootRef, boolean midSurvey)Walks the current set of conditions, and evaluates each of them with the current context.- Specified by:
initializeTriggerablesin classIDagmidSurvey- true if we are during the survey, false if we are on loading/saving phase
-
triggerTriggerables
public Collection<QuickTriggerable> triggerTriggerables(FormInstance mainInstance, EvaluationContext evalContext, TreeReference ref, boolean midSurvey)The entry point for the DAG cascade after a value is changed in the model.- Specified by:
triggerTriggerablesin classIDag- Parameters:
ref- The full contextualized unambiguous reference of the value that was changed.
-
shouldTrustPreviouslyCommittedAnswer
public boolean shouldTrustPreviouslyCommittedAnswer()Description copied from class:IDagSpecifies if unchanged answers should be trusted (and not re-committed).- Specified by:
shouldTrustPreviouslyCommittedAnswerin classIDag- Returns:
-