package lrs; /** * Mutable linear recursive structure.
* Visitor Pattern: Serves as a host capable of executing algorithms which are * visitors.* @author Dung X. Nguyen and Stephen Wong Copyright 2005 - All rights reserved. * @author Mathias Ricken - Copyright 2008 - All rights reserved. * @since 8/25/05 */ public class LRStruct
LRStruct
.
*/
private ANodeLRStruct
to the empty state.
*/
public LRStruct() {
_head = new EmptyNodeLRStruct
enclosed in parentheses.
*/
public String toString() {
return _head.toString(this);
}
/**
* Inserts dat to the front of this LRStruct.getFirst()
now returns dat.
* @param dat data to be inserted.
* @return this LRStruct
*/
public final LRStructLRStruct
's first.
*/
public final T removeFront() {
return _head.removeFront(this);
}
/**
* Gets the first data element from this LRStruct
*/
public final T getFirst() {
return _head.getFirst (this);
}
/**
* Sets first data element to a new value.
* @param dat replaces the existing first for this LRStruct
.
* @throws NoSuchElementException if this LRStruct
is empty.
* @return this LRStruct
*/
public final LRStructLRStruct
.
* @throws NoSuchElementException if this LRStruct
is empty.
*/
public final LRStructLRStruct
.getRest()
now returns tail.
* @throws NoSuchElementException if this LRStruct
is empty.
* @return this LRStruct
*/
public final LRStructLRStruct
with a given head node.
* @param node != null.
*/
LRStruct(ANodeLRStruct
.
* @param head replaces the exisiting state of this LRStruct
.
* @return this LRStruct
*/
final LRStructLRStruct
.
* @return the head node.
*/
final ANode