Less warnings. Changed a priority queue test to check if updating an element and removing it works.
This commit is contained in:
parent
443539a6ba
commit
375e783c42
@ -83,6 +83,8 @@ public abstract class PriorityQueueTest {
|
|||||||
public final E[] data;
|
public final E[] data;
|
||||||
public final int[] deleteOrder;
|
public final int[] deleteOrder;
|
||||||
|
|
||||||
|
// data contains values
|
||||||
|
// deleteOrder contains indexes in data[]
|
||||||
public TestParameters(E[] data, int[] deleteOrder) {
|
public TestParameters(E[] data, int[] deleteOrder) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.deleteOrder = deleteOrder;
|
this.deleteOrder = deleteOrder;
|
||||||
@ -309,9 +311,10 @@ public abstract class PriorityQueueTest {
|
|||||||
Assume.assumeFalse(queue.isEmpty());
|
Assume.assumeFalse(queue.isEmpty());
|
||||||
int min = Collections.min(Arrays.asList(parameters.data)).get();
|
int min = Collections.min(Arrays.asList(parameters.data)).get();
|
||||||
for (MutableInteger mi : parameters.data) {
|
for (MutableInteger mi : parameters.data) {
|
||||||
|
// Update value before removing it. This is what happens when updating a Dijkstra label before updating it.
|
||||||
|
mi.set(--min);
|
||||||
queue.remove(mi);
|
queue.remove(mi);
|
||||||
assertEquals(parameters.data.length - 1, queue.size());
|
assertEquals(parameters.data.length - 1, queue.size());
|
||||||
mi.set(--min);
|
|
||||||
queue.insert(mi);
|
queue.insert(mi);
|
||||||
assertEquals(parameters.data.length, queue.size());
|
assertEquals(parameters.data.length, queue.size());
|
||||||
assertEquals(min, queue.findMin().get());
|
assertEquals(min, queue.findMin().get());
|
||||||
|
@ -107,6 +107,7 @@ public class PathsPanel extends JPanel
|
|||||||
* @param path Path for this bundle, must not be null.
|
* @param path Path for this bundle, must not be null.
|
||||||
* @throws IOException If a resource was not found.
|
* @throws IOException If a resource was not found.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public PathPanel(Path path, Color color) throws IOException {
|
public PathPanel(Path path, Color color) throws IOException {
|
||||||
super();
|
super();
|
||||||
setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
|
setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
|
||||||
|
@ -37,7 +37,7 @@ public class ThreadWrapper implements RunningAction {
|
|||||||
return thread != null && thread.isAlive();
|
return thread != null && thread.isAlive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("removal")
|
||||||
@Override
|
@Override
|
||||||
public void interrupt() {
|
public void interrupt() {
|
||||||
thread.stop();
|
thread.stop();
|
||||||
|
@ -26,6 +26,7 @@ public class BinaryPathReader extends BinaryReader implements PathReader {
|
|||||||
super(MAGIC_NUMBER, VERSION, dis);
|
super(MAGIC_NUMBER, VERSION, dis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public Path readPath(Graph graph) throws IOException {
|
public Path readPath(Graph graph) throws IOException {
|
||||||
|
|
||||||
|
@ -110,6 +110,7 @@ public class PathTest {
|
|||||||
assertEquals(10, longLoopPath.size());
|
assertEquals(10, longLoopPath.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void testIsValid() {
|
public void testIsValid() {
|
||||||
assertTrue(emptyPath.isValid());
|
assertTrue(emptyPath.isValid());
|
||||||
@ -122,6 +123,7 @@ public class PathTest {
|
|||||||
assertFalse(invalidPath.isValid());
|
assertFalse(invalidPath.isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void testGetLength() {
|
public void testGetLength() {
|
||||||
assertEquals(0, emptyPath.getLength(), 1e-6);
|
assertEquals(0, emptyPath.getLength(), 1e-6);
|
||||||
@ -132,6 +134,7 @@ public class PathTest {
|
|||||||
assertEquals(120, longLoopPath.getLength(), 1e-6);
|
assertEquals(120, longLoopPath.getLength(), 1e-6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void testGetTravelTime() {
|
public void testGetTravelTime() {
|
||||||
// Note: 18 km/h = 5m/s
|
// Note: 18 km/h = 5m/s
|
||||||
@ -151,6 +154,7 @@ public class PathTest {
|
|||||||
assertEquals(15, longLoopPath.getTravelTime(28.8), 1e-6);
|
assertEquals(15, longLoopPath.getTravelTime(28.8), 1e-6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void testGetMinimumTravelTime() {
|
public void testGetMinimumTravelTime() {
|
||||||
assertEquals(0, emptyPath.getMinimumTravelTime(), 1e-4);
|
assertEquals(0, emptyPath.getMinimumTravelTime(), 1e-4);
|
||||||
@ -161,6 +165,7 @@ public class PathTest {
|
|||||||
assertEquals(11.25, longLoopPath.getMinimumTravelTime(), 1e-4);
|
assertEquals(11.25, longLoopPath.getMinimumTravelTime(), 1e-4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void testCreateFastestPathFromNodes() {
|
public void testCreateFastestPathFromNodes() {
|
||||||
Path path;
|
Path path;
|
||||||
@ -197,6 +202,7 @@ public class PathTest {
|
|||||||
assertTrue(path.isEmpty());
|
assertTrue(path.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void testCreateShortestPathFromNodes() {
|
public void testCreateShortestPathFromNodes() {
|
||||||
Path path;
|
Path path;
|
||||||
@ -233,12 +239,14 @@ public class PathTest {
|
|||||||
assertTrue(path.isEmpty());
|
assertTrue(path.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void testCreateFastestPathFromNodesException() {
|
public void testCreateFastestPathFromNodesException() {
|
||||||
Path.createFastestPathFromNodes(graph,
|
Path.createFastestPathFromNodes(graph,
|
||||||
Arrays.asList(new Node[] { nodes[1], nodes[0] }));
|
Arrays.asList(new Node[] { nodes[1], nodes[0] }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void testCreateShortestPathFromNodesException() {
|
public void testCreateShortestPathFromNodesException() {
|
||||||
Path.createShortestPathFromNodes(graph,
|
Path.createShortestPathFromNodes(graph,
|
||||||
|
Loading…
Reference in New Issue
Block a user