public void determineValues(Instances inst) {
      int					i;
      AttributeStats		stats;
      int					attIdx;
      int					min;
      int					max;
      int					count;

      m_AttIndex.setUpper(inst.numAttributes() - 1);
      attIdx = m_AttIndex.getIndex();
      
      // init names
      m_Values = new HashSet();
      
      if (inst == null)
         return;
      
      // number of values to retain
      stats = inst.attributeStats(attIdx);
      if (m_Invert)
         count = stats.nominalCounts.length - m_NumValues;
      else
         count = m_NumValues;
      // out of bounds? -> fix
      if (count < 1)
         count = 1;  // at least one value!
      if (count > stats.nominalCounts.length)
         count = stats.nominalCounts.length;  // at max the existing values
      
      // determine min/max occurences
      Arrays.sort(stats.nominalCounts);
      if (m_LeastValues) {
         min = stats.nominalCounts[0];
         max = stats.nominalCounts[count - 1];
      }
      else {
         min = stats.nominalCounts[(stats.nominalCounts.length - 1) - count + 1];
         max = stats.nominalCounts[stats.nominalCounts.length - 1];
      }
      
      // add values if they are inside min/max (incl. borders) and not more than count
      stats = inst.attributeStats(attIdx);
      for (i = 0; i < stats.nominalCounts.length; i++) {
         if ( (stats.nominalCounts[i] >= min) && (stats.nominalCounts[i] <= max) && (m_Values.size() < count) )
            m_Values.add(inst.attribute(attIdx).value(i));
      }
   }