Program: 44878
Project: 44878
Buggy source:
public void actionPerformed(java.awt.event.ActionEvent e){
  try {
    String command=e.getActionCommand();
    if (command.equals("String_Node_Str")) {
      final SwingWorker worker=new SwingWorker(){
        SynchronizedProgressFrame pm=new SynchronizedProgressFrame(0);
        public Object construct(){
          try {
            clearOutput();
            paramUnit=parent.Parameters.unitMetric.isSelected();
            final double g=paramUnit ? Analysis.Gcmss : Analysis.Ginss;
            int dyn=dynamicRespParams.isSelected() ? WITH_DYN : NO_DYN;
            unitDisplacement=paramUnit ? "String_Node_Str" : "String_Node_Str";
            String h_rb="String_Node_Str" + ParametersPanel.stringRB + "String_Node_Str"+ unitDisplacement+ "String_Node_Str";
            String h_dc="String_Node_Str" + ParametersPanel.stringDC + "String_Node_Str"+ unitDisplacement+ "String_Node_Str";
            String h_cp="String_Node_Str" + ParametersPanel.stringCP + "String_Node_Str"+ unitDisplacement+ "String_Node_Str";
            String h_km="String_Node_Str";
            String h_vs="String_Node_Str";
            String h_damp="String_Node_Str";
            String h_dampf="String_Node_Str";
            String h_omega="String_Node_Str";
            if (dyn == NO_DYN)             outputTableModel.setColumnIdentifiers(new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",h_rb + polarityName[NOR],h_rb + polarityName[INV],h_rb + polarityName[AVG],"String_Node_Str",h_dc + polarityName[NOR],h_dc + polarityName[INV],h_dc + polarityName[AVG],"String_Node_Str",h_cp + polarityName[NOR],h_cp + polarityName[INV],h_cp + polarityName[AVG]});
 else             outputTableModel.setColumnIdentifiers(new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",h_rb + polarityName[NOR],h_rb + polarityName[INV],h_rb + polarityName[AVG],"String_Node_Str",h_km,h_vs,h_damp,h_dampf,h_omega,"String_Node_Str",h_dc + polarityName[NOR],h_dc + polarityName[INV],h_dc + polarityName[AVG],"String_Node_Str",h_cp + polarityName[NOR],h_cp + polarityName[INV],h_cp + polarityName[AVG]});
            outputTable.getTableHeader().setDefaultRenderer(new ResultsRenderer());
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_RB]).setMinWidth(0);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_DC]).setMinWidth(0);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_CP]).setMinWidth(0);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_RB]).setPreferredWidth(5);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_DC]).setPreferredWidth(5);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_CP]).setPreferredWidth(5);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_RB]).setMaxWidth(5);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_DC]).setMaxWidth(5);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_CP]).setMaxWidth(5);
            if (dyn == WITH_DYN) {
              outputTable.getColumnModel().getColumn(tableCols[dyn][N_DY]).setMinWidth(0);
              outputTable.getColumnModel().getColumn(tableCols[dyn][N_DY]).setPreferredWidth(5);
              outputTable.getColumnModel().getColumn(tableCols[dyn][N_DY]).setMaxWidth(5);
            }
            boolean paramDualslope=parent.Parameters.dualSlope.isSelected();
            Double d;
            double paramScale;
            if (parent.Parameters.scalePGA.isSelected()) {
              d=(Double)Utils.checkNum(parent.Parameters.scalePGAval.getText(),"String_Node_Str",null,false,null,new Double(0),false,null,false);
              if (d == null) {
                parent.selectParameters();
                return null;
              }
              paramScale=d.doubleValue();
            }
 else             if (parent.Parameters.scaleOn.isSelected()) {
              d=(Double)Utils.checkNum(parent.Parameters.scaleData.getText(),"String_Node_Str",null,false,null,null,false,null,false);
              if (d == null) {
                parent.selectParameters();
                return null;
              }
              paramScale=d.doubleValue();
            }
 else             paramScale=0;
            changeDecimal();
            boolean paramRigid=parent.Parameters.typeRigid.isSelected();
            boolean paramDecoupled=parent.Parameters.typeDecoupled.isSelected();
            boolean paramCoupled=parent.Parameters.typeCoupled.isSelected();
            graphDisp(paramRigid,paramDecoupled,paramCoupled);
            if (!paramRigid && !paramDecoupled && !paramCoupled) {
              parent.selectParameters();
              GUIUtils.popupError("String_Node_Str");
              return null;
            }
            Object[][] res=Utils.getDB().runQuery("String_Node_Str");
            if (res == null || res.length <= 1) {
              parent.selectSelectRecords();
              GUIUtils.popupError("String_Node_Str");
              return null;
            }
            xys=new XYSeries[res.length][3][2];
            dataVect=new ArrayList[3][3];
            String eq, record;
            DoubleList dat;
            double di;
            int num=0;
            double avg;
            double total[][]=new double[3][3];
            double scale=1, iscale, scaleRB;
            double inv, norm;
            double[][] ca;
            double[] ain=null;
            double thrust=0, uwgt=0, height=0, vs=0, damp=0, refstrain=0, vr=0;
            boolean dv3=false;
            scaleRB=paramUnit ? 1 : Analysis.CMtoIN;
            if (parent.Parameters.CAdisp.isSelected()) {
              String value;
              java.util.Vector caVect;
              TableCellEditor editor=null;
              editor=parent.Parameters.dispTable.getCellEditor();
              caVect=parent.Parameters.dispTableModel.getDataVector();
              if (editor != null)               editor.stopCellEditing();
              ca=new double[caVect.size()][2];
              for (int i=0; i < caVect.size(); i++) {
                for (int j=0; j < 2; j++) {
                  value=(String)(((java.util.Vector)(caVect.get(i))).get(j));
                  if (value == null || value == "String_Node_Str") {
                    parent.selectParameters();
                    GUIUtils.popupError("String_Node_Str");
                    return null;
                  }
                  d=(Double)Utils.checkNum(value,"String_Node_Str",null,false,null,null,false,null,false);
                  if (d == null) {
                    parent.selectParameters();
                    return null;
                  }
                  ca[i][j]=d.doubleValue();
                }
              }
              if (caVect.size() == 0) {
                parent.selectParameters();
                GUIUtils.popupError("String_Node_Str");
                return null;
              }
            }
 else {
              d=(Double)Utils.checkNum(parent.Parameters.CAconstTF.getText(),"String_Node_Str",null,false,null,new Double(0),true,null,false);
              if (d == null) {
                parent.selectParameters();
                return null;
              }
              ca=new double[1][2];
              ca[0][0]=0;
              ca[0][1]=d.doubleValue();
            }
            if (paramRigid && paramDualslope) {
              Double thrustD=(Double)Utils.checkNum(parent.Parameters.thrustAngle.getText(),"String_Node_Str",new Double(90),true,null,new Double(0),true,null,false);
              if (thrustD == null) {
                parent.selectParameters();
                return null;
              }
 else               thrust=thrustD.doubleValue();
            }
            if (paramDecoupled || paramCoupled) {
              Double tempd;
              uwgt=100.0;
              tempd=(Double)Utils.checkNum(parent.Parameters.paramHeight.getText(),ParametersPanel.stringHeight + "String_Node_Str",null,false,null,null,false,null,false);
              if (tempd == null) {
                parent.selectParameters();
                return null;
              }
 else               height=tempd.doubleValue();
              tempd=(Double)Utils.checkNum(parent.Parameters.paramVs.getText(),ParametersPanel.stringVs + "String_Node_Str",null,false,null,null,false,null,false);
              if (tempd == null) {
                parent.selectParameters();
                return null;
              }
 else               vs=tempd.doubleValue();
              tempd=(Double)Utils.checkNum(parent.Parameters.paramDamp.getText(),ParametersPanel.stringDamp + "String_Node_Str",null,false,null,null,false,null,false);
              if (tempd == null) {
                parent.selectParameters();
                return null;
              }
 else               damp=tempd.doubleValue() / 100.0;
              tempd=(Double)Utils.checkNum(parent.Parameters.paramRefStrain.getText(),ParametersPanel.stringRefStrain + "String_Node_Str",null,false,null,null,false,null,false);
              if (tempd == null) {
                parent.selectParameters();
                return null;
              }
 else               refstrain=tempd.doubleValue();
              dv3=parent.Parameters.paramSoilModel.getSelectedIndex() == 1;
              if (paramUnit) {
                uwgt/=Analysis.M3toCM3;
                height*=Analysis.MtoCM;
                vs*=Analysis.MtoCM;
                vr*=Analysis.MtoCM;
              }
 else {
                uwgt/=Analysis.FT3toIN3;
                height*=Analysis.FTtoIN;
                vs*=Analysis.FTtoIN;
                vr*=Analysis.FTtoIN;
              }
            }
            File testFile;
            String path;
            int num_analyses=0;
            if (paramRigid) {
              num_analyses++;
              dataVect[RB][NOR]=new ArrayList<Double>(res.length - 1);
              dataVect[RB][INV]=new ArrayList<Double>(res.length - 1);
              dataVect[RB][AVG]=new ArrayList<Double>(res.length - 1);
            }
            if (paramDecoupled) {
              num_analyses++;
              dataVect[DC][NOR]=new ArrayList<Double>(res.length - 1);
              dataVect[DC][INV]=new ArrayList<Double>(res.length - 1);
              dataVect[DC][AVG]=new ArrayList<Double>(res.length - 1);
            }
            if (paramCoupled) {
              num_analyses++;
              dataVect[CP][NOR]=new ArrayList<Double>(res.length - 1);
              dataVect[CP][INV]=new ArrayList<Double>(res.length - 1);
              dataVect[CP][AVG]=new ArrayList<Double>(res.length - 1);
            }
            iscale=-1.0 * scale;
            pm.setMaximum(res.length * 2 * num_analyses);
            pm.update(0,"String_Node_Str");
            int j, k;
            Object[] row;
            int rowcount=0;
            resultVec=new java.util.Vector<ResultThread>(res.length * 2 * ANALYSIS_TYPES);
            NUM_CORES=Runtime.getRuntime().availableProcessors();
            pool=Executors.newFixedThreadPool(NUM_CORES);
            ResultThread rt;
            int row_idx;
            long startTime=System.currentTimeMillis();
            for (int i=1; i < res.length && !pm.isCanceled(); i++) {
              row=new Object[tableCols[dyn][LEN]];
              eq=res[i][0].toString();
              row_idx=i - 1;
              record=res[i][1].toString();
              row[0]=eq;
              row[1]=record;
              path=res[i][3].toString();
              testFile=new File(path);
              if (!testFile.exists() || !testFile.canRead()) {
                row[2]="String_Node_Str";
                row[3]=path;
                outputTableModel.addRow(row);
                rowcount++;
                continue;
              }
              dat=new DoubleList(path,0,parent.Parameters.scaleOn.isSelected() ? paramScale : 1.0);
              if (dat.bad()) {
                row[2]="String_Node_Str" + dat.badEntry();
                row[3]=path;
                outputTableModel.addRow(row);
                rowcount++;
                continue;
              }
              num++;
              di=Double.parseDouble(res[i][2].toString());
              if (parent.Parameters.scalePGA.isSelected()) {
                scale=paramScale / Double.parseDouble(res[i][4].toString());
                iscale=-scale;
              }
              ain=dat.getAsArray();
              if (paramRigid) {
                rt=new ResultThread(eq,record,row_idx,rowcount,RB,NOR,ain,di,ca,scale,paramDualslope,thrust,scaleRB,pm);
                pool.execute(rt);
                resultVec.add(rt);
                rt=new ResultThread(eq,record,row_idx,rowcount,RB,INV,ain,di,ca,iscale,paramDualslope,thrust,scaleRB,pm);
                pool.execute(rt);
                resultVec.add(rt);
              }
              if (paramDecoupled) {
                rt=new ResultThread(eq,record,row_idx,rowcount,DC,NOR,ain,uwgt,height,vs,damp,refstrain,di,scale / Analysis.Gcmss,g,vr,ca,dv3,pm);
                pool.execute(rt);
                resultVec.add(rt);
                rt=new ResultThread(eq,record,row_idx,rowcount,DC,INV,ain,uwgt,height,vs,damp,refstrain,di,iscale / Analysis.Gcmss,g,vr,ca,dv3,pm);
                pool.execute(rt);
                resultVec.add(rt);
              }
              if (paramCoupled) {
                rt=new ResultThread(eq,record,row_idx,rowcount,CP,NOR,ain,uwgt,height,vs,damp,refstrain,di,scale / Analysis.Gcmss,g,vr,ca,dv3,pm);
                pool.execute(rt);
                resultVec.add(rt);
                rt=new ResultThread(eq,record,row_idx,rowcount,CP,INV,ain,uwgt,height,vs,damp,refstrain,di,iscale / Analysis.Gcmss,g,vr,ca,dv3,pm);
                pool.execute(rt);
                resultVec.add(rt);
              }
              outputTableModel.addRow(row);
              rowcount++;
            }
            pool.shutdown();
            while (!pool.awaitTermination(1,TimeUnit.SECONDS)) {
              if (pm.isCanceled()) {
                pool.shutdownNow();
                break;
              }
            }
            pm.update("String_Node_Str");
            ResultThread prt;
            int i_analysis;
            for (int i=0; i < resultVec.size(); i++) {
              rt=resultVec.get(i);
              if (!rt.finished())               continue;
              rt.graphData.setKey(rt.eq + "String_Node_Str" + rt.record+ "String_Node_Str"+ ParametersPanel.stringRB+ "String_Node_Str"+ polarityName[NOR]);
              xys[rt.idx][rt.analysis][rt.orientation]=rt.graphData;
              total[rt.analysis][rt.orientation]+=rt.result;
              i_analysis=1 + rt.analysis * 2;
              for (j=0; j < dataVect[rt.analysis][rt.orientation].size() && ((Double)dataVect[rt.analysis][rt.orientation].get(j)).doubleValue() < rt.result; j++)               ;
              dataVect[rt.analysis][rt.orientation].add(j,new Double(rt.result));
              outputTableModel.setValueAt(unitFmt.format(rt.result),rt.row,tableCols[dyn][i_analysis] + rt.orientation);
              if (rt.orientation == INV) {
                prt=resultVec.get(i - 1);
                avg=avg(rt.result,prt.result);
                total[rt.analysis][AVG]+=avg;
                for (j=0; j < dataVect[rt.analysis][AVG].size() && ((Double)dataVect[rt.analysis][AVG].get(j)).doubleValue() < avg; j++)                 ;
                dataVect[rt.analysis][AVG].add(j,new Double(avg));
                outputTableModel.setValueAt(unitFmt.format(avg),rt.row,tableCols[dyn][i_analysis] + AVG);
                if (dyn == WITH_DYN && (rt.analysis == DC || rt.analysis == CP)) {
                  outputTableModel.setValueAt(unitFmt.format(rt._kmax / g),rt.row,tableCols[dyn][I_DY] + 0);
                  outputTableModel.setValueAt(unitFmt.format(rt._vs / g),rt.row,tableCols[dyn][I_DY] + 1);
                  outputTableModel.setValueAt(unitFmt.format(rt._damp),rt.row,tableCols[dyn][I_DY] + 2);
                  outputTableModel.setValueAt(unitFmt.format(rt._dampf),rt.row,tableCols[dyn][I_DY] + 3);
                  outputTableModel.setValueAt(unitFmt.format(rt._omega),rt.row,tableCols[dyn][I_DY] + 4);
                }
              }
            }
            if (!pm.isCanceled()) {
              double mean, value, valtemp;
              int idx;
              Object[] rmean=new Object[tableCols[dyn][LEN]];
              Object[] rmedian=new Object[tableCols[dyn][LEN]];
              Object[] rsd=new Object[tableCols[dyn][LEN]];
              rmean[1]="String_Node_Str";
              rmedian[1]="String_Node_Str";
              rsd[1]="String_Node_Str";
              for (j=0; j < total.length; j++) {
                for (k=0; k < total[j].length; k++) {
                  if (dataVect[j][k] == null || dataVect[j][k].size() == 0)                   continue;
                  idx=tableCols[dyn][1 + j * 2] + k;
                  mean=Double.parseDouble(unitFmt.format(total[j][k] / num));
                  System.out.println(idx + "String_Node_Str" + rmean.length+ "String_Node_Str"+ j+ "String_Node_Str"+ k);
                  rmean[idx]=unitFmt.format(mean);
                  if (num % 2 == 0) {
                    double fst=(Double)dataVect[j][k].get(num / 2);
                    double snd=(Double)dataVect[j][k].get(num / 2 - 1);
                    rmedian[idx]=unitFmt.format(avg(fst,snd));
                  }
 else                   rmedian[idx]=unitFmt.format(dataVect[j][k].get(num / 2));
                  value=0;
                  for (int i=0; i < num; i++) {
                    valtemp=mean - ((Double)dataVect[j][k].get(i)).doubleValue();
                    value+=(valtemp * valtemp);
                  }
                  value/=num;
                  value=Math.sqrt(value);
                  rsd[idx]=unitFmt.format(value);
                }
              }
              outputTableModel.addRow(new Object[0]);
              outputTableModel.addRow(rmean);
              outputTableModel.addRow(rmedian);
              outputTableModel.addRow(rsd);
            }
          }
 catch (          Throwable ex) {
            Utils.catchException(ex);
          }
          return null;
        }
        public void finished(){
          pm.dispose();
        }
      }
;
      worker.start();
    }
 else     if (command.equals("String_Node_Str")) {
      clearOutput();
    }
 else     if (command.equals("String_Node_Str")) {
      if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
        FileWriter fw=new FileWriter(fc.getSelectedFile());
        String delim;
        if (outputDelSpace.isSelected())         delim="String_Node_Str";
 else         if (outputDelComma.isSelected())         delim="String_Node_Str";
 else         delim="String_Node_Str";
        int c=outputTableModel.getColumnCount();
        int r=outputTableModel.getRowCount();
        for (int i=0; i < c; i++) {
          if (i != 0)           fw.write(delim);
          fw.write(outputTableModel.getColumnName(i).replaceAll("String_Node_Str","String_Node_Str"));
        }
        fw.write("String_Node_Str");
        Object o;
        for (int i=0; i < r; i++) {
          for (int j=0; j < c; j++) {
            if (j != 0)             fw.write(delim);
            o=outputTableModel.getValueAt(i,j);
            if (o == null)             o="String_Node_Str";
            fw.write(o.toString());
          }
          fw.write("String_Node_Str");
        }
        fw.close();
      }
    }
 else     if (command.equals("String_Node_Str")) {
      if (dataVect == null)       return;
      String name="String_Node_Str", title, pname;
      HistogramDataset dataset=new HistogramDataset();
      int polarity, analysis=-1;
      if (polarityAvgHist.isSelected())       polarity=AVG;
 else       if (polarityNorHist.isSelected())       polarity=NOR;
 else       if (polarityInvHist.isSelected())       polarity=INV;
 else       polarity=-1;
      for (int i=0; i < analysisHist.length; i++)       if (analysisHist[i].isSelected())       analysis=i;
      if (analysis == -1)       return;
      pname=polarityName[polarity];
      Double Bins=(Double)Utils.checkNum(outputBins.getText(),"String_Node_Str",null,false,null,new Double(0),false,null,false);
      if (Bins == null || dataVect[analysis][polarity] == null)       return;
      name=analysisTitle[analysis];
      double series[]=new double[dataVect[analysis][polarity].size()];
      for (int j=0; j < dataVect[analysis][polarity].size(); j++)       series[j]=(((Double)dataVect[analysis][polarity].get(j)).doubleValue());
      dataset.addSeries(name,series,(int)Bins.doubleValue());
      title="String_Node_Str" + name + "String_Node_Str"+ pname+ "String_Node_Str";
      JFreeChart hist=ChartFactory.createHistogram(title,"String_Node_Str" + unitDisplacement,"String_Node_Str",dataset,org.jfree.chart.plot.PlotOrientation.VERTICAL,false,true,false);
      ChartFrame frame=new ChartFrame(title,hist);
      frame.pack();
      frame.setLocationRelativeTo(null);
      frame.setVisible(true);
    }
 else     if (command.equals("String_Node_Str")) {
      XYSeriesCollection xysc=new XYSeriesCollection();
      int polarity=polarityNorDisp.isSelected() ? NOR : INV;
      String pname=polarityName[polarity];
      String name="String_Node_Str";
      boolean first=true;
      for (int i=0; i < analysisDisp.length; i++) {
        if (analysisDisp[i].isSelected() && dataVect[i][polarity] != null) {
          if (first)           first=false;
 else           name+="String_Node_Str";
          name+=analysisTitle[i];
          for (int j=0; j < dataVect[i][polarity].size(); j++)           xysc.addSeries(xys[j][i][polarity]);
        }
      }
      if (first)       return;
      name+="String_Node_Str";
      JFreeChart chart=ChartFactory.createXYLineChart(name,"String_Node_Str","String_Node_Str" + pname + "String_Node_Str"+ unitDisplacement,xysc,org.jfree.chart.plot.PlotOrientation.VERTICAL,plotDisplacementLegend.isSelected(),true,false);
      chart.getXYPlot().getDomainAxis().setLowerMargin(0);
      chart.getXYPlot().getDomainAxis().setUpperMargin(0);
      chart.getXYPlot().getDomainAxis().setLowerBound(0);
      ChartFrame frame=new ChartFrame(name,chart);
      frame.pack();
      frame.setLocationRelativeTo(null);
      frame.setVisible(true);
    }
  }
 catch (  Exception ex) {
    Utils.catchException(ex);
  }
}

Fixed version (ground truth):
public void actionPerformed(java.awt.event.ActionEvent e){
  try {
    String command=e.getActionCommand();
    if (command.equals("String_Node_Str")) {
      final SwingWorker worker=new SwingWorker(){
        SynchronizedProgressFrame pm=new SynchronizedProgressFrame(0);
        public Object construct(){
          try {
            clearOutput();
            paramUnit=parent.Parameters.unitMetric.isSelected();
            final double g=paramUnit ? Analysis.Gcmss : Analysis.Ginss;
            int dyn=dynamicRespParams.isSelected() ? WITH_DYN : NO_DYN;
            unitDisplacement=paramUnit ? "String_Node_Str" : "String_Node_Str";
            String h_rb="String_Node_Str" + ParametersPanel.stringRB + "String_Node_Str"+ unitDisplacement+ "String_Node_Str";
            String h_dc="String_Node_Str" + ParametersPanel.stringDC + "String_Node_Str"+ unitDisplacement+ "String_Node_Str";
            String h_cp="String_Node_Str" + ParametersPanel.stringCP + "String_Node_Str"+ unitDisplacement+ "String_Node_Str";
            String h_km="String_Node_Str";
            String h_vs="String_Node_Str";
            String h_damp="String_Node_Str";
            String h_dampf="String_Node_Str";
            if (parent.Parameters.paramSoilModel.getSelectedIndex() == 1)             h_vs="String_Node_Str";
            if (dyn == NO_DYN)             outputTableModel.setColumnIdentifiers(new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",h_rb + polarityName[NOR],h_rb + polarityName[INV],h_rb + polarityName[AVG],"String_Node_Str",h_dc + polarityName[NOR],h_dc + polarityName[INV],h_dc + polarityName[AVG],"String_Node_Str",h_cp + polarityName[NOR],h_cp + polarityName[INV],h_cp + polarityName[AVG]});
 else             outputTableModel.setColumnIdentifiers(new Object[]{"String_Node_Str","String_Node_Str","String_Node_Str",h_rb + polarityName[NOR],h_rb + polarityName[INV],h_rb + polarityName[AVG],"String_Node_Str",h_km,h_vs,h_damp,h_dampf,"String_Node_Str",h_dc + polarityName[NOR],h_dc + polarityName[INV],h_dc + polarityName[AVG],"String_Node_Str",h_cp + polarityName[NOR],h_cp + polarityName[INV],h_cp + polarityName[AVG]});
            outputTable.getTableHeader().setDefaultRenderer(new ResultsRenderer());
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_RB]).setMinWidth(0);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_DC]).setMinWidth(0);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_CP]).setMinWidth(0);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_RB]).setPreferredWidth(5);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_DC]).setPreferredWidth(5);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_CP]).setPreferredWidth(5);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_RB]).setMaxWidth(5);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_DC]).setMaxWidth(5);
            outputTable.getColumnModel().getColumn(tableCols[dyn][N_CP]).setMaxWidth(5);
            if (dyn == WITH_DYN) {
              outputTable.getColumnModel().getColumn(tableCols[dyn][N_DY]).setMinWidth(0);
              outputTable.getColumnModel().getColumn(tableCols[dyn][N_DY]).setPreferredWidth(5);
              outputTable.getColumnModel().getColumn(tableCols[dyn][N_DY]).setMaxWidth(5);
            }
            boolean paramDualslope=parent.Parameters.dualSlope.isSelected();
            Double d;
            double paramScale;
            if (parent.Parameters.scalePGA.isSelected()) {
              d=(Double)Utils.checkNum(parent.Parameters.scalePGAval.getText(),"String_Node_Str",null,false,null,new Double(0),false,null,false);
              if (d == null) {
                parent.selectParameters();
                return null;
              }
              paramScale=d.doubleValue();
            }
 else             if (parent.Parameters.scaleOn.isSelected()) {
              d=(Double)Utils.checkNum(parent.Parameters.scaleData.getText(),"String_Node_Str",null,false,null,null,false,null,false);
              if (d == null) {
                parent.selectParameters();
                return null;
              }
              paramScale=d.doubleValue();
            }
 else             paramScale=0;
            changeDecimal();
            boolean paramRigid=parent.Parameters.typeRigid.isSelected();
            boolean paramDecoupled=parent.Parameters.typeDecoupled.isSelected();
            boolean paramCoupled=parent.Parameters.typeCoupled.isSelected();
            graphDisp(paramRigid,paramDecoupled,paramCoupled);
            if (!paramRigid && !paramDecoupled && !paramCoupled) {
              parent.selectParameters();
              GUIUtils.popupError("String_Node_Str");
              return null;
            }
            Object[][] res=Utils.getDB().runQuery("String_Node_Str");
            if (res == null || res.length <= 1) {
              parent.selectSelectRecords();
              GUIUtils.popupError("String_Node_Str");
              return null;
            }
            xys=new XYSeries[res.length][3][2];
            dataVect=new ArrayList[3][3];
            String eq, record;
            DoubleList dat;
            double di;
            int num=0;
            double avg;
            double total[][]=new double[3][3];
            double scale=1, iscale, scaleRB;
            double inv, norm;
            double[][] ca;
            double[] ain=null;
            double thrust=0, uwgt=0, height=0, vs=0, damp=0, refstrain=0, vr=0;
            boolean dv3=false;
            scaleRB=paramUnit ? 1 : Analysis.CMtoIN;
            if (parent.Parameters.CAdisp.isSelected()) {
              String value;
              java.util.Vector caVect;
              TableCellEditor editor=null;
              editor=parent.Parameters.dispTable.getCellEditor();
              caVect=parent.Parameters.dispTableModel.getDataVector();
              if (editor != null)               editor.stopCellEditing();
              ca=new double[caVect.size()][2];
              for (int i=0; i < caVect.size(); i++) {
                for (int j=0; j < 2; j++) {
                  value=(String)(((java.util.Vector)(caVect.get(i))).get(j));
                  if (value == null || value == "String_Node_Str") {
                    parent.selectParameters();
                    GUIUtils.popupError("String_Node_Str");
                    return null;
                  }
                  d=(Double)Utils.checkNum(value,"String_Node_Str",null,false,null,null,false,null,false);
                  if (d == null) {
                    parent.selectParameters();
                    return null;
                  }
                  ca[i][j]=d.doubleValue();
                }
              }
              if (caVect.size() == 0) {
                parent.selectParameters();
                GUIUtils.popupError("String_Node_Str");
                return null;
              }
            }
 else {
              d=(Double)Utils.checkNum(parent.Parameters.CAconstTF.getText(),"String_Node_Str",null,false,null,new Double(0),true,null,false);
              if (d == null) {
                parent.selectParameters();
                return null;
              }
              ca=new double[1][2];
              ca[0][0]=0;
              ca[0][1]=d.doubleValue();
            }
            if (paramRigid && paramDualslope) {
              Double thrustD=(Double)Utils.checkNum(parent.Parameters.thrustAngle.getText(),"String_Node_Str",new Double(90),true,null,new Double(0),true,null,false);
              if (thrustD == null) {
                parent.selectParameters();
                return null;
              }
 else               thrust=thrustD.doubleValue();
            }
            if (paramDecoupled || paramCoupled) {
              Double tempd;
              uwgt=100.0;
              tempd=(Double)Utils.checkNum(parent.Parameters.paramHeight.getText(),ParametersPanel.stringHeight + "String_Node_Str",null,false,null,null,false,null,false);
              if (tempd == null) {
                parent.selectParameters();
                return null;
              }
 else               height=tempd.doubleValue();
              tempd=(Double)Utils.checkNum(parent.Parameters.paramVs.getText(),ParametersPanel.stringVs + "String_Node_Str",null,false,null,null,false,null,false);
              if (tempd == null) {
                parent.selectParameters();
                return null;
              }
 else               vs=tempd.doubleValue();
              tempd=(Double)Utils.checkNum(parent.Parameters.paramVr.getText(),ParametersPanel.stringVr + "String_Node_Str",null,false,null,null,false,null,false);
              if (tempd == null) {
                parent.selectParameters();
                return null;
              }
 else               vr=tempd.doubleValue();
              tempd=(Double)Utils.checkNum(parent.Parameters.paramDamp.getText(),ParametersPanel.stringDamp + "String_Node_Str",null,false,null,null,false,null,false);
              if (tempd == null) {
                parent.selectParameters();
                return null;
              }
 else               damp=tempd.doubleValue() / 100.0;
              tempd=(Double)Utils.checkNum(parent.Parameters.paramRefStrain.getText(),ParametersPanel.stringRefStrain + "String_Node_Str",null,false,null,null,false,null,false);
              if (tempd == null) {
                parent.selectParameters();
                return null;
              }
 else               refstrain=tempd.doubleValue();
              dv3=parent.Parameters.paramSoilModel.getSelectedIndex() == 1;
              if (paramUnit) {
                uwgt/=Analysis.M3toCM3;
                height*=Analysis.MtoCM;
                vs*=Analysis.MtoCM;
                vr*=Analysis.MtoCM;
              }
 else {
                uwgt/=Analysis.FT3toIN3;
                height*=Analysis.FTtoIN;
                vs*=Analysis.FTtoIN;
                vr*=Analysis.FTtoIN;
              }
            }
            File testFile;
            String path;
            int num_analyses=0;
            if (paramRigid) {
              num_analyses++;
              dataVect[RB][NOR]=new ArrayList<Double>(res.length - 1);
              dataVect[RB][INV]=new ArrayList<Double>(res.length - 1);
              dataVect[RB][AVG]=new ArrayList<Double>(res.length - 1);
            }
            if (paramDecoupled) {
              num_analyses++;
              dataVect[DC][NOR]=new ArrayList<Double>(res.length - 1);
              dataVect[DC][INV]=new ArrayList<Double>(res.length - 1);
              dataVect[DC][AVG]=new ArrayList<Double>(res.length - 1);
            }
            if (paramCoupled) {
              num_analyses++;
              dataVect[CP][NOR]=new ArrayList<Double>(res.length - 1);
              dataVect[CP][INV]=new ArrayList<Double>(res.length - 1);
              dataVect[CP][AVG]=new ArrayList<Double>(res.length - 1);
            }
            iscale=-1.0 * scale;
            pm.setMaximum(res.length * 2 * num_analyses);
            pm.update(0,"String_Node_Str");
            int j, k;
            Object[] row;
            int rowcount=0;
            resultVec=new java.util.Vector<ResultThread>(res.length * 2 * ANALYSIS_TYPES);
            NUM_CORES=Runtime.getRuntime().availableProcessors();
            pool=Executors.newFixedThreadPool(NUM_CORES);
            ResultThread rt;
            int row_idx;
            long startTime=System.currentTimeMillis();
            for (int i=1; i < res.length && !pm.isCanceled(); i++) {
              row=new Object[tableCols[dyn][LEN]];
              eq=res[i][0].toString();
              row_idx=i - 1;
              record=res[i][1].toString();
              row[0]=eq;
              row[1]=record;
              path=res[i][3].toString();
              testFile=new File(path);
              if (!testFile.exists() || !testFile.canRead()) {
                row[2]="String_Node_Str";
                row[3]=path;
                outputTableModel.addRow(row);
                rowcount++;
                continue;
              }
              dat=new DoubleList(path,0,parent.Parameters.scaleOn.isSelected() ? paramScale : 1.0);
              if (dat.bad()) {
                row[2]="String_Node_Str" + dat.badEntry();
                row[3]=path;
                outputTableModel.addRow(row);
                rowcount++;
                continue;
              }
              num++;
              di=Double.parseDouble(res[i][2].toString());
              if (parent.Parameters.scalePGA.isSelected()) {
                scale=paramScale / Double.parseDouble(res[i][4].toString());
                iscale=-scale;
              }
              ain=dat.getAsArray();
              if (paramRigid) {
                rt=new ResultThread(eq,record,row_idx,rowcount,RB,NOR,ain,di,ca,scale,paramDualslope,thrust,scaleRB,pm);
                pool.execute(rt);
                resultVec.add(rt);
                rt=new ResultThread(eq,record,row_idx,rowcount,RB,INV,ain,di,ca,iscale,paramDualslope,thrust,scaleRB,pm);
                pool.execute(rt);
                resultVec.add(rt);
              }
              if (paramDecoupled) {
                rt=new ResultThread(eq,record,row_idx,rowcount,DC,NOR,ain,uwgt,height,vs,damp,refstrain,di,scale / Analysis.Gcmss,g,vr,ca,dv3,pm);
                pool.execute(rt);
                resultVec.add(rt);
                rt=new ResultThread(eq,record,row_idx,rowcount,DC,INV,ain,uwgt,height,vs,damp,refstrain,di,iscale / Analysis.Gcmss,g,vr,ca,dv3,pm);
                pool.execute(rt);
                resultVec.add(rt);
              }
              if (paramCoupled) {
                rt=new ResultThread(eq,record,row_idx,rowcount,CP,NOR,ain,uwgt,height,vs,damp,refstrain,di,scale / Analysis.Gcmss,g,vr,ca,dv3,pm);
                pool.execute(rt);
                resultVec.add(rt);
                rt=new ResultThread(eq,record,row_idx,rowcount,CP,INV,ain,uwgt,height,vs,damp,refstrain,di,iscale / Analysis.Gcmss,g,vr,ca,dv3,pm);
                pool.execute(rt);
                resultVec.add(rt);
              }
              outputTableModel.addRow(row);
              rowcount++;
            }
            pool.shutdown();
            while (!pool.awaitTermination(1,TimeUnit.SECONDS)) {
              if (pm.isCanceled()) {
                pool.shutdownNow();
                break;
              }
            }
            pm.update("String_Node_Str");
            ResultThread prt;
            int i_analysis;
            for (int i=0; i < resultVec.size(); i++) {
              rt=resultVec.get(i);
              if (!rt.finished())               continue;
              rt.graphData.setKey(rt.eq + "String_Node_Str" + rt.record+ "String_Node_Str"+ ParametersPanel.stringRB+ "String_Node_Str"+ polarityName[NOR]);
              xys[rt.idx][rt.analysis][rt.orientation]=rt.graphData;
              total[rt.analysis][rt.orientation]+=rt.result;
              i_analysis=1 + rt.analysis * 2;
              for (j=0; j < dataVect[rt.analysis][rt.orientation].size() && ((Double)dataVect[rt.analysis][rt.orientation].get(j)).doubleValue() < rt.result; j++)               ;
              dataVect[rt.analysis][rt.orientation].add(j,new Double(rt.result));
              outputTableModel.setValueAt(unitFmt.format(rt.result),rt.row,tableCols[dyn][i_analysis] + rt.orientation);
              if (rt.orientation == INV) {
                prt=resultVec.get(i - 1);
                avg=avg(rt.result,prt.result);
                total[rt.analysis][AVG]+=avg;
                for (j=0; j < dataVect[rt.analysis][AVG].size() && ((Double)dataVect[rt.analysis][AVG].get(j)).doubleValue() < avg; j++)                 ;
                dataVect[rt.analysis][AVG].add(j,new Double(avg));
                outputTableModel.setValueAt(unitFmt.format(avg),rt.row,tableCols[dyn][i_analysis] + AVG);
                if (dyn == WITH_DYN && (rt.analysis == DC || rt.analysis == CP)) {
                  outputTableModel.setValueAt(unitFmt.format(rt._kmax / g),rt.row,tableCols[dyn][I_DY] + 0);
                  outputTableModel.setValueAt(unitFmt.format(rt._vs),rt.row,tableCols[dyn][I_DY] + 1);
                  outputTableModel.setValueAt(unitFmt.format(rt._damp),rt.row,tableCols[dyn][I_DY] + 2);
                  outputTableModel.setValueAt(unitFmt.format(rt._dampf),rt.row,tableCols[dyn][I_DY] + 3);
                }
              }
            }
            if (!pm.isCanceled()) {
              double mean, value, valtemp;
              int idx;
              Object[] rmean=new Object[tableCols[dyn][LEN]];
              Object[] rmedian=new Object[tableCols[dyn][LEN]];
              Object[] rsd=new Object[tableCols[dyn][LEN]];
              rmean[1]="String_Node_Str";
              rmedian[1]="String_Node_Str";
              rsd[1]="String_Node_Str";
              for (j=0; j < total.length; j++) {
                for (k=0; k < total[j].length; k++) {
                  if (dataVect[j][k] == null || dataVect[j][k].size() == 0)                   continue;
                  idx=tableCols[dyn][1 + j * 2] + k;
                  mean=Double.parseDouble(unitFmt.format(total[j][k] / num));
                  rmean[idx]=unitFmt.format(mean);
                  if (num % 2 == 0) {
                    double fst=(Double)dataVect[j][k].get(num / 2);
                    double snd=(Double)dataVect[j][k].get(num / 2 - 1);
                    rmedian[idx]=unitFmt.format(avg(fst,snd));
                  }
 else                   rmedian[idx]=unitFmt.format(dataVect[j][k].get(num / 2));
                  value=0;
                  for (int i=0; i < num; i++) {
                    valtemp=mean - ((Double)dataVect[j][k].get(i)).doubleValue();
                    value+=(valtemp * valtemp);
                  }
                  value/=num;
                  value=Math.sqrt(value);
                  rsd[idx]=unitFmt.format(value);
                }
              }
              outputTableModel.addRow(new Object[0]);
              outputTableModel.addRow(rmean);
              outputTableModel.addRow(rmedian);
              outputTableModel.addRow(rsd);
            }
          }
 catch (          Throwable ex) {
            Utils.catchException(ex);
          }
          return null;
        }
        public void finished(){
          pm.dispose();
        }
      }
;
      worker.start();
    }
 else     if (command.equals("String_Node_Str")) {
      clearOutput();
    }
 else     if (command.equals("String_Node_Str")) {
      if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
        FileWriter fw=new FileWriter(fc.getSelectedFile());
        String delim;
        if (outputDelSpace.isSelected())         delim="String_Node_Str";
 else         if (outputDelComma.isSelected())         delim="String_Node_Str";
 else         delim="String_Node_Str";
        int c=outputTableModel.getColumnCount();
        int r=outputTableModel.getRowCount();
        for (int i=0; i < c; i++) {
          if (i != 0)           fw.write(delim);
          fw.write(outputTableModel.getColumnName(i).replaceAll("String_Node_Str","String_Node_Str"));
        }
        fw.write("String_Node_Str");
        Object o;
        for (int i=0; i < r; i++) {
          for (int j=0; j < c; j++) {
            if (j != 0)             fw.write(delim);
            o=outputTableModel.getValueAt(i,j);
            if (o == null)             o="String_Node_Str";
            fw.write(o.toString());
          }
          fw.write("String_Node_Str");
        }
        fw.close();
      }
    }
 else     if (command.equals("String_Node_Str")) {
      if (dataVect == null)       return;
      String name="String_Node_Str", title, pname;
      HistogramDataset dataset=new HistogramDataset();
      int polarity, analysis=-1;
      if (polarityAvgHist.isSelected())       polarity=AVG;
 else       if (polarityNorHist.isSelected())       polarity=NOR;
 else       if (polarityInvHist.isSelected())       polarity=INV;
 else       polarity=-1;
      for (int i=0; i < analysisHist.length; i++)       if (analysisHist[i].isSelected())       analysis=i;
      if (analysis == -1)       return;
      pname=polarityName[polarity];
      Double Bins=(Double)Utils.checkNum(outputBins.getText(),"String_Node_Str",null,false,null,new Double(0),false,null,false);
      if (Bins == null || dataVect[analysis][polarity] == null)       return;
      name=analysisTitle[analysis];
      double series[]=new double[dataVect[analysis][polarity].size()];
      for (int j=0; j < dataVect[analysis][polarity].size(); j++)       series[j]=(((Double)dataVect[analysis][polarity].get(j)).doubleValue());
      dataset.addSeries(name,series,(int)Bins.doubleValue());
      title="String_Node_Str" + name + "String_Node_Str"+ pname+ "String_Node_Str";
      JFreeChart hist=ChartFactory.createHistogram(title,"String_Node_Str" + unitDisplacement,"String_Node_Str",dataset,org.jfree.chart.plot.PlotOrientation.VERTICAL,false,true,false);
      ChartFrame frame=new ChartFrame(title,hist);
      frame.pack();
      frame.setLocationRelativeTo(null);
      frame.setVisible(true);
    }
 else     if (command.equals("String_Node_Str")) {
      XYSeriesCollection xysc=new XYSeriesCollection();
      int polarity=polarityNorDisp.isSelected() ? NOR : INV;
      String pname=polarityName[polarity];
      String name="String_Node_Str";
      boolean first=true;
      for (int i=0; i < analysisDisp.length; i++) {
        if (analysisDisp[i].isSelected() && dataVect[i][polarity] != null) {
          if (first)           first=false;
 else           name+="String_Node_Str";
          name+=analysisTitle[i];
          for (int j=0; j < dataVect[i][polarity].size(); j++)           xysc.addSeries(xys[j][i][polarity]);
        }
      }
      if (first)       return;
      name+="String_Node_Str";
      JFreeChart chart=ChartFactory.createXYLineChart(name,"String_Node_Str","String_Node_Str" + pname + "String_Node_Str"+ unitDisplacement,xysc,org.jfree.chart.plot.PlotOrientation.VERTICAL,plotDisplacementLegend.isSelected(),true,false);
      chart.getXYPlot().getDomainAxis().setLowerMargin(0);
      chart.getXYPlot().getDomainAxis().setUpperMargin(0);
      chart.getXYPlot().getDomainAxis().setLowerBound(0);
      ChartFrame frame=new ChartFrame(name,chart);
      frame.pack();
      frame.setLocationRelativeTo(null);
      frame.setVisible(true);
    }
  }
 catch (  Exception ex) {
    Utils.catchException(ex);
  }
}