87 lines
1.5 KiB
Java
87 lines
1.5 KiB
Java
/**
|
|
* Represents an item in a doubly linked deque.
|
|
*/
|
|
public class Item {
|
|
|
|
/**
|
|
* The value of the item.
|
|
*/
|
|
private String value;
|
|
|
|
/**
|
|
* The previous item in the deque.
|
|
*/
|
|
private Item prev;
|
|
|
|
/**
|
|
* The next item in the deque.
|
|
*/
|
|
private Item next;
|
|
|
|
/**
|
|
* Constructor for creating a new item.
|
|
*
|
|
* @param value The value of the item.
|
|
*/
|
|
public Item(String value) {
|
|
this.value = value;
|
|
this.prev = null;
|
|
this.next = null;
|
|
}
|
|
|
|
/**
|
|
* Returns the value of the item.
|
|
*
|
|
* @return The value of the item.
|
|
*/
|
|
public String getValue() {
|
|
return value;
|
|
}
|
|
|
|
/**
|
|
* Sets the value of the item.
|
|
*
|
|
* @param value The value of the item.
|
|
*/
|
|
public void setValue(String value) {
|
|
this.value = value;
|
|
}
|
|
|
|
/**
|
|
* Returns the previous item in the deque.
|
|
*
|
|
* @return The previous item in the deque.
|
|
*/
|
|
public Item getPrev() {
|
|
return prev;
|
|
}
|
|
|
|
/**
|
|
* Sets the previous item in the deque.
|
|
*
|
|
* @param prev The previous item in the deque.
|
|
*/
|
|
public void setPrev(Item prev) {
|
|
this.prev = prev;
|
|
}
|
|
|
|
/**
|
|
* Returns the next item in the deque.
|
|
*
|
|
* @return The next item in the deque.
|
|
*/
|
|
public Item getNext() {
|
|
return next;
|
|
}
|
|
|
|
/**
|
|
* Sets the next item in the deque.
|
|
*
|
|
* @param next The next item in the deque.
|
|
*/
|
|
public void setNext(Item next) {
|
|
this.next = next;
|
|
}
|
|
|
|
}
|