(
final boolean errorOnly, final boolean ascending)
| 42 | } |
| 43 | |
| 44 | public final String getMessages( |
| 45 | final boolean errorOnly, final boolean ascending) { |
| 46 | |
| 47 | StringBuffer sb = new StringBuffer(); |
| 48 | Message m; |
| 49 | |
| 50 | final int end = messages.size() - 1; |
| 51 | |
| 52 | int i = (ascending ? 0 : end - 1); |
| 53 | while ( |
| 54 | (ascending && i <= end) || |
| 55 | (!ascending && i >= 0) |
| 56 | ) { |
| 57 | |
| 58 | m = (Message) messages.elementAt(i); |
| 59 | if (!errorOnly || m.error) { |
| 60 | sb.append(m.msg); |
| 61 | sb.append('\n'); |
| 62 | } |
| 63 | |
| 64 | if (ascending) { |
| 65 | i++; |
| 66 | } else { |
| 67 | i--; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | return sb.toString(); |
| 72 | } |
| 73 | |
| 74 | public final boolean isEmpty() { |
| 75 | return messages.isEmpty(); |
no test coverage detected