keyedemployee.java

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

JAVA
31
字号
package fileMerging;

import dslib.base.KeyedUos;
import sequentialProcessing.Employee;

/**	An Employee with a key, the employee number. */
public class KeyedEmployee extends Employee implements KeyedUos
{
	/**	Construct a new employee. 
		Analysis: Time = O(1) */
	public KeyedEmployee(String newName, int newNumber, float newRate, String newClassification)
	{
		super(newName, newNumber, newRate, newClassification);
	}

	/**	Key of the employee.
		Analysis: Time = O(1) */
	public Comparable key()
	{
		return new Integer(number);
	}

	/**	Set the key to be newKey.
		Analysis: Time = O(1)
		@param newKey the new key value for the current employee */
	public void setKey(Comparable newKey)
	{
		number = ((Integer)newKey).intValue();
	}
} 

⌨️ 快捷键说明

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