dictuos.java

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

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

import dslib.base.*;

/**	A Dictionary class with search capabilities to set the 
	current item.  It also includes a LinearIteratorUos to move 
	through the dictionary, and deleteItem to delete the current item. 
	It has a frequency routine and the basic dictionary routines: has, 
	delete, insert, obtain, and isEmpty.  All classes that implement 
	this interface will be bags (except for SetDictUos). */
public interface DictUos extends BasicDictUos, SearchableUos, DispenserUos, 
				LinearIteratorUos, SavableCursorUos
{
	/**	Suggested implementation
		The number of times x occurs within the dictionary
		@param x item to check how often it occurs in the dictionary */
	public int frequency(Object x);
//  	{
//  		int result = 0;
//  		CursorUos saveCurrentPos = currentPosition();
//  		boolean saveSearchMode = searchesContinue;
//  		restartSearches();
//  		search(i);
//  		resumeSearches();
//  		while (itemExists())
//  		{
//  			result++;
//  			search(i);
//  		}
//  		goPosition(saveCurrentPos);
//  		searchesContinue = saveSearchMode;
//  		return result;
//  	} 
}

⌨️ 快捷键说明

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