Rimosso ArraySequenceFake. Implementato positions() in NodePositionList. Creato il DefaultComparator. Prima implementazione di SortedPriorityList

This commit is contained in:
2014-04-01 22:06:51 +02:00
parent 9836790893
commit 5e892f4961
10 changed files with 230 additions and 305 deletions

View File

@@ -1,51 +0,0 @@
package sequence.utility;
import exceptions.InvalidPositionException;
import position.Position;
/**
* A simple node class for a doubly-linked list. Each DNode has a
* reference to a stored element, a previous node, and a next node.
*
* @author Roberto Tamassia
*/
//Copyright (c) 2003 Brown University, Providence, RI
//Additional modifications and methods by xgiovio
// used on ArraySequenceFake
public class DNodeFake<E> implements Position<E> {
private E element = null;
private int index = -1;
public DNodeFake(E elem, int in_idex) {
element = elem;
index = in_idex;
}
public DNodeFake(E elem) {
element = elem;
}
public E element() throws InvalidPositionException {
if (index == -1)
throw new InvalidPositionException("Position is not in a list!");
return element;
}
public void setElement(E newElement) { element = newElement; }
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
}