📄 arrayedpkeyedbasicdictuos.java
字号:
/** A PKeyedBasicDictUos implemented via an ordered sequence of (key, item)
pairs in an array. Capabilities include insert for key-item pairs, and
obtain, has, and delete by key. */
public class ArrayedPKeyedBasicDictUos implements PKeyedBasicDictUos, BoundedUos
{
/** Constructor to build and initialize a dictionary with capacity size. */
public ArrayedPKeyedBasicDictUos(int size);
/** Current number of elements in the dictionary. */
public int count();
/** Maximum number of elements allowed to be stored in this data structure. */
public int capacity();
/** Is the data structure empty? */
public boolean isEmpty();
/** Is the data structure full? */
public boolean isFull();
/** Does the data structure contain an item with key k? */
public boolean has(Comparable k);
/** Return the item with key k from the data structure.
PRECONDITION:
has(k) */
public Object obtain(Comparable k) throws ItemNotFoundUosException;
/** Insert a key and item pair into the data structure.
PRECONDITION:
!isFull()
!has(key) */
public void insert(Comparable key, Object item) throws ContainerFullUosException,
DuplicateItemsUosException;
/** Set the item associated with key k to be x.
PRECONDITION:
has(k) */
public void set(Comparable k, Object x) throws ItemNotFoundUosException;
/** Delete an object from the dictionary with key k.
PRECONDITION:
has(k) */
public void delete(Comparable k) throws ItemNotFoundUosException;
/** String representation of this data structure. */
public String toString();
/** Clear the data structure of all present elements stored in it. */
public void wipeOut();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -