Example #1
0
  /**
   * tests whether the Kernel can handle certain attributes and if not, if the exception is OK
   *
   * @param nom to check for nominal attributes
   * @param num to check for numeric attributes
   * @param str to check for string attributes
   * @param dat to check for date attributes
   * @param rel to check for relational attributes
   * @param allowFail whether a junit fail can be executed
   * @see CheckKernel#canPredict(boolean, boolean, boolean, boolean, boolean, boolean, int)
   * @see CheckKernel#testsPerClassType(int, boolean, boolean)
   */
  protected void checkAttributes(
      boolean nom, boolean num, boolean str, boolean dat, boolean rel, boolean allowFail) {
    boolean[] result;
    String att;
    int i;

    // determine text for type of attributes
    att = "";
    if (nom) att = "nominal";
    else if (num) att = "numeric";
    else if (str) att = "string";
    else if (dat) att = "date";
    else if (rel) att = "relational";

    for (i = FIRST_CLASSTYPE; i <= LAST_CLASSTYPE; i++) {
      result = m_Tester.canPredict(nom, num, str, dat, rel, m_multiInstanceHandler, i);
      if (nom) m_NominalPredictors[i] = result[0];
      else if (num) m_NumericPredictors[i] = result[0];
      else if (str) m_StringPredictors[i] = result[0];
      else if (dat) m_DatePredictors[i] = result[0];
      else if (rel) m_RelationalPredictors[i] = result[0];

      if (!result[0] && !result[1] && allowFail)
        fail("Error handling " + att + " attributes (" + getClassTypeString(i) + " class)!");
    }
  }