Package java.text

Examples of java.text.DecimalFormatSymbols


   @param d      Number of digits after the decimal.
   */

   public void print (PrintWriter output, int w, int d) {
      DecimalFormat format = new DecimalFormat();
      format.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
      format.setMinimumIntegerDigits(1);
      format.setMaximumFractionDigits(d);
      format.setMinimumFractionDigits(d);
      format.setGroupingUsed(false);
      print(output,format,w+2);
View Full Code Here


        if (pd instanceof SimplePropertyDescriptor) {
            Object value = ((SimplePropertyDescriptor)pd).getValue(obj);
            //return EditorUtil.translateObjectToStringValue(pd.getPropertyName(), ((SimplePropertyDescriptor)pd).getValue(obj););
            //SchedConf special formatting for double values
            if (obj instanceof SchedConf && value instanceof Double) {
                DecimalFormat df = new DecimalFormat("#0.000000", new DecimalFormatSymbols(Locale.US));
                return df.format(value);
            }
            return value;
        } else if (pd instanceof DefaultListPropertyDescriptor) {
            return convertList2String(obj, (DefaultListPropertyDescriptor)pd);
View Full Code Here

        if (obj instanceof SchedConf) {
            Set keys = pd.getKeys(obj);
            if (keys.size() != 3) {
                throw new IllegalArgumentException("Author only expected 3 keys [cpu, mem, io], but you got "+keys.size());
            }
            DecimalFormat df = new DecimalFormat("#0.000000", new DecimalFormatSymbols(Locale.US));
            return "cpu="+df.format(pd.get(obj,"cpu")) +
                    ",mem="+df.format(pd.get(obj,"mem")) +
                    ",io="+df.format(pd.get(obj,"io"));
        }
       
View Full Code Here

  private static DecimalFormat createFormatter(PrecisionModel precisionModel) {
    // the default number of decimal places is 16, which is sufficient
    // to accomodate the maximum precision of a double.
    int decimalPlaces = precisionModel.getMaximumSignificantDigits();
    // specify decimal separator explicitly to avoid problems in other locales
    DecimalFormatSymbols symbols = new DecimalFormatSymbols();
    symbols.setDecimalSeparator('.');
    return new DecimalFormat("0" + (decimalPlaces > 0 ? "." : "")
                 +  stringOfChar('#', decimalPlaces), symbols);
  }
View Full Code Here

        };

        formatter = new PropertyFormatter<BigDecimal>(property) {

            private final DecimalFormat df = new DecimalFormat("#,##0.00",
                    new DecimalFormatSymbols(new Locale("en", "UK")));
            {
                df.setParseBigDecimal(true);
                // df.setRoundingMode(RoundingMode.HALF_UP);
            }
View Full Code Here

        assertThat(converter.accept(Number.class), equalTo(true));
        assertThat(converter.accept(WrongType.class), equalTo(false));       
    }

    private void assertThatAllNumbersAreConverted(ParameterConverter converter, Locale locale) {
      DecimalFormatSymbols format = new DecimalFormatSymbols(locale);
      char dot = format.getDecimalSeparator();
      char minus = format.getMinusSign();
        assertThat((Byte) converter.convertValue("127", Byte.class), equalTo(Byte.MAX_VALUE));
    assertThat((Byte) converter.convertValue(minus + "128", byte.class), equalTo(Byte.MIN_VALUE));
        assertThat((Short) converter.convertValue("32767", Short.class), equalTo(Short.MAX_VALUE));
        assertThat((Short) converter.convertValue(minus + "32768", short.class), equalTo(Short.MIN_VALUE));
        assertThat((Integer) converter.convertValue("3", Integer.class), equalTo(3));
View Full Code Here

    DecimalFormat df;

    public StatsCellRenderer() {
        df = new DecimalFormat("#,##0");
        DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
        dfs.setDecimalSeparator('.');
        dfs.setGroupingSeparator(',');
        df.setDecimalFormatSymbols(dfs);
    }
View Full Code Here

    public ItemCellRenderer(Map<String, LocationProperty> locationsProperties, Map<String, ItemProperty> itemsProperties) {
        this.locationsProperties = locationsProperties;
        this.itemsProperties = itemsProperties;
        df = new DecimalFormat("#,##0");
        DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
        dfs.setDecimalSeparator('.');
        dfs.setGroupingSeparator(',');
        df.setDecimalFormatSymbols(dfs);
    }
View Full Code Here

public String toString() {
  String  formatString = "0.";
   for (int k = 0; k < scalaSci.PrintFormatParams.vecDigitsPrecision(); k++)
       formatString += "0";
    DecimalFormat digitFormat = new DecimalFormat(formatString);
    digitFormat.setDecimalFormatSymbols(new DecimalFormatSymbols(new Locale("us")));
  
    StringBuilder sb = new StringBuilder();
      int N = realEvs.length;
      sb.append("\nEigenvalues: \n");
      for (int k=0; k<N; k++) {
View Full Code Here

   @param d      Number of digits after the decimal.
   */

   public void print (PrintWriter output, int w, int d) {
      DecimalFormat format = new DecimalFormat();
      format.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
      format.setMinimumIntegerDigits(1);
      format.setMaximumFractionDigits(d);
      format.setMinimumFractionDigits(d);
      format.setGroupingUsed(false);
      print(output,format,w+2);
View Full Code Here

TOP

Related Classes of java.text.DecimalFormatSymbols

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.