⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ecgparamwindow.java

📁 egc 心电信号检测的源程序
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    private javax.swing.JTextField txtSeed;    private javax.swing.JTextField txtSf;    private javax.swing.JTextField txtSfEcg;    // End of variables declaration//GEN-END:variables        private EcgParam paramOb;    private EcgLogWindow ecgLog;    private boolean checkParameters(){        ecgLog.println("Starting to check ECG parameters...");        String errorStr = "";        boolean RetValue = true;        //ECG Sampling frequency flag        boolean sfecg_flg = true;        //Internal Sampling frequency flag        boolean sf_flg = true;        /* General Interface parameters */        try {            paramOb.setN(Integer.valueOf(txtN.getText()).intValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'Approximate number of heart beats' entered, please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //txtN.setText(Integer.toString(paramOb.getN()));            RetValue = false;        }        try {            paramOb.setSfEcg(Integer.valueOf(txtSfEcg.getText()).intValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'ECG Sampling Frequency' entered, please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //txtSfEcg.setText(Integer.toString(paramOb.getSfEcg()));            sfecg_flg = false;            RetValue = false;        }        if(sfecg_flg){            try {                paramOb.setSf(Integer.valueOf(txtSf.getText()).intValue());            } catch(java.lang.NumberFormatException e){                errorStr += "Incorrect 'Internal Sampling Frequency' entered, please correct it!\n";                errorStr += "Exception Error : " + e + "\n";                //txtSf.setText(Integer.toString(paramOb.getSf()));                sf_flg = false;                RetValue = false;            }        }        // Check the Internal frequency respect to ECG frequency        if(sfecg_flg && sf_flg){            if(((int)Math.IEEEremainder(Integer.valueOf(txtSf.getText()).intValue(), Integer.valueOf(txtSfEcg.getText()).intValue())) != 0){                errorStr += "Internal sampling frequency must be an integer multiple of the\n";                errorStr += "ECG sampling frequency!\n";                //txtSfEcg.setText(Integer.toString(paramOb.getSfEcg()));                //txtSf.setText(Integer.toString(paramOb.getSf()));                RetValue = false;            }        }        try {            paramOb.setANoise(Double.valueOf(txtANoise.getText()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'Amplitude of additive uniform noise' entered, please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //txtANoise.setText(Double.toString(paramOb.getANoise()));            RetValue = false;        }        try {            paramOb.setHrMean(Double.valueOf(txtHrMean.getText()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'Heart rate mean' entered, please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //txtHrMean.setText(Double.toString(paramOb.getHrMean()));            RetValue = false;        }        try {            paramOb.setHrStd(Double.valueOf(txtHrStd.getText()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'Heart rate standard deviation' entered, please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //txtHrStd.setText(Double.toString(paramOb.getHrStd()));            RetValue = false;        }                try {            paramOb.setSeed(Integer.valueOf(txtSeed.getText()).intValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'seed' entered, please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //txtSeed.setText(Integer.toString(paramOb.getSeed()));            RetValue = false;        }               try {            paramOb.setAmplitude(Double.valueOf(txtAmplitude.getText()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'Plot Area Amplitude' entered, please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //txtAmplitude.setText(Double.toString(paramOb.getAmplitude()));            RetValue = false;        }        /* Spectral Characteristics parameters */        try {            paramOb.setFLo(Double.valueOf(txtFLo.getText()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'Low frequency' entered, please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //txtFLo.setText(Double.toString(paramOb.getFLo()));            RetValue = false;        }        try {            paramOb.setFHi(Double.valueOf(txtFHi.getText()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'High frequency' entered, please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //txtFHi.setText(Double.toString(paramOb.getFHi()));            RetValue = false;        }        try {            paramOb.setFLoStd(Double.valueOf(txtFLoStd.getText()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'Low frequency standard deviation' entered, please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //txtFLoStd.setText(Double.toString(paramOb.getFLo()));            RetValue = false;        }        try {            paramOb.setFHiStd(Double.valueOf(txtFHiStd.getText()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'High frequency standard deviation' entered, please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //txtFHiStd.setText(Double.toString(paramOb.getFHiStd()));            RetValue = false;        }        try {            paramOb.setLfHfRatio(Double.valueOf(txtLfHfRatio.getText()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'LF/HF ratio' entered, please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //txtLfHfRatio.setText(Double.toString(paramOb.getLfHfRatio()));            RetValue = false;        }        /* ECG morphology: Order of extrema: [P Q R S T] */        // theta        try {            paramOb.setTheta(0, Double.valueOf(tiTable.getValueAt(0,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'theta' value entered (position 1), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //tiTable.getModel().setValueAt(new Double(paramOb.getTheta(1)), 0, 0);            RetValue = false;        }        try {            paramOb.setTheta(1, Double.valueOf(tiTable.getValueAt(1,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'theta' value entered (position 2), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //tiTable.getModel().setValueAt(new Double(paramOb.getTheta(2)), 1, 0);            RetValue = false;        }        try {            paramOb.setTheta(2, Double.valueOf(tiTable.getValueAt(2,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'theta' value entered (position 3), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //tiTable.getModel().setValueAt(new Double(paramOb.getTheta(3)), 2, 0);            RetValue = false;        }        try {            paramOb.setTheta(3, Double.valueOf(tiTable.getValueAt(3,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'theta' value entered (position 4), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //tiTable.getModel().setValueAt(new Double(paramOb.getTheta(4)), 3, 0);            RetValue = false;        }        try {            paramOb.setTheta(4, Double.valueOf(tiTable.getValueAt(4,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'theta' value entered (position 5), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //tiTable.getModel().setValueAt(new Double(paramOb.getTheta(5)), 4, 0);            RetValue = false;        }        // a        try {            paramOb.setA(0, Double.valueOf(aiTable.getValueAt(0,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'a' value entered (position 1), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //aiTable.getModel().setValueAt(new Double(paramOb.getTheta(1)), 0, 0);            RetValue = false;        }        try {            paramOb.setA(1, Double.valueOf(aiTable.getValueAt(1,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'a' value entered (position 2), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //aiTable.getModel().setValueAt(new Double(paramOb.getTheta(2)), 1, 0);            RetValue = false;        }        try {            paramOb.setA(2, Double.valueOf(aiTable.getValueAt(2,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'a' value entered (position 3), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //aiTable.getModel().setValueAt(new Double(paramOb.getTheta(3)), 2, 0);            RetValue = false;        }        try {            paramOb.setA(3, Double.valueOf(aiTable.getValueAt(3,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'a' value entered (position 4), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //aiTable.getModel().setValueAt(new Double(paramOb.getTheta(4)), 3, 0);            RetValue = false;        }        try {            paramOb.setA(4, Double.valueOf(aiTable.getValueAt(4,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'a' value entered (position 5), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //aiTable.getModel().setValueAt(new Double(paramOb.getTheta(5)), 4, 0);            RetValue = false;        }        // b        try {            paramOb.setB(0, Double.valueOf(biTable.getValueAt(0,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'b' value entered (position 1), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //biTable.getModel().setValueAt(new Double(paramOb.getTheta(1)), 0, 0);            RetValue = false;        }        try {            paramOb.setB(1, Double.valueOf(biTable.getValueAt(1,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'b' value entered (position 2), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //biTable.getModel().setValueAt(new Double(paramOb.getTheta(2)), 1, 0);            RetValue = false;        }        try {            paramOb.setB(2, Double.valueOf(biTable.getValueAt(2,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'b' value entered (position 3), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //biTable.getModel().setValueAt(new Double(paramOb.getTheta(3)), 2, 0);            RetValue = false;        }        try {            paramOb.setB(3, Double.valueOf(biTable.getValueAt(3,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'b' value entered (position 4), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //biTable.getModel().setValueAt(new Double(paramOb.getTheta(4)), 3, 0);            RetValue = false;        }        try {            paramOb.setB(4, Double.valueOf(biTable.getValueAt(4,0).toString()).doubleValue());        } catch(java.lang.NumberFormatException e){            errorStr += "Incorrect 'b' value entered (position 5), please correct it!\n";            errorStr += "Exception Error : " + e + "\n";            //biTable.getModel().setValueAt(new Double(paramOb.getTheta(5)), 4, 0);            RetValue = false;        }        /* Check aditional Parameters' internal Rules*/        if(!paramOb.checkParameters()){            errorStr += "There were errors in internal validation rules!:.\n";            RetValue = false;        }        if(RetValue){            errorStr = "All Parameters are valid, you can run ECG!.";            ecgLog.println(errorStr);        }else{            errorStr = "There were errors in some parameters!:.\n" + errorStr;            ecgLog.print(errorStr);        }        JOptionPane.showMessageDialog(this, errorStr);        ecgLog.println("Finished checking ECG parameters.\n");        return(RetValue);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -