public SessionGenerationInfo(ITestProject testProject) { this.Session = CommonConst.TestGroupSession; this.Status = GenerationStatus.Idle; this.SequenceStatus = new SerializableMap <int, GenerationStatus>(2); SequenceStatus.Add(CommonConst.SetupIndex, GenerationStatus.Idle); SequenceStatus.Add(CommonConst.TeardownIndex, GenerationStatus.Idle); }
private SequenceHistory History(SequenceStatus status) => new SequenceHistory { InstanceKey = status.Key, DefinitionId = status.StartOptions.DefinitionId, LastUpdated = status.LastUpdated, DeleteAfter = status.LastUpdated.AddDays(historyRetentionDays).Date, FinalRunStatus = status.RunStatus, FullDetailsJson = JsonConvert.SerializeObject(status) };
public SessionGenerationInfo(ISequenceGroup sequenceGroup, int session) { this.Session = session; this.Status = GenerationStatus.Idle; this.SequenceStatus = new SerializableMap <int, GenerationStatus>(sequenceGroup.Sequences.Count + 2); SequenceStatus.Add(CommonConst.SetupIndex, GenerationStatus.Idle); SequenceStatus.Add(CommonConst.TeardownIndex, GenerationStatus.Idle); for (int i = 0; i < sequenceGroup.Sequences.Count; i++) { SequenceStatus.Add(i, GenerationStatus.Idle); } }
/// <summary> /// The function returns a html text string reconstructed /// from the sub collection of words its starting and ending /// indexes are marked by parameter seq and its collection is /// denoted by parameter status. If the status is "deleted", /// then the _original collection is used, otherwise, _modified /// is used. /// </summary> /// <param name="seq"> /// Sequence object that marks the start index and end /// index of the sub sequence /// </param> /// <param name="status"> /// Denoting the status of the sequence. When its value is /// Deleted or Added, some extra decoration will be added /// around the word. /// </param> /// <returns> /// The html text string constructed /// </returns> private string ConstructText(Sequence seq, SequenceStatus status) { var result = new StringBuilder(); switch (status) { case SequenceStatus.Deleted: // the sequence exists in _original and // will be marked as deleted in the merged // file. for (var i = seq.StartIndex; i < seq.EndIndex; i++) { result.Append(this.original[i].reconstruct(CommentOff.BeginTag, CommentOff.EndTag)); } break; case SequenceStatus.Inserted: // the sequence exists in _modified and // will be marked as added in the merged // file. for (var i = seq.StartIndex; i < seq.EndIndex; i++) { result.Append(this.modified[i].reconstruct(Added.BeginTag, Added.EndTag)); } break; case SequenceStatus.NoChange: // the sequence exists in both _original and // _modified and will be left as what it is in // the merged file. We chose to reconstruct from // _modified collection for (var i = seq.StartIndex; i < seq.EndIndex; i++) { result.Append(this.modified[i].reconstruct()); } break; default: // this will not happen (hope) break; } return(result.ToString()); }
void OnChangeSequenceState(SequenceStatus state) { switch (state) { case SequenceStatus.Stoppped: if (m_CurrentSequence != null && m_CurrentSequence.IsInterrupted) { SetSequenceWeight(0f); m_CurrentSequence = null; break; } FadeSequence(0f, 0.5f, () => { var ctx = m_CurrentSequence; m_CurrentSequence = null; ctx?.Complete(); }); break; case SequenceStatus.Interrupted: m_CurrentSequence?.Interupt(); break; } }
void SetState(SequenceStatus state) { m_State = state; OnChangeStatus?.Invoke(state); }
private List <ComparisonTextUnit> ConstructText(Sequence seq, SequenceStatus status) { var comparisonTextUnits = new List <ComparisonTextUnit>(); switch (status) { case SequenceStatus.Deleted: for (var i = seq.StartIndex; i < seq.EndIndex; i++) { if (_original[i].Prefix != string.Empty) { comparisonTextUnits.Add(new ComparisonTextUnit(_original[i].Prefix, ComparisonTextUnitType.Removed)); } if (_original[i].word != string.Empty) { comparisonTextUnits.Add(new ComparisonTextUnit(_original[i].word, ComparisonTextUnitType.Removed)); } if (_original[i].Suffix != string.Empty) { comparisonTextUnits.Add(new ComparisonTextUnit(_original[i].Suffix, ComparisonTextUnitType.Removed)); } } break; case SequenceStatus.Inserted: for (var i = seq.StartIndex; i < seq.EndIndex; i++) { if (_modified[i].Prefix != string.Empty) { comparisonTextUnits.Add(new ComparisonTextUnit(_modified[i].Prefix, ComparisonTextUnitType.New)); } if (_modified[i].word != string.Empty) { comparisonTextUnits.Add(new ComparisonTextUnit(_modified[i].word, ComparisonTextUnitType.New)); } if (_modified[i].Suffix != string.Empty) { comparisonTextUnits.Add(new ComparisonTextUnit(_modified[i].Suffix, ComparisonTextUnitType.New)); } } break; case SequenceStatus.NoChange: for (var i = seq.StartIndex; i < seq.EndIndex; i++) { if (_modified[i].Prefix != string.Empty) { comparisonTextUnits.Add(new ComparisonTextUnit(_modified[i].Prefix, ComparisonTextUnitType.Identical)); } if (_modified[i].word != string.Empty) { comparisonTextUnits.Add(new ComparisonTextUnit(_modified[i].word, ComparisonTextUnitType.Identical)); } if (_modified[i].Suffix != string.Empty) { comparisonTextUnits.Add(new ComparisonTextUnit(_modified[i].Suffix, ComparisonTextUnitType.Identical)); } } break; } return(comparisonTextUnits); }
/// <summary> /// The function returns a html text string reconstructed /// from the sub collection of words its starting and ending /// indexes are marked by parameter seq and its collection is /// denoted by parameter status. If the status is "deleted", /// then the _original collection is used, otherwise, _modified /// is used. /// </summary> /// <param name="seq"> /// Sequence object that marks the start index and end /// index of the sub sequence /// </param> /// <param name="status"> /// Denoting the status of the sequence. When its value is /// Deleted or Added, some extra decoration will be added /// around the word. /// </param> /// <returns> /// The html text string constructed /// </returns> private string constructText(Sequence seq, SequenceStatus status) { StringBuilder result = new StringBuilder(); switch(status) { case SequenceStatus.Deleted: // the sequence exists in _original and // will be marked as deleted in the merged // file. for (int i= seq.StartIndex; i < seq.EndIndex; i++) { result.Append(_original[i].reconstruct(CommentOff.BeginTag, CommentOff.EndTag)); } break; case SequenceStatus.Inserted: // the sequence exists in _modified and // will be marked as added in the merged // file. for (int i= seq.StartIndex; i < seq.EndIndex; i++) { result.Append(_modified[i].reconstruct(Added.BeginTag, Added.EndTag)); } break; case SequenceStatus.NoChange: // the sequence exists in both _original and // _modified and will be left as what it is in // the merged file. We chose to reconstruct from // _modified collection for (int i= seq.StartIndex; i < seq.EndIndex; i++) { result.Append(_modified[i].reconstruct()); } break; default: // this will not happen (hope) break; } return result.ToString(); }
public async Task UpdateStatus(SequenceStatus status) => await ExecAsync(ConstQueries.UpdateSequenceHistory, History(status));
public async Task InsertStatus(SequenceStatus status) => await ExecAsync(ConstQueries.InsertSequenceHistory, History(status));