From 9e1c8f743b4b8e008c3e839c43d066e5c8eed5ac Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 25 May 2018 12:49:59 +0900 Subject: [PATCH] ing --- src/model/commons/Page.ts | 87 +++++---------------------------------- 1 file changed, 10 insertions(+), 77 deletions(-) diff --git a/src/model/commons/Page.ts b/src/model/commons/Page.ts index 1ac8bed..8a063ca 100644 --- a/src/model/commons/Page.ts +++ b/src/model/commons/Page.ts @@ -1,78 +1,11 @@ -// export interface Page { -// content: any; -// first: boolean; -// last: boolean; -// number: number; -// numberOfElements: number; -// size: number; -// sort: any; -// totalElements: number; -// totalPages: number; -// } - -export class Pageable { - page: number; - size: number; - - public getPageSize(): number { - return this.size; - } - - public getPageNumber(): number { - return this.page; - } - - public getOffset(): number { - return this.page * this.size; - } +export interface Page { + content: T[]; + first: boolean; + last: boolean; + number: number; + numberOfElements: number; + size: number; + sort: any; + totalElements: number; + totalPages: number; } - -export class Page { - content: T[]; - pageable: Pageable; - total: number; - - public getNumber(): number { - return this.pageable == null ? 0 : this.pageable.getPageNumber(); - } - - public getSize(): number { - return this.pageable == null ? 0 : this.pageable.getPageSize(); - } - - public getTotalPages(): number { - return this.getSize() == 0 ? 0 : Math.ceil(this.total / this.getSize()); - } - - public getNumberOfElements(): number { - return this.content.length; - } - - public getTotalElements(): number { - return this.total; - } - - public hasPreviousPage(): boolean { - return this.getNumber() > 0; - } - - public isFirstPage(): boolean { - return !this.hasPreviousPage(); - } - - public hasNextPage(): boolean { - return ((this.getNumber() + 1) * this.getSize()) < this.total; - } - - public isLastPage(): boolean { - return !this.hasNextPage(); - } - - public getContent(): T[] { - return this.content; - } - - public hasContent(): boolean { - return null !== this.content && 0 < this.content.length; - } -} \ No newline at end of file