/// <summary> /// Returns an IntegerList wrapper that is synchronized. /// </summary> /// <param name="list">The list to synchronize.</param> /// <returns>An IntegerList wrapper that is synchronized (thread-safe).</returns> public static IntegerList Synchronized(IntegerList list) { IntegerList result = new IntegerList(); result.list = ArrayList.Synchronized(list.list); return(result); }
/// <summary> /// Returns an integer list which represents a subset of the elements in /// the source list. /// </summary> /// <param name="index">The zero-based list index at which the range starts.</param> /// <param name="count">The number of elements in the range.</param> /// <returns>An integer list which represents a subset of the elements /// in the source list.</returns> public IntegerList GetRange(int index, int count) { IntegerList result = new IntegerList(); result.list = list.GetRange(index, count); return(result); }
/// <summary> /// A shallow copy of the list. /// </summary> /// <returns></returns> public virtual object Clone() { IntegerList result = new IntegerList(); result.list = (ArrayList)list.Clone(); return(result); }
/// <summary> /// Inserts the elements of the other integer list into the list at the specified index. /// </summary> /// <param name="index">The zero-based index at which the new elements should be inserted.</param> /// <param name="other">The other list whose elements should be inserted into the list.</param> public void InsertRange(int index, IntegerList other) { for (int i = 0; i < other.Count; i++) { list[index + i] = other[i]; } }
/// <summary> /// Returns an IntegerList whose elements are copies of the specified value. /// </summary> /// <param name="value">The value to copy multiple times in the list.</param> /// <param name="count">The number of times value should be copied.</param> /// <returns>An IntegerList with count number of elements, all of which are copies of value.</returns> public static IntegerList Repeat(int value, int count) { IntegerList result = new IntegerList(); for (int i=0; i < count; i++) { result.Add(value); } return result; }
/// <summary> /// Determines whether the specified Object is equal to the current Object. /// </summary> /// <param name="obj">The Object to compare with the current Object.</param> /// <returns>true if the specified Object is equal to the current Object; /// otherwise, false.</returns> public override bool Equals(object obj) { if (! (obj is IntegerList)) return false; IntegerList otherList = (IntegerList)obj; if (otherList.Count != this.Count) return false; for (int i=0; i < this.list.Count; i++) { if (this[i] != otherList[i]) return false; } return true; }
public RuleRecord(Record record) { if (record.Entries.Count < 4) throw new CGTContentException("Invalid number of entries for rule"); byte header = record.Entries[0].ToByteValue(); if (header != 82) //'R' throw new CGTContentException("Invalid rule header"); this.index = record.Entries[1].ToIntValue(); this.nonterminal = record.Entries[2].ToIntValue(); //skip reserved empty entry this.symbols = new IntegerList(); for (int i=4;i<record.Entries.Count;i++) { int symbol = record.Entries[i].ToIntValue(); symbols.Add(symbol); } }
/// <summary> /// Determines whether the specified Object is equal to the current Object. /// </summary> /// <param name="obj">The Object to compare with the current Object.</param> /// <returns>true if the specified Object is equal to the current Object; /// otherwise, false.</returns> public override bool Equals(object obj) { if (!(obj is IntegerList)) { return(false); } IntegerList otherList = (IntegerList)obj; if (otherList.Count != Count) { return(false); } for (int i = 0; i < list.Count; i++) { if (this[i] != otherList[i]) { return(false); } } return(true); }
/// <summary> /// Copies the elements of a collection over a range of elements in the list. /// </summary> /// <param name="index">The zero-based index at which to start copying the elements /// of otherList</param> /// <param name="otherList">The other list whose elements to copy to the list.</param> public void SetRange(int index, IntegerList otherList) { list.SetRange(index, otherList.list); }
/// <summary> /// Returns an integer list which represents a subset of the elements in /// the source list. /// </summary> /// <param name="index">The zero-based list index at which the range starts.</param> /// <param name="count">The number of elements in the range.</param> /// <returns>An integer list which represents a subset of the elements /// in the source list.</returns> public IntegerList GetRange(int index, int count) { IntegerList result = new IntegerList(); result.list = list.GetRange(index, count); return result; }
/// <summary> /// A shallow copy of the list. /// </summary> /// <returns></returns> public virtual object Clone() { IntegerList result = new IntegerList(); result.list = (ArrayList)list.Clone(); return result; }
/// <summary> /// Returns an IntegerList wrapper that is synchronized. /// </summary> /// <param name="list">The list to synchronize.</param> /// <returns>An IntegerList wrapper that is synchronized (thread-safe).</returns> public static IntegerList Synchronized(IntegerList list) { IntegerList result = new IntegerList(); result.list = ArrayList.Synchronized(list.list); return result; }
/// <summary> /// Returns an IntegerList whose elements are copies of the specified value. /// </summary> /// <param name="value">The value to copy multiple times in the list.</param> /// <param name="count">The number of times value should be copied.</param> /// <returns>An IntegerList with count number of elements, all of which are copies of value.</returns> public static IntegerList Repeat(int value, int count) { IntegerList result = new IntegerList(); for (int i = 0; i < count; i++) { result.Add(value); } return result; }