📄 stacknode.java
字号:
/**
* This is the node for the stack.
* It includes an object field to store the value, and a reference to
* store the pointer to the next node.
*
* @author Rachel Chen 0122070
* @version 1.0 2003/3/22
*/
public class StackNode
{
/** The variable to store the value of the node. */
private Object element;
/** The variable to store the reference to the next node. */
private StackNode next;
/**
* The constructor for this class.
* It initializes the fields element and next to null.
*/
public StackNode()
{
element = null;
next = null;
}
/**
* The constructor for this class. <p>
* It initializes the fields element and next to the parameters given.
*
* @param it The value for the node.
* @param nextEle The reference to the next node.
*/
public StackNode( Object it, StackNode nextEle )
{
element = it;
next = nextEle;
}
/**
* The constructor for this class. <p>
* It initializes the fields element to the parameters given and next to null.
*
* @param it The value for the node.
*/
public StackNode( Object it )
{
element = it;
next = null;
}
/**
* The constructor for this class. <p>
* It initializes the fields element and next to the parameters given.
*
* @param nextEle The reference to the next node.
*/
public StackNode( StackNode nextEle )
{
next = nextEle;
}
/**
* Give the next node of the current node.
*
* @return The reference of the next node.
*/
public StackNode next()
{
return next;
}
/**
* Set the next field of the current node to the parameter.
*
* @param nextEle The given node.
* @return The set reference of the next node.
*/
public StackNode setNext( StackNode nextEle )
{
return next = nextEle;
}
/**
* Give the value of the current node.
*
* @return The value of the node.
*/
public Object element()
{
return element;
}
/**
* Set the value of the current node.
*
* @param it The value to be set.
* @return The set value.
*/
public Object setElement( Object it )
{
return element = it;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -