📄 ordereddictcursoruos.java
字号:
/* OrderedDictCursorUos.java
* ---------------------------------------------
* Copyright (c) 2001 University of Saskatchewan
* All Rights Reserved
* --------------------------------------------- */
package dslib.dictionary.bintree;
import dslib.base.*;
import dslib.dispenser.LinkedStackUos;
/** A cursor that has a current item, a previous item, and a
stack of items yet to visit. */
public class OrderedDictCursorUos implements CursorUos
{
/** The stack of items yet to visit */
public LinkedStackUos theStack;
/** The current item */
public HtBalNodeUos cur;
/** The previous item */
public HtBalNodeUos parent;
/** Create a new cursor for an ordered dictionary. <br>
Analysis: Time = O(1) */
public OrderedDictCursorUos(HtBalNodeUos newCur, HtBalNodeUos newParent, LinkedStackUos newTheStack)
{
theStack = newTheStack;
cur = newCur;
parent = newParent;
}
/** Is there a current item?. <br>
Analysis: Time = O(1) */
public boolean itemExists()
{
return cur!=null;
}
/** The current item. <br>
Anlaysis: Time = O(1) <br>
PRECONDITION: <br>
<ul>
itemExists()
</ul> */
public Object item()
{
return cur.item();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -