public List <int> GetEnds() { // Поиск концевых элементов дерева. Номер элемента не встрачается в массиве Bases. bool isEnd; Ends.Add(0); for (int i = 1; i < Bases[0] + 1; ++i) { isEnd = true; for (int j = i + 1; j < Bases[0] + 1; ++j) { if (Bases[j] == i || Ends.Contains(i)) { isEnd = false; break; } } if (isEnd) { Ends.Add(i); } } Ends[0] = Ends.Count - 1; return(Ends); }
public CharRange(byte[,] range) : this() { for (int i = 0; i < range.GetLength(0); i++) { Starts.Add((char)range[i, 0]); Ends.Add((char)range[i, 1]); } }
/// <summary> /// handle the End child element /// </summary> /// <param name="reader"> XmlReader positioned at the end element </param> private void HandleEndElement(XmlReader reader) { DebugCheck.NotNull(reader); var end = new RelationshipEnd(this); end.Parse(reader); if (Ends.Count == 2) { AddError(ErrorCode.InvalidAssociation, EdmSchemaErrorSeverity.Error, Strings.TooManyAssociationEnds(FQName)); return; } Ends.Add(end); }
/// <summary> /// handle the End child element /// </summary> /// <param name="reader">XmlReader positioned at the end element</param> private void HandleEndElement(XmlReader reader) { Debug.Assert(reader != null); RelationshipEnd end = new RelationshipEnd(this); end.Parse(reader); if (Ends.Count == 2) { AddError(ErrorCode.InvalidAssociation, EdmSchemaErrorSeverity.Error, System.Data.Entity.Strings.TooManyAssociationEnds(FQName)); return; } Ends.Add(end); }
public void AddEnd(End end) { if (Ends.Count == this.GetNumberOfEnds()) { throw new Exception("Cannot add another end. Already reached the maximum number of ends"); } if (!Ends.ContainsKey(end.EndNumber)) { Ends.Add(end.EndNumber, end); } else { throw new Exception("Linescore already contains this end number"); } }
/// <summary> /// Gets or sets the start and end of the range at the specified index. /// </summary> /// <param name="i"></param> /// <returns></returns> public KeyValuePair <char, char> this[int i] { get { var kvp = new KeyValuePair <char, char>(Starts[i], Ends[i]); return(kvp); } set { if (Starts.Count <= i) { Starts[i] = value.Key; Ends[i] = value.Value; } else { Starts.Add(value.Key); Ends.Add(value.Value); } } }