holdset.java

来自「一个关于图书馆的服务器的管理程序」· Java 代码 · 共 84 行

JAVA
84
字号
package library;
import java.util.*;

/**
* A class representing a set of holds
*
* @author CTE
* @version 1.0
*/
public class HoldSet{
   
    // set is stored as a vector.
    private Vector set = null;
    
    /**
     * class HoldSet constructor.
     *
     */
    public HoldSet() {
	set = new Vector();
    } 
    
    /**
     * class HoldSet constructor
     * @param inSet Vector of holds to initialize this set
     */
    public HoldSet( Vector inSet ) {
	set = new Vector( inSet );
    }
    
    /**
     * getHoldAt returns the Hold at the specified index
     * @param index int index of hold to return
     * @return Hold 
     */
    public Hold getHoldAt( int index ) {
	return (Hold)set.get(index);
    }

    /**
     * getHoldCount returns the number of holds in this set
     * @return int
     */
    public int getHoldCount() {
	return set.size();
    }
    
    /**
     * addHold adds a hold to this set
     * @param hold Hold hold to add to the set
     * @return void
     */
    public void addHold( Hold hold ) {
	set.add( hold );
    }

    /**
     * removeHoldAt removes and returns the hold at the specified index
     * @param index int index of hold to remove
     * @return Hold
     */
    public Hold removeHoldAt( int index ) {
	return (Hold)set.remove( index );
    }
    
    /**
     * removeHold removes the specified hold from the set
     * @param hold Hold hold to remove
     * @return boolean
     */
    public boolean removeHold( Hold hold ) {
	return set.remove( hold );
    }
}









⌨️ 快捷键说明

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