001package myproject.model;
002
003import java.util.List;
004import java.util.ArrayList;
005
006/**
007 * A road holds cars.
008 */
009public class Road {
010        Road() { } // Created only by this package
011
012        private List<Car> cars = new ArrayList<Car>();
013
014        public void accept(Car d) {
015                if (d == null) { throw new IllegalArgumentException(); }
016                cars.add(d);
017        }
018        public List<Car> getCars() {
019                return cars;
020        }
021}