MCPcopy Create free account
hub / github.com/PCGen/pcgen / toString

Method toString

code/src/java/pcgen/core/RollInfo.java:277–425  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

275 }
276
277 @Override
278 public String toString()
279 {
280 final StringBuilder buf = new StringBuilder(50);
281
282 if (times > 0)
283 {
284 buf.append(times);
285 }
286
287 buf.append('d').append(sides);
288
289 while (keepList != null) // let break work
290 {
291 int p;
292 int i;
293
294 for (i = 0; i < times; ++i)
295 {
296 if (keepList[i])
297 {
298 break;
299 }
300 }
301
302 if (i == times) // all false
303 {
304 Logging.errorPrint("Bad rolls: nothing to keep!");
305
306 return "";
307 }
308
309 // Note the ordering: by testing for bottom
310 // first, we can also test if all the dice are
311 // all to be kept, and drop the
312 // top/bottom/list specification completely.
313 // First test for bottom
314 for (i = 0; i < times; ++i)
315 {
316 if (!keepList[i])
317 {
318 break;
319 }
320 }
321
322 if (i == times)
323 {
324 break; // all true
325 }
326
327 p = i;
328
329 for (; i < times; ++i)
330 {
331 if (keepList[i])
332 {
333 break;
334 }

Callers 1

adjustDamageMethod · 0.95

Calls 3

errorPrintMethod · 0.95
toStringMethod · 0.65
appendMethod · 0.45

Tested by

no test coverage detected