     return
 
 
-  setFilter: (fields, query) ->
+  setFilter : (fields, query) ->
 
     if query == '' or not _.isString(query)
       @state.filterQuery = ""

    return


  _reset: ->
    @_resetModels()
    @models = @currentModels.slice(
      @state.currentPage * @state.pageSize,

    return


  getPaginationInfo : ->
    return {
      firstPage : 0
      lastPage : @_lastPageIndex()
      currentPage : @state.currentPage
      pageSize : @state.pageSize
    }


  getPreviousPage : ->
    @getPage(@state.currentPage - 1)
    return


  getNextPage : ->
    @getPage(@state.currentPage + 1)
    return


  getFirstPage : ->
    @getPage(0)
    return


  getLastPage : ->
    @getPage(@_lastPageIndex())
    return


  getPage : (pageIndex) ->
    if 0 <= pageIndex < Math.ceil(@currentModels.length / @state.pageSize)
      @state.currentPage = pageIndex
      @_reset()
    return

  toJSON : ->
    @models.map((model) -> model.toJSON())


  findWhere : ->

    return @fullCollection.findWhere.apply(@fullCollection, arguments)


module.exports = PaginationCollection
