/** * @Author 陈伟兵 * @Msn:[email protected] * @E-mail:[email protected] * @CreateTime 2004-11-30 * @Version:1.0 */ package com.cwbnig.util;
import java.util.Iterator;
public interface BagADT { //Adds one element to this bag public void add(Object element); //Remove and returns a random element from the bag public Object removeRandom()throws EmptyBagException; //Removes and returns the specified element from this bag public Object remove(Object element)throws EmptyBagException,NoSuchElementException;
//Returns the union of this bag and the parameter public BagADT union(BagADT set); //Returns true if this bag contains the parameter public boolean contains(Object target); //Returns true if this bag and the parameter contain exacitly the same elements public boolean isEmpty(); //Returns the number of elements in this set public int size(); //Returns an iterator for the elements in this bag public Iterator iterator(); //Returns a string representation of this bag public String toString(); } 
|