public RepetitionConstruction(RepetitionForm repetition) { Contract.Requires(repetition != null); Repetition = repetition; selectedLeavesPerParseElement = new TinyIndexedCollection<List<ReadOnlyCollection<LeafIndex>>, RepetitionFormIndex>(); //Contract.Requires(Contract.ForAll(this, t => t.Repetition.MinimumRepetitionCount <= t.Count && t.Count <= t.Repetition.MaximumRepetitionCount)); }
private RepetitionFormIndex(ParseFormIndex parseIndex, RepetitionForm repetitionForm, bool throwIfNotContained) : this() { //concat concatenates the stretches Index = repetitionForm.Concat().IndexOf(parseIndex); if (throwIfNotContained) Contract.Assert(Index != -1, "The specified parse element is not part of the specified repetition"); }
/// <summary> May return an index with value -1. </summary> public static RepetitionFormIndex TryCreate(ParseFormIndex parseIndex, RepetitionForm repetitionForm) { return new RepetitionFormIndex(parseIndex, repetitionForm, false); }
public RepetitionFormIndex(ParseFormIndex parseIndex, RepetitionForm repetitionForm) : this(parseIndex, repetitionForm, true) { }