Skip to content

Commit 0e71b1d

Browse files
author
ndeverge
committed
Code simplification
1 parent e77b93e commit 0e71b1d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

app/views/map.scala.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ <h4 class="alert-heading">A new vehicle has joined the race!</h4>
6161
// and add it to the list of marker
6262
markers.push(marker);
6363

64-
// tell the client that we have a new vehicle
64+
// tell the user that we have a new vehicle
6565
$("#newVehicle").removeClass("hide");
6666
$("#vehicleName").text("And its name is \"" + move.id + "\" !");
6767
window.setTimeout(function() {

test/integrationTest/MovingVehicle.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
import java.io.InputStream;
88
import java.io.InputStreamReader;
99
import java.util.ArrayList;
10+
import java.util.LinkedList;
1011
import java.util.List;
12+
import java.util.Queue;
1113

1214
import org.apache.http.NameValuePair;
1315
import org.apache.http.client.HttpClient;
@@ -32,21 +34,21 @@ public void simulateMovingVehicle() throws Exception {
3234
int cpt = 0;
3335

3436
// we store the old location for the chaser vehicle
35-
List<String> cache = new ArrayList<String>();
37+
Queue<String> queue = new LinkedList<String>();
3638

3739
String line;
3840
while ((line = br.readLine()) != null) {
3941
String[] split = line.split(";");
4042
if (split.length > 1) {
4143

42-
cache.add(line);
44+
queue.add(line);
4345

4446
move("Oh no, I'm being followed !!", split);
4547

4648
// move the second vehicle ("the chaser")
4749
// we let 20 steps ahead
4850
if (cpt > 20) {
49-
String chaserPosition = cache.get(cpt - 20);
51+
String chaserPosition = queue.poll();
5052
move("I'll catch you !!", chaserPosition.split(";"));
5153
}
5254

0 commit comments

Comments
 (0)