/// <summary> /// Creates a new PositionsAndLengths entry with the specified values. /// </summary> /// <param name="SpokenPosition">The location of this entry in the spoken string.</param> /// <param name="SpokenLength">The length of this entry in the spoken string.</param> /// <param name="WrittenPosition">The location of this entry in the written string.</param> /// <param name="WrittenLength">The length of this entry in the written string.</param> /// <param name="PronunciationType">The entry type.</param> public PositionsAndLengths(int SpokenPosition, int SpokenLength, int WrittenPosition, int WrittenLength, PronunciationTypeEnum PronunciationType) { // Store the provided values. spokenPosition = SpokenPosition; spokenLength = SpokenLength; writtenPosition = WrittenPosition; writtenLength = WrittenLength; pronunciationType = PronunciationType; // Adding a new object invalidates the previous sort. isSorted = false; }
/// <summary> /// Creates an entry in the PositionsAndLengths writtenToSpoken array. /// </summary> /// <param name="SpokenPosition">The position in the spoken string.</param> /// <param name="SpokenLength">The length of the spoken word.</param> /// <param name="WrittenPosition">The position in the written string.</param> /// <param name="WrittenLength">The length of the written word.</param> /// <param name="PronunciationType">The pronunciation type.</param> private void AddEntry(int SpokenPosition, int SpokenLength, int WrittenPosition, int WrittenLength, PronunciationTypeEnum PronunciationType) { // Avoid adding empty entries. if (SpokenLength > 0 || WrittenLength > 0) { writtenToSpoken.Add(new PositionsAndLengths(SpokenPosition, SpokenLength, WrittenPosition, WrittenLength, PronunciationType)); } }