public BibleTranslationDifferencesParallelVersesFormula(string parallelVersesFormula, BibleTranslationDifferencesBaseVersesFormula baseVersesFormula, BibleBookDifference.CorrespondenceVerseType correspondenceType, int?valueVersesCount, bool skipCheck, bool emptyVerseContent) : base(parallelVersesFormula) { if (valueVersesCount.HasValue && valueVersesCount == 0) { throw new NotSupportedException("ValueVersesCount must be greater than 0."); } if (valueVersesCount.HasValue && correspondenceType == BibleBookDifference.CorrespondenceVerseType.All) { throw new ArgumentException("CorrespondenceType must not be 'All' if ValueVersesCount defined."); } this.BaseVersesFormula = baseVersesFormula; this.CorrespondenceType = correspondenceType; this.ValueVersesCount = valueVersesCount; if (!string.IsNullOrEmpty(OriginalFormula)) { var indexOfColon = OriginalFormula.IndexOf(":"); if (indexOfColon != OriginalFormula.LastIndexOf(":")) { var indexOfComma = OriginalFormula.IndexOf(","); if (indexOfComma == -1) { throw new NotSupportedException(string.Format("Two colons must be devided by comma: '{0}'", OriginalFormula)); } if (indexOfComma != OriginalFormula.LastIndexOf(",")) { throw new NotSupportedException(string.Format("Only one comma is supported: '{0}'", OriginalFormula)); } var parts = OriginalFormula.Split(new char[] { ',' }); this.OriginalFormula = parts[0]; SecondFormula = new BibleTranslationDifferencesParallelVersesFormula( parts[1], this.BaseVersesFormula, this.CorrespondenceType, this.ValueVersesCount, skipCheck, emptyVerseContent); } ChapterFormulaPart = new ParallelChapterFormulaPart(OriginalFormula.Substring(0, indexOfColon), this); VersesFormulaPart = new ParallelVersesFormulaPart(OriginalFormula.Substring(indexOfColon + 1), this, correspondenceType); } else { this.IsEmpty = true; } this.SkipCheck = skipCheck; this.EmptyVerseContent = emptyVerseContent; }
public ParallelVersesFormulaPart( string formulaPart, BibleTranslationDifferencesParallelVersesFormula parallelVersesFormula, BibleBookDifference.CorrespondenceVerseType correspondenceType) : base(ShellFormula(formulaPart), parallelVersesFormula) { this.CorrespondenceType = correspondenceType; CalculateVersePartIndexes(formulaPart); }
public ParallelFormulaPart(string formulaPart, BibleTranslationDifferencesParallelVersesFormula parallelVersesFormula) { this.FormulaPart = formulaPart; this.ParallelVersesFormula = parallelVersesFormula; var indexOfX = formulaPart.IndexOf("X"); if (indexOfX == -1) { int indexOfDash = formulaPart.IndexOf("-"); if (indexOfDash == -1) // тогда просто число { ParseSimpleVerse(); } else // тогда диапазон стихов, типа "1-3" { ParseMultiVerse(); } } else // тогда формула, типа "X+1" { ParseFormulaVerse(); } }
public ParallelChapterFormulaPart(string formulaPart, BibleTranslationDifferencesParallelVersesFormula parallelVersesFormula) : base(formulaPart, parallelVersesFormula) { }