📄 twothreepnodeuos.java
字号:
/* TwoThreePNodeUos.java
* ---------------------------------------------
* Copyright (c) 2001 University of Saskatchewan
* All Rights Reserved
* --------------------------------------------- */
package dslib.dictionary.twothreetree;
import dslib.base.PairUos;
import java.io.Serializable;
/** A node for a two-three tree. It has a key instance variable,
the methods search, insert, and delete, and a formatted output. */
public abstract class TwoThreePNodeUos implements Cloneable, Serializable
{
/** The parent node of this node. */
protected TwoThreePInteriorUos parent;
/** The parent node of this node. <br>
Analysis: Time = O(1) */
public TwoThreePInteriorUos parent()
{
return parent;
}
/** Set the parent equal to y. <br>
Analysis: Time = O(1)
@param y The new parent */
public void setParent(TwoThreePInteriorUos y)
{
parent = y;
}
/** Search for the item with key i. */
public abstract void search(Comparable i, TwoThreePKeyedDictUos treeHeader);
/** Should insert object y with key i and returns the extra node. */
public abstract PairUos insert(Comparable i, Object y);
/** Delete the item with key i. */
public abstract boolean delete(Comparable i);
/** String representation of the contents of the node with indentation
for different levels of the tree. */
public abstract String formatToString(String indentation);
/** A shallow clone of this object. <br>
Analysis: Time = O(1) */
public Object clone()
{
try
{
return super.clone();
} catch (CloneNotSupportedException e)
{
/* Should not occur: implements Cloneable. */
e.printStackTrace();
return null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -