📄 twothreenodeuos.java
字号:
/* TwoThreeNodeUos.java
* ---------------------------------------------
* Copyright (c) 2001 University of Saskatchewan
* All Rights Reserved
* --------------------------------------------- */
package dslib.dictionary.twothreetree;
import dslib.base.*;
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 TwoThreeNodeUos implements Cloneable, Serializable
{
/** The parent node of this subtree */
protected TwoThreeInteriorUos parent;
/** The parent of this node. <br>
Analysis: Time = O(1) */
public TwoThreeInteriorUos parent()
{
return parent;
}
/** Set the parent equal to y. <br>
Analysis: Time = O(1)
@param y The new parent */
public void setParent(TwoThreeInteriorUos y)
{
parent = y;
}
/** Search for the item with key i */
public abstract void search(Comparable i, TwoThreeKeyedDictUos treeHeader);
/** Should insert object y and returns the extra node */
public abstract PairUos insert(KeyedUos 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 + -