/// <summary> /// Determines whether the specified index is within the current bounds of the <see cref="IDynamicIndexingBounds{TIndex}"/>. /// </summary> /// <typeparam name="TIndex">The type of the index.</typeparam> /// <param name="bounded">The bounds to check against.</param> /// <param name="index">The index to check.</param> /// <returns> /// <c>true</c> if the index is within current bounds; otherwise, <c>false</c>. /// </returns> public static bool IsIndexInCurrentBounds <TIndex>(this IDynamicIndexingBounds <TIndex> bounded, TIndex index) where TIndex : IIndex { Contracts.Requires.That(bounded != null); Contracts.Requires.That(index != null); Contracts.Requires.That(bounded.Rank == index.Rank); return(IndexUtilities.IsIn(index, bounded.CurrentLowerBounds, bounded.CurrentUpperBounds)); }
/// <summary> /// Gets the current index of the last slot of the specified dimension within the specified bounds. /// </summary> /// <param name="bounds">The bounds to check against.</param> /// <param name="axis">The axis of the dimension whose ending index needs to be determined.</param> /// <returns> /// The current index of the last slot of the specified dimension. /// </returns> public static int GetCurrentUpperBound(this IDynamicIndexingBounds<Index4D> bounds, Axis4D axis) { Contracts.Requires.That(bounds != null); return bounds.GetCurrentUpperBound((int)axis); }
/// <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); }
/// <summary> /// Gets a 32-bit integer that represents the current length of the specified dimension of the bounds. /// </summary> /// <param name="bounds">The bounds to check against.</param> /// <param name="axis">The axis of the dimension whose length needs to be determined.</param> /// <returns> /// A 32-bit integer that represents the current length of the specified dimension. /// </returns> public static int GetCurrentLength(this IDynamicIndexingBounds <Index3D> bounds, Axis3D axis) { Contracts.Requires.That(bounds != null); return(bounds.GetCurrentLength((int)axis)); }
public static void GetCurrentUpperBound <TIndex>(IDynamicIndexingBounds <TIndex> instance, int dimension) where TIndex : IIndex { Contracts.Requires.That(instance != null); Contracts.Requires.That(dimension.IsIn(Range.FromLength(instance.Rank))); }