Exemplo n.º 1
0
    /// <summary>
    /// Determines whether the specified index is valid to use with this array's indexer.
    /// </summary>
    /// <typeparam name="T">The type of values stored in the array.</typeparam>
    /// <param name="array">The array.</param>
    /// <param name="index">The index to check.</param>
    /// <returns>True if the index is valid to use, otherwise false.</returns>
    public static bool IsIndexValid <T>(this T[,,,] array, Index4D index)
    {
        Contracts.Requires.That(array != null);

        return(index.IsIn(array.GetLowerBounds(), array.GetUpperBounds()));
    }
	/// <summary>
	/// Determines whether the specified index is within the current bounds.
	/// </summary>
	/// <param name="bounds">The bounds to check against.</param>
	/// <param name="index">The index to check.</param>
	/// <returns>
	///   <c>true</c> if the index is within the current bounds; otherwise, <c>false</c>.
	/// </returns>
	public static bool IsIndexInCurrentBounds(this IDynamicIndexingBounds<Index4D> bounds, Index4D index)
	{
		Contracts.Requires.That(bounds != null);

		return index.IsIn(bounds.CurrentLowerBounds, bounds.CurrentUpperBounds);
	}
Exemplo n.º 3
0
    /// <summary>
    /// Determines whether the specified index is within bounds.
    /// </summary>
    /// <param name="bounds">The bounds to check against.</param>
    /// <param name="index">The index to check.</param>
    /// <returns>
    ///   <c>true</c> if the index is within bounds; otherwise, <c>false</c>.
    /// </returns>
    public static bool IsIndexInBounds(this IIndexingBounds <Index4D> bounds, Index4D index)
    {
        Contracts.Requires.That(bounds != null);

        return(index.IsIn(bounds.LowerBounds, bounds.UpperBounds));
    }