Joutsen Persistence v0.3.0+1-ga730d6d
Public Member Functions | Protected Attributes | Properties | List of all members
Joutsen.Persistence.Page< TItem > Class Template Reference

A collection class representing a page of results retrived from the database. More...

Public Member Functions

 Page (int pageNumber, int pageSize, SCG.IEnumerable< TItem > items)
 Creates a new page of elements. More...
 
 Page (int pageNumber, int pageSize, SCG.IEnumerable< TItem > items, int totalNumberOfItems)
 Creates a new page of elements including the total count of elements. More...
 
TItem GetItemByAbsoluteIndex (int index)
 Fetches an item from the page using the absolute index. More...
 
TItem GetItemByIndex (int index)
 Fetches an item from the page using the index relative to the page's first element. More...
 
int AbsoluteIndexOf (TItem item)
 Determines the absolute index of an item on the page. More...
 
int IndexOf (TItem item)
 Determines the relative index of an item on the page. More...
 
int IndexOf (TItem item, SCG.IEqualityComparer< TItem > comparer)
 Determines the relative index of an item on the page using a comparer object instead of the Equals method. More...
 
bool Contains (TItem item)
 Checks if an item is part of the page. More...
 
SCG.IEnumerator< TItem > GetEnumerator ()
 
override bool Equals (object obj)
 
override int GetHashCode ()
 

Protected Attributes

List< TItem > items
 

Properties

int PageNumber [get]
 The number of the current page of results, zero based. More...
 
int TotalNumberOfItems [get]
 The total number of results possible. More...
 
int PageSize [get]
 The number items on the page. More...
 
int IndexOfFirstElement [get]
 The absolute (ignoring pages) index of the first element on the page. More...
 
int IndexOfLastElement [get]
 The absolute (ignoring pages) index of the last element on the page. More...
 
int Count [get]
 The number of elements on the page. More...
 
TItem this[int index] [get]
 Fetches the item with the index relative to the page start. More...
 

Detailed Description

A collection class representing a page of results retrived from the database.

Since
0.2.0

Constructor & Destructor Documentation

◆ Page() [1/2]

Joutsen.Persistence.Page< TItem >.Page ( int  pageNumber,
int  pageSize,
SCG.IEnumerable< TItem >  items 
)

Creates a new page of elements.

Parameters
pageInfoinformation of the page like page size etc.
itemsthe items on the page

◆ Page() [2/2]

Joutsen.Persistence.Page< TItem >.Page ( int  pageNumber,
int  pageSize,
SCG.IEnumerable< TItem >  items,
int  totalNumberOfItems 
)

Creates a new page of elements including the total count of elements.

Parameters
pageInfoinformation of the page like page size etc.
itemsthe items on the page
totalNumberOfItemsthe absolute total number of items, independent of the page

Member Function Documentation

◆ AbsoluteIndexOf()

int Joutsen.Persistence.Page< TItem >.AbsoluteIndexOf ( TItem  item)

Determines the absolute index of an item on the page.

◆ Contains()

bool Joutsen.Persistence.Page< TItem >.Contains ( TItem  item)

Checks if an item is part of the page.

◆ Equals()

override bool Joutsen.Persistence.Page< TItem >.Equals ( object  obj)

◆ GetEnumerator()

SCG.IEnumerator< TItem > Joutsen.Persistence.Page< TItem >.GetEnumerator ( )

◆ GetHashCode()

override int Joutsen.Persistence.Page< TItem >.GetHashCode ( )

◆ GetItemByAbsoluteIndex()

TItem Joutsen.Persistence.Page< TItem >.GetItemByAbsoluteIndex ( int  index)

Fetches an item from the page using the absolute index.

◆ GetItemByIndex()

TItem Joutsen.Persistence.Page< TItem >.GetItemByIndex ( int  index)

Fetches an item from the page using the index relative to the page's first element.

◆ IndexOf() [1/2]

int Joutsen.Persistence.Page< TItem >.IndexOf ( TItem  item)

Determines the relative index of an item on the page.

◆ IndexOf() [2/2]

int Joutsen.Persistence.Page< TItem >.IndexOf ( TItem  item,
SCG.IEqualityComparer< TItem >  comparer 
)

Determines the relative index of an item on the page using a comparer object instead of the Equals method.

Member Data Documentation

◆ items

List<TItem> Joutsen.Persistence.Page< TItem >.items
protected

Property Documentation

◆ Count

int Joutsen.Persistence.Page< TItem >.Count
get

The number of elements on the page.

◆ IndexOfFirstElement

int Joutsen.Persistence.Page< TItem >.IndexOfFirstElement
get

The absolute (ignoring pages) index of the first element on the page.

◆ IndexOfLastElement

int Joutsen.Persistence.Page< TItem >.IndexOfLastElement
get

The absolute (ignoring pages) index of the last element on the page.

◆ PageNumber

int Joutsen.Persistence.Page< TItem >.PageNumber
get

The number of the current page of results, zero based.

◆ PageSize

int Joutsen.Persistence.Page< TItem >.PageSize
get

The number items on the page.

◆ this[int index]

TItem Joutsen.Persistence.Page< TItem >.this[int index]
get

Fetches the item with the index relative to the page start.

◆ TotalNumberOfItems

int Joutsen.Persistence.Page< TItem >.TotalNumberOfItems
get

The total number of results possible.