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

📄 matrix.java

📁 一个数据挖掘软件ALPHAMINERR的整个过程的JAVA版源代码
💻 JAVA
字号:
/**
 * This file is generated by BorlandXML.
 */

package com.prudsys.pdm.Adapters.PmmlVersion20;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

/**
 * The Matrix class represents the element "Matrix" with the content
 * model defined as follows:
 * <p>
 * &lt;!ELEMENT Matrix (Array+|MatCell+)?&gt;<br>
 */
public class Matrix extends com.borland.xml.toolkit.XmlObject 
{
	/** xml tag name of this element. */
	public static String _tagName = "Matrix";
	/** Defines a nbRows attribute */
	public com.borland.xml.toolkit.Attribute nbRows = new com.borland.xml.toolkit.Attribute("nbRows", "CDATA", "IMPLIED", "");
	/** Defines a nbCols attribute */
	public com.borland.xml.toolkit.Attribute nbCols = new com.borland.xml.toolkit.Attribute("nbCols", "CDATA", "IMPLIED", "");
	/** Defines a kind attribute */
	public com.borland.xml.toolkit.Attribute kind = new com.borland.xml.toolkit.Attribute("kind", "(diagonal | symmetric | any)", "", "any");
	/** Defines a offDiagDefault attribute */
	public com.borland.xml.toolkit.Attribute offDiagDefault = new com.borland.xml.toolkit.Attribute("offDiagDefault", "CDATA", "IMPLIED", "");
	/** Defines a diagDefault attribute */
	public com.borland.xml.toolkit.Attribute diagDefault = new com.borland.xml.toolkit.Attribute("diagDefault", "CDATA", "IMPLIED", "");
	/** Defines a list of Array objects. */
	protected ArrayList _objArray = new ArrayList();
	/** Defines a list of MatCell objects. */
	protected ArrayList _objMatCell = new ArrayList();

	/**
	 * Creates an empty Matrix object
	 */
	public Matrix()
	{
		super();
	}

	/**
	 * Gets the value of "nbRows" attribute.
	 */
	public String getNbRows()
	{
		return nbRows.getValue();
	}

	/**
	 * Replaces the existing attribute value with a new value.
	 * @param value	New value.
	 */
	public void setNbRows(String value_)
	{
		nbRows.setValue(value_ );
	}

	/**
	 * Gets the value of "nbCols" attribute.
	 */
	public String getNbCols()
	{
		return nbCols.getValue();
	}

	/**
	 * Replaces the existing attribute value with a new value.
	 * @param value	New value.
	 */
	public void setNbCols(String value_)
	{
		nbCols.setValue(value_ );
	}

	/**
	 * Gets the value of "kind" attribute.
	 */
	public String getKind()
	{
		return kind.getValue();
	}

	/**
	 * Replaces the existing attribute value with a new value.
	 * @param value	New value.
	 */
	public void setKind(String value_)
	{
		kind.setValue(value_ );
	}

	/**
	 * Gets the value of "offDiagDefault" attribute.
	 */
	public String getOffDiagDefault()
	{
		return offDiagDefault.getValue();
	}

	/**
	 * Replaces the existing attribute value with a new value.
	 * @param value	New value.
	 */
	public void setOffDiagDefault(String value_)
	{
		offDiagDefault.setValue(value_ );
	}

	/**
	 * Gets the value of "diagDefault" attribute.
	 */
	public String getDiagDefault()
	{
		return diagDefault.getValue();
	}

	/**
	 * Replaces the existing attribute value with a new value.
	 * @param value	New value.
	 */
	public void setDiagDefault(String value_)
	{
		diagDefault.setValue(value_ );
	}

	/**
	 * Returns an array of Array objects. The length of the returned
	 * array is zero if the list of Array object is empty.
	 */
	public Array[] getArray()
	{
		return (Array[])_objArray.toArray(new Array[0]);
	}

	/**
	 * Replaces all existing Array objects with a new array of
	 * Array objects.
	 * @param objArray	an array of Array objects.
	 */
	public void setArray(Array[] objArray)
	{
		if( objArray == null || objArray.length == 0 )
			this._objArray.clear();
		else
		{
			this._objArray = new ArrayList(Arrays.asList(objArray));
			for( int i=0; i<objArray.length; i++ )
			{
				if( objArray[i] != null )
					objArray[i]._setParent(this);
			}
		}
		clearMatCellList();
	}

	/**
	 * Gets the Array object at the specified index.
	 * @param index	index of the returned object.
	 * @throws IndexOutOfBoundsException	if index is out of range.
	 */
	public Array getArray(int index)
	{
		return (Array)_objArray.get(index);
	}

	/**
	 * Replaces an existing Array object at the specified index with
	 * a new Array object.
	 * @param index	index of replaced object.
	 * @throws IndexOutOfBoundsException	if index is out of range.
	 */
	public void setArray(int index, Array obj)
	{
		if( obj == null )
			removeArray(index);
		else
		{
			_objArray.set(index, obj);
			obj._setParent(this);
		}
		clearMatCellList();
	}

	/**
	 * Returns the number of Array objects in the list.
	 */
	public int getArrayCount()
	{
		return _objArray.size();
	}

	/**
	 * Returns <code>true</code> if there is no Array object in the list; otherwise,
	 * the method returns <code>false</code>.
	 */
	public boolean isNoArray()
	{
		return _objArray.size() == 0;
	}

	/**
	 * Returns a read-only list of Array objects.
	 */
	public List getArrayList()
	{
		return Collections.unmodifiableList(_objArray);
	}

	/**
	 * Adds a new Array object at the end of the list.
	 * @return <code>true</code> if the new object is added to the list; otherwise,
	 * the method returns <code>false</code>.
	 */
	public boolean addArray(Array obj)
	{
		if( obj==null )
			return false;

		clearMatCellList();
		obj._setParent(this);
		return _objArray.add(obj);
	}

	/**
	 * Adds a list of new Array objects at the end of the list.
	 * @return <code>true</code> if the list was changed; otherwise, the method
	 * returns <code>false</code>.
	 */
	public boolean addArray(Collection coArray)
	{
		if( coArray==null )
			return false;

		clearMatCellList();
		java.util.Iterator it = coArray.iterator();
		while( it.hasNext() )
		{
			Object obj = it.next();
			if( obj != null && obj instanceof com.borland.xml.toolkit.XmlObject )
				((com.borland.xml.toolkit.XmlObject)obj)._setParent(this);
		}
		return _objArray.addAll(coArray);
	}

	/**
	 * Removes an existing Array object at the specified index.
	 * @return	The removed object.
	 */
	public Array removeArray(int index)
	{
		return (Array)_objArray.remove(index);
	}

	/**
	 * Removes the specified Array object.
	 * @return <code>true</code> if this list contains the object; otherwise,
	 * the method returns <code>false</code>.
	 */
	public boolean removeArray(Array obj)
	{
		return _objArray.remove(obj);
	}

	/**
	 * Clears all Array objects from the list.
	 */
	public void clearArrayList()
	{
		_objArray.clear();
	}
	/**
	 * Returns an array of MatCell objects. The length of the returned
	 * array is zero if the list of MatCell object is empty.
	 */
	public MatCell[] getMatCell()
	{
		return (MatCell[])_objMatCell.toArray(new MatCell[0]);
	}

	/**
	 * Replaces all existing MatCell objects with a new array of
	 * MatCell objects.
	 * @param objArray	an array of MatCell objects.
	 */
	public void setMatCell(MatCell[] objArray)
	{
		if( objArray == null || objArray.length == 0 )
			this._objMatCell.clear();
		else
		{
			this._objMatCell = new ArrayList(Arrays.asList(objArray));
			for( int i=0; i<objArray.length; i++ )
			{
				if( objArray[i] != null )
					objArray[i]._setParent(this);
			}
		}
		clearArrayList();
	}

