2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections;
19 using System.Collections.Generic;
21 namespace Tizen.Multimedia.Util
24 /// Represents a collection of <see cref="ImageTransform"/> objects that can be individually accessed by index.
26 /// <since_tizen> 4 </since_tizen>
27 public class ImageTransformCollection : IEnumerable<ImageTransform>, IList<ImageTransform>
29 private List<ImageTransform> _list = new List<ImageTransform>();
32 /// Initializes a new instance of the ImageTransformCollection class.
34 /// <since_tizen> 4 </since_tizen>
35 public ImageTransformCollection()
40 /// Gets or sets the <see cref="ImageTransform"/> at the specified index.
42 /// <param name="index">The zero-based index of the <see cref="ImageTransform"/> to get or set.</param>
43 /// <value>The <see cref="ImageTransform"/> at the specified index.</value>
44 /// <exception cref="ArgumentOutOfRangeException">
45 /// index is less than 0.<br/>
47 /// index is equal to or greater than <see cref="Count"/>.
49 /// <since_tizen> 4 </since_tizen>
50 public ImageTransform this[int index]
52 get { return _list[index]; }
53 set { _list[index] = value; }
57 /// Gets the number of items contained in the TransformCollection.
59 /// <since_tizen> 4 </since_tizen>
60 public int Count => _list.Count;
62 bool ICollection<ImageTransform>.IsReadOnly => false;
65 /// Adds a <see cref="ImageTransform"/> to the end of the collection.
67 /// <param name="item">The <see cref="ImageTransform"/> to add.</param>
69 /// <see cref="ImageTransformCollection"/> accepts null as a valid value for reference types and allows duplicate elements.
71 /// <since_tizen> 4 </since_tizen>
72 public void Add(ImageTransform item)
76 throw new ArgumentNullException(nameof(item));
82 /// Removes all items.
84 /// <since_tizen> 4 </since_tizen>
85 public void Clear() => _list.Clear();
88 /// Determines whether the <see cref="ImageTransformCollection"/> contains the specified item.
90 /// <param name="item">The <see cref="ImageTransform"/> to locate in the collection.</param>
91 /// <returns>true if the <see cref="ImageTransform"/> is found in the collection; otherwise, false.</returns>
92 /// <since_tizen> 4 </since_tizen>
93 public bool Contains(ImageTransform item) => _list.Contains(item);
96 /// Copies the items of the collection to an array, starting at the specified array index.
98 /// <param name="array">The one-dimensional array that is the destination of the items copied from the collection.</param>
99 /// <param name="arrayIndex">The zero-based index in array at which copying begins.</param>
100 /// <exception cref="ArgumentNullException"><paramref name="array"/> is null.</exception>
101 /// <exception cref="ArgumentOutOfRangeException"><paramref name="arrayIndex"/> is less than 0.</exception>
102 /// <exception cref="ArgumentException">
103 /// The number of elements in the source collection is greater than the available space from arrayIndex to the end of the destination array.
105 /// <since_tizen> 4 </since_tizen>
106 public void CopyTo(ImageTransform[] array, int arrayIndex) => _list.CopyTo(array, arrayIndex);
109 /// Determines the index of the specified item in the collection.
111 /// <param name="item">The <see cref="ImageTransform"/> to locate in the collection.</param>
112 /// <returns>The index of value if found in the <see cref="ImageTransformCollection"/>; otherwise, -1.</returns>
113 /// <since_tizen> 4 </since_tizen>
114 public int IndexOf(ImageTransform item) => _list.IndexOf(item);
117 /// Inserts a <see cref="ImageTransform"/> into the collection at the specified index.
119 /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param>
120 /// <param name="item">The <see cref="ImageTransform"/> to insert into the collection.</param>
121 /// <exception cref="ArgumentNullException"><paramref name="item"/> is null.</exception>
122 /// <exception cref="ArgumentOutOfRangeException">
123 /// index is less than 0.<br/>
125 /// index is greater than <see cref="Count"/>.
127 /// <since_tizen> 4 </since_tizen>
128 public void Insert(int index, ImageTransform item)
132 throw new ArgumentNullException(nameof(item));
134 _list.Insert(index, item);
138 /// Removes the first occurrence of the specified <see cref="ImageTransform"/> from the collection.
140 /// <param name="item">The <see cref="ImageTransform"/> to remove.</param>
141 /// <returns>true if <paramref name="item"/> was removed from the collection; otherwise, false.</returns>
142 /// <since_tizen> 4 </since_tizen>
143 public bool Remove(ImageTransform item) => _list.Remove(item);
146 /// Removes the <see cref="ImageTransform"/> at the specified index.
148 /// <param name="index">The zero-based index to remove.</param>
149 /// <exception cref="ArgumentOutOfRangeException">
150 /// index is less than 0.<br/>
152 /// index is equal to or greater than <see cref="Count"/>.
154 /// <since_tizen> 4 </since_tizen>
155 public void RemoveAt(int index) => _list.RemoveAt(index);
158 /// Returns an enumerator that can iterate through the collection.
160 /// <returns>An enumerator that can be used to iterate through the collection.</returns>
161 /// <since_tizen> 4 </since_tizen>
162 public IEnumerator<ImageTransform> GetEnumerator() => _list.GetEnumerator();
164 IEnumerator IEnumerable.GetEnumerator() => _list.GetEnumerator();