Example #1
0
        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);
            }
        }
Example #2
0
        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 &amp;lt;TransitionPlanning&amp;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);
 }
Example #5
0
 private void ChangeCodeset(int index, int length, Codeset fromCodeset, Codeset toCodeset)
 {
     this.Advance(index, length, fromCodeset, toCodeset, 2);
 }
Example #6
0
 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>&lt;PlannedAssessmentParticipation&gt;</c> element.</summary>
 /// <param name="Codeset">Identifies source of value provided.</param>
 /// <param name="Value">Gets or sets the content value of the &amp;lt;PlannedAssessmentParticipation&amp;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));
 }
Example #8
0
 /// <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 &amp;lt;ProjectedExitReason&amp;gt; element</param>
 ///
 public ProjectedExitReason(Codeset codeset, string value) : base(ProgramsDTD.PROJECTEDEXITREASON)
 {
     this.SetCodeset(codeset);
     this.Value = value;
 }
Example #9
0
 /// <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);
 }