private Codeset[] GeneratePath() { var length = this.Text.Length; var codesets = new Codeset[length]; var currentIndex = 0; var currentCodeset = ChooseStartCodeset(); while (currentIndex < length) { codesets[currentIndex] = currentCodeset; var nextIndex = this.NextIndex[(int)currentCodeset, currentIndex]; currentCodeset = this.NextCodeset[(int)currentCodeset, currentIndex]; currentIndex = nextIndex; } return(codesets); Codeset ChooseStartCodeset() { var costA = this.Costs[(int)Codeset.A, 0]; var costB = this.Costs[(int)Codeset.B, 0]; var costC = this.Costs[(int)Codeset.C, 0]; if (costC < costA && costC < costB) { return(Codeset.C); } return(costA < costB ? Codeset.A : Codeset.B); } }
private void Advance(int index, int length, Codeset fromCodeset, Codeset toCodeset, int cost) { var fromIndex = index + length; var fromCost = this.Costs[(int)fromCodeset, fromIndex]; if (fromCost < int.MaxValue) { var toIndex = index; var toCost = fromCost + cost; var currentBestCost = this.Costs[(int)toCodeset, toIndex]; if (toCost < currentBestCost) { this.Costs[(int)toCodeset, toIndex] = toCost; this.NextIndex[(int)toCodeset, toIndex] = fromIndex; this.NextCodeset[(int)toCodeset, toIndex] = fromCodeset; } } }
/// <summary> /// Constructor that accepts values for all mandatory fields /// </summary> ///<param name="codeset">Identifies source of value provided.</param> ///<param name="value">Gets or sets the content value of the &lt;TransitionPlanning&gt; element</param> /// public TransitionPlanning(Codeset codeset, string value) : base(ProgramsDTD.TRANSITIONPLANNING) { this.SetCodeset(codeset); this.Value = value; }
/// <summary> /// Sets the value of the <c>Codeset</c> attribute. /// </summary> /// <param name="val">A Codeset object</param> /// <remarks> /// <para>The SIF specification defines the meaning of this attribute as: "Identifies source of value provided."</para> /// <para>Version: 2.6</para> /// <para>Since: 2.0</para> /// </remarks> public void SetCodeset(Codeset val) { SetField(ProgramsDTD.TRANSITIONPLANNING_CODESET, val); }
private void ChangeCodeset(int index, int length, Codeset fromCodeset, Codeset toCodeset) { this.Advance(index, length, fromCodeset, toCodeset, 2); }
private void UseSameCodeset(int index, int length, Codeset codeset, int cost = 1) { this.Advance(index, length, codeset, codeset, cost); }
///<summary>Sets the value of the <c><PlannedAssessmentParticipation></c> element.</summary> /// <param name="Codeset">Identifies source of value provided.</param> /// <param name="Value">Gets or sets the content value of the &lt;PlannedAssessmentParticipation&gt; element</param> ///<remarks> /// <para>This form of <c>setPlannedAssessmentParticipation</c> is provided as a convenience method /// that is functionally equivalent to the <c>PlannedAssessmentParticipation</c></para> /// <para>Version: 2.6</para> /// <para>Since: 2.0</para> /// </remarks> public void SetPlannedAssessmentParticipation(Codeset Codeset, string Value) { RemoveChild(EtranscriptsDTD.STUDENTPARTICIPATIONDATA_PLANNEDASSESSMENTPARTICIPATION); AddChild(EtranscriptsDTD.STUDENTPARTICIPATIONDATA_PLANNEDASSESSMENTPARTICIPATION, new PlannedAssessmentParticipation(Codeset, Value)); }
/// <summary> /// Constructor that accepts values for all mandatory fields /// </summary> ///<param name="codeset">Identifies source of value provided.</param> ///<param name="value">Gets or sets the content value of the &lt;ProjectedExitReason&gt; element</param> /// public ProjectedExitReason(Codeset codeset, string value) : base(ProgramsDTD.PROJECTEDEXITREASON) { this.SetCodeset(codeset); this.Value = value; }
/// <summary> /// Sets the value of the <c>Codeset</c> attribute. /// </summary> /// <param name="val">A Codeset object</param> /// <remarks> /// <para>The SIF specification defines the meaning of this attribute as: "Identifies source of value provided."</para> /// <para>Version: 2.6</para> /// <para>Since: 2.0</para> /// </remarks> public void SetCodeset(Codeset val) { SetField(ProgramsDTD.PROJECTEDEXITREASON_CODESET, val); }