Example usage for java.lang Double Double

List of usage examples for java.lang Double Double

Introduction

In this page you can find the example usage for java.lang Double Double.

Prototype

@Deprecated(since = "9")
public Double(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Double object that represents the floating-point value of type double represented by the string.

Usage

From source file:Main.java

public Main() {
    JSpinner m_numberSpinner;//from  w  ww  .ja v a 2s .c om
    SpinnerNumberModel m_numberSpinnerModel;
    Double current = new Double(5.50);
    Double min = new Double(0.00);
    Double max = new Double(10.00);
    Double step = new Double(0.25);
    m_numberSpinnerModel = new SpinnerNumberModel(current, min, max, step);
    m_numberSpinner = new JSpinner(m_numberSpinnerModel);
    add(m_numberSpinner);
}

From source file:Main.java

private static final Object readThisPrimitiveValueXml(XmlPullParser parser, String tagName)
        throws XmlPullParserException, java.io.IOException {
    try {/* ww  w  . ja  v a 2s .  c  om*/
        if (tagName.equals("int")) {
            return Integer.parseInt(parser.getAttributeValue(null, "value"));
        } else if (tagName.equals("long")) {
            return Long.valueOf(parser.getAttributeValue(null, "value"));
        } else if (tagName.equals("float")) {
            return new Float(parser.getAttributeValue(null, "value"));
        } else if (tagName.equals("double")) {
            return new Double(parser.getAttributeValue(null, "value"));
        } else if (tagName.equals("boolean")) {
            return Boolean.valueOf(parser.getAttributeValue(null, "value"));
        } else {
            return null;
        }
    } catch (NullPointerException e) {
        throw new XmlPullParserException("Need value attribute in <" + tagName + ">");
    } catch (NumberFormatException e) {
        throw new XmlPullParserException("Not a number in value attribute in <" + tagName + ">");
    }
}

From source file:Main.java

private static final Object readThisPrimitiveValueXml(XmlPullParser parser, String tagName)
        throws XmlPullParserException, IOException {
    try {/*from  w  ww. j a  v  a 2  s .c  o m*/
        if (tagName.equals("int")) {
            return Integer.parseInt(parser.getAttributeValue(null, "value"));
        } else if (tagName.equals("long")) {
            return Long.valueOf(parser.getAttributeValue(null, "value"));
        } else if (tagName.equals("float")) {
            return new Float(parser.getAttributeValue(null, "value"));
        } else if (tagName.equals("double")) {
            return new Double(parser.getAttributeValue(null, "value"));
        } else if (tagName.equals("boolean")) {
            return Boolean.valueOf(parser.getAttributeValue(null, "value"));
        } else {
            return null;
        }
    } catch (NullPointerException e) {
        throw new XmlPullParserException("Need value attribute in <" + tagName + ">");
    } catch (NumberFormatException e) {
        throw new XmlPullParserException("Not a number in value attribute in <" + tagName + ">");
    }
}

From source file:com.ryderbot.utils.ModelUtils.java

public static AccountBalance generateAccountBalance(NamedNodeMap attributes) {

    Long accountID = new Long(attributes.getNamedItem("accountID").getNodeValue());
    Long accountKey = new Long(attributes.getNamedItem("accountKey").getNodeValue());
    Double balance = new Double(attributes.getNamedItem("balance").getNodeValue());

    AccountBalance accountBalance = new AccountBalance(accountID);
    accountBalance.setAccountKey(accountKey);
    accountBalance.setBalance(balance);/*from  w  ww. ja  va2 s  .c om*/

    return accountBalance;
}

From source file:com.muni.fi.pa165.survive.rest.client.utils.DtoBuilder.java

public static WeaponDto getWeaponDto(CommandLine line) {
    WeaponDto dto = new WeaponDto();
    //name/*from  ww w. j a  v  a2 s .com*/
    if (line.hasOption("n")) {
        dto.setName(line.getOptionValue("n"));
    }
    //caliber
    if (line.hasOption("m")) {
        dto.setCaliber(new Double(line.getOptionValue("m")));
    }
    //range
    if (line.hasOption("g")) {
        dto.setRange(new Integer(line.getOptionValue("g")));
    }
    //rounds
    if (line.hasOption("r")) {
        dto.setRounds(new Integer(line.getOptionValue("r")));
    }
    //index
    if (line.hasOption("i")) {
        dto.setId(new Long(line.getOptionValue("i")));
    }
    //type
    if (line.hasOption("t")) {
        dto.setWeaponType(WeaponType.valueOf(line.getOptionValue("t").toUpperCase()));
    }
    //class
    if (line.hasOption("c")) {
        dto.setWeaponClass(WeaponClass.valueOf(line.getOptionValue("c").toUpperCase()));
    }
    //desc
    if (line.hasOption("d")) {
        dto.setDescription(line.getOptionValue("d"));
    }
    return dto;

}

From source file:Main.java

public static List<Double> toList(double... array) {
    if (isEmpty(array)) {
        return new ArrayList<>(0);
    }//from w ww  .  j  ava2  s .  c o m
    List<Double> list = new ArrayList<>(array.length);
    for (double d : array) {
        list.add(new Double(d));
    }
    return list;
}

From source file:Main.java

public void setInterest(double interest) {
    try {/*from  w  w  w  .  j a  v a2  s.  c  om*/
        vcs.fireVetoableChange("interest", new Double(this.interest), new Double(interest));
        this.interest = interest;
    } catch (PropertyVetoException e) {
        e.printStackTrace();
    }
}

From source file:WeeklyReport.Charts.java

protected JFreeChart pieChart() {
    DefaultPieDataset dataset = new DefaultPieDataset();
    dataset.setValue("Automobile/POVs (New & Used)", new Double(new CargoTypeData().automobiles()));
    dataset.setValue("Construction Equipment", new Double(new CargoTypeData().construction()));
    dataset.setValue("Trucks, Busses, Vans, & Chassis", new Double(new CargoTypeData().trucks()));
    dataset.setValue("Agricultural Equipment & Tractors", new Double(new CargoTypeData().agricultural()));
    dataset.setValue("Boats on Trailer", new Double(new CargoTypeData().BT()));
    dataset.setValue("Boats on Cradle", new Double(new CargoTypeData().BC()));
    dataset.setValue("Static Cargo (Forklift & MAFI)", new Double(new CargoTypeData().staticCargo()));

    JFreeChart chart = ChartFactory.createPieChart("Quotes by Commodity Class", dataset, true, true, false);
    return chart;
}

From source file:Main.java

/**
 * Get double from the JComboBox input/*from   w w w  . ja v  a2  s  . co  m*/
 * 
 * @param input the JComboBox object
 * @return the double number
 */
public static double getDouble(javax.swing.JComboBox input) throws Exception {
    return new Double((String) (input.getSelectedItem())).doubleValue();
}

From source file:Main.java

/**
 * Check if the JTextField input is larger or equal than x
 * //from w w w  .j  a v  a 2s  .c  o m
 * @param input  the JTextField object
 * @param x  parameter x
 * @return true or false
 */
public static boolean largeEqualThan(javax.swing.JTextField input, double x) throws Exception {
    double d = new Double(input.getText()).doubleValue();
    if (d >= x)
        return true;
    return false;
}