public static <F, S> Pair<F, S> of(F first, S second) { return new Pair<F, S>(first, second); }
private Pair<Integer, Integer> nextRow(int offset, int index, int width) { int count = 0; while (true) { if (index >= buffer.get(offset).text.length()) { if (offset + 1 >= buffer.size()) { return null; } else { index = 0; offset++; } } else { char c = buffer.get(offset).text.charAt(index++); if (c == '\n') { return new Pair<Integer, Integer>(offset, index); } else if (c >= 32) { if (++count == width) { return new Pair<Integer, Integer>(offset, index); } } } } }
private static Pair<Integer, Integer> size(String s, int index, int height) { if (height < 1) { throw new IllegalArgumentException("A non positive height=" + height + " cannot be accepted"); } if (index < s.length()) { int pos = s.indexOf('\n', index); if (pos == -1) { return Pair.of(s.length() - index, height); } else { Pair<Integer, Integer> ret = size(s, pos + 1, height + 1); return new Pair<Integer, Integer>(Math.max(pos - index, ret.getFirst()), ret.getSecond()); } } else { return Pair.of(0, height); } }
public static <F, S> Pair<F, S> of(F first, S second) { return new Pair<F, S>(first, second); }
public static <F, S> Pair<F, S> of(F first, S second) { return new Pair<F, S>(first, second); }
public static <F, S> Pair<F, S> of(F first, S second) { return new Pair<F, S>(first, second); }
private Pair<Integer, Integer> nextRow(int offset, int index, int width) { int count = 0; while (true) { if (index >= buffer.get(offset).text.length()) { if (offset + 1 >= buffer.size()) { return null; } else { index = 0; offset++; } } else { char c = buffer.get(offset).text.charAt(index++); if (c == '\n') { return new Pair<Integer, Integer>(offset, index); } else if (c >= 32) { if (++count == width) { return new Pair<Integer, Integer>(offset, index); } } } } }
private Pair<Integer, Integer> nextRow(int offset, int index, int width) { int count = 0; while (true) { if (index >= buffer.get(offset).text.length()) { if (offset + 1 >= buffer.size()) { return null; } else { index = 0; offset++; } } else { char c = buffer.get(offset).text.charAt(index++); if (c == '\n') { return new Pair<Integer, Integer>(offset, index); } else if (c >= 32) { if (++count == width) { return new Pair<Integer, Integer>(offset, index); } } } } }
private static Pair<Integer, Integer> size(String s, int index, int height) { if (height < 1) { throw new IllegalArgumentException("A non positive height=" + height + " cannot be accepted"); } if (index < s.length()) { int pos = s.indexOf('\n', index); if (pos == -1) { return Pair.of(s.length() - index, height); } else { Pair<Integer, Integer> ret = size(s, pos + 1, height + 1); return new Pair<Integer, Integer>(Math.max(pos - index, ret.getFirst()), ret.getSecond()); } } else { return Pair.of(0, height); } }
private static Pair<Integer, Integer> size(String s, int index, int height) { if (height < 1) { throw new IllegalArgumentException("A non positive height=" + height + " cannot be accepted"); } if (index < s.length()) { int pos = s.indexOf('\n', index); if (pos == -1) { return Pair.of(s.length() - index, height); } else { Pair<Integer, Integer> ret = size(s, pos + 1, height + 1); return new Pair<Integer, Integer>(Math.max(pos - index, ret.getFirst()), ret.getSecond()); } } else { return Pair.of(0, height); } }
private static Pair<Integer, Integer> size(String s, int index, int height) { if (height < 1) { throw new IllegalArgumentException("A non positive height=" + height + " cannot be accepted"); } if (index < s.length()) { int pos = s.indexOf('\n', index); if (pos == -1) { return Pair.of(s.length() - index, height); } else { Pair<Integer, Integer> ret = size(s, pos + 1, height + 1); return new Pair<Integer, Integer>(Math.max(pos - index, ret.getFirst()), ret.getSecond()); } } else { return Pair.of(0, height); } }