	/**
	 * Gets the MatCell object at the specified index.
	 * @param index	index of the returned object.
	 * @throws IndexOutOfBoundsException	if index is out of range.
	 */
	public MatCell getMatCell(int index)
	{
		return (MatCell)_objMatCell.get(index);
	}

	/**
	 * Replaces an existing MatCell object at the specified index with
	 * a new MatCell object.
	 * @param index	index of replaced object.
	 * @throws IndexOutOfBoundsException	if index is out of range.
	 */
	public void setMatCell(int index, MatCell obj)
	{
		if( obj == null )
			removeMatCell(index);
		else
		{
			_objMatCell.set(index, obj);
			obj._setParent(this);
		}
		clearArrayList();
	}

	/**
	 * Returns the number of MatCell objects in the list.
	 */
	public int getMatCellCount()
	{
		return _objMatCell.size();
	}

	/**
	 * Returns <code>true</code> if there is no MatCell object in the list; otherwise,
	 * the method returns <code>false</code>.
	 */
	public boolean isNoMatCell()
	{
		return _objMatCell.size() == 0;
	}

	/**
	 * Returns a read-only list of MatCell objects.
	 */
	public List getMatCellList()
	{
		return Collections.unmodifiableList(_objMatCell);
	}

	/**
	 * Adds a new MatCell object at the end of the list.
	 * @return <code>true</code> if the new object is added to the list; otherwise,
	 * the method returns <code>false</code>.
	 */
	public boolean addMatCell(MatCell obj)
	{
		if( obj==null )
			return false;

		clearArrayList();
		obj._setParent(this);
		return _objMatCell.add(obj);
	}

	/**
	 * Adds a list of new MatCell objects at the end of the list.
	 * @return <code>true</code> if the list was changed; otherwise, the method
	 * returns <code>false</code>.
	 */
	public boolean addMatCell(Collection coMatCell)
	{
		if( coMatCell==null )
			return false;

		clearArrayList();
		java.util.Iterator it = coMatCell.iterator();
		while( it.hasNext() )
		{
			Object obj = it.next();
			if( obj != null && obj instanceof com.borland.xml.toolkit.XmlObject )
				((com.borland.xml.toolkit.XmlObject)obj)._setParent(this);
		}
		return _objMatCell.addAll(coMatCell);
	}

	/**
	 * Removes an existing MatCell object at the specified index.
	 * @return	The removed object.
	 */
	public MatCell removeMatCell(int index)
	{
		return (MatCell)_objMatCell.remove(index);
	}

	/**
	 * Removes the specified MatCell object.
	 * @return <code>true</code> if this list contains the object; otherwise,
	 * the method returns <code>false</code>.
	 */
	public boolean removeMatCell(MatCell obj)
	{
		return _objMatCell.remove(obj);
	}

	/**
	 * Clears all MatCell objects from the list.
	 */
	public void clearMatCellList()
	{
		_objMatCell.clear();
	}

	/**
	 * Marshals this object to an element.
	 */
	public com.borland.xml.toolkit.Element marshal()
	{
		com.borland.xml.toolkit.Element elem = new com.borland.xml.toolkit.Element(get_TagName());
		/** Marshals "nbRows" attribute */
		elem.addAttribute(nbRows.marshal());
		/** Marshals "nbCols" attribute */
		elem.addAttribute(nbCols.marshal());
		/** Marshals "kind" attribute */
		elem.addAttribute(kind.marshal());
		/** Marshals "offDiagDefault" attribute */
		elem.addAttribute(offDiagDefault.marshal());
		/** Marshals "diagDefault" attribute */
		elem.addAttribute(diagDefault.marshal());
		/** Marshals a list of Array objects to elements */
		Iterator it1 = _objArray.iterator();
		while( it1.hasNext() )
		{
			Array obj = (Array)it1.next();
			if( obj != null )
				elem.addContent(obj.marshal());
		}
		/** Marshals a list of MatCell objects to elements */
		Iterator it2 = _objMatCell.iterator();
		while( it2.hasNext() )
		{
			MatCell obj = (MatCell)it2.next();
			if( obj != null )
				elem.addContent(obj.marshal());
		}

		return elem;
	}

	/**
	 * Unmarshals the specified "Matrix" element back to a Matrix object.
	 */
	public static Matrix unmarshal(com.borland.xml.toolkit.Element elem)
	{
		if( elem == null )
			return null;

		Matrix __objMatrix = new Matrix();
		if( __objMatrix != null ) //found the element?
		{
			/** Unmarshals "nbRows" attribute */
			__objMatrix.nbRows.setValue(elem.getAttribute("nbRows"));
			/** Unmarshals "nbCols" attribute */
			__objMatrix.nbCols.setValue(elem.getAttribute("nbCols"));
			/** Unmarshals "kind" attribute */
			__objMatrix.kind.setValue(elem.getAttribute("kind"));
			/** Unmarshals "offDiagDefault" attribute */
			__objMatrix.offDiagDefault.setValue(elem.getAttribute("offDiagDefault"));
			/** Unmarshals "diagDefault" attribute */
			__objMatrix.diagDefault.setValue(elem.getAttribute("diagDefault"));
		}
		/** Unmarshals a list of "<<_tagName_>>" elements back to Array objects. */
		Iterator it1 = elem.getChildren(Array._tagName).iterator();
		while( it1.hasNext() )
			__objMatrix.addArray(Array.unmarshal((com.borland.xml.toolkit.Element)it1.next()));
		/** Unmarshals a list of "<<_tagName_>>" elements back to MatCell objects. */
		Iterator it2 = elem.getChildren(MatCell._tagName).iterator();
		while( it2.hasNext() )
			__objMatrix.addMatCell(MatCell.unmarshal((com.borland.xml.toolkit.Element)it2.next()));

		return __objMatrix;
	}

	/**
	 * Validates this object. If you pass <code>true</code> to this method, it
	 * checks for the first error and stops. On the other hand, if you pass
	 * <code>false</code> to this method, it collects all the errors by
	 * visiting every available elements.
	 * @param firstError	<code>true</code> to exit this method when the first error
	 * is found; <code>false</code> to collect all errors.
	 * @return com.borland.xml.toolkit.ErrorList	A list that contains one or more errors.
	 * @see com.borland.xml.toolkit.XmlObject#validate()
	 * @see com.borland.xml.toolkit.XmlObject#isValid()
	 * @see com.borland.xml.toolkit.ErrorList
	 */
	public com.borland.xml.toolkit.ErrorList validate(boolean firstError)
	{
		com.borland.xml.toolkit.ErrorList errors = new com.borland.xml.toolkit.ErrorList();

		/** "or" block */
		if( _objArray.size() > 0 )
		{
			/** Array is zero or more */
			Iterator it1 = _objArray.iterator();
			while( it1.hasNext() )
			{
				Array obj = (Array)it1.next();
				if( obj != null )
				{
					errors.add(obj.validate(firstError));
					if( firstError && errors.size() > 0 )
						return errors;
				}
			}
		}
		if( _objMatCell.size() > 0 )
		{
			/** MatCell is zero or more */
			Iterator it2 = _objMatCell.iterator();
			while( it2.hasNext() )
			{
				MatCell obj = (MatCell)it2.next();
				if( obj != null )
				{
					errors.add(obj.validate(firstError));
					if( firstError && errors.size() > 0 )
						return errors;
				}
			}
		}

		return errors.size()==0 ? null : errors;
	}

	/**
	 * Returns a list containing all child elements. Each element in the list is a subclass
	 * of XmlObject.
	 */
	public java.util.List _getChildren()
	{
		java.util.List children = new java.util.ArrayList();
		/** adds _objArray */
		if( _objArray != null && _objArray.size() > 0 )
			children.add(_objArray);
		/** adds _objMatCell */
		if( _objMatCell != null && _objMatCell.size() > 0 )
			children.add(_objMatCell);
		return children;
	}


	/**
	 * Gets the tag name of this element.
	 */
	public String get_TagName()
	{
		return _tagName;
	}
}

⌨️ 快捷键说明

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