BrightSide Workbench Full Report + Source Code
org.turro.collections.CollectionIterator< E, ID > Class Template Referenceabstract
Inheritance diagram for org.turro.collections.CollectionIterator< E, ID >:
Collaboration diagram for org.turro.collections.CollectionIterator< E, ID >:

Public Member Functions

 CollectionIterator (List< E > collection)
 
int getPage ()
 
void setPage (int page)
 
void initClauses ()
 
List< E > getItems ()
 
int getTotalCount ()
 
List< E > getTotalItems ()
 
int item ()
 
void current (int value)
 
int current ()
 
int pages ()
 
boolean beginning ()
 
boolean end ()
 
void next ()
 
void previous ()
 
boolean isEmpty ()
 

Protected Attributes

List< E > items
 
int _total = -1
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 27 of file CollectionIterator.java.

Constructor & Destructor Documentation

◆ CollectionIterator()

Definition at line 35 of file CollectionIterator.java.

35  {
36  this.collection = collection;
37  }

Member Function Documentation

◆ beginning()

boolean org.turro.collections.CollectionIterator< E, ID >.beginning ( )

Definition at line 101 of file CollectionIterator.java.

101  {
102  return _curr <= 0;
103  }

◆ current() [1/2]

int org.turro.collections.CollectionIterator< E, ID >.current ( )

Definition at line 87 of file CollectionIterator.java.

87  {
88  if(_curr > -1) {
89  return (int) Math.ceil((_curr) / (_page + 0.0d));
90  }
91  return -1;
92  }
Here is the caller graph for this function:

◆ current() [2/2]

void org.turro.collections.CollectionIterator< E, ID >.current ( int  value)

Definition at line 73 of file CollectionIterator.java.

73  {
74  value = (value * _page) - _page;
75  if(value >= _total) {
76  value = _total - _page;
77  end = true;
78  }
79  if(value < 0) {
80  _curr = 0;
81  } else {
82  _curr = value;
83  }
84  loadItems();
85  }
Here is the caller graph for this function:

◆ end()

boolean org.turro.collections.CollectionIterator< E, ID >.end ( )

Definition at line 105 of file CollectionIterator.java.

105  {
106  return end;
107  }

◆ getItems()

List<E> org.turro.collections.CollectionIterator< E, ID >.getItems ( )

Definition at line 54 of file CollectionIterator.java.

54  {
55  return items;
56  }

◆ getPage()

int org.turro.collections.CollectionIterator< E, ID >.getPage ( )

Definition at line 39 of file CollectionIterator.java.

39  {
40  return _page;
41  }

◆ getTotalCount()

int org.turro.collections.CollectionIterator< E, ID >.getTotalCount ( )

Definition at line 58 of file CollectionIterator.java.

58  {
59  if(_total == -1) {
60  _total = collection.size();
61  }
62  return _total;
63  }
Here is the caller graph for this function:

◆ getTotalItems()

List<E> org.turro.collections.CollectionIterator< E, ID >.getTotalItems ( )

Definition at line 65 of file CollectionIterator.java.

65  {
66  return collection;
67  }
Here is the caller graph for this function:

◆ initClauses()

void org.turro.collections.CollectionIterator< E, ID >.initClauses ( )

Definition at line 47 of file CollectionIterator.java.

47  {
48  _curr = -1;
49  end = false;
50  _total = -1;
51  getTotalCount();
52  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEmpty()

boolean org.turro.collections.CollectionIterator< E, ID >.isEmpty ( )

Reimplemented in org.turro.collections.CollectionHtmlIterator< E, ID >.

Definition at line 117 of file CollectionIterator.java.

117  {
118  return items == null || items.isEmpty();
119  }

◆ item()

Definition at line 69 of file CollectionIterator.java.

69  {
70  return _curr;
71  }

◆ next()

Definition at line 109 of file CollectionIterator.java.

109  {
110  current(current() + 1);
111  }
Here is the call graph for this function:

◆ pages()

Definition at line 94 of file CollectionIterator.java.

94  {
95  if(_total > -1) {
96  return (int) Math.ceil((_total + 0.0d) / (_page + 0.0d));
97  }
98  return -1;
99  }
Here is the caller graph for this function:

◆ previous()

void org.turro.collections.CollectionIterator< E, ID >.previous ( )

Definition at line 113 of file CollectionIterator.java.

113  {
114  current(current() - 1);
115  }
Here is the call graph for this function:

◆ setPage()

void org.turro.collections.CollectionIterator< E, ID >.setPage ( int  page)

Definition at line 43 of file CollectionIterator.java.

43  {
44  this._page = page;
45  }
Here is the caller graph for this function:

Member Data Documentation

◆ _total

int org.turro.collections.CollectionIterator< E, ID >._total = -1
protected

Definition at line 30 of file CollectionIterator.java.

◆ items

List<E> org.turro.collections.CollectionIterator< E, ID >.items
protected

Reimplemented in org.turro.polls.PollIterator.

Definition at line 29 of file CollectionIterator.java.


The documentation for this class was generated from the following file: