pkeyedbasicdictuos.java

来自「国外的数据结构与算法分析用书」· Java 代码 · 共 56 行

JAVA
56
字号
/* PKeyedBasicDictUos.java
 * ---------------------------------------------
 * Copyright (c) 2001 University of Saskatchewan
 * All Rights Reserveds
 * --------------------------------------------- */
 
package dslib.dictionary;

import dslib.base.*;
import dslib.exception.*;

/**	A ContainerUos class that stores items and their keys.  Key-item 
	pairs can be inserted, and an item deleted and obtained by its key value.
	All classes that implement this interface will be sets. */
public interface PKeyedBasicDictUos extends ContainerUos
{
	/**	Does the structure contain key 'i'?. 
		@param i key whose presence is to be determined */
	public boolean has(Comparable i);
 
	/**	Insert x with key i into the dictionary. <br>
		PRECONDITION: <br>
		<ul>
			!isFull() <br>
			!has(i)
		</ul>
		@param i key of the item to be inserted
		@param x item to be inserted in the dictionary */
	public void insert(Comparable i, Object x) throws ContainerFullUosException, DuplicateItemsUosException;

	/**	Delete the item with key i. <br>
		PRECONDITION: <br>
		<ul>
			has(i)
		</ul>
		@param i key of the item to be deleted */
	public void delete(Comparable i) throws ItemNotFoundUosException;
 
	/**	An item with key i from the container. <br>
		PRECONDITION: <br>
		<ul>
			has(i)
		</ul>
		@param i key of the item to obtain from the dictionary */
	public Object obtain(Comparable i) throws ItemNotFoundUosException;
 
	/**	Set x to be the item associated with key i. <br>
		PRECONDITION: <br>
		<ul>
			has(i)
		</ul>
		@param i key with which x is to be associated
		@param x item to associate to the key i */
	public void set(Comparable i, Object x) throws ItemNotFoundUosException;
}

⌨️ 快捷键说明

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