本文整理汇总了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();
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例6: StrictDecimalFormat
import java.text.DecimalFormatSymbols; //导入方法依赖的package包/类
public StrictDecimalFormat(char decimalSeparator) {
this();
DecimalFormatSymbols symbols = getDecimalFormatSymbols();
symbols.setDecimalSeparator(decimalSeparator);
setDecimalFormatSymbols(symbols);
setGroupingUsed(false);
}
示例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();
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
}