/*
 * *************************************************************************
 * Copyright (C) FRS Belgium NV ("FRSGlobal"). All rights reserved.
 *
 * This computer program is protected by copyright law and international
 * treaties. Unauthorized reproduction or distribution of this program,
 * or any portion of it, may result in severe civil and criminal penalties,
 * and will be prosecuted to the maximum extent possible under the law.
 * *************************************************************************
 */
package org.cluj.bus;

import org.apache.commons.io.IOUtils;
import org.cluj.bus.logging.LogInitializer;
import org.cluj.bus.pojo.Coordinate;
import org.cluj.bus.pojo.WayPointInfo;

import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.StringTokenizer;

/**
 * Main class of the Bus-bot
 */
public class BusBot
{
    /**
     * @param args the first parameter is the server host name or ip address
     *             the second parameter has to be the bus id
     *             the third parameter is a file with the coordinate points
     * @throws InterruptedException
     * @throws IOException
     */
    public static void main(String[] args) throws InterruptedException, IOException
    {
        LogInitializer.configureLOG4J();

        BusBotRunner botRunner = new BusBotRunner(args[0], args[1], getWayPointInfoList(args[2]));
        botRunner.runBot();
    }

    private static Collection<WayPointInfo> getWayPointInfoList(String fileName) throws IOException
    {
        final List<String> strings = IOUtils.readLines(new FileReader(fileName));
        final Collection<WayPointInfo> wayPointInfos = new ArrayList<>(strings.size());
        for(String line : strings)
        {
            final StringTokenizer tokenizer = new StringTokenizer(line, ";");
            final String latitudeString = tokenizer.nextToken();
            final String longitudeString = tokenizer.nextToken();
            final String isStationString = tokenizer.nextToken();
            final Double latitude = Double.parseDouble(latitudeString);
            final Double longitude = Double.parseDouble(longitudeString);
            final Boolean isStation = Boolean.parseBoolean(isStationString);
            final Coordinate coordinate = new Coordinate(latitude, longitude);
            final WayPointInfo wayPointInfo = new WayPointInfo(coordinate, isStation);
            wayPointInfos.add(wayPointInfo);
        }
        return wayPointInfos;
    }
}

@@ -1354,16 +1354,163 @@
 G4J();%0A%0A
+        if (args.length != 3)%0A        %7B%0A            throw new IllegalArgumentException(%22Bus bot must be started with three arguments!%22);%0A        %7D%0A
         
@@ -1922,16 +1922,17 @@
      for
+ 
 (String 

Throw error if bot is started with a wrong number of arguments.