docs: protected double difference(int index, double val1, double val2) {
      //switch (m_Data.attribute(index).type()) {
        //case Attribute.NOMINAL:
        if (m_Data.attribute(index).isNominal() == true){
          if (isMissingValue(val1) ||
             isMissingValue(val2) ||
             ((int) val1 != (int) val2)) {
            return 1;
          }
          else {
            return 0;
          }
        } else {  
        //case Attribute.NUMERIC:
          if (isMissingValue(val1) ||
             isMissingValue(val2)) {
            if (isMissingValue(val1) &&
               isMissingValue(val2)) {
              if (!m_DontNormalize)  //We are doing normalization
                return 1;
              else
                return (m_Ranges[index][R_MAX] - m_Ranges[index][R_MIN]);
            }
            else {
              double diff;
              if (isMissingValue(val2)) {
                diff = (!m_DontNormalize) ? norm(val1, index) : val1;
              }
              else {
                diff = (!m_DontNormalize) ? norm(val2, index) : val2;
              }
              if (!m_DontNormalize && diff < 0.5) {
                diff = 1.0 - diff;
              }
              else if (m_DontNormalize) {
                if ((m_Ranges[index][R_MAX]-diff) > (diff-m_Ranges[index][R_MIN]))
                  return m_Ranges[index][R_MAX]-diff;
                else
                  return diff-m_Ranges[index][R_MIN];
              }
              return diff;
            }
          }
          else {
            return (!m_DontNormalize) ? 
                	 (norm(val1, index) - norm(val2, index)) :
                	 (val1 - val2);
          }
          
        //default:
        //  return 0;
      }
    }