All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.bretty.console.table.NumberColumnFormatter Maven / Gradle / Ivy

Go to download

An extensible Java library to build stylish Excel-like tables, which can be converted into a single string with all table formats preserved.

The newest version!
/*
 * Copyright (c) 2015 SUN XIMENG (Nathaniel). All rights reserved.
 */

package io.bretty.console.table;

class NumberColumnFormatter extends ColumnFormatter {

	protected Precision precision;

	protected NumberColumnFormatter(Alignment al, int width, Precision p) {
		super(al, width);
		this.precision = p;
	}

	/*protected double cast(Object n) {
		return ((Number) n).doubleValue();
	}*/

	@Override
	public String format(Number n) {
		double value = n.doubleValue();
		return this.formatString(this.precision.format(value), this.width);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy