implemented methods to add cars to train.

This commit is contained in:
Stephan Richter
2020-11-01 20:22:31 +01:00
parent 6ed1255076
commit b89f89f298
7 changed files with 74 additions and 12 deletions

View File

@@ -177,8 +177,8 @@ public class Locomotive extends Car implements Constants,Device{
return json;
}
static Vector<Locomotive> list() {
Vector<Locomotive> locos = new Vector<Locomotive>();
static Vector<Car> list() {
Vector<Car> locos = new Vector<Car>();
for (Car car : Car.cars.values()) {
if (car instanceof Locomotive) locos.add((Locomotive) car);
}