//
//  NSIndexPath+MPRemoveFirstIndex.h
//  MathPad
//
//  Created by Kim Wittenburg on 23.04.14.
//  Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//

@import Foundation;

@interface NSIndexPath (MPAdditions)

- (NSUInteger)lastIndex;

- (NSIndexPath *)indexPathByReplacingLastIndexWithIndex:(NSUInteger)index;

/*!
 @method indexPathByRemovingFirstIndex
 @brief Provides an index path with the indexes in the receiving index path, excluding the first one.
 @discussion Returns an empty NSIndexPath instance if the receiving index path’s length is 1 or less.
 @return A new index path with the receiving index path’s indexes, excluding the first one.
 */
- (NSIndexPath *)indexPathByRemovingFirstIndex;

/*!
 @method indexPathByPreceedingIndex:
 @brief Provides an index path with the given index followed by the indexes of the receiver.
 @discussion If the receiver does not contain any indexes the given index is the only index contained in the returned index path.
 @param index The index new index preceeding all others
 @return A new index path with all the receiver's indexes preceeded by @c index.
 */
- (NSIndexPath *)indexPathByPreceedingIndex:(NSUInteger)index;

- (NSIndexPath *)indexPathByIncrementingLastIndex;
- (NSIndexPath *)indexPathByDecrementingLastIndex;

- (NSIndexPath *)indexPathWithLength:(NSUInteger)length; // use length indexes from the receiver, exception if too much

- (NSIndexPath *)commonIndexPathWith:(NSIndexPath *)indexPath;

@end
