private static int width(int width, Iterator<Object> stream, CharSequence current, Integer from) { while (current == null) { if (stream.hasNext()) { Object next = stream.next(); if (next instanceof CharSequence) { current = (CharSequence)next; from = 0; } } else { break; } } if (current == null) { return width; } else { int pos = Utils.indexOf(current, from, '\n'); if (pos == -1) { return width(width + current.length() - from, stream, current, from); } else { return Math.max(width + pos - from, width(0, stream, null, 0)); } } }
private static int width(int width, Iterator<Object> stream, CharSequence current, Integer from) { while (current == null) { if (stream.hasNext()) { Object next = stream.next(); if (next instanceof CharSequence) { current = (CharSequence)next; from = 0; } } else { break; } } if (current == null) { return width; } else { int pos = Utils.indexOf(current, from, '\n'); if (pos == -1) { return width(width + current.length() - from, stream, current, from); } else { return Math.max(width + pos - from, width(0, stream, null, 0)); } } }
private static int width(int width, Iterator<Object> stream, CharSequence current, Integer from) { while (current == null) { if (stream.hasNext()) { Object next = stream.next(); if (next instanceof CharSequence) { current = (CharSequence)next; from = 0; } } else { break; } } if (current == null) { return width; } else { int pos = Utils.indexOf(current, from, '\n'); if (pos == -1) { return width(width + current.length() - from, stream, current, from); } else { return Math.max(width + pos - from, width(0, stream, null, 0)); } } }
private static int width(int width, Iterator<Chunk> stream, Text current, Integer from) { while (current == null) { if (stream.hasNext()) { Chunk next = stream.next(); if (next instanceof Text) { current = (Text)next; from = 0; } } else { break; } } if (current == null) { return width; } else { int pos = Utils.indexOf(current.getText(), from, '\n'); if (pos == -1) { return width(width + current.getText().length() - from, stream, current, from); } else { return Math.max(width + pos - from, width(0, stream, null, 0)); } } }