if(m_data.instance(k).isMissing(m_attribIndex)) continue;
    public void run() {      synchronized (m_locker) {        if((m_classIndex >= 0) &&           (m_data.attribute(m_classIndex).isNominal())) {                    int intervals; double intervalWidth=0.0;                    //This uses the M.P.Wand's method to calculate the histogram's          //interval width. See "Data-Based Choice of Histogram Bin Width", in          //The American Statistician, Vol. 51, No. 1, Feb., 1997, pp. 59-64.          //intervalWidth = Math.pow(6D/( -psi(2, g21())*m_data.numInstances()),          //                          1/3D );                    //This uses the Scott's method to calculate the histogram's interval          //width. See "On optimal and data-based histograms".          // See Biometrika, 66, 605-610 OR see the same paper mentioned above.          intervalWidth =  3.49 * m_as.numericStats.stdDev *                           Math.pow(m_data.numInstances(), -1/3D);          //The Math.max is introduced to remove the possibility of          //intervals=0 and =NAN that can happen if respectively all the numeric          //values are the same or the interval width is evaluated to zero.          intervals = Math.max(1,          (int)Math.round( (m_as.numericStats.max - m_as.numericStats.min) /                           intervalWidth) );                    //System.out.println("Max: "+m_as.numericStats.max+          //                   " Min: "+m_as.numericStats.min+          //                   " stdDev: "+m_as.numericStats.stdDev+          //                   "intervalWidth: "+intervalWidth);                    //The number 4 below actually represents a padding of 3 pixels on          //each side of the histogram, and is also reflected in other parts of           //the code in the shape of numerical constants like "6" here.          if(intervals > AttributeVisualizationPanel.this.getWidth()) {            intervals = AttributeVisualizationPanel.this.getWidth()-6;            if(intervals<1)//if width is too small then use 1 and forget padding              intervals = 1;          }          int histClassCounts[][]  =                          new int[intervals]                                 [m_data.attribute(m_classIndex).numValues()+1];                    double barRange   = (m_as.numericStats.max - m_as.numericStats.min) /                              (double)histClassCounts.length;                    m_maxValue = 0;                    if(m_colorList.size()==0)            m_colorList.addElement(Color.black);          for(int i = m_colorList.size();          i < m_data.attribute(m_classIndex).numValues()+1; i++) {            Color pc = m_defaultColors[(i-1) % 10];            int ija =  (i-1) / 10;            ija *= 2;            for (int j=0;j<ija;j++) {              pc = pc.darker();            }            m_colorList.addElement(pc);          }                    for(int k=0; k<m_data.numInstances(); k++) {            int t=0; //This holds the interval that the attibute value of the                     //new instance belongs to.            try {              if(!m_data.instance(k).isMissing(m_attribIndex)) {                //1. see footnote at the end of this file                t = (int)Math.ceil( (float)(                (m_data.instance(k).value(m_attribIndex)-m_as.numericStats.min)                / barRange) );                if(t==0) {                  if(m_data.instance(k).isMissing(m_classIndex))                    histClassCounts[t][0]++;                  else                    histClassCounts[t][(int)m_data.instance(k).value(m_classIndex)+1]++;                  //if(histCounts[t]>m_maxValue)                  //  m_maxValue = histCounts[t];                }                else {                  if(m_data.instance(k).isMissing(m_classIndex))                    histClassCounts[t-1][0]++;                  else                    histClassCounts[t-1][(int)m_data.instance(k).value(m_classIndex)+1]++;                  //if(histCounts[t-1]>m_maxValue)                  //  m_maxValue = histCounts[t-1];                }              }            }            catch(ArrayIndexOutOfBoundsException ae) {              System.out.println("t:"+(t)+              " barRange:"+barRange+              " histLength:"+histClassCounts.length+              " value:"+m_data.instance(k).value(m_attribIndex)+              " min:"+m_as.numericStats.min+              " sumResult:"+              (m_data.instance(k).value(m_attribIndex) -              m_as.numericStats.min)+              " divideResult:"+              (float)((m_data.instance(k).value(m_attribIndex) -              m_as.numericStats.min) / barRange)+              " finalResult:"+              Math.ceil((float)((m_data.instance(k).value(m_attribIndex)-              m_as.numericStats.min) / barRange)) );            }          }          for(int i=0; i<histClassCounts.length; i++) {            int sum=0;            for(int j=0; j<histClassCounts[i].length; j++)              sum = sum+histClassCounts[i][j];            if(m_maxValue<sum)              m_maxValue = sum;          }          m_histBarClassCounts = histClassCounts;          m_barRange =  barRange;                  }        else { //else if the class attribute is numeric or the class is not set                    int intervals; double intervalWidth;          //At the time of this coding the          //possibility of datasets with zero instances          //was being dealt with in the          //PreProcessPanel of weka Explorer.                    //old method of calculating number of intervals          //intervals =  m_as.totalCount>10 ?          //                  (int)(m_as.totalCount*0.1):(int)m_as.totalCount;                    //This uses the M.P.Wand's method to calculate the histogram's          //interval width. See "Data-Based Choice of Histogram Bin Width", in          //The American Statistician, Vol. 51, No. 1, Feb., 1997, pp. 59-64.          //intervalWidth = Math.pow(6D/(-psi(2, g21())*m_data.numInstances() ),          //                          1/3D );                    //This uses the Scott's method to calculate the histogram's interval          //width. See "On optimal and data-based histograms".          // See Biometrika, 66, 605-610 OR see the same paper mentioned above.          intervalWidth =  3.49 * m_as.numericStats.stdDev *                           Math.pow(m_data.numInstances(), -1/3D);          //The Math.max is introduced to remove the possibility of          //intervals=0 and =NAN that can happen if respectively all the numeric          //values are the same or the interval width is evaluated to zero.          intervals = Math.max(1,          (int)Math.round( (m_as.numericStats.max - m_as.numericStats.min) /                           intervalWidth) );                    //The number 4 below actually represents a padding of 3 pixels on          //each side of the histogram, and is also reflected in other parts of           //the code in the shape of numerical constants like "6" here.          if(intervals > AttributeVisualizationPanel.this.getWidth()) {            intervals = AttributeVisualizationPanel.this.getWidth()-6;            if(intervals<1)              intervals = 1;          }                    int histCounts[]  = new int[intervals];          double barRange   = (m_as.numericStats.max - m_as.numericStats.min) /                              (double)histCounts.length;                    m_maxValue = 0;                    for(int k=0; k<m_data.numInstances(); k++) {            int t=0; //This holds the interval to which the current attribute's                    //value of this particular instance k belongs to.            try {              //1. see footnote at the end of this file              t =(int) Math.ceil((float)(              (m_data.instance(k).value(m_attribIndex)-m_as.numericStats.min)              / barRange));              if(t==0) {                histCounts[t]++;                if(histCounts[t]>m_maxValue)                  m_maxValue = histCounts[t];              }              else {                histCounts[t-1]++;                if(histCounts[t-1]>m_maxValue)                  m_maxValue = histCounts[t-1];              }            }            catch(ArrayIndexOutOfBoundsException ae) {              ae.printStackTrace();              System.out.println("t:"+(t)+              " barRange:"+barRange+              " histLength:"+histCounts.length+              " value:"+m_data.instance(k).value(m_attribIndex)+              " min:"+m_as.numericStats.min+              " sumResult:"+              (m_data.instance(k).value(m_attribIndex)-m_as.numericStats.min)+              " divideResult:"+              (float)((m_data.instance(k).value(m_attribIndex) -              m_as.numericStats.min)/barRange)+              " finalResult:"+              Math.ceil( (float)((m_data.instance(k).value(m_attribIndex) -              m_as.numericStats.min) / barRange)) );            }          }          m_histBarCounts = histCounts;          m_barRange =  barRange;        }                m_threadRun=false;        //Image tmpImg = new BufferedImage(getWidth(), getHeight(),        //                                 BufferedImage.TYPE_INT_RGB);        //drawGraph( tmpImg.getGraphics() );        //img = tmpImg;        AttributeVisualizationPanel.this.repaint();      }    }