keyeddictuos.java

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

JAVA
43
字号
/* KeyedDictUos.java
 * ---------------------------------------------
 * Copyright (c) 2001 University of Saskatchewan
 * All Rights Reserved
 * --------------------------------------------- */
 
package dslib.dictionary;

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

/**	A keyed Dictionary class with the usual routines for inserting, 
	deleting, setting and obtaining items by key.  It also includes 
	a KeyedLinearIteratorUos to move through the dictionary, and deleteItem 
	to delete the current item. It also has a search procedure and a 
	frequency function. */
public interface KeyedDictUos extends KeyedBasicDictUos, KeyedLinearIteratorUos, SavableCursorUos
{
	/**	Move to the item with key i or else set to !itemExists.
		@param i key being sought */
	public void search(Comparable i);

	/**	Delete the current item from the data structure. 
		PRECONDITION: <br>
		<ul>
			itemExists() 
		</ul> */
	public void deleteItem() throws NoCurrentItemUosException;
	
	/**	The number of times key i occurs within the dictionary. 
		@param i item to check how often it occurs in the dictionary */
	public int frequency(Comparable i);
		
	/**	Replace the current item with another item having the same key. <br>
		PRECONDITION: <br>
		<ul>
			itemExists() <br>
	   		!(x.key().compareTo(itemKey())!=0)
		</ul>
		@param x item to replace the current item */
	public void setItem(KeyedUos x) throws NoCurrentItemUosException, InvalidArgumentUosException;
} 

⌨️ 快捷键说明

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