| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | using System; |
| | using System.Collections; |
| | using System.Collections.Generic; |
| |
|
| | namespace Mujoco { |
| | |
| | public abstract class FixedSizeIListHelper<T> : IList<T> { |
| | public IEnumerator<T> GetEnumerator() { |
| | for (int i = 0; i < this.Count; ++i) { |
| | yield return this[i]; |
| | } |
| | } |
| |
|
| | IEnumerator IEnumerable.GetEnumerator() { |
| | return GetEnumerator(); |
| | } |
| |
|
| | public void Add(T item) { |
| | throw new NotSupportedException(); |
| | } |
| |
|
| | public void Clear() { |
| | throw new NotSupportedException(); |
| | } |
| |
|
| | public bool Contains(T item) { |
| | for (int i = 0; i < Count; ++i) { |
| | if (this[i].Equals(item)) { |
| | return true; |
| | } |
| | } |
| | return false; |
| | } |
| |
|
| | public void CopyTo(T[] array, int arrayIndex) { |
| | for (int i = 0; i < Count; ++i) { |
| | array[arrayIndex + i] = this[i]; |
| | } |
| | } |
| |
|
| | public bool Remove(T item) { |
| | throw new NotSupportedException(); |
| | } |
| |
|
| | public bool IsReadOnly => false; |
| |
|
| | public int IndexOf(T item) { |
| | for (int i = 0; i < Count; ++i) { |
| | if (this[i].Equals(item)) { |
| | return i; |
| | } |
| | } |
| | return -1; |
| | } |
| |
|
| | public void Insert(int index, T item) { |
| | throw new NotSupportedException(); |
| | } |
| |
|
| | public void RemoveAt(int index) { |
| | throw new NotSupportedException(); |
| | } |
| |
|
| | public abstract int Count { get; } |
| | public abstract T this[int index] { |
| | get; |
| | set; |
| | } |
| | } |
| | } |
| |
|