DistributionsEditor.java 文件源码

java
阅读 40 收藏 0 点赞 0 评论 0

项目:QN-ACTR-Release 作者:
@Override
protected void updateValues(ComponentEvent e) {
    //          Get the textfield
    JTextField sourcefield = (JTextField) e.getSource();
    try {
        // Get the probability entered in the textfield
        Double probability = new Double(Double.parseDouble(sourcefield.getText()));
        //Probability has to be smaller or equal than 1 (otherwise don't update value)
        if (probability.doubleValue() <= 1.0) {
            //If the probability was entered into the probability field of interval B
            //then the probability parameter in the distribution has to be set to 1-enteredProbability
            if (sourcefield.getName().equals(PROBABILITY_INTERVAL_B)) {
                probability = new Double(1 - probability.doubleValue());

            }
            //set the parameter
            current.getParameter(0).setValue(probability);
        }
    } catch (NumberFormatException ex) {
        //If user enters a value that is not a number -> reset value back to the value before
    }

    refreshValues();

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号