public static String spaces(int n) { return chars(' ', n); }
private void startLine(String text, int level, StringBuffer buf) { if (linePrefix != null) buf.append(linePrefix); buf.append(StringUtil.spaces(INDENT_SIZE * level)); buf.append(text); }
public static String getStackTrace(Throwable t, int depth) { String stackTrace = ""; StringReader stringReader = new StringReader(getStackTrace(t)); LineNumberReader lineNumberReader = new LineNumberReader(stringReader); for (int i = 0; i < depth; i++) { try { stackTrace += lineNumberReader.readLine() + NEWLINE; } catch (IOException e) { Assert.shouldNeverReachHere(); } } return stackTrace; }
/** * Creates a string representation of a {@link CoordinateSequence}. * The format is: * <pre> * ( ord0,ord1.. ord0,ord1,... ... ) * </pre> * * @param cs the sequence to output * @return the string representation of the sequence */ public static String toString(CoordinateSequence cs) { int size = cs.size(); if (size == 0) return "()"; int dim = cs.getDimension(); StringBuffer buf = new StringBuffer(); buf.append('('); for (int i = 0; i < size; i++) { if (i > 0) buf.append(" "); for (int d = 0; d < dim; d++) { if (d > 0) buf.append(","); buf.append(StringUtil.toString(cs.getOrdinate(i, d))); } } buf.append(')'); return buf.toString(); } }
throw new SAXException("Cannot create a coordinate sequence without a non-null touple to parse"); int dim = StringUtil.split(touples[0], coordSeperator).length; CoordinateSequence cs = gf.getCoordinateSequenceFactory().create(numNonNullTouples,dim);
/** * Creates the <code>DecimalFormat</code> used to write <code>double</code>s * with a sufficient number of decimal places. * * @param precisionModel * the <code>PrecisionModel</code> used to determine the number of * decimal places to write. * @return a <code>DecimalFormat</code> that write <code>double</code> s * without scientific notation. */ private static DecimalFormat createFormatter(int precision) { // specify decimal separator explicitly to avoid problems in other locales DecimalFormatSymbols symbols = new DecimalFormatSymbols(); symbols.setDecimalSeparator('.'); DecimalFormat format = new DecimalFormat("0." + StringUtil.chars('#', precision), symbols); format.setDecimalSeparatorAlwaysShown(false); return format; }