📄 genericindex.cs
字号:
#endif
/// <summary>
/// Get enumerable collection of objects in descending order
/// </summary>
/// <returns>enumerable collection</returns>
///
#if USE_GENERICS
IEnumerable<V> Reverse();
#else
IEnumerable Reverse();
#endif
/// <summary>
/// Get enumerable ascent ordered collection of objects in the index which key starts with specified prefix.
/// You should not update/remove or add members to the index during iteration
/// </summary>
/// <param name="prefix">String key prefix</param>
/// <returns>enumerable collection</returns>
///
#if USE_GENERICS
IEnumerable<V> StartsWith(string prefix);
#else
IEnumerable StartsWith(string prefix);
#endif
/// <summary>
/// Get enumerator for traversing all entries in the index
/// You should not update/remove or add members to the index during iteration
/// </summary>
/// <returns>entry enumerator</returns>
///
IDictionaryEnumerator GetDictionaryEnumerator();
/// <summary>
/// Get enumerator for traversing entries in the index with key belonging to the specified range.
/// You should not update/remove or add members to the index during iteration
/// </summary>
/// <param name="from">Low boundary. If <code>null</code> then low boundary is not specified.
/// Low boundary can be inclusive or exclusive.</param>
/// <param name="till">High boundary. If <code>null</code> then high boundary is not specified.
/// High boundary can be inclusive or exclusive.</param>
/// <param name="order"><code>AscanrOrder</code> or <code>DescentOrder</code></param>
/// <returns>selection enumerator</returns>
///
IDictionaryEnumerator GetDictionaryEnumerator(Key from, Key till, IterationOrder order);
/// <summary>
/// Get type of index key
/// </summary>
/// <returns>type of index key</returns>
Type KeyType {get;}
#if USE_GENERICS
}
/// <summary> Interface of object index with arbitrary key type
/// Index is used to provide fast access to the object by key.
/// Object in the index are stored ordered by key value.
/// It is possible to select object using exact value of the key or
/// select set of objects which key belongs to the specified interval
/// (each boundary can be specified or unspecified and can be inclusive or exclusive)
/// Key should be of scalar, String, DateTime or peristent object type.
/// </summary>
public interface GenericIndex<K,V> : GenericKeyIndex<V> where V:class,IPersistent
{
#endif
/// <summary> Access element by key
/// </summary>
#if USE_GENERICS
V this[K key]
#else
IPersistent this[object key]
#endif
{
get;
set;
}
/// <summary> Get objects which key value belongs to the specified range.
/// </summary>
#if USE_GENERICS
V[] this[K from, K till]
#else
IPersistent[] this[object from, object till]
#endif
{
get;
}
/// <summary> Get object by key (exact match)
/// </summary>
/// <param name="key">specified key value. It should match with type of the index and should be inclusive.
/// </param>
/// <returns>object with this value of the key or <code>null</code> if key nmot found
/// </returns>
/// <exception cref="Perst.StorageError">StorageError(StorageError.ErrorCode.KEY_NOT_UNIQUE) exception if there are more than
/// one objects in the index with specified value of the key.
///
/// </exception>
#if USE_GENERICS
V Get(K key);
#else
IPersistent Get(object key);
#endif
/// <summary> Get objects which key value belongs to the specified inclusive range.
/// Either from boundary, either till boundary either both of them can be <code>null</code>.
/// In last case the method returns all objects from the index.
/// </summary>
/// <param name="from">Inclusive low boundary. If <code>null</code> then low boundary is not specified.
/// </param>
/// <param name="till">Inclusive high boundary. If <code>null</code> then high boundary is not specified.
/// </param>
/// <returns>array of objects which keys belongs to the specified interval, ordered by key value
///
/// </returns>
#if USE_GENERICS
V[] Get(K from, K till);
#else
IPersistent[] Get(object from, object till);
#endif
/// <summary>
/// Get enumerator for traversing objects in the index with key belonging to the specified range.
/// You should not update/remove or add members to the index during iteration
/// </summary>
/// <param name="from">Low boundary. If <code>null</code> then low boundary is not specified.
/// Low boundary can be inclusive or exclusive.</param>
/// <param name="till">High boundary. If <code>null</code> then high boundary is not specified.
/// High boundary can be inclusive or exclusive.</param>
/// <param name="order"><code>IterationOrder.AscentOrder</code> or <code>IterationOrder.DescentOrder</code></param>
/// <returns>selection enumerator</returns>
///
#if USE_GENERICS
IEnumerator<V> GetEnumerator(K from, K till, IterationOrder order);
#else
IEnumerator GetEnumerator(object from, object till, IterationOrder order);
#endif
/// <summary>
/// Get enumerator for traversing objects in ascent order belonging to the specified range.
/// You should not update/remove or add members to the index during iteration
/// </summary>
/// <param name="from">Low boundary. If <code>null</code> then low boundary is not specified.
/// Low boundary can be inclusive or exclusive.</param>
/// <param name="till">High boundary. If <code>null</code> then high boundary is not specified.
/// High boundary can be inclusive or exclusive.</param>
/// <returns>selection enumerator</returns>
///
#if USE_GENERICS
IEnumerator<V> GetEnumerator(K from, K till);
#else
IEnumerator GetEnumerator(object from, object till);
#endif
/// <summary>
/// Get enumerable collection of objects in the index with key belonging to the specified range.
/// You should not update/remove or add members to the index during iteration
/// </summary>
/// <param name="from">Inclusive low boundary. If <code>null</code> then low boundary is not specified.</param>
/// <param name="till">Inclusive high boundary. If <code>null</code> then high boundary is not specified.</param>
/// <param name="order"><code>IterationOrder.AscentOrder</code> or <code>IterationOrder.DescentOrder</code></param>
/// <returns>enumerable collection</returns>
///
#if USE_GENERICS
IEnumerable<V> Range(K from, K till, IterationOrder order);
#else
IEnumerable Range(object from, object till, IterationOrder order);
#endif
/// <summary>
/// Get enumerable ascent ordered collection of objects in the index with key belonging to the specified range.
/// You should not update/remove or add members to the index during iteration
/// </summary>
/// <param name="from">Inclusive low boundary. If <code>null</code> then low boundary is not specified.</param>
/// <param name="till">Inclusive high boundary. If <code>null</code> then high boundary is not specified.</param>
/// <returns>enumerable collection</returns>
///
#if USE_GENERICS
IEnumerable<V> Range(K from, K till);
#else
IEnumerable Range(object from, object till);
#endif
/// <summmary>
/// Get element at specified position. This methid is efficient only for random access indices
/// </summmary>
/// <param name="i">position of element in the index</param>
/// <returns>object at sepcified position</returns>
/// <exception cref="System.IndexOutOfRangeException">System.IndexOutOfRangeException if position is less than 0 or greater or equal than index size</exception>
#if USE_GENERICS
V GetAt(int i);
#else
object GetAt(int i);
#endif
/// <summary>
/// Get dictionary enumerator of objects in the index starting with specified position.
/// This methid is efficient only for random access indices
/// You should not update/remove or add members to the index during iteration
/// </summary>
/// <param name="start">Start position in the index. First <code>pos</code> elements will be skipped.</param>
/// <param name="order"><code>IterationOrder.AscentOrder</code> or <code>IterationOrder.DescentOrder</code></param>
/// <returns>dictionary enumerator</returns>
///
IDictionaryEnumerator GetDictionaryEnumerator(int start, IterationOrder order);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -