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