⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testinstances.java

📁 矩阵的QR分解算法
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
  /**   * sets the number of values for nominal attributes   *    * @param value	the number of values   */  public void setNumNominalValues(int value) {    m_NumNominalValues = value;  }    /**   * returns the current number of values for nominal attributes   *    * @return 		the number of values   */  public int getNumNominalValues() {    return m_NumNominalValues;  }    /**   * sets the number of numeric attributes   *    * @param value 	the number of numeric attributes   */  public void setNumNumeric(int value) {    m_NumNumeric = value;  }    /**   * returns the current number of numeric attributes   *    * @return 		the number of numeric attributes   */  public int getNumNumeric() {    return m_NumNumeric;  }    /**   * sets the number of string attributes   *    * @param value 	the number of string attributes   */  public void setNumString(int value) {    m_NumString = value;  }    /**   * returns the current number of string attributes   *    * @return 		the number of string attributes   */  public int getNumString() {    return m_NumString;  }  /**   * turns the comma-separated list into an array   *    * @param value	the list to process   * @return		the list as array   */  protected static String[] listToArray(String value) {    StringTokenizer	tok;    Vector		list;        list = new Vector();    tok = new StringTokenizer(value, ",");    while (tok.hasMoreTokens())      list.add(tok.nextToken());        return (String[]) list.toArray(new String[list.size()]);  }    /**   * turns the array into a comma-separated list   *    * @param value	the array to process   * @return		the array as list   */  protected static String arrayToList(String[] value) {    String	result;    int		i;        result = "";        for (i = 0; i < value.length; i++) {      if (i > 0)	result += ",";      result += value[i];    }        return result;  }    /**   * Sets the comma-separated list of words to use for generating strings. The   * list must contain at least 2 words, otherwise an exception will be thrown.   *    * @param value			the list of words   * @throws IllegalArgumentException	if not at least 2 words are provided   */  public void setWords(String value) {    if (listToArray(value).length < 2)      throw new IllegalArgumentException("At least 2 words must be provided!");        m_Words = listToArray(value);  }    /**   * returns the words used for assembling strings in a comma-separated list.   *    * @return		the words as comma-separated list   */  public String getWords() {    return arrayToList(m_Words);  }  /**   * sets the word separators (chars) to use for assembling strings.   *    * @param value	the characters to use as separators   */  public void setWordSeparators(String value) {    m_WordSeparators = value;  }    /**   * returns the word separators (chars) to use for assembling strings.   *    * @return		the current separators   */  public String getWordSeparators() {    return m_WordSeparators;  }    /**   * sets the number of date attributes   *    * @param value	the number of date attributes   */  public void setNumDate(int value) {    m_NumDate = value;  }    /**   * returns the current number of date attributes   *    * @return		the number of date attributes   */  public int getNumDate() {    return m_NumDate;  }    /**   * sets the number of relational attributes   *    * @param value	the number of relational attributes   */  public void setNumRelational(int value) {    m_NumRelational = value;    m_RelationalFormat = new Instances[value];  }    /**   * returns the current number of relational attributes   *    * @return		the number of relational attributes   */  public int getNumRelational() {    return m_NumRelational;  }    /**   * sets the number of nominal attributes in a relational attribute   *    * @param value	the number of nominal attributes   */  public void setNumRelationalNominal(int value) {    m_NumRelationalNominal = value;  }    /**   * returns the current number of nominal attributes in a relational attribute   *    * @return 		the number of nominal attributes   */  public int getNumRelationalNominal() {    return m_NumRelationalNominal;  }    /**   * sets the number of values for nominal attributes in a relational attribute   *    * @param value	the number of values   */  public void setNumRelationalNominalValues(int value) {    m_NumRelationalNominalValues = value;  }    /**   * returns the current number of values for nominal attributes in a relational attribute   *    * @return 		the number of values   */  public int getNumRelationalNominalValues() {    return m_NumRelationalNominalValues;  }    /**   * sets the number of numeric attributes in a relational attribute   *    * @param value 	the number of numeric attributes   */  public void setNumRelationalNumeric(int value) {    m_NumRelationalNumeric = value;  }    /**   * returns the current number of numeric attributes in a relational attribute   *    * @return 		the number of numeric attributes   */  public int getNumRelationalNumeric() {    return m_NumRelationalNumeric;  }    /**   * sets the number of string attributes in a relational attribute   *    * @param value 	the number of string attributes   */  public void setNumRelationalString(int value) {    m_NumRelationalString = value;  }    /**   * returns the current number of string attributes in a relational attribute   *    * @return 		the number of string attributes   */  public int getNumRelationalString() {    return m_NumRelationalString;  }    /**   * sets the number of date attributes in a relational attribute   *    * @param value	the number of date attributes   */  public void setNumRelationalDate(int value) {    m_NumRelationalDate = value;  }    /**   * returns the current number of date attributes in a relational attribute   *    * @return		the number of date attributes   */  public int getNumRelationalDate() {    return m_NumRelationalDate;  }    /**   * sets the number of instances in relational/bag attributes to produce   *    * @param value	the number of instances   */  public void setNumInstancesRelational(int value) {    m_NumInstancesRelational = value;  }    /**   * returns the current number of instances in relational/bag attributes to produce   *    * @return		the number of instances   */  public int getNumInstancesRelational() {    return m_NumInstancesRelational;  }  /**   * sets whether multi-instance data should be generated (with a fixed   * data structure)   *    * @param value	whether multi-instance data is generated   */  public void setMultiInstance(boolean value) {    m_MultiInstance = value;  }    /**   * Gets whether multi-instance data (with a fixed structure) is generated   *    * @return		true if multi-instance data is generated   */  public boolean getMultiInstance() {    return m_MultiInstance;  }    /**   * sets the structure for the bags for the relational attribute   *    * @param index       the index of the relational attribute   * @param value       the new structure   */  public void setRelationalFormat(int index, Instances value) {    if (value != null)      m_RelationalFormat[index] = new Instances(value, 0);    else      m_RelationalFormat[index] = null;  }    /**   * returns the format for the specified relational attribute, can be null   *    * @param index       the index of the relational attribute   * @return            the current structure   */  public Instances getRelationalFormat(int index) {    return m_RelationalFormat[index];  }  /**   * sets the structure for the relational class attribute   *    * @param value	the structure for the relational attribute   */  public void setRelationalClassFormat(Instances value) {    if (value != null)      m_RelationalClassFormat = new Instances(value, 0);    else      m_RelationalClassFormat = null;  }    /**   * returns the current strcuture of the relational class attribute, can   * be null   *    * @return 		the relational structure of the class attribute   */  public Instances getRelationalClassFormat() {    return m_RelationalClassFormat;  }    /**   * returns the overall number of attributes (incl. class, if that is also   * generated)   *    * @return 		the overall number of attributes   */  public int getNumAttributes() {    int		result;        result = m_NumNominal + m_NumNumeric + m_NumString + m_NumDate + m_NumRelational;        if (!getNoClass())      result++;          return result;  }    /**   * returns the current dataset, can be null   *    * @return		the current dataset   */  public Instances getData() {    return m_Data;  }    /**   * sets the Capabilities handler to generate the data for   *    * @param value	the handler to generate the data for   */  public void setHandler(CapabilitiesHandler value) {    m_Handler = value;  }    /**   * returns the current set CapabilitiesHandler to generate the dataset   * for, can be null   *    * @return		the handler to generate the data for   */  public CapabilitiesHandler getHandler() {    return m_Handler;  }    /**   * creates a new Attribute of the given type   *    * @param index the index of the current attribute (0-based)   * @param attType the attribute type (NUMERIC, NOMINAL, etc.)   * @return the configured attribute   * @throws Exception if something goes wrong, e.g., an unknown attribute type   *    * @see Attribute#type()   * @see #CLASS_IS_LAST   * @see #NO_CLASS   */  protected Attribute generateAttribute(int index, int attType) throws Exception {    Attribute     result;    String        name;    int           valIndex;    int           nomCount;    String        prefix;        result = null;    // determine name and start-index    if (index == CLASS_IS_LAST) {      valIndex = 0;      name     = "Class";      prefix   = "class";      nomCount = getNumClasses();    }    else {      valIndex = index;      nomCount = getNumNominalValues();      prefix   = "att" + (valIndex + 1) + "val";            switch (attType) {        case Attribute.NOMINAL:          name = "Nominal" + (valIndex + 1);          break;                  case Attribute.NUMERIC:          name = "Numeric" + (valIndex + 1);          break;                  case Attribute.STRING:          name = "String" + (valIndex + 1);          break;                  case Attribute.DATE:          name = "Date" + (valIndex + 1);          break;                  case Attribute.RELATIONAL:          name = "Relational" + (valIndex + 1);          break;                  default:          throw new IllegalArgumentException("Attribute type '" + attType + "' unknown!");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -