/**
  * @param dir the layout direction of the road.
  * @return the closest numition of the car on the given road
  */
 public int getPosition(Direction dir) {
   if (dir.equals(Direction.EAST_WEST)) {
     return numEW;
   } else if (dir.equals(Direction.WEST_EAST)) {
     return numWE;
   } else if (dir.equals(Direction.SOUTH_NORTH)) {
     return numSN;
   } else {
     return numNS;
   }
 }
 /**
  * @param num the closest numition of the car on the given road.
  * @param dir the layout direction of the road.
  */
 public void setPosition(int num, Direction dir) {
   if (dir.equals(Direction.EAST_WEST)) {
     numEW = num;
   } else if (dir.equals(Direction.WEST_EAST)) {
     numWE = num;
   } else if (dir.equals(Direction.SOUTH_NORTH)) {
     numSN = num;
   } else if (dir.equals(Direction.NORTH_SOUTH)) {
     numNS = num;
   }
 }