Ejemplo n.º 1
0
 /**
  * Check if the complex gets the given data
  *
  * @param m Muestra The example
  * @return boolean True if gets the example
  */
 public boolean isCovered(Sample m) {
   boolean cubierto = true;
   double[] sample = m.getSample();
   for (int i = 0; i < this.size() && cubierto; i++) { // recorremos los selectores del complejo
     Selector s = this.getSelector(i);
     switch (s.getOperator()) {
       case 0: // se trata del igual
         double[] valor = s.getValues();
         cubierto = false;
         // ahora cada selector solo guarda el minimo y maximo
         // para cuando se trata de una excepcion
         if (valor.length == 1) {
           if (sample[s.getAttribute()] == valor[0]) cubierto = true;
         }
         // ahora ya sabemos que valor solo va a tener 2 componentes
         else {
           if ((sample[s.getAttribute()] >= valor[0]) && (sample[s.getAttribute()] <= valor[1]))
             cubierto = true;
         }
         break;
       case 1: // se trata del distinto
         cubierto = sample[s.getAttribute()] != s.getZeroValue();
         break;
       case 2: // menor o igual
         cubierto = sample[s.getAttribute()] <= s.getZeroValue();
         break;
       case 3: // mayor
         cubierto = sample[s.getAttribute()] > s.getZeroValue();
         break;
     }
   }
   return cubierto;
 }