当前位置: 首页>>代码示例>>Java>>正文


Java DecimalFormatSymbols.setDecimalSeparator方法代码示例

本文整理汇总了Java中java.text.DecimalFormatSymbols.setDecimalSeparator方法的典型用法代码示例。如果您正苦于以下问题:Java DecimalFormatSymbols.setDecimalSeparator方法的具体用法?Java DecimalFormatSymbols.setDecimalSeparator怎么用?Java DecimalFormatSymbols.setDecimalSeparator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.text.DecimalFormatSymbols的用法示例。


在下文中一共展示了DecimalFormatSymbols.setDecimalSeparator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
/**
 * Initializes the panel.
 */
private void initialize() {
	this.setLayout(new GridLayout(0, 1, 10, 10));

	DecimalFormatSymbols symbol = new DecimalFormatSymbols();

	symbol.setDecimalSeparator('.');
	DecimalFormat decimalFormat = new DecimalFormat();
	decimalFormat.setDecimalFormatSymbols(symbol);
	mtFieldFormat = decimalFormat;

	Double expected = firstMoment.evaluate(reliabilityFunction);

	JLabel expectedLabel = new JLabel("Expected Value:");
	JPanel propertiesPanel = createPropertiesPanel(expected, expectedLabel);
	JPanel mttfPanel = createMttfPanel(expected, expectedLabel.getPreferredSize());
	JPanel mtPanel = createMtPanel(expectedLabel.getPreferredSize());

	this.add(propertiesPanel);
	this.add(mttfPanel);
	this.add(mtPanel);

	revalidate();
	repaint();
}
 
开发者ID:felixreimann,项目名称:jreliability,代码行数:28,代码来源:MeasuresPanel.java

示例2: cluster_simplfication

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
public static JSONArray cluster_simplfication(JSONArray coords, double tolerance){
	DecimalFormat df = new DecimalFormat("0.0000");
	DecimalFormatSymbols simbolos = new DecimalFormatSymbols();
	simbolos.setDecimalSeparator('.');
	df.setDecimalFormatSymbols(simbolos);
	double pivotx = coords.getDouble(0);
	double pivoty = coords.getDouble(1);
	JSONArray newcoords = new JSONArray();
	newcoords.put(new Float(df.format(pivotx)));
	newcoords.put(new Float(df.format(pivoty)));
	for(int i=2; i<coords.length(); i++){
		if(Math.sqrt(Math.pow((coords.getDouble(i)-pivotx), 2)+Math.pow((coords.getDouble(i+1)-pivoty), 2)) >= tolerance){
			pivotx = coords.getDouble(i);
			pivoty = coords.getDouble(i+1);
			newcoords.put(new Float(df.format(pivotx)));
			newcoords.put(new Float(df.format(pivoty)));
		}
		i++;
	}
	return newcoords;
}
 
开发者ID:acalvoa,项目名称:EARLGREY,代码行数:22,代码来源:GeoAlgorithm.java

示例3: CSVLogger

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
/**
 * Creates a new CSVLogger that writes to the given file
 * @param file the file we should write to
 * @param columns the columns for the log file
 * @param append true to append to an existing file. False to create a new file
 * @param colSep the column separator
 * @param digitSep the decimal digits separator
 */
public CSVLogger(File file, String[] columns, boolean append, String colSep, char digitSep) {
	this.file = file;
	this.initialized = false;
	this.append = append;
	this.columns = columns;
	this.colSep = colSep;
	
	DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US);
	dfs.setDecimalSeparator(digitSep);
	numberFormat = new DecimalFormat("#.#", dfs);
	numberFormat.setMaximumFractionDigits(340);
	numberFormat.setMaximumIntegerDigits(340);
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:22,代码来源:CSVLogger.java

示例4: toString

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
public String toString(Object obj){
  DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.ROOT);
  symbols.setDecimalSeparator('.');
  symbols.setGroupingSeparator(','); 
  
  DecimalFormat formatDecimal = new DecimalFormat("#0.00", symbols);
  formatDecimal.setRoundingMode(RoundingMode.HALF_UP);
  return formatDecimal.format((Double) obj);
}
 
开发者ID:pablopdomingos,项目名称:nfse,代码行数:10,代码来源:DoubleConversor.java

示例5: parseToCash

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
public static String parseToCash( String value) {
    double temp = parseToDouble(value);
    String pattern = "###,###.00";
    DecimalFormatSymbols ds = new DecimalFormatSymbols();
    ds.setDecimalSeparator(',');
    ds.setGroupingSeparator('.');
    DecimalFormat df = new DecimalFormat(pattern,ds);
    df.setGroupingUsed(true);
    return df.format(temp);
}
 
开发者ID:ViniciusSossela,项目名称:meuboleto,代码行数:11,代码来源:InterpretadorCodigoBarras.java

示例6: StrictDecimalFormat

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
public StrictDecimalFormat(char decimalSeparator) {
	this();
	DecimalFormatSymbols symbols = getDecimalFormatSymbols();
	symbols.setDecimalSeparator(decimalSeparator);
	setDecimalFormatSymbols(symbols);
	setGroupingUsed(false);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:StrictDecimalFormat.java

示例7: VerboseCSVMeasureOutputReader

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
/**
 * Builds a new CSV measure reader
 * @param measureCsvFile the measure csv file. Muse be a valid file
 * @param logDecimalSeparator the decimal separator
 * @param logCsvDelimiter the CSV delimiter
 */
public VerboseCSVMeasureOutputReader(File measureCsvFile, String logDecimalSeparator, String logCsvDelimiter) {
	this.measureCsvFile = measureCsvFile;
	this.logCsvDelimiter = logCsvDelimiter;
	DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US);
	dfs.setDecimalSeparator(logDecimalSeparator.charAt(0));
	numberParser = new DecimalFormat("#.#", dfs);
	fileSize = measureCsvFile.length();
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:15,代码来源:VerboseCSVMeasureOutputReader.java

示例8: TikzExporter

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
/**
 * General constructor for the class, pure object oriented approach.
 * It is necessary to create the object with the network before printing.
 * @param network
 */
public TikzExporter(BrowsableNetwork network){			
	this.network = network;
	colors = new HashMap<Color, String>();
	DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.getDefault());
	symbols.setDecimalSeparator('.');
	formatter = new DecimalFormat("###.#######", symbols);
	formatter.setGroupingUsed(false);
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:14,代码来源:TikzExporter.java

示例9: getDecimalFormat

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
/**
 * Procedure creates new dot-separated DecimalFormat
 */
public static DecimalFormat getDecimalFormat(String format)
{
    DecimalFormat df = new DecimalFormat(format);
    DecimalFormatSymbols dfs = new DecimalFormatSymbols();
    dfs.setDecimalSeparator('.');
    dfs.setExponentSeparator("e");
    df.setDecimalFormatSymbols(dfs);
    return df;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:13,代码来源:CompatUtils.java

示例10: ScientificNotationExchangeItem

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
/**
 * Constructor
 *
 * @param id
 * @param description
 * @param role
 * @param value
 * @param format
 */
public ScientificNotationExchangeItem (String id, String description, Role role, double value, String format) {
	this.id = id;
	this.description = description;
	this.role = role;
	this.value = value;
	DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.getDefault());
	otherSymbols.setDecimalSeparator('.');
	this.formatter = new DecimalFormat(format, otherSymbols);
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:19,代码来源:ScientificNotationExchangeItem.java

示例11: printNumber

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
private String printNumber(double value) {
	DecimalFormatSymbols symbols = new DecimalFormatSymbols();
	symbols.setDecimalSeparator('.');
	DecimalFormat formatFloat = new DecimalFormat("0.###", symbols);
	DecimalFormat formatExponent = new DecimalFormat("0.###E0", symbols);

	if (Math.abs(value) > 0.01 && Math.abs(value) < 1000.0 || value == 0.0) {
		return formatFloat.format(value);
	} else {
		return formatExponent.format(value);
	}
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:13,代码来源:SimpleLeastSquaresCostFunctionWithState.java

示例12: printNumber

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
private String printNumber(double value) {
    DecimalFormatSymbols symbols = new DecimalFormatSymbols();
    symbols.setDecimalSeparator('.');
    DecimalFormat formatFloat = new DecimalFormat("0.###", symbols);
    DecimalFormat formatExponent = new DecimalFormat("0.###E0", symbols);

    if (Math.abs(value) > 0.01 && Math.abs(value) < 1000.0 || value == 0.0) {
        return formatFloat.format(value);
    } else {
        return formatExponent.format(value);
    }
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:13,代码来源:SimpleLeastSquaresCostFunction.java

示例13: TikzExporter

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
public TikzExporter() {
	colors = new HashMap<Color, String>();
	DecimalFormatSymbols symbols = new DecimalFormatSymbols(
			Locale.getDefault());
	symbols.setDecimalSeparator('.');
	formatter = new DecimalFormat("###.#######", symbols);
	formatter.setGroupingUsed(false);
	setScalingFactors(defaultNodeSizeFactor, defaultEdgeSizeFactor,
			defaultCoordinateFactor);
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:11,代码来源:TikzExporter.java

示例14: getDecimalNumber

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
/**
 * Returns parsed number.
 * @param number String number representation.
 * @return Parsed number.
 * @throws ParseException Unable to parse given string.
 */
private Number getDecimalNumber(String number) throws ParseException {
	DecimalFormat format = new DecimalFormat();
	DecimalFormatSymbols custom=new DecimalFormatSymbols();
	custom.setDecimalSeparator('.');
	format.setDecimalFormatSymbols(custom);
	return format.parse(number);
}
 
开发者ID:fgulan,项目名称:java-course,代码行数:14,代码来源:ValueWrapper.java

示例15: printNumberExtended

import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
public static String printNumberExtended(double value) {
    DecimalFormatSymbols symbols = new DecimalFormatSymbols();
    symbols.setDecimalSeparator('.');
    DecimalFormat formatFloat = new DecimalFormat("0.#####", symbols);
    DecimalFormat formatExponent = new DecimalFormat("0.#####E0", symbols);

    if (Math.abs(value) > 0.01 && Math.abs(value) < 1000.0 || value == 0.0) {
        return formatFloat.format(value);
    } else {
        return formatExponent.format(value);
    }
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:13,代码来源:PrintNumber.java


注:本文中的java.text.DecimalFormatSymbols.setDecimalSeparator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。