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

📄 bookset.java

📁 一个关于图书馆的服务器的管理程序
💻 JAVA
字号:
package library;
import java.util.*;

/**
 * Class <b>BookSet</b> represents a 
 * collection of books.
 *
 * @author CTE
 * @version 1.0
 */

public class BookSet{
    
    // The set is maintained in a vector.
    private Vector set;
    
    /**
     * class Book constructor.
     *
     */
    public BookSet() {
	set = new Vector();
    } 
    
    /**
     * class Book constructor.
     * @param inSet Vector vector of objects to initialize this set.
     */
    public BookSet( Vector inSet ) {
	set = new Vector( inSet );
    }
    
    /**
     * getBookAt returns the book at the specified location in the set.
     * @param int index index of Book to return
     * @return Book
     */
    public Book getBookAt( int index ) {
	return (Book)set.get(index);
    }

    /**
     * getBookCount returns the number of books in the set.
     * @return int
     */
    public int getBookCount() {
	return set.size();
    }
    
    /**
     * addBook adds a book to the set
     * @param book Book book to be added to the set.
     * @return void
     */
    public void addBook( Book book ) {
	set.add( book );
    }

    /**
     * removeBookAt removes a book at the specified index and returns it
     * @param index int index of book to remove
     * @return Book
     */
    public Book removeBookAt( int index ) {
	return (Book)set.remove( index );
    }

    /**
     * removeBook removes the input book from the bookset
     * @param book Book book to remove
     * @return boolean
     */
    public boolean removeBook( Book book ) {
	return set.remove( book );
    }
}









⌨️ 快捷键说明

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