	doTerminationRequest: function (iRequest, iTentative)	{		// The Termination Request Process may return a sequencing request		var seqReq = null;		this.mExitAll = false;				// Ensure the request exists		if (iRequest == null)		{			this.mValidTermination = false;			return seqReq;		}				// The Sequencing Request Process will always begin processing at the		// 'first candidate'.		// Assume the first candidate for sequencing is the current activity.		var cur = this.mSeqTree.getCurrentActivity();				if (cur != null)		{			this.mSeqTree.setFirstCandidate(cur);		}		else		{			this.mValidTermination = false;			return seqReq;		}				// Apply the termination request		if (iRequest == TER_EXIT)		{						// Make sure the current activity is active.			if (cur.getIsActive())			{							// End the attempt on the current activity				this.endAttempt(cur, iTentative);								// Evaluate exit action rules				this.evaluateExitRules(iTentative);								// Evaluate post conditions				var exited = false;								// todo: check this do loop				do				{					exited = false;										// Only process post conditions on the first candidate					var process = this.mSeqTree.getFirstCandidate();										// Make sure we are not at the root					if (!this.mExitCourse)					{						// This block implements the Sequencing Post Condition Rule						// Subprocess (SB.2.2)						// Attempt to get rule information from the activity						var postRules = process.getPostSeqRules();												if (postRules != null)						{							var result = null;							result = postRules.evaluate(RULE_TYPE_POST, process, false);														if (result != null)							{								// This set of ifs implement TB.2.2								if (result == SEQ_ACTION_RETRY)								{									// Override any existing sequencing request									seqReq = SEQ_RETRY;																		// If we are processing the root activity, behave									// as if this where an exitAll									if (process == this.mSeqTree.getRoot())									{        										// Break from the current loop and jump to the										// next case										iRequest = TER_EXITALL;									}								}								else if (result == SEQ_ACTION_CONTINUE)								{									// Override any existing sequencing request									seqReq = SEQ_CONTINUE;								}								else if (result == SEQ_ACTION_PREVIOUS)								{									// Override any existing sequencing request									seqReq = SEQ_PREVIOUS;								}								else if (result == SEQ_ACTION_EXITALL)								{									// Break from the current loop and jump to the									// next case									iRequest = TER_EXITALL;								}								else if (result == SEQ_ACTION_EXITPARENT)								{									process = process.getParent();											if (process == null)									{									}									else									{										this.mSeqTree.setFirstCandidate(process);										this.endAttempt(process, iTentative);										exited = true;									}								}								else if (result == SEQ_ACTION_RETRYALL)								{									// Override any existing sequencing request									seqReq = SEQ_RETRY;																		// Break from the current loop and jump to the									// next case									iRequest = TER_EXITALL;								}								else if (process == this.mSeqTree.getRoot())								{									// Exited Root with no postcondition rules									// End the Course									this.mExitCourse = true;                        								}							}						}						else if (process == this.mSeqTree.getRoot())						{							// Exited Root with no postcondition rules							// End the Course							this.mExitCourse = true;						}					}				}				while (exited);			}			else			{				this.mValidTermination = false;			}		}				// Double check for an EXIT request		if (iRequest == TER_EXIT)		{			// Already handled		}		else if (iRequest == TER_EXITALL)		{			// Don't modify the activity tree if this is only a tentative exit			if (!iTentative)			{				var process = this.mSeqTree.getFirstCandidate();				if (process.getIsActive())				{					this.endAttempt(process, false);				}								this.terminateDescendentAttempts(this.mSeqTree.getRoot());				this.endAttempt(this.mSeqTree.getRoot(), false);				// only exit if we're not retrying the root				if (seqReq != SEQ_RETRY)				{					seqReq = SEQ_EXIT;				}								// Start any subsequent seqencing request from the root				this.mSeqTree.setFirstCandidate(this.mSeqTree.getRoot());			}			else			{				// Although this was a tentative evaluation, remember that we				// processed the exitAll so that a retry from the root can be				// tested			}						// Start any subsequent seqencing request from the root			this.mSeqTree.setFirstCandidate(this.mSeqTree.getRoot());					}		else if (iRequest == TER_SUSPENDALL)		{			// Don't modify the activty tree if this is only a tentative exit			if (!iTentative)			{				var process = this.mSeqTree.getFirstCandidate();				this.reportSuspension(process.getID(), true);								if (process.getIsActive())				{					// Invoke rollup					this.invokeRollup(process, null);										this.mSeqTree.setSuspendAll(process);										// Check to see if the SCO's learner attempt ended					if (!process.getIsSuspended())					{						process.incrementSCOAttempt();					}				}				else				{					if (!process.getIsSuspended())					{						this.mSeqTree.setSuspendAll(process.getParent());												// Make sure there was a an activity to suspend						if (this.mSeqTree.getSuspendAll() == null)						{							this.mValidTermination = false;						}					}				}								if (this.mValidTermination)				{					var start = this.mSeqTree.getSuspendAll();										// This process suspends all clusters up to the root					while (start != null)					{						start.setIsActive(false);						start.setIsSuspended(true);						start = start.getParent();					}				}			}						// Start any subsequent seqencing request from the root			this.mSeqTree.setFirstCandidate(this.mSeqTree.getRoot());					}		else if (iRequest == TER_ABANDON)		{			// Don't modify the activty tree if this is only a tentativen exit			if (!iTentative)			{				var process = this.mSeqTree.getFirstCandidate();				// Ignore any status values reported by the content				process.setProgress(TRACK_UNKNOWN);				process.setObjSatisfied(null, TRACK_UNKNOWN);				process.clearObjMeasure(null);								process.setIsActive(false);			}		}		else if (iRequest == TER_ABANDONALL)		{			// Don't modify the activty tree if this is only a tentative exit			if (!iTentative)			{				var process = this.mSeqTree.getFirstCandidate();								// Ignore any status values reported by the content				process.setProgress(TRACK_UNKNOWN);				process.setObjSatisfied(null, TRACK_UNKNOWN);				process.clearObjMeasure(null);								while (process != null)				{					process.setIsActive(false);					process = process.getParent();				}								seqReq = SEQ_EXIT;								// Start any subsequent seqencing request from the root				this.mSeqTree.setFirstCandidate(this.mSeqTree.getRoot());			}		}		else		{			this.mValidTermination = false;		}				// If this was a 'real' termination request, move the current activity		if (!iTentative)		{			this.mSeqTree.setCurrentActivity(this.mSeqTree.getFirstCandidate());		}				// todo: why this?		var tmpID = this.mSeqTree.getFirstCandidate().getID();				return seqReq;	},
6251	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/6251/1411d268e590bd7d23033c9d5908b240a6aef0df/ADLSequencer.js/clean/Modules/Scorm2004/scripts/adl2js/ADLSequencer.js