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

📄 miningstoreddata.java

📁 一个数据挖掘软件ALPHAMINERR的整个过程的JAVA版源代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    }

    public MiningDataSpecification recognize() throws MiningException
    {
        throw new MiningException( "Not implemented." );
    }

    // -----------------------------------------------------------------------
    //  Methods of cursor positioning
    // -----------------------------------------------------------------------
    /**
     * Sets the cursor before first row.
     */
    public void reset() throws MiningException
    {
        cursorPosition = -1;
        this.iterator = this.iterator();
    }

    /**
     * Advances the cursor by one position.
     *
     * @return true if data vector for further reading exists,
     * else false
     */
    public boolean next() throws MiningException
    {
        cursorPosition++;
        if( cursorPosition >= size() )
        {
            return false;
        }
        else
        {
            return true;
        }
    }

    /**
     * Moves cursor to a specified position.
     *
     * @param position new position to move
     * @return false, if cursor out of bounds, else true
     */
    public boolean move( int position ) throws MiningException
    {
        if( position >= size() )
        {
            return false;
        }
        else
        {
            this.cursorPosition = position;
            return true;
        }
    }

    // -----------------------------------------------------------------------
    //  Methods of reading from the stream
    // -----------------------------------------------------------------------
    /**
     * Returns mining vector at current cursor position.
     *
     * @return mining vector at current cursor poistion
     */
    public MiningVector read() throws MiningException
    {
        return (MiningVector)get( cursorPosition );
    }

    // -----------------------------------------------------------------------
    //  Methods of writing into the stream
    // -----------------------------------------------------------------------
    /**
     * Sets new meta data to this stream. Removes all data.
     *
     * @param metaData new meta data to set
     * @exception MiningException if an error occurs
     */
    public void updateSetMetaData(MiningDataSpecification metaData) throws MiningException
    {
      updateRemoveAllVectors();
      this.metaData = metaData;
    };

    /**
     * Removes all mining vectors from this stream. Note that metadata is not
     * affected by this operation since it is fixed for any stream.
     *
     * @exception MiningException if an error occurs
     */
    public void updateRemoveAllVectors() throws MiningException
    {
      this.miningVectors = new ArrayList<Object>();
      this.iterator = this.iterator();
      this.cursorPosition = -1;
    };

    /**
     * Appends new mining vector to this stream. Only for updateble
     * input streams.
     *
     * @param vector new vector to add
     * @exception MiningException if an error occurs
     */
    public void updateAppendVector(MiningVector vector) throws MiningException
    {
      this.miningVectors.add(vector);
    };

    // -----------------------------------------------------------------------
    //  Other methods
    // -----------------------------------------------------------------------
    /**
     * Writes data of mining stored data to writer.
     *
     * @param writer writer for writing the data
     */
    public void write( Writer writer ) throws MiningException
    {
        try
        {
            writer.write( metaData.createArffDescription() + "\n" );
            int size = size();
            for (int i = 0; i < size; i++)
            {
                writer.write( (MiningVector)get( i ) + "\n" );
            }
        }
        catch( IOException ex )
        {
            throw new MiningException( "Can't write to file." );
        }
    }

    // -----------------------------------------------------------------------
	//  Other methods
    //	<<Frank Xu, 09/11/2004
    //	New methods for integrate with KBBI.
	// -----------------------------------------------------------------------
	/**
	 * Writes data of mining stored data to writer.
	 *
	 * @param writer writer for writing the data
	 */
	public void write( Writer writer, String ext ) throws MiningException
	{
		if (ext==null || !ext.equals("arff"))
			write(writer);
			
		try
		{        	
			writer.write( metaData.createArffDescription() + "\n" );
			int size = size();
			for (int i = 0; i < size; i++)
			{
				if (i==0)
					writer.write("@data\n");
				writer.write( (MiningVector)get( i ) + "\n" );
			}
		}
		catch( IOException ex )
		{
			throw new MiningException( "Can't write to file." );
		}
	}
	//Frank Xu, 09/11/2004>>
	
    // -----------------------------------------------------------------------
    //  Methods of java.util.List interface
    // -----------------------------------------------------------------------
    public int size()
    {
        return miningVectors.size();
    }

    public boolean isEmpty()
    {
        return miningVectors.isEmpty();
    }

    public boolean contains(Object o)
    {
        return miningVectors.contains( o );
    }

    public Iterator<Object> iterator()
    {
        return miningVectors.iterator();
    }

    public Object[] toArray()
    {
        return miningVectors.toArray();
    }

    @SuppressWarnings("unchecked")
	public Object[] toArray(Object[] a)
    {
        return miningVectors.toArray( a );
    }

    public boolean add(Object o)
    {
        return miningVectors.add( o );
    }

    public boolean remove(Object o)
    {
        return miningVectors.remove( o );
    }

    public boolean containsAll(Collection c)
    {
        return miningVectors.containsAll( c );
    }

    @SuppressWarnings("unchecked")
	public boolean addAll(Collection c)
    {
        return miningVectors.addAll( c );
    }

    @SuppressWarnings({ "unchecked" })
	public boolean addAll(int index, Collection c)
    {
        return miningVectors.addAll( index, c );
    }

    public boolean removeAll(Collection c)
    {
        return miningVectors.removeAll( c );
    }

    public boolean retainAll(Collection c)
    {
        return miningVectors.retainAll( c );
    }

    public void clear()
    {
        miningVectors.clear();
    }

    public int hashCode() {

        return miningVectors.hashCode();
    }

    public boolean equals(Object o)
    {
        return miningVectors.equals( o );
    }

    public Object get(int index)
    {
        return miningVectors.get( index );
    }

    public Object set(int index, Object element)
    {
        return miningVectors.set( index, element );
    }

    public void add(int index, Object element)
    {
        miningVectors.add( index, element );
    }

    public Object remove(int index)
    {
        return miningVectors.remove( index );
    }

    public int indexOf(Object o)
    {
        return miningVectors.indexOf( o );
    }

    public int lastIndexOf(Object o)
    {
        return miningVectors.lastIndexOf( o );
    }

    public ListIterator<Object> listIterator()
    {
        return miningVectors.listIterator();
    }

    public ListIterator<Object> listIterator(int index)
    {
        return miningVectors.listIterator( index );
    }

    public List<Object> subList(int fromIndex, int toIndex)
    {
        return miningVectors.subList( fromIndex, toIndex );
    }
}

⌨️ 快捷键说明

